Package org.apache.muse.core

Examples of org.apache.muse.core.ResourceManager


       
        //
        // 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


     *
     */
    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

     *
     */
    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

        return new SimpleResourceManager();
    }
     
 
  public Resource addNewResource(Contribution contribution) throws SoapFault{
    ResourceManager manager = getResourceManager();
    ManagementContributionProxy proxy = null;
    if(contribution instanceof BundleContribution)
      proxy = (ManagementContributionProxy)manager.createResource("/OSGiBundleResource");
    else if(contribution instanceof ServiceContribution)
      proxy = (ManagementContributionProxy)manager.createResource("/OSGiServiceResource");
    proxy.setContribution(contribution);
    proxy.initialize();
    //fix up the EPR with the resource ID
    EndpointReference epr = proxy.getEndpointReference();
    epr.addParameter(WsaConstants.DEFAULT_RESOURCE_ID_QNAME ,contribution.getIdentifier());
    manager.addResource(proxy.getEndpointReference(),proxy);
    return proxy;
  }
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);
    }
View Full Code Here

            ProducerPropertiesFilter propertiesFilter = (ProducerPropertiesFilter)filter;
            propertiesFilter.setResource(getWsResource());
        }
       
        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

    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

        // 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);
        }
       
        //
        // make sure the entry resource can process termination time, if
        // one exists. if it can't, the request was invalid.
        //
        // NOTE: we do NOT shutdown() the resource because it has not
        //       been initialize()d yet.       
        //
        if (termination != null && !resource.hasCapability(WsrlConstants.SCHEDULED_TERMINATION_URI))
        {
            Object[] filler = { endpoint, WsrlConstants.SCHEDULED_TERMINATION_URI };
            throw new AddRefusedFault(_MESSAGES.get("NoWSRL", filler));
        }
       
        //
        // 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

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.