Examples of GerResourceRefType


Examples of org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType

            //}
        }
        // Handle removed or new resourceRefs
        for (Iterator it = before.iterator(); it.hasNext();) {
            ResourceRef adapter = (ResourceRef) it.next();
            GerResourceRefType all[] = getWebApp().getResourceRefArray();
            for (int i = 0; i < all.length; i++) {
                if(all[i] == adapter) {
                    getWebApp().removeResourceRef(i);
                    break;
                }
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType

        int unresolvedRefSize = resourceRefsUntyped.size();
        for (ResourceRefType resourceRef : resourceRefsUntyped) {
            String name = resourceRef.getResRefName().getStringValue().trim();
            addInjections(name, resourceRef.getInjectionTargetArray(), componentContext);
            String type = resourceRef.getResType().getStringValue().trim();
            GerResourceRefType gerResourceRef = (GerResourceRefType) refMap.get(name);
            refMap.remove(name);
            Class iface;
            try {
                iface = cl.loadClass(type);
            } catch (ClassNotFoundException e) {
                throw new DeploymentException("could not load class " + type, e);
            }
            if (iface == URL.class) {
                if (gerResourceRef == null || !gerResourceRef.isSetUrl()) {
                    throw new DeploymentException("No url supplied to resolve: " + name);
                }
                String url = gerResourceRef.getUrl().trim();
                //TODO expose jsr-77 objects for these guys
                try {
                    //check for malformed URL
                    new URL(url);
                } catch (MalformedURLException e) {
                    throw new DeploymentException("Could not convert " + url + " to URL", e);
                }
                getJndiContextMap(componentContext).put(ENV + name, new URLReference(url));

            } else if (ORB.class.isAssignableFrom(iface)) {
                CorbaGBeanNameSource corbaGBeanNameSource = (CorbaGBeanNameSource) corbaGBeanNameSourceCollection.getElement();
                if (corbaGBeanNameSource == null) {
                    throw new DeploymentException("No orb setup but there is a orb reference");
                }
                AbstractNameQuery corbaName = corbaGBeanNameSource.getCorbaGBeanName();
                if (corbaName != null) {
                    Artifact[] moduleId = module.getConfigId();
                    Map context = getJndiContextMap(componentContext);
                    context.put(ENV + name, new ORBReference(moduleId, corbaName));
                    EnvironmentBuilder.mergeEnvironments(module.getEnvironment(), corbaEnvironment);
                }
            } else {
                //determine jsr-77 type from interface
                String j2eeType;


                if (JAVAX_MAIL_SESSION_CLASS.equals(type)) {
                    j2eeType = NameFactory.JAVA_MAIL_RESOURCE;
                } else if (JAXR_CONNECTION_FACTORY_CLASS.equals(type)) {
                    j2eeType = NameFactory.JAXR_CONNECTION_FACTORY;
                } else {
                    j2eeType = NameFactory.JCA_MANAGED_CONNECTION_FACTORY;
                }
                try {
                    AbstractNameQuery containerId = getResourceContainerId(name, j2eeType, null, gerResourceRef);

                    module.getEarContext().findGBean(containerId);

                    Object ref = new ResourceReferenceFactory<ResourceException>(module.getConfigId(), containerId, iface);
                    getJndiContextMap(componentContext).put(ENV + name, ref);
                } catch (GBeanNotFoundException e) {

                    StringBuffer errorMessage = new StringBuffer("Unable to resolve resource reference '");
                    errorMessage.append(name);
                    errorMessage.append("' (");
                    if (e.hasMatches()) {
                        errorMessage.append("Found multiple matching resources.  Try being more specific in a resource-ref mapping in your Geronimo deployment plan.\n");
                        for (AbstractName match : e.getMatches()) {
                            errorMessage.append(match).append("\n");
                        }
                    } else if (gerResourceRef == null) {
                        errorMessage.append("Could not auto-map to resource.  Try adding a resource-ref mapping to your Geronimo deployment plan.");
                    } else if (gerResourceRef.isSetResourceLink()) {
                        errorMessage.append("Could not find resource '");
                        errorMessage.append(gerResourceRef.getResourceLink());
                        errorMessage.append("'.  Perhaps it has not yet been configured, or your application does not have a dependency declared for that resource module?");
                    } else {
                        errorMessage.append("Could not find the resource specified in your Geronimo deployment plan:");
                        errorMessage.append(gerResourceRef.getPattern());
                    }
                    errorMessage.append("\nSearch conducted in current module and dependencies:\n");
                    for (Dependency dependency : module.getEnvironment().getDependencies()) {
                        errorMessage.append(dependency).append("\n");
                    }
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType

            if (!URL.class.getName().equals(type)
                    && !"javax.mail.Session".equals(type)
                    && !JAXR_CONNECTION_FACTORY_CLASS.equals(type)) {

                GerResourceRefType gerResourceRef = (GerResourceRefType) refMap.get(resourceRefType.getResRefName().getStringValue());
                AbstractNameQuery containerId = getResourceContainerId(getStringValue(resourceRefType.getResRefName()), NameFactory.JCA_MANAGED_CONNECTION_FACTORY, null, gerResourceRef);

                if ("Unshareable".equals(getStringValue(resourceRefType.getResSharingScope()))) {
                    unshareableResources.add(containerId);
                }
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType

    private Map<String, GerResourceRefType> mapResourceRefs(XmlObject[] refs) {
        Map<String, GerResourceRefType> refMap = new HashMap<String, GerResourceRefType>();
        if (refs != null) {
            for (XmlObject ref1 : refs) {
                GerResourceRefType ref = (GerResourceRefType) ref1.copy().changeType(GerResourceRefType.type);
                refMap.put(ref.getRefName().trim(), ref);
            }
        }
        return refMap;
    }
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType

    public void testConstructPlan() throws Exception {
        JettyWebAppDocument jettyWebAppDoc = JettyWebAppDocument.Factory.newInstance();
        JettyWebAppType webApp = jettyWebAppDoc.addNewWebApp();
        addEnvironment(webApp);
        GerResourceRefType ref = webApp.addNewResourceRef();
        ref.setRefName("ref");
        ref.setResourceLink("target");

        XmlBeansUtil.validateDD(webApp);
        log.debug(webApp.toString());
    }
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType

        GerWebAppType tomcatWebAppType = tomcatWebAppDoc.addNewWebApp();
        EnvironmentType environmentType = tomcatWebAppType.addNewEnvironment();
        ArtifactType artifactType = environmentType.addNewModuleId();
        artifactType.setArtifactId("foo");

        GerResourceRefType ref = tomcatWebAppType.addNewResourceRef();
        ref.setRefName("ref");
        ref.setResourceLink("target");

        XmlBeansUtil.validateDD(tomcatWebAppType);
    }
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType

        GerApplicationClientDocument appClientDoc = GerApplicationClientDocument.Factory.newInstance();
        GerApplicationClientType appClient = appClientDoc.addNewApplicationClient();
        appClient.setClientConfigId("clientConfigId");
        appClient.setConfigId("configId");
        appClient.setParentId("parentId");
        GerResourceRefType ref = appClient.addNewResourceRef();
        ref.setRefName("ref");
        ref.setTargetName("target");

        SchemaConversionUtils.validateDD(appClient);
//        System.out.println(appClient.toString());
    }
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType

        JettyWebAppDocument jettyWebAppDoc = JettyWebAppDocument.Factory.newInstance();
        JettyWebAppType webApp = jettyWebAppDoc.addNewWebApp();
        webApp.setConfigId("configId");
        webApp.setParentId("parentId");
        webApp.setContextPriorityClassloader(false);
        GerResourceRefType ref = webApp.addNewResourceRef();
        ref.setRefName("ref");
        ref.setTargetName("target");

        SchemaConversionUtils.validateDD(webApp);
        System.out.println(webApp.toString());
    }
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType

        for (int i = 0; i < resourceRefs.length; i++) {
            ResourceRefType resourceRef = resourceRefs[i];
            String name = getStringValue(resourceRef.getResRefName());
            String type = getStringValue(resourceRef.getResType());
            GerResourceRefType gerResourceRef = (GerResourceRefType) refMap.get(name);
            Class iface;
            try {
                iface = cl.loadClass(type);
            } catch (ClassNotFoundException e) {
                throw new DeploymentException("could not load class " + type, e);
            }
            Reference ref;
            if (iface == URL.class) {
                if (gerResourceRef == null || !gerResourceRef.isSetUrl()) {
                    throw new DeploymentException("No url supplied to resolve: " + name);
                }
                try {
                    //TODO expose jsr-77 objects for these guys
                    builder.bind(name, new URL(gerResourceRef.getUrl()));
                } catch (MalformedURLException e) {
                    throw new DeploymentException("Could not convert " + gerResourceRef.getUrl() + " to URL", e);
                }
            } else {
                //determine jsr-77 type from interface
                String j2eeType;


                if ("javax.mail.Session".equals(type)) {
                    j2eeType = NameFactory.JAVA_MAIL_RESOURCE;
                } else if (JAXR_CONNECTION_FACTORY_CLASS.equals(type)) {
                    j2eeType = NameFactory.JAXR_CONNECTION_FACTORY;
                } else {
                    j2eeType = NameFactory.JCA_MANAGED_CONNECTION_FACTORY;
                }
                try {
                    AbstractNameQuery containerId = getResourceContainerId(name, j2eeType, null, gerResourceRef);

                    ref = refContext.getConnectionFactoryRef(containerId, iface, earContext);
                    builder.bind(name, ref);
                } catch (UnresolvedReferenceException e) {

                    StringBuffer errorMessage = new StringBuffer("Unable to resolve resource reference '");
                    errorMessage.append(name);
                    errorMessage.append("' (");
                    if (e.isMultiple()) {
                        errorMessage.append("Found multiple matching resources.  Try being more specific in a resource-ref mapping in your Geronimo deployment plan.");
                    } else if (gerResourceRef == null){
                        errorMessage.append("Could not auto-map to resource.  Try adding a resource-ref mapping to your Geronimo deployment plan.");
                    } else if (gerResourceRef.isSetResourceLink()){
                        errorMessage.append("Could not find resource '");
                        errorMessage.append(gerResourceRef.getResourceLink());
                        errorMessage.append("'.  Perhaps it has not yet been configured, or your application does not have a dependency declared for that resource module?");
                    } else {
                        errorMessage.append("Could not find the resource specified in your Geronimo deployment plan:");
                        errorMessage.append(gerResourceRef.getPattern());
                    }
                    errorMessage.append(")");

                    throw new DeploymentException(errorMessage.toString());
                }
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType

            if (!URL.class.getName().equals(type)
                    && !"javax.mail.Session".equals(type)
                    && !JAXR_CONNECTION_FACTORY_CLASS.equals(type)) {

                GerResourceRefType gerResourceRef = (GerResourceRefType) refMap.get(resourceRefType.getResRefName().getStringValue());
                AbstractNameQuery containerId = getResourceContainerId(getStringValue(resourceRefType.getResRefName()), NameFactory.JCA_MANAGED_CONNECTION_FACTORY, null, gerResourceRef);

                if ("Unshareable".equals(getStringValue(resourceRefType.getResSharingScope()))) {
                    unshareableResources.add(containerId);
                }
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.