Package org.apache.muse.core

Examples of org.apache.muse.core.Resource


        super.initialize();
       
        //
        // make sure the owner resource type IS a service group
        //
        Resource resource = getResource();
       
        if (!resource.hasCapability(WssgConstants.SERVICE_GROUP_URI))
        {
            Object[] filler = { resource.getContextPath(), resource.getCapabilityURIs() };
            throw new RuntimeException(_MESSAGES.get("NoServiceGroupCapability", filler));
        }
    }
View Full Code Here


    public void initializeCompleted()
        throws SoapFault
    {
        super.initializeCompleted();
       
        Resource resource = getResource();
       
        //
        // 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 =
            (NotificationProducer)resource.getCapability(WsnConstants.PRODUCER_URI);
       
        wsn.addTopic(MuwsConstants.ADV_ME_CREATION_TOPIC);
        wsn.addTopic(MuwsConstants.ADV_ME_DESTRUCTION_TOPIC);
       
        //
View Full Code Here

            return;
       
        Element payload = XmlUtils.createElement(MuwsConstants.DESTROY_NOTIFICATION_QNAME);
        sendMessage(epr, MuwsConstants.ADV_ME_DESTRUCTION_TOPIC, WefConstants.DESTROY_SITUATION_QNAME, payload);
       
        Resource advertiser = getResource();
       
        if (advertiser.hasBeenShutdown())
            advertiser.getResourceManager().removeListener(this);
    }
View Full Code Here

                               QName topicName,
                               QName situationCategory,
                               Element payload)
        throws SoapFault
    {
        Resource advertiser = getResource();
       
        WefFactory factory = createWefFactory();
        ManagementEvent event = factory.createEvent();
       
        event.addExtendedElement(payload);

        Component source = factory.createComponent();
        source.setName(WefConstants.SOURCE_COMP_QNAME);
       
        ComponentAddress address = factory.createComponentAddress(sourceEPR);
        source.setAddress(address);
       
        event.setSource(source);
       
        Component reporter = factory.createComponent();
        reporter.setName(WefConstants.REPORTER_COMP_QNAME);
       
        address = factory.createComponentAddress(advertiser.getEndpointReference());
        reporter.setAddress(address);
       
        event.setReporter(reporter);
       
        Situation situation = factory.createSituation();
        situation.setCategoryType(situationCategory);
        event.setSituation(situation);

        NotificationProducer wsn = (NotificationProducer)advertiser.getCapability(WsnConstants.PRODUCER_URI);
        wsn.publish(topicName, event.toXML());
    }
View Full Code Here

  public OSGiResourceDefinition(Bundle bundle){
    this.bundle = bundle;
  }

  public Resource newInstance(){
    Resource instance = super.newInstance();
    return instance;
  }
View Full Code Here

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

        return new Element[]{ metadata };
    }
   
    protected Element getWSDL()
    {
        Resource owner = getResource();
       
        Environment env = owner.getEnvironment();
        String path = owner.getWsdlPath();
       
        Document wsdlDoc = WsdlUtils.createWSDL(env, path, true);
        Element wsdl = XmlUtils.getFirstElement(wsdlDoc);
       
        WsdlUtils.removeWsdlReferences(wsdl);
View Full Code Here

        return null;
  }


  public Element invoke(Element soapBody){
    Resource resource = null;
    try {
      Bundle bundle = getDelegateBundle();     
      ResourceRouter delegateRouter = null;
      if(bundle != null){
        delegateRouter = (ResourceRouter)delegateMap.get(bundle);
View Full Code Here

       
        //
        // instantiate the resource object itself
        //
        Class resourceClass = getResourceClass();
        Resource resource = (Resource)ReflectUtils.newInstance(resourceClass);
       
        //
        // give the resource access to all the standard Muse components
        //
        resource.setEnvironment(env);
        resource.setLog(log);
        resource.setContextPath(getContextPath());
        resource.setInitializationParameters(getInitializationParameters());
       
        WsdlConfig wsdl = getWsdlConfig();
        resource.setWsdlPath(wsdl.getWsdlPath());
        resource.setWsdlPortType(wsdl.getWsdlPortType());
       
        //
        // create the unique EPR for the resource using the
        // ID factory specified
        //
        EndpointReference uniqueEPR = env.getDeploymentEPR();
       
        ResourceIdFactory idFactory = getResourceIdFactory();
       
        if (idFactory != null)
        {
            QName id = idFactory.getIdentifierName();
            String value = idFactory.getNextIdentifier();
            uniqueEPR.addParameter(id, value);
        }
       
        resource.setEndpointReference(uniqueEPR);
       
        //
        // add all of the capabilities to the resource
        //
        Iterator i = getCapabilityDefinitions().iterator();
       
        while (i.hasNext())
        {
            CapabilityDefinition next = (CapabilityDefinition)i.next();
            Capability capability = next.newInstance();           
            resource.addCapability(capability);
        }
       
        return resource;
    }
View Full Code Here

        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
View Full Code Here

TOP

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

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.