Package org.apache.muse.core

Examples of org.apache.muse.core.ResourceManager


        //
        // make sure the Entry endpoint is exposed, since our entries
        // are all first-class resources
        //
        WsResource resource = getWsResource();
        ResourceManager manager = resource.getResourceManager();
       
        _entryPath = manager.getResourceContextPath(Entry.class);
       
        if (_entryPath == null)
            throw new RuntimeException(_MESSAGES.get("NoEntryEndpoint"));
       
        //
        // set up persistence, if it's used
        //
        Persistence persistence = getPersistence();
       
        if (persistence != null)
        {
            if (!ServiceGroupPersistence.class.isAssignableFrom(persistence.getClass()))
            {
                Object[] filler = { ServiceGroupPersistence.class, persistence.getClass() };
                throw new RuntimeException(_MESSAGES.get("IncorrectPersistenceRoot", filler));
            }
           
            ServiceGroupPersistence sgP = (ServiceGroupPersistence)persistence;
            sgP.setServiceGroup(resource);
        }
               
        //
        // listen for all new resources being created so they can
        // be added to the service group
        //
        manager.addListener(this);
       
        SerializerRegistry registry = SerializerRegistry.getInstance();
        registry.registerSerializer(MembershipContentRule.class, new MembershipContentRuleSerializer());
    }
View Full Code Here


    private String _pullPointPath = null;
   
    public EndpointReference createPullPoint()
        throws UnableToCreatePullPointFault
    {
        ResourceManager manager = getResource().getResourceManager();
       
        //
        // create the resource to represent the pullpoint
        //
        String endpoint = getPullPointContextPath();
        WsResource pullPoint = null;
       
        try
        {
            pullPoint = (WsResource)manager.createResource(endpoint);
        }
       
        catch (SoapFault error)
        {
            throw new UnableToCreatePullPointFault(error);
        }
       
        EndpointReference epr = pullPoint.getEndpointReference();
       
        PullPoint pullPointCap = (PullPoint)pullPoint.getCapability(WsnConstants.PULL_POINT_URI);
        Filter filter = pullPointCap.getFilter();
       
        //
        // create subscription that will send messages to the pullpoint
        //
        NotificationProducer wsn = (NotificationProducer)getResource().getCapability(WsnConstants.PRODUCER_URI);
        WsResource sub = null;
       
        try
        {
            sub = wsn.subscribe(epr, filter, null, null);
        }
       
        catch (BaseFault error)
        {
            throw new UnableToCreatePullPointFault(error);
        }
       
        pullPointCap.setSubscription(sub);
       
        //
        // initialize pullpoint to complete creation process
        //
        try
        {
            pullPoint.initialize();
            manager.addResource(epr, pullPoint);
        }
       
        catch (SoapFault error)
        {
            throw new UnableToCreatePullPointFault(error);
View Full Code Here

       
        //
        // find pullpoint resource type so we can create instances of it
        // in createPullPoint()
        //
        ResourceManager manager = getResource().getResourceManager();
        _pullPointPath = manager.getResourceContextPath(PullPoint.class);

        if (_pullPointPath == null)
            throw new RuntimeException("No PullPoint endpoint deployed");
    }
View Full Code Here

        super.initializeCompleted();
       
        Thread resourceCreationThread = new Thread(){
            public void run()
            {
                ResourceManager manager = getResource().getResourceManager();
               
                try
                {
                    while (true)
                    {
                        Thread.currentThread().sleep(7000);
                        Resource next = manager.createResource("WsResource");
                        next.initialize();
                        manager.addResource(next.getEndpointReference(), next);
                    }
                }
               
                catch (Throwable error)
                {
View Full Code Here

        //
        // make sure we're exposing the subscription endpoint so that
        // clients can manage subscriptions/consumers
        //
        WsResource resource = getWsResource();
        ResourceManager manager = resource.getResourceManager();
        _subscriptionPath = manager.getResourceContextPath(SubscriptionManager.class);

        if (_subscriptionPath == null)
            throw new RuntimeException(_MESSAGES.get("NoSubscriptionManager"));
       
        //
        // make sure any persistence impl is of the right type
        //
        Persistence persistence = getPersistence();
       
        if (persistence != null)
        {
            if (!NotificationProducerPersistence.class.isAssignableFrom(persistence.getClass()))
            {
                Object[] filler = { NotificationProducerPersistence.class, persistence.getClass() };
                throw new RuntimeException(_MESSAGES.get("IncorrectPersistenceRoot", filler));
            }
           
            NotificationProducerPersistence npPersistence = (NotificationProducerPersistence)persistence;
            npPersistence.setNotificationProducer(this);
        }
       
        //
        // make sure we can listen for new subscriptions/destructions
        //
        manager.addListener(this);
       
        //
        // if there are any user-defined topic spaces, find those files
        // and make sure they exist
        //
View Full Code Here

            if (!hasTopic(topic))
                throw new TopicNotSupportedFault("Topic not found: " + topic);
        }
       
        WsResource producer = getWsResource();
        ResourceManager manager = producer.getResourceManager();
       
        //
        // create the resource to represent the subscription
        //
        String endpoint = getSubscriptionContextPath();
        WsResource sub = null;
       
        try
        {
            sub = (WsResource)manager.createResource(endpoint);
        }
       
        catch (SoapFault error)
        {
            throw new SubscribeCreationFailedFault(error);
        }
       
        //
        // use the subscription capability to set all the subscription fields
        //
        SubscriptionManager subMgr =
            (SubscriptionManager)sub.getCapability(WsnConstants.SUBSCRIPTION_MGR_URI);
       
        EndpointReference producerEPR = producer.getEndpointReference();
        subMgr.setProducerReference(producerEPR);
       
        subMgr.setConsumerReference(consumer);
        subMgr.setFilter(filter);
        subMgr.setSubscriptionPolicy(policy);
       
        try
        {
            sub.initialize();
            manager.addResource(sub.getEndpointReference(), sub);
        }
       
        catch (SoapFault error)
        {
            throw new SubscribeCreationFailedFault(error);           
View Full Code Here

        // make sure this is a valid member of the group
        //
        if (!isMatch(epr))
            throw new AddRefusedFault(_MESSAGES.get("ContentCreationFailed"));

        ResourceManager manager = sg.getResourceManager();
        String endpoint = getEntryContextPath();
        WsResource resource = null;
       
        try
        {
            resource = (WsResource)manager.createResource(endpoint);
        }
       
        catch (SoapFault error)
        {
            throw new ResourceInitializationFault(error);
        }
       
        //
        // set the sg entry fields before initializing the entry resource
        //
       
        Entry entry = (Entry)resource.getCapability(WssgConstants.ENTRY_URI);
       
        entry.setServiceGroup(sg);
        entry.setMemberEPR(epr);
       
        try
        {
            resource.initialize();
            manager.addResource(resource.getEndpointReference(), resource);
        }
       
        catch (SoapFault error)
        {
            throw new ResourceInitializationFault(error);
View Full Code Here

        //
        // make sure the Entry endpoint is exposed, since our entries
        // are all first-class resources
        //
        WsResource resource = getWsResource();
        ResourceManager manager = resource.getResourceManager();
       
        _entryPath = manager.getResourceContextPath(Entry.class);
       
        if (_entryPath == null)
            throw new RuntimeException(_MESSAGES.get("NoEntryEndpoint"));
       
        //
        // set up persistence, if it's used
        //
        Persistence persistence = getPersistence();
       
        if (persistence != null)
        {
            if (!ServiceGroupPersistence.class.isAssignableFrom(persistence.getClass()))
            {
                Object[] filler = { ServiceGroupPersistence.class, persistence.getClass() };
                throw new RuntimeException(_MESSAGES.get("IncorrectPersistenceRoot", filler));
            }
           
            ServiceGroupPersistence sgP = (ServiceGroupPersistence)persistence;
            sgP.setServiceGroup(resource);
        }
               
        //
        // listen for all new resources being created so they can
        // be added to the service group
        //
        manager.addListener(this);
       
        SerializerRegistry registry = SerializerRegistry.getInstance();
        registry.registerSerializer(MembershipContentRule.class, new MembershipContentRuleSerializer());
    }
View Full Code Here

TOP

Related Classes of org.apache.muse.core.ResourceManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.