Package org.apache.geronimo.xbeans.geronimo.naming

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


        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

    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

        for (int i = 0; i < resourceRefsUntyped.length; i++) {
            ResourceRefType resourceRef = (ResourceRefType) resourceRefsUntyped[i];
            String name = resourceRef.getResRefName().getStringValue().trim();
            String type = resourceRef.getResType().getStringValue().trim();
            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);
            }
            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
                    getJndiContextMap(componentContext).put(ENV + 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_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);

                    try {
                        localConfiguration.findGBean(containerId);
                    } catch (GBeanNotFoundException e) {
                        throw new UnresolvedReferenceException("Resource", false, containerId.toString(), localConfiguration.getId().toString());
                    }

                    Reference ref = new ResourceReference(localConfiguration.getId(), containerId, iface);
                    getJndiContextMap(componentContext).put(ENV + 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

            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

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

    public String getResourceLink() {
        return getResourceRef().getResourceLink();
    }

    public void setResourceLink(String link) {
        GerResourceRefType ref = getResourceRef();
        if(link != null) {
            if(ref.isSetPattern()) {
                clearPatternFromChoice();
            }
            if(ref.isSetUrl()) {
                String old = getUrl();
                ref.unsetUrl();
                pcs.firePropertyChange("url", old, null);
            }
        }
        String old = getResourceLink();
        ref.setResourceLink(link);
        pcs.firePropertyChange("resourceLink", old, link);
    }
View Full Code Here

    public String getUrl() {
        return getResourceRef().getResourceLink();
    }

    public void setUrl(String link) {
        GerResourceRefType ref = getResourceRef();
        if(link != null) {
            if(ref.isSetPattern()) {
                clearPatternFromChoice();
            }
            if(ref.isSetResourceLink()) {
                String old = getResourceLink();
                ref.unsetResourceLink();
                pcs.firePropertyChange("resourceLink", old, null);
            }
        }
        String old = getUrl();
        ref.setUrl(link);
        pcs.firePropertyChange("url", old, link);
    }
View Full Code Here

        pcs.firePropertyChange("url", old, link);
    }


    protected void clearNonPatternFromChoice() {
        GerResourceRefType ref = getResourceRef();
        if(ref.isSetResourceLink()) {
            String temp = ref.getResourceLink();
            ref.unsetResourceLink();
            pcs.firePropertyChange("resourceLink", temp, null);
        }
        if(ref.isSetUrl()) {
            String temp = ref.getUrl();
            ref.unsetUrl();
            pcs.firePropertyChange("url", temp, null);
        }
    }
View Full Code Here

        clientId.setGroupId("group");
        clientId.setArtifactId("artifact");
        EnvironmentType serverEnvironmentType = appClient.addNewServerEnvironment();
        serverEnvironmentType.setModuleId(clientId);

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

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

TOP

Related Classes of org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType

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.