Package org.apache.geronimo.xbeans.javaee6

Examples of org.apache.geronimo.xbeans.javaee6.WebAppType


        Map<String, WebFragmentEntry> webFragmentEntryMap = new HashMap<String, WebFragmentEntry>(jarURLDocumentMap.size());
        boolean absoluteOrderingConfigured = webApp.getAbsoluteOrderingArray().length != 0;
        Set<String> usedWebFragmentNames = new HashSet<String>();
        Map<String, WebFragmentType> unnamedWebFragmentMap = new HashMap<String, WebFragmentType>();
        for (String jarURL : jarURLDocumentMap.keySet()) {
            WebFragmentType webFragment = jarURLDocumentMap.get(jarURL).getWebFragment();
            JavaIdentifierType[] names = webFragment.getNameArray();
            String webFragmentName = names.length == 0 ? null : names[0].getStringValue();
            if (webFragmentName != null) {
                if (webFragmentEntryMap.containsKey(webFragmentName)) {
                    //TODO Please correct my understanding about how to handle the duplicate web-fragment name (spec 8.2.2)
                    //If absolute-ordering is configured, the web-fragments of the same name are allowed, but only the first occurrence is considered
                    //If relative-ordering is configured, Duplicate name exception: if, when traversing the web-fragments, multiple
                    //members with the same <name> element are encountered, the application must
                    //log an informative error message including information to help fix the
                    //problem, and must fail to deploy. For example, one way to fix this problem is
                    //for the user to use absolute ordering, in which case relative ordering is ignored.
                    //TODO If there is no configuration for absolute-ordering in web.xml and relative-ordering in webfragment.xml files, shall we allowed duplicate names ?
                    if (!absoluteOrderingConfigured) {
                        throw new DeploymentException("Mutiple web-fragments with the same name [" + webFragmentName + "] are found in " + jarURL + " and "
                                + webFragmentEntryMap.get(webFragmentName).getJarURL() + ", you might make the name unique or use absolute ordering in web.xml");
                    }
                } else {
                    webFragmentEntryMap.put(webFragmentName, new WebFragmentEntry(webFragmentName, webFragmentName, webFragment, jarURL));
                }
                usedWebFragmentNames.add(webFragmentName);
            } else {
                unnamedWebFragmentMap.put(jarURL, webFragment);
            }
            //Add names configurations in before/after, so that we would not add an existing name for those unamed web fragment by sudden.
            if (webFragment.getOrderingArray().length > 0) {
                OrderingType order = webFragment.getOrderingArray()[0];
                if (order.getBefore() != null) {
                    for (JavaIdentifierType name : order.getBefore().getNameArray()) {
                        usedWebFragmentNames.add(name.getStringValue());
                    }
                }
                if (order.getAfter() != null) {
                    for (JavaIdentifierType name : order.getAfter().getNameArray()) {
                        usedWebFragmentNames.add(name.getStringValue());
                    }
                }
            }
        }
        //Generate names for all the web fragments which are not explicitly configured
        String tempNamePrefix = "geronimo-deployment";
        int nameSubfix = 0;
        for (String webFragmentURL : unnamedWebFragmentMap.keySet()) {
            WebFragmentType webFragment = unnamedWebFragmentMap.get(webFragmentURL);
            String tempWebFragmentName = tempNamePrefix + nameSubfix++;
            while (usedWebFragmentNames.contains(tempWebFragmentName)) {
                tempWebFragmentName = tempNamePrefix + nameSubfix++;
            }
            webFragmentEntryMap.put(tempWebFragmentName, new WebFragmentEntry(tempNamePrefix, null, webFragment, webFragmentURL));
View Full Code Here


                        resScope.setStringValue(annotation.shareable() ? "Shareable" : "Unshareable");

                        // mappedName
                        String mappdedNameAnnotation = annotation.mappedName();
                        if (!mappdedNameAnnotation.equals("")) {
                            XsdStringType mappedName = resourceRef.addNewMappedName();
                            mappedName.setStringValue(mappdedNameAnnotation);
                        }

                        // lookup
                        String lookup = annotation.lookup();
                        if (!lookup.equals("")) {
                            XsdStringType lookupName = resourceRef.addNewLookupName();
                            lookupName.setStringValue(lookup);
                        }
                    }
                    catch (Exception anyException) {
                        log.debug("ResourceRefBuilder: Exception caught while processing <resource-ref>");
                    }
View Full Code Here

            }

            // mappedName
            String mappdedNameAnnotation = annotation.mappedName();
            if (!mappdedNameAnnotation.equals("")) {
                XsdStringType mappedName = resourceEnvRef.addNewMappedName();
                mappedName.setStringValue(mappdedNameAnnotation);
            }
           
            // lookup
            String lookup = annotation.lookup();
            if (!lookup.equals("")) {
                XsdStringType lookupName = resourceEnvRef.addNewLookupName();
                lookupName.setStringValue(lookup);
            }
        }
View Full Code Here

            }

            // mappedName
            String mappdedNameAnnotation = annotation.mappedName();
            if (!mappdedNameAnnotation.equals("")) {
                XsdStringType mappedName = messageDestinationRef.addNewMappedName();
                mappedName.setStringValue(mappdedNameAnnotation);
            }
           
            // lookup
            String lookup = annotation.lookup();
            if (!lookup.equals("")) {
                XsdStringType lookupName = messageDestinationRef.addNewLookupName();
                lookupName.setStringValue(lookup);
            }
        }
View Full Code Here

  public JAXBElement createGeronimoWebDeploymentPlan(IFile dpFile) throws Exception {
      Trace.tracePoint("Entry", "V11DeploymentPlanCreationOperation.createGeronimoWebDeploymentPlan",
        dpFile, dpFile.getFullPath());

      org.apache.geronimo.xml.ns.j2ee.web_1.ObjectFactory webFactory = new org.apache.geronimo.xml.ns.j2ee.web_1.ObjectFactory();
    WebAppType web = webFactory.createWebAppType();

    web.setContextRoot("/" + getProject().getName());
    web.setEnvironment(getConfigEnvironment());

    JAXBElement jaxbElement = webFactory.createWebApp(web);
    JAXBUtils.marshalDeploymentPlan(jaxbElement, dpFile);

    Trace.tracePoint("Exit ", "V11DeploymentPlanCreationOperation.createGeronimoWebDeploymentPlan", jaxbElement);
View Full Code Here

            SecurityType security = (SecurityType)source;
            if (security.getRoleMappings() != null && security.getRoleMappings().getRole().size() == 0) {
                security.setRoleMappings(null);
            }
        } else if (source instanceof WebAppType) {
            WebAppType webapp = (WebAppType)source;
            GbeanLocatorType gbeanlocator = webapp.getWebContainer();
            if (gbeanlocator != null && isEmpty(gbeanlocator.getGbeanLink()) && isEmpty(gbeanlocator.getPattern())) {
                webapp.setWebContainer(null);
            }
        } else if (source instanceof OpenejbJarType) {
          OpenejbJarType openejb = (OpenejbJarType)source;
            ResourceLocatorType locator = openejb.getCmpConnectionFactory();
            if (locator != null && isEmpty(locator.getResourceLink()) && isEmpty(locator.getUrl()) && isEmpty(locator.getPattern())) {
View Full Code Here

        Trace.tracePoint("Enter", "DependencyHelper.getEnvironment", module);

        EnvironmentType environment = null;
        if (GeronimoUtils.isWebModule(module)) {
            if (getWebDeploymentPlan(module) != null) {
                WebAppType plan = getWebDeploymentPlan(module).getValue();
                if (plan != null)
                    environment = plan.getEnvironment();
            }
        }
        else if (GeronimoUtils.isEjbJarModule(module)) {
            if (getOpenEjbDeploymentPlan(module) != null) {
                OpenejbJarType plan = getOpenEjbDeploymentPlan(module).getValue();
                if (plan != null)
                    environment = plan.getEnvironment();
            }
        }
        else if (GeronimoUtils.isEarModule(module)) {
            if (getApplicationDeploymentPlan(module) != null) {
                ApplicationType plan = getApplicationDeploymentPlan(module).getValue();
                if (plan != null)
                    environment = plan.getEnvironment();
            }
        }
        else if (GeronimoUtils.isRARModule(module)) {
            if (getConnectorDeploymentPlan(module) != null) {
                ConnectorType plan = getConnectorDeploymentPlan(module).getValue();
                if (plan != null)
                    environment = plan.getEnvironment();
            }
        }else if (GeronimoUtils.isAppClientModule(module)) {
            if (getAppClientDeploymentPlan(module) != null) {
                ApplicationClientType plan = getAppClientDeploymentPlan(module).getValue();
                if (plan != null)
                    environment = plan.getServerEnvironment();
            }
        }

        Trace.tracePoint("Exit ", "DependencyHelper.getEnvironment", environment);
        return environment;
View Full Code Here

  public static String getConfigId(IModule module) throws Exception {

    EnvironmentType environment = null;
    if (isWebModule(module)) {
      JAXBElement<WebAppType> webapptype=getWebDeploymentPlan(module);
      WebAppType plan = webapptype.getValue();
      if (plan != null)
        environment = plan.getEnvironment();
    } else if (isEjbJarModule(module)) {
      OpenejbJarType plan = getOpenEjbDeploymentPlan(module).getValue();
      // if (plan != null)
      // environment = plan.getEnvironment();
    } else if (isEarModule(module)) {
      ApplicationType plan = getApplicationDeploymentPlan(module).getValue();
      if (plan != null)
        environment = plan.getEnvironment();
    } else if (isRARModule(module)) {
      ConnectorType plan = getConnectorDeploymentPlan(module).getValue();
      if (plan != null)
        environment = plan.getEnvironment();
    }
    if (environment != null
              && environment.getModuleId() != null) {
              Trace.tracePoint("EXIT", "GeronimoV11Utils.getConfigId", getQualifiedConfigID(environment.getModuleId()));
              return getQualifiedConfigID(environment.getModuleId());
View Full Code Here

  }

  public static String getContextRoot(IModule module) throws Exception {
    String contextRoot = null;

    WebAppType deploymentPlan = getWebDeploymentPlan(module).getValue();
    if (deploymentPlan != null)
      contextRoot = deploymentPlan.getContextRoot();

    if (contextRoot == null)
      contextRoot = GeronimoUtils.getContextRoot(module);

    return contextRoot;
View Full Code Here

     *
     * @see org.apache.geronimo.ui.pages.AbstractGeronimoFormPage#fillBody(org.eclipse.ui.forms.IManagedForm)
     */
    protected void fillBody(IManagedForm managedForm) {
        if (WebAppType.class.isInstance (getDeploymentPlan().getValue())) {
            WebAppType webapp = (WebAppType)((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan().getValue();
            managedForm.addPart(new EjbRefSection(getDeploymentPlan(), body, toolkit, getStyle(), webapp.getEjbRef()));
            managedForm.addPart(new ResourceRefSection(getDeploymentPlan(), body, toolkit, getStyle(), webapp.getResourceRef()));
            managedForm.addPart(new ServiceRefSection(getDeploymentPlan(), body, toolkit, getStyle(), webapp.getServiceRef()));
            managedForm.addPart(new ResourceEnvRefSection(getDeploymentPlan(), body, toolkit, getStyle(), webapp.getResourceEnvRef()));
            managedForm.addPart(new EjbLocalRefSection(getDeploymentPlan(), body, toolkit, getStyle(), webapp.getEjbLocalRef()));
            managedForm.addPart(new GBeanRefSection(getDeploymentPlan(), body, toolkit, getStyle(), webapp.getGbeanRef()));
            managedForm.addPart(new MessageDestSection(getDeploymentPlan(), body, toolkit, getStyle(), webapp.getMessageDestination()));
        }
        else if (ApplicationClientType.class.isInstance (getDeploymentPlan().getValue())){
          ApplicationClientType appClient = (ApplicationClientType)((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan().getValue();
            managedForm.addPart(new EjbRefSection(getDeploymentPlan(), body, toolkit, getStyle(), appClient.getEjbRef()));
            managedForm.addPart(new ResourceRefSection(getDeploymentPlan(), body, toolkit, getStyle(), appClient.getResourceRef()));
View Full Code Here

TOP

Related Classes of org.apache.geronimo.xbeans.javaee6.WebAppType

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.