Package org.apache.muse.core

Examples of org.apache.muse.core.ResourceManager


    protected WsResource createRelationship(String name,
                                            RelationshipType type,
                                            Participant[] participants)
        throws BaseFault
    {
        ResourceManager manager = getWsResource().getResourceManager();
        String endpoint = getRelationshipContextPath();
       
        //
        // first create an empty instance of the relationship type
        //
        WsResource resource = null;
       
        try
        {
            resource = (WsResource)manager.createResource(endpoint);
        }
       
        catch (SoapFault error)
        {
            throw new RelationshipCreationFailedFault(error);
        }
       
        //
        // use the relationship capability to set the fields before initializing
        //
        RelationshipResource relationship =
            (RelationshipResource)resource.getCapability(MuwsConstants.RELATIONSHIP_RESOURCE_URI);
       
        relationship.setName(name);
        relationship.setType(type);
        relationship.setParticipant(participants);
       
        try
        {
            resource.initialize();
            manager.addResource(resource.getEndpointReference(), resource);
        }
       
        catch (SoapFault error)
        {
            throw new RelationshipCreationFailedFault(error);
View Full Code Here


        // make sure the RelationshipResource endpoint is exposed, since our
        // relationships are all first-class resources
        //
        WsResource resource = getWsResource();
       
        ResourceManager manager = resource.getResourceManager();
        _relationshipPath = manager.getResourceContextPath(RelationshipResource.class);
       
        if (_relationshipPath == null)
            throw new RuntimeException(_MESSAGES.get("NoRelationshipEndpoint"));
       
        setMessageHandler(createQueryHandler());
View Full Code Here

       
        //
        // this allows the advertisement capability to hear about
        // all resource lifecycle events that happen in the application
        //
        ResourceManager manager = resource.getResourceManager();
        manager.addListener(this);
               
        //
        // initialize the advertisement topics
        //
        NotificationProducer wsn =
View Full Code Here

     *
     */
    protected Resource reloadResource(String contextPath, Element resourceXML)
        throws SoapFault
    {
        ResourceManager manager = getResourceManager();
       
        //
        // the XML from the file is the reference parameters of an EPR, so
        // we're going to construct the rest of the EPR XML around it and
        // then turn it into an EPR object
        //
       
        //
        // wrap parameter XML in a wsa:EndpointReference element
        //       
        Document doc = resourceXML.getOwnerDocument();
        Element eprXML = XmlUtils.createElement(doc, WsaConstants.EPR_QNAME);
        eprXML.appendChild(resourceXML);
       
        //
        // get the right address URI for the wsa:Address element - this is
        // the default URI (has the proper host/port/app) with the context
        // path for the resource type at the end
        //
        String address = manager.getEnvironment().getDefaultURI();
        int lastSlash = address.lastIndexOf('/');
        address = address.substring(0, lastSlash + 1) + contextPath;
       
        XmlUtils.setElement(eprXML, WsaConstants.ADDRESS_QNAME, address);
       
        //
        // create EPR object from XML and set it on the newly-created resource
        //
        EndpointReference epr = new EndpointReference(eprXML);
       
        Resource resource = manager.createResource(contextPath);
        resource.setEndpointReference(epr);
       
        //
        // continue initialization/registration
        //
        resource.initialize();
        manager.addResource(epr, resource);
       
        return resource;
    }
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);
    }
View Full Code Here

     *
     */
    protected Resource getTargetResource()
        throws SoapFault
    {
        ResourceManager manager = getResourceManager();
        Environment env = getEnvironment();
        MessageHeaders wsa = env.getAddressingContext();
       
        if (wsa == null)
            throw new RuntimeException(_MESSAGES.get("NoAddressingContext"));
       
        EndpointReference epr = wsa.getToAddress();
       
        Resource resource = manager.getResource(epr);
       
        if (resource == null)
        {
            //
            // construct an error message that has a formatted list of
            // all of the valid EPRs so that users can determine what
            // was wrong with the EPR they provided
            //
           
            StringBuffer eprNotFound = new StringBuffer(512);
            eprNotFound.append("\n\n");
            eprNotFound.append(epr);
            eprNotFound.append('\n');
           
            Iterator i = manager.getResourceEPRs();
            StringBuffer eprListing = new StringBuffer(1024);
            eprListing.append('\n');
           
            while (i.hasNext())
            {
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

    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

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.