Package org.apache.felix.ipojo

Examples of org.apache.felix.ipojo.Factory


    }
   
    foo1.stop();
    foo2.stop();
   
    Factory factory = Utils.getFactoryByName(getContext(), "composite.export.2");
    Properties props = new Properties();
    props.put("instance.name","export");
    try {
      export2 = factory.createComponentInstance(props);
    } catch(Exception e) {
      fail("Fail to instantiate exporter " + e.getMessage());
    }
  }
View Full Code Here


            return null;
        }
    }

    public static ComponentInstance getComponentInstance(BundleContext bc, String factoryName, Dictionary configuration) {
        Factory fact = getFactoryByName(bc, factoryName);

        if (fact == null) {
            System.err.println("Factory " + factoryName + " not found");
            return null;
        }

        // if(fact.isAcceptable(configuration)) {
        try {
            return fact.createComponentInstance(configuration);
        } catch (Exception e) {
            System.err.println("Cannot create the instance from " + factoryName + " : " + e.getMessage());
            e.printStackTrace();
            return null;
        }
View Full Code Here

        // return null;
        // }
    }

    public static ComponentInstance getComponentInstanceByName(BundleContext bc, String factoryName, String name) {
        Factory fact = getFactoryByName(bc, factoryName);

        if (fact == null) {
            System.err.println("Factory " + factoryName + " not found");
            return null;
        }

        try {
            Properties props = new Properties();
            props.put("instance.name",name);
            return fact.createComponentInstance(props);
        } catch (Exception e) {
            System.err.println("Cannot create the instance from " + factoryName + " : " + e.getMessage());
            e.printStackTrace();
            return null;
        }
View Full Code Here

            return null;
        }
    }

    public static ComponentInstance getComponentInstance(ServiceContext bc, String factoryName, Dictionary configuration) {
        Factory fact = getFactoryByName(bc, factoryName);

        if (fact == null) { return null; }

        if (fact.isAcceptable(configuration)) {
            try {
                return fact.createComponentInstance(configuration);
            } catch (Exception e) {
                System.err.println(e.getMessage());
                e.printStackTrace();
                return null;
            }
View Full Code Here

    }
   
    foo1.stop();
    foo2.stop();
   
    Factory factory = Utils.getFactoryByName(getContext(), "composite.export.4");
    Properties props = new Properties();
    props.put("instance.name","export");
    try {
      export3 = factory.createComponentInstance(props);
    } catch(Exception e) {
      fail("Fail to instantiate exporter " + e.getMessage());
    }
  }
View Full Code Here

        }
       
        totoProv.stop();
        totoProv2.stop();
       
        Factory factory = Utils.getFactoryByName(getContext(), "comp-7");
        Properties props2 = new Properties();
        props2.put("instance.name","ff");
        try {
            under = factory.createComponentInstance(props2);
        } catch(Exception e) {
            e.printStackTrace();
        }
        tataFactory.stop();
        
View Full Code Here

        }
       
        totoProv.stop();
        totoProv2.stop();
       
        Factory factory = Utils.getFactoryByName(getContext(), "comp-0");
        Properties props2 = new Properties();
        props2.put("instance.name","ff");
        try {
            under = factory.createComponentInstance(props2);
        } catch(Exception e) {
            e.printStackTrace();
            fail("Cannot create an instance : " + e.getMessage());
        }
    }
View Full Code Here

  public void setUp() {
   
    Properties p = new Properties();
    p.put("instance.name","importer");
    Factory compFact = Utils.getFactoryByName(getContext(), "composite.requires.3");
    try {
      import3 = compFact.createComponentInstance(p);
    } catch(Exception e) {
      fail("Cannot instantiate the component : " + e.getMessage());
    }
   
    import3.stop();
View Full Code Here

  public void setUp() {
   
    Properties p = new Properties();
    p.put("instance.name","importer");
    Factory compFact = Utils.getFactoryByName(getContext(), "composite.requires.4");
    try {
      import4 = compFact.createComponentInstance(p);
    } catch(Exception e) {
      fail("Cannot instantiate the component : " + e.getMessage());
    }
   
    import4.stop();
View Full Code Here

        }
       
        totoProv.stop();
        totoProv2.stop();
       
        Factory factory = Utils.getFactoryByName(getContext(), "comp-3");
        Properties props2 = new Properties();
        props2.put("instance.name","ff");
        try {
            under = factory.createComponentInstance(props2);
        } catch(Exception e) {
            e.printStackTrace();
        }
        
    }
View Full Code Here

TOP

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

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.