Examples of Factory


Examples of org.apache.commons.collections.Factory

                JCRNodeWrapper child = (JCRNodeWrapper) children.nextNode();
                if (defs == null) {
                    // first child
                    defs = LazyMap.decorate(new HashMap<String, Map<String, ExtendedPropertyDefinition>>(),
                                            new Factory() {
                                                public Object create() {
                                                    return new HashMap<String, ExtendedPropertyDefinition>();
                                                }
                                            });
                    referencedDefs = LazyMap.decorate(
                            new HashMap<String, Map<String, Map<String, ExtendedPropertyDefinition>>>(), new Factory() {
                                public Object create() {
                                    return LazyMap.decorate(
                                            new HashMap<ExtendedPropertyDefinition, Map<String, ExtendedPropertyDefinition>>(),
                                            new Factory() {
                                                public Object create() {
                                                    return new HashMap<String, ExtendedPropertyDefinition>();
                                                }
                                            });
                                }
View Full Code Here

Examples of org.apache.cxf.common.util.factory.Factory

public class JAXWSMethodInvoker extends FactoryInvoker {

    public JAXWSMethodInvoker(final Object bean) {
        super(
            new Factory() {
                public Object create() {
                    return bean;
                }
            },
            ApplicationScopePolicy.instance());
View Full Code Here

Examples of org.apache.cxf.service.invoker.Factory

   
   
    @SuppressWarnings("deprecation")
    protected void run() {
       
        Factory factory = new PerRequestFactory(DocLitWrappedCodeFirstServiceImpl.class);
        factory = new PooledFactory(factory, 4);
       
        JAXWSMethodInvoker invoker = new JAXWSMethodInvoker(factory);
        JaxWsServerFactoryBean factoryBean;
       
View Full Code Here

Examples of org.apache.directory.server.core.integ.annotations.Factory

        if ( parent != null )
        {
            parentFactory = parent.getFactory();
        }

        Factory annotation = description.getAnnotation( Factory.class );
       
        if ( annotation == null )
        {
            return parentFactory;
        }
        else
        {
            return ( DirectoryServiceFactory ) annotation.value().newInstance();
        }
    }
View Full Code Here

Examples of org.apache.felix.ipojo.Factory

     * @param name the factory name
     * @throws IOException if the json object cannot be written.
     */
    private void getFactoryDetail(PrintWriter pw, String name) throws IOException{
        // Find the factory
        Factory factory = null;
        for (Factory fact : m_factories) {
            if (fact.getName().equals(name)) {
                factory = fact;
            }
        }
       
        if (factory == null) {
            // This will be used a error message (cannot be interpreted as json)
            pw.println("The factory " + name + " does not exist or is private");
            return;
        }
       
        try {
            JSONObject resp = new JSONObject();
           
            // Statline.
            resp.put("count", m_factories.size());
            resp.put("valid_count", StateUtils.getValidFactoriesCount(m_factories));
            resp.put("invalid_count", StateUtils.getInvalidFactoriesCount(m_factories));
            // End of the statline
           
            // Factory object
            JSONObject data = new JSONObject();
            data.put("name", factory.getName());
            data.put("state", StateUtils.getFactoryState(factory.getState()));
           
            String bundle = factory.getBundleContext().getBundle().getSymbolicName()
            + " (" + factory.getBundleContext().getBundle().getBundleId() + ")";
            data.put("bundle", bundle);
           
            // Provided service specifications
            if (factory.getComponentDescription().getprovidedServiceSpecification().length != 0) {
                JSONArray services = new JSONArray
                    (Arrays.asList(factory.getComponentDescription().getprovidedServiceSpecification()));
                data.put("services", services);
            }
           
            // Properties
            PropertyDescription[] props = factory.getComponentDescription().getProperties();
            if (props != null  && props.length != 0) {
                JSONArray properties = new JSONArray();
                for (int i = 0; i < props.length; i++) {
                    JSONObject prop = new JSONObject();
                    prop.put("name", props[i].getName());
                    prop.put("type", props[i].getType());
                    prop.put("mandatory", props[i].isMandatory());
                    prop.put("immutable", props[i].isImmutable());
                    if (props[i].getValue() != null) {
                        prop.put("value", props[i].getValue());
                    }
                    properties.put(prop);
                }
                data.put("properties", properties);
            }
           
            if (! factory.getRequiredHandlers().isEmpty()) {
                JSONArray req = new JSONArray
                    (factory.getRequiredHandlers());
                data.put("requiredHandlers", req);
            }
           
            if (! factory.getMissingHandlers().isEmpty()) {
                JSONArray req = new JSONArray
                    (factory.getMissingHandlers());
                data.put("missingHandlers", req);
            }
           
            List<?> instances = StateUtils.getInstanceList(m_archs, name);
            if (! instances.isEmpty()) {
                JSONArray req = new JSONArray(instances);
                data.put("instances", req);
            }
           
            data.put("architecture", factory.getDescription().toString());
            resp.put("data", data);
           
            pw.print(resp.toString());
        } catch (JSONException e) {
            // Propagate the exception.
View Full Code Here

Examples of org.apache.felix.ipojo.Factory

        // verify component's factory is here
        // verify BazService has been published
        // --> verify instance has been created

        Factory factory = ipojoHelper.getFactory(BAZ_FACTORY_NAME);
        Assert.assertNotNull(factory);
        assertEquals(Factory.VALID, factory.getState());


        List<BazService> services = osgiHelper.getServiceObjects(BazService.class);
        assertEquals(1, services.size());
View Full Code Here

Examples of org.apache.felix.ipojo.Factory

        // verify component's factory is here
        // verify that the requires handler has been activated
        // verify that a created instance works

        Factory factory = ipojoHelper.getFactory(MB_FACTORY_NAME);
        Assert.assertNotNull(factory);
        assertEquals(Factory.VALID, factory.getState());

        assertTrue(factory.getRequiredHandlers().contains("org.apache.felix.ipojo:requires"));

        ComponentInstance instance = ipojoHelper.createComponentInstance(MB_FACTORY_NAME, "stereotype-multibind-instance");
        assertTrue(ipojoHelper.isInstanceValid(instance));

        ipojoHelper.dispose();
View Full Code Here

Examples of org.apache.felix.ipojo.Factory

     * @param name the factory name
     * @throws IOException if the json object cannot be written.
     */
    private void getFactoryDetail(PrintWriter pw, String name) throws IOException{
        // Find the factory
        Factory factory = null;
        for (Factory fact : m_factories) {
            if (fact.getName().equals(name)) {
                factory = fact;
            }
        }
       
        if (factory == null) {
            // This will be used a error message (cannot be interpreted as json)
            pw.println("The factory " + name + " does not exist or is private");
            return;
        }
       
        try {
            JSONObject resp = new JSONObject();
           
            // Statline.
            resp.put("count", m_factories.size());
            resp.put("valid_count", StateUtils.getValidFactoriesCount(m_factories));
            resp.put("invalid_count", StateUtils.getInvalidFactoriesCount(m_factories));
            // End of the statline
           
            // Factory object
            JSONObject data = new JSONObject();
            data.put("name", factory.getName());
            data.put("state", StateUtils.getFactoryState(factory.getState()));
           
            String bundle = factory.getBundleContext().getBundle().getSymbolicName()
            + " (" + factory.getBundleContext().getBundle().getBundleId() + ")";
            data.put("bundle", bundle);
           
            // Provided service specifications
            if (factory.getComponentDescription().getprovidedServiceSpecification().length != 0) {
                JSONArray services = new JSONArray
                    (Arrays.asList(factory.getComponentDescription().getprovidedServiceSpecification()));
                data.put("services", services);
            }
           
            // Properties
            PropertyDescription[] props = factory.getComponentDescription().getProperties();
            if (props != null  && props.length != 0) {
                JSONArray properties = new JSONArray();
                for (int i = 0; i < props.length; i++) {
                    JSONObject prop = new JSONObject();
                    prop.put("name", props[i].getName());
                    prop.put("type", props[i].getType());
                    prop.put("mandatory", props[i].isMandatory());
                    prop.put("immutable", props[i].isImmutable());
                    if (props[i].getValue() != null) {
                        prop.put("value", props[i].getValue());
                    }
                    properties.put(prop);
                }
                data.put("properties", properties);
            }
           
            if (! factory.getRequiredHandlers().isEmpty()) {
                JSONArray req = new JSONArray
                    (factory.getRequiredHandlers());
                data.put("requiredHandlers", req);
            }
           
            if (! factory.getMissingHandlers().isEmpty()) {
                JSONArray req = new JSONArray
                    (factory.getMissingHandlers());
                data.put("missingHandlers", req);
            }
           
            List<?> instances = StateUtils.getInstanceList(m_archs, name);
            if (! instances.isEmpty()) {
                JSONArray req = new JSONArray(instances);
                data.put("instances", req);
            }
           
            data.put("architecture", factory.getDescription().toString());
            resp.put("data", data);
           
            pw.print(resp.toString());
        } catch (JSONException e) {
            // Propagate the exception.
View Full Code Here

Examples of org.apache.felix.ipojo.Factory

*/
public class IPojoTestUtils {

    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;
        }

        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

Examples of org.apache.felix.ipojo.Factory

        }
    }

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