Examples of ServiceContext


Examples of org.apache.axis2.context.ServiceContext

        // mark the anon services created to be used in the client side of synapse as hidden
        // from the server side of synapse point of view
        anoymousService.getParent().addParameter(SynapseConstants.HIDDEN_SERVICE_PARAM, "true");
        ServiceGroupContext sgc = new ServiceGroupContext(
            axisCfgCtx, (AxisServiceGroup) anoymousService.getParent());
        ServiceContext serviceCtx = sgc.getServiceContext(anoymousService);

        boolean outOnlyMessage = "true".equals(synapseOutMessageContext.getProperty(
                SynapseConstants.OUT_ONLY)) || WSDL2Constants.MEP_URI_IN_ONLY.equals(
                originalInMsgCtx.getOperationContext()
                        .getAxisOperation().getMessageExchangePattern());
View Full Code Here

Examples of org.apache.axis2.context.ServiceContext

        org.apache.axis2.context.MessageContext axis2MC
                = new org.apache.axis2.context.MessageContext();
        axis2MC.setConfigurationContext(this.configContext);

        ServiceContext svcCtx = new ServiceContext();
        OperationContext opCtx = new OperationContext(new InOutAxisOperation(), svcCtx);
        axis2MC.setServiceContext(svcCtx);
        axis2MC.setOperationContext(opCtx);
        MessageContext mc = new Axis2MessageContext(axis2MC, synapseConfig, this);
        mc.setMessageID(UIDGenerator.generateURNString());
View Full Code Here

Examples of org.apache.axis2.context.ServiceContext

        // mark the anon services created to be used in the client side of synapse as hidden
        // from the server side of synapse point of view
        anoymousService.getParent().addParameter(SynapseConstants.HIDDEN_SERVICE_PARAM, "true");
        ServiceGroupContext sgc = new ServiceGroupContext(
            axisCfgCtx, (AxisServiceGroup) anoymousService.getParent());
        ServiceContext serviceCtx = sgc.getServiceContext(anoymousService);

        boolean outOnlyMessage = "true".equals(synapseOutMessageContext.getProperty(
                SynapseConstants.OUT_ONLY)) || WSDL2Constants.MEP_URI_IN_ONLY.equals(
                originalInMsgCtx.getOperationContext()
                        .getAxisOperation().getMessageExchangePattern());
View Full Code Here

Examples of org.apache.axis2.context.ServiceContext

        ConfigurationContext configurationContext = msgContext.getConfigurationContext();
        configurationContext.fillServiceContextAndServiceGroupContext(msgContext);
       
        setMsgContextProperties(request, response, service, msgContext);

        ServiceContext serviceContext = msgContext.getServiceContext();
        serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, this.endpointInstance);

        try {
            HTTPTransportUtils.processHTTPPostRequest(msgContext,
                                                      request.getInputStream(),
                                                      response.getOutputStream(),
View Full Code Here

Examples of org.apache.axis2.context.ServiceContext

     * @param msgContext the active MessageContext
     * @return the appropriate back-end service object.
     * @throws AxisFault if there's a problem
     */
    protected Object getTheImplementationObject(MessageContext msgContext) throws AxisFault {
        ServiceContext serviceContext = msgContext.getServiceContext();
        Object serviceimpl = serviceContext.getProperty(ServiceContext.SERVICE_OBJECT);
        if (serviceimpl != null) {
            // since service impl is there in service context , take that from there
            return serviceimpl;
        } else {
            // create a new service impl class for that service
            serviceimpl = makeNewServiceObject(msgContext);
            //Service initialization
            DependencyManager.initServiceObject(serviceimpl, msgContext.getServiceContext());
            serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, serviceimpl);
            return serviceimpl;
        }
    }
View Full Code Here

Examples of org.apache.felix.ipojo.ServiceContext

    empty.dispose();
    empty = null;
  }
 
  public void testLevelOne1() {
    ServiceContext sc2 = Utils.getServiceContext(empty);
   
    Factory fact1 = Utils.getFactoryByName(sc2, "COMPO-SimpleCheckServiceProvider");
    Properties props = new Properties();
    props.put("instance.name","client");
    ComponentInstance client = null;
    try {
      client = fact1.createComponentInstance(props);
    } catch(Exception e) { fail("Cannot instantiate the client : " + e.getMessage()); }
   
    Factory fact2 = Utils.getFactoryByName(sc2, "COMPO-FooProviderType-1");
    Properties props2 = new Properties();
    props2.put("instance.name","provider");
    ComponentInstance provider = null;
    try {
      provider = fact2.createComponentInstance(props2);
    } catch(Exception e) {
      fail("Cannot instantiate the provider : " + e.getMessage());
    }
   
    ServiceReference ref = sc2.getServiceReference(CheckService.class.getName());
    CheckService check = (CheckService) sc2.getService(ref);
   
    assertTrue("Check invocation", check.check());
   
    sc2.ungetService(ref);
   
    // Check visibility
    assertNotNull("Check foo service visible inside the composite", sc2.getServiceReference(FooService.class.getName()));
    assertNotNull("Check check service visible inside the composite", sc2.getServiceReference(CheckService.class.getName()));
    // Check invisibilty
    assertNull("Check foo service invisible inside the context", getContext().getServiceReference(FooService.class.getName()));
    try {
      assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
    } catch (InvalidSyntaxException e) {
      fail("Invalid filter : " + e);
    }
   
    provider.dispose();
    client.dispose();
    
    assertNull("Check foo service invisible inside the composite", sc2.getServiceReference(FooService.class.getName()));
    assertNull("Check check service invisible inside the composite", sc2.getServiceReference(CheckService.class.getName()));
    assertNull("Check foo service invisible from the context", getContext().getServiceReference(FooService.class.getName()));
    try {
      assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
    } catch (InvalidSyntaxException e) {
      fail("Invalid filter : " + e);
View Full Code Here

Examples of org.apache.felix.ipojo.ServiceContext

      fail("Invalid filter : " + e);
    }
  }
 
  public void testLevelOne2() {
    ServiceContext sc2 = Utils.getServiceContext(empty);
   
    Factory fact1 = Utils.getFactoryByName(sc2, "COMPO-SimpleCheckServiceProvider");
    Properties props = new Properties();
    props.put("instance.name","client");
    ComponentInstance client = null;
    try {
      client = fact1.createComponentInstance(props, sc2);
    } catch(Exception e) { fail("Cannot instantiate the client : " + e.getMessage()); }
   
    Factory fact2 = Utils.getFactoryByName(sc2, "COMPO-FooProviderType-1");
    Properties props2 = new Properties();
    props2.put("instance.name","provider");
    ComponentInstance provider = null;
    try {
      provider = fact2.createComponentInstance(props2, sc2);
    } catch(Exception e) {
      fail("Cannot instantiate the provider : " + e.getMessage());
    }
   
    ServiceReference ref = sc2.getServiceReference(CheckService.class.getName());
    CheckService check = (CheckService) sc2.getService(ref);
   
    assertTrue("Check invocation", check.check());
   
    sc2.ungetService(ref);
   
    // Check visibility
    assertNotNull("Check foo service visible inside the composite", sc2.getServiceReference(FooService.class.getName()));
    assertNotNull("Check check service visible inside the composite", sc2.getServiceReference(CheckService.class.getName()));
    // Check invisibilty
    assertNull("Check foo service invisible inside the context", getContext().getServiceReference(FooService.class.getName()));
    try {
      assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
    } catch (InvalidSyntaxException e) {
      fail("Invalid filter : " + e);
    }
   
    client.dispose();
    provider.dispose();
    
    assertNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName()));
    assertNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName()));
    assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName()));
    try {
      assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
    } catch (InvalidSyntaxException e) {
      fail("Invalid filter : " + e);
View Full Code Here

Examples of org.apache.felix.ipojo.ServiceContext

      fail("Invalid filter : " + e);
    }
  }
 
  public void testLevelOne3() {
    ServiceContext sc2 = Utils.getServiceContext(empty);
   
    Factory fact1 = Utils.getFactoryByName(getContext(), "COMPO-SimpleCheckServiceProvider");
    Properties props = new Properties();
    props.put("instance.name","client");
    ComponentInstance client = null;
    try {
      client = fact1.createComponentInstance(props, sc2);
    } catch(Exception e) { fail("Cannot instantiate the client : " + e.getMessage()); }
   
    Factory fact2 = Utils.getFactoryByName(getContext(), "COMPO-FooProviderType-1");
    Properties props2 = new Properties();
    props2.put("instance.name","provider");
    ComponentInstance provider = null;
    try {
      provider = fact2.createComponentInstance(props2, sc2);
    } catch(Exception e) {
      fail("Cannot instantiate the provider : " + e.getMessage());
    }
   
    ServiceReference ref = sc2.getServiceReference(CheckService.class.getName());
    CheckService check = (CheckService) sc2.getService(ref);
   
    assertTrue("Check invocation", check.check());
   
    sc2.ungetService(ref);
   
    // Check visibility
    assertNotNull("Check foo service visible inside the composite", sc2.getServiceReference(FooService.class.getName()));
    assertNotNull("Check check service visible inside the composite", sc2.getServiceReference(CheckService.class.getName()));
    // Check invisibilty
    assertNull("Check foo service invisible inside the context", getContext().getServiceReference(FooService.class.getName()));
    try {
      assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
    } catch (InvalidSyntaxException e) {
      fail("Invalid filter : " + e);
    }
   
    client.dispose();
    provider.dispose();
    
    assertNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName()));
    assertNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName()));
    assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName()));
    try {
      assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
    } catch (InvalidSyntaxException e) {
      fail("Invalid filter : " + e);
View Full Code Here

Examples of org.apache.felix.ipojo.ServiceContext

      fail("Invalid filter : " + e);
    }
  }
 
  public void testLevelTwo1() {
    ServiceContext sc1 = Utils.getServiceContext(empty);   
    Factory fact = Utils.getFactoryByName(sc1, "composite.empty");
    Properties p = new Properties();
    p.put("instance.name","empty2");
    ComponentInstance empty2 = null;
    try {
      empty2 = fact.createComponentInstance(p);
    } catch(Exception e) {
      fail("Cannot instantiate empty2 instance : " + e.getMessage());
    }
   
    ServiceContext sc2 = Utils.getServiceContext(empty2);
   
    Factory fact1 = Utils.getFactoryByName(sc2, "COMPO-SimpleCheckServiceProvider");
    Properties props = new Properties();
    props.put("instance.name","client");
    ComponentInstance client = null;
    try {
      client = fact1.createComponentInstance(props);
    } catch(Exception e) { fail("Cannot instantiate the client : " + e.getMessage()); }
   
    Factory fact2 = Utils.getFactoryByName(sc2, "COMPO-FooProviderType-1");
    Properties props2 = new Properties();
    props2.put("instance.name","provider");
    ComponentInstance provider = null;
    try {
      provider = fact2.createComponentInstance(props2);
    } catch(Exception e) {
      fail("Cannot instantiate the provider : " + e.getMessage());
    }
   
    ServiceReference ref = sc2.getServiceReference(CheckService.class.getName());
    CheckService check = (CheckService) sc2.getService(ref);
   
    assertTrue("Check invocation", check.check());
   
    sc2.ungetService(ref);
   
    //  Check visibility
    assertNotNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName()));
    assertNotNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName()));
    // Check invisibilty
    assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName()));
    assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName()));
    assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName()));
    try {
      assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
    } catch (InvalidSyntaxException e) {
      fail("Invalid filter : " + e);
    }
   
    client.dispose();
    provider.dispose();
    
    assertNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName()));
    assertNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName()));
    assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName()));
    assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName()));
    assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName()));
    try {
      assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
View Full Code Here

Examples of org.apache.felix.ipojo.ServiceContext

    }
    empty2.dispose();
  }
 
  public void testLevelTwo2() {
    ServiceContext sc1 = Utils.getServiceContext(empty);   
    Factory fact = Utils.getFactoryByName(sc1, "composite.empty");
    Properties p = new Properties();
    p.put("instance.name","empty2");
    ComponentInstance empty2 = null;
    try {
      empty2 = fact.createComponentInstance(p);
    } catch(Exception e) {
      fail("Cannot instantiate empty2 instance : " + e.getMessage());
    }
   
    ServiceContext sc2 = Utils.getServiceContext(empty2);
   
    Factory fact1 = Utils.getFactoryByName(sc1, "COMPO-SimpleCheckServiceProvider");
    Properties props = new Properties();
    props.put("instance.name","client");
    ComponentInstance client = null;
    try {
      client = fact1.createComponentInstance(props, sc2);
    } catch(Exception e) { fail("Cannot instantiate the client : " + e.getMessage()); }
   
    Factory fact2 = Utils.getFactoryByName(sc1, "COMPO-FooProviderType-1");
    Properties props2 = new Properties();
    props2.put("instance.name","provider");
    ComponentInstance provider = null;
    try {
      provider = fact2.createComponentInstance(props2, sc2);
    } catch(Exception e) {
      fail("Cannot instantiate the provider : " + e.getMessage());
    }
   
    ServiceReference ref = sc2.getServiceReference(CheckService.class.getName());
    CheckService check = (CheckService) sc2.getService(ref);
   
    assertTrue("Check invocation", check.check());
   
    sc2.ungetService(ref);
   
    //  Check visibility
    assertNotNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName()));
    assertNotNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName()));
    // Check invisibilty
    assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName()));
    assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName()));
    assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName()));
    try {
      assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
    } catch (InvalidSyntaxException e) {
      fail("Invalid filter : " + e);
    }
   
    client.dispose();
    provider.dispose();
    
    assertNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName()));
    assertNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName()));
    assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName()));
    assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName()));
    assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName()));
    try {
      assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.