Package org.apache.felix.ipojo

Examples of org.apache.felix.ipojo.Pojo


        // Get foo object
        FooService fs = (FooService) osgiHelper.getServiceObject(ref);

        // Cast to POJO
        Pojo pojo = (Pojo) fs;
        Field im = fs.getClass().getDeclaredField("__IM");
        assertNotNull(im);
        im.setAccessible(true);
        assertNotNull(im.get(fs));

        Method method = fs.getClass().getMethod("getComponentInstance");
        assertNotNull(method);

        // GetComponentInstance
        ComponentInstance instance = pojo.getComponentInstance();
        assertNotNull(instance);
        assertEquals("Check component instance name", instance.getInstanceName(), compName);
        assertEquals("Check component factory name", instance.getFactory().getName(), factName);
        assertNotNull("Instance description not null", instance.getInstanceDescription());
        PrimitiveInstanceDescription id = (PrimitiveInstanceDescription) instance.getInstanceDescription();
View Full Code Here


    /*
     * If this is a Apam native component (iPOJO+APAM) then just follow the
     * chained references
     */
    if (service instanceof Pojo) {
      Pojo pojo = (Pojo) service;
      if (pojo.getComponentInstance() instanceof ApformInstance) {
        ApformInstance apform = (ApformInstance) pojo.getComponentInstance();
        return apform.getApamComponent();
      }
    }

    // it is a legacy, use brute force
View Full Code Here

      for (ServiceReference serviceReference : trackedReferences != null ? trackedReferences : new ServiceReference[0]) {

        Object factoryName = serviceReference.getProperty("factory.name");
        if ( factoryName != null && component.getName().equals(factoryName)) {

          Pojo pojo = (Pojo) instancesServiceTracker.getService(serviceReference);
          if (pojo != null) {
                instanceBound(serviceReference,pojo.getComponentInstance());
          }
        }
      }
    }
   
View Full Code Here

   
    // Get foo object
    FooService fs = (FooService) getServiceObject(ref);
   
    // Cast to POJO
    Pojo pojo = (Pojo) fs;
   
    // GetComponentInstance
    ComponentInstance instance = pojo.getComponentInstance();
    assertEquals("Check component instance name", instance.getInstanceName(), compName);
    assertEquals("Check component factory name", instance.getFactory().getName(), factName);
    assertNotNull("Instance description not null", instance.getInstanceDescription());
    PrimitiveInstanceDescription id = (PrimitiveInstanceDescription) instance.getInstanceDescription();
    assertTrue("Check instance state", id.getState() == ComponentInstance.VALID);
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.Pojo

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.