Package org.apache.geronimo.gbean

Examples of org.apache.geronimo.gbean.GBeanInfoBuilder


        for (int i = 0; i < messagelistenerArray.length; i++) {
            MessagelistenerType messagelistenerType = messagelistenerArray[i];
            String messageListenerInterface = messagelistenerType.getMessagelistenerType().getStringValue().trim();
            ActivationspecType activationspec = messagelistenerType.getActivationspec();
            String activationSpecClassName = activationspec.getActivationspecClass().getStringValue().trim();
            GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder(ActivationSpecWrapperGBean.class, ActivationSpecWrapperGBean.GBEAN_INFO);

            //add all javabean properties that have both getter and setter.  Ignore the "required" flag from the dd.
            Map getters = new HashMap();
            Set setters = new HashSet();
            Method[] methods;
            try {
                Class activationSpecClass = cl.loadClass(activationSpecClassName);
                methods = activationSpecClass.getMethods();
            } catch (ClassNotFoundException e) {
                throw new DeploymentException("Can not load activation spec class", e);
            }
            for (int j = 0; j < methods.length; j++) {
                Method method = methods[j];
                String methodName = method.getName();
                if ((methodName.startsWith("get") || methodName.startsWith("is")) && method.getParameterTypes().length == 0)
                {
                    String attributeName = (methodName.startsWith("get")) ? methodName.substring(3) : methodName.substring(2);
                    getters.put(Introspector.decapitalize(attributeName), method.getReturnType().getName());
                } else if (methodName.startsWith("set") && method.getParameterTypes().length == 1) {
                    setters.add(Introspector.decapitalize(methodName.substring(3)));
                }
            }
            getters.keySet().retainAll(setters);
            getters.remove("resourceAdapter");

            for (Iterator iterator = getters.entrySet().iterator(); iterator.hasNext();) {
                Map.Entry entry = (Map.Entry) iterator.next();
                infoBuilder.addAttribute(new DynamicGAttributeInfo((String) entry.getKey(), (String) entry.getValue(), true, true, true, true));
            }

            GBeanInfo gbeanInfo = infoBuilder.getBeanInfo();
            try {
                //make sure the class is available, but we don't use it.
                cl.loadClass(activationSpecClassName);
            } catch (ClassNotFoundException e) {
                throw new DeploymentException("Could not load ActivationSpec class", e);
View Full Code Here


        configurationManager = ConfigurationUtil.getEditableConfigurationManager(kernel);

        configurationData = new ConfigurationData(new Artifact("test", "test", "", "car"), kernel.getNaming());
        configurationData.addGBean("GlobalContext", GlobalContextGBean.GBEAN_INFO);

        GBeanInfoBuilder builder = new GBeanInfoBuilder(ImmutableContext.class);
        builder.setConstructor(new String[]{"nameInNamespace", "bindings", "cacheReferences"});
        builder.addAttribute("nameInNamespace", String.class, true);
        builder.addAttribute("bindings", Map.class, true);
        builder.addAttribute("cacheReferences", boolean.class, true);
        immutableContextGBeanInfo = builder.getBeanInfo();

        contextEnv = new Hashtable();
        contextEnv.put(Context.INITIAL_CONTEXT_FACTORY, GlobalContextManager.class.getName());
    }
View Full Code Here

    public GBeanInfo buildGBeanInfo() throws GBeanAnnotationException {
        try {
            String name = getName();
            String j2eeType = getJ2eeyType();
            GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(name, gbeanClass, j2eeType);

            setPriority(infoBuilder);
            setConstructor(infoBuilder);
            markPersistent(infoBuilder);
            addReferences(infoBuilder);

            return infoBuilder.getBeanInfo();
        } catch (NoClassDefFoundError e) {
            throw new GBeanAnnotationException("Could not fully load class: " + gbeanClass.getName() + "\n due to: " + e.getMessage() "\n in classloader \n" + gbeanClass.getClassLoader(), e);
        }
    }
View Full Code Here

        resourceAdapterModuleData.setAttribute("resourceAdapterVersion", connector.getResourceAdapterVersion());

        ResourceAdapterBase resourceAdapter = connector.getResourceAdapter();
        // Create the resource adapter gbean
        if (resourceAdapter.getResourceAdapterClass() != null) {
            GBeanInfoBuilder resourceAdapterInfoBuilder = new GBeanInfoBuilder(ResourceAdapterWrapperGBean.class, new MultiGBeanInfoFactory().getGBeanInfo(ResourceAdapterWrapperGBean.class));
            String resourceAdapterClassName = resourceAdapter.getResourceAdapterClass();
            GBeanData resourceAdapterGBeanData = setUpDynamicGBeanWithProperties(resourceAdapterClassName, resourceAdapterInfoBuilder, resourceAdapter.getConfigProperty(), bundle, Collections.<String>emptySet());

            resourceAdapterGBeanData.setAttribute("resourceAdapterClass", resourceAdapterClassName);
View Full Code Here

        Map<String, GBeanData> activationSpecInfos = new HashMap<String, GBeanData>();
        for (MessageListener messageListener : messageListeners) {
            String messageListenerInterface = messageListener.getMessageListenerType();
            ActivationSpec activationSpec = messageListener.getActivationSpec();
            String activationSpecClassName = activationSpec.getActivationSpecClass();
            GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder(ActivationSpecWrapperGBean.class, new AnnotationGBeanInfoBuilder(ActivationSpecWrapperGBean.class).buildGBeanInfo());
            Set<String> ignore = Collections.singleton("resourceAdapter");
            setUpDynamicGBean(activationSpecClassName, infoBuilder, ignore, bundle, true);


            GBeanInfo gbeanInfo = infoBuilder.getBeanInfo();

            GBeanData activationSpecInfo = new GBeanData(gbeanInfo);
            activationSpecInfo.setAttribute("activationSpecClass", activationSpecClassName);
            activationSpecInfos.put(messageListenerInterface, activationSpecInfo);
        }
View Full Code Here

    }

    private Map getManagedConnectionFactoryInfoMap(List<ConnectionDefinition> connectionDefinitions, Bundle bundle) throws DeploymentException {
        Map<String, GBeanData> managedConnectionFactoryInfos = new HashMap<String, GBeanData>();
        for (ConnectionDefinition connectionDefinition : connectionDefinitions) {
            GBeanInfoBuilder managedConnectionFactoryInfoBuilder = new GBeanInfoBuilder(ManagedConnectionFactoryWrapper.class, ManagedConnectionFactoryWrapperGBean.GBEAN_INFO);
            String managedConnectionfactoryClassName = connectionDefinition.getManagedConnectionFactoryClass();
            Set<String> ignore = new HashSet<String>();
            ignore.add("ResourceAdapter");
            ignore.add("LogWriter");
            GBeanData managedConnectionFactoryGBeanData = setUpDynamicGBeanWithProperties(managedConnectionfactoryClassName, managedConnectionFactoryInfoBuilder, connectionDefinition.getConfigProperty(), bundle, ignore);
View Full Code Here

    }

    private Map getAdminObjectInfoMap(List<AdminObject> adminObjects, Bundle bundle) throws DeploymentException {
        Map<String, GBeanData> adminObjectInfos = new HashMap<String, GBeanData>();
        for (AdminObject adminObject : adminObjects) {
            GBeanInfoBuilder adminObjectInfoBuilder = new GBeanInfoBuilder(AdminObjectWrapper.class, AdminObjectWrapperGBean.GBEAN_INFO);
            String adminObjectClassName = adminObject.getAdminObjectClass();
            GBeanData adminObjectGBeanData = setUpDynamicGBeanWithProperties(adminObjectClassName, adminObjectInfoBuilder, adminObject.getConfigProperty(), bundle, Collections.<String>emptySet());

            // set the standard properties
            String adminObjectInterface = adminObject.getAdminObjectInterface();
View Full Code Here

        configurationData = new ConfigurationData(new Artifact("test", "test", "", "car"), kernel.getNaming());
        configurationData.setBundleContext(bundleContext);
        configurationData.addGBean("GlobalContext", GlobalContextGBean.class);

        GBeanInfoBuilder builder = new GBeanInfoBuilder(ImmutableContext.class);
        builder.setConstructor(new String[]{"nameInNamespace", "bindings", "cacheReferences"});
        builder.addAttribute("nameInNamespace", String.class, true);
        builder.addAttribute("bindings", Map.class, true);
        builder.addAttribute("cacheReferences", boolean.class, true);
        immutableContextGBeanInfo = builder.getBeanInfo();

    }
View Full Code Here

        resourceAdapterModuleData.setAttribute("resourceAdapterVersion", connector.getResourceadapterVersion().getStringValue());

        ResourceadapterType resourceadapter = connector.getResourceadapter();
        // Create the resource adapter gbean
        if (resourceadapter.isSetResourceadapterClass()) {
            GBeanInfoBuilder resourceAdapterInfoBuilder = new GBeanInfoBuilder(ResourceAdapterWrapperGBean.class, ResourceAdapterWrapperGBean.GBEAN_INFO);
            GBeanData resourceAdapterGBeanData = setUpDynamicGBean(resourceAdapterInfoBuilder, resourceadapter.getConfigPropertyArray(), cl);

            resourceAdapterGBeanData.setAttribute("resourceAdapterClass", resourceadapter.getResourceadapterClass().getStringValue().trim());
            resourceAdapterModuleData.setAttribute("resourceAdapterGBeanData", resourceAdapterGBeanData);
        }
View Full Code Here

        for (int i = 0; i < messagelistenerArray.length; i++) {
            MessagelistenerType messagelistenerType = messagelistenerArray[i];
            String messageListenerInterface = messagelistenerType.getMessagelistenerType().getStringValue().trim();
            ActivationspecType activationspec = messagelistenerType.getActivationspec();
            String activationSpecClassName = activationspec.getActivationspecClass().getStringValue().trim();
            GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder(ActivationSpecWrapperGBean.class, ActivationSpecWrapperGBean.GBEAN_INFO);

            //add all javabean properties that have both getter and setter.  Ignore the "required" flag from the dd.
            Map getters = new HashMap();
            Set setters = new HashSet();
            Method[] methods;
            try {
                Class activationSpecClass = cl.loadClass(activationSpecClassName);
                methods = activationSpecClass.getMethods();
            } catch (ClassNotFoundException e) {
                throw new DeploymentException("Can not load activation spec class", e);
            }
            for (int j = 0; j < methods.length; j++) {
                Method method = methods[j];
                String methodName = method.getName();
                if ((methodName.startsWith("get") || methodName.startsWith("is")) && method.getParameterTypes().length == 0)
                {
                    String attributeName = (methodName.startsWith("get")) ? methodName.substring(3) : methodName.substring(2);
                    getters.put(Introspector.decapitalize(attributeName), method.getReturnType().getName());
                } else if (methodName.startsWith("set") && method.getParameterTypes().length == 1) {
                    setters.add(Introspector.decapitalize(methodName.substring(3)));
                }
            }
            getters.keySet().retainAll(setters);
            getters.remove("resourceAdapter");

            for (Iterator iterator = getters.entrySet().iterator(); iterator.hasNext();) {
                Map.Entry entry = (Map.Entry) iterator.next();
                infoBuilder.addAttribute(new DynamicGAttributeInfo((String) entry.getKey(), (String) entry.getValue(), true, true, true, true));
            }

            GBeanInfo gbeanInfo = infoBuilder.getBeanInfo();
            try {
                //make sure the class is available, but we don't use it.
                cl.loadClass(activationSpecClassName);
            } catch (ClassNotFoundException e) {
                throw new DeploymentException("Could not load ActivationSpec class", e);
View Full Code Here

TOP

Related Classes of org.apache.geronimo.gbean.GBeanInfoBuilder

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.