Package com.sun.enterprise.deployment

Examples of com.sun.enterprise.deployment.EnvironmentProperty


        try {
            ApplicationParameter[] appParams =
                    context.findApplicationParameters();
            ContextParameter contextParam;
            for (int i=0; i<appParams.length; i++) {
                contextParam = new EnvironmentProperty(appParams[i].getName(),
                    appParams[i].getValue(), appParams[i].getDescription());
                ((WebBundleDescriptor)webBundleDescriptor).addContextParameter(contextParam);
            }

            ContextEnvironment[] envs = context.findEnvironments();
            EnvironmentProperty envEntry;
            for (int i=0; i<envs.length; i++) {
                envEntry = new EnvironmentProperty(
                        envs[i].getName(), envs[i].getValue(),
                        envs[i].getDescription(), envs[i].getType());
                if (envs[i].getValue()!=null) {
                    envEntry.setValue(envs[i].getValue());
                }
                ((WebBundleDescriptor)webBundleDescriptor).addEnvironmentProperty(envEntry);
            }

            ContextResource[] resources = context.findResources();
View Full Code Here


            JdbcConnectionPool adminPool,
            ConnectorConnectionPool conConnPool, ConnectorDescriptor connDesc) {

        ArrayList propList = new ArrayList();

        propList.add(new EnvironmentProperty("ClassName",
                adminPool.getDatasourceClassname() == null ? "" :
                        adminPool.getDatasourceClassname(),
                "The datasource class name",
                "java.lang.String"));


        propList.add(new EnvironmentProperty("ConnectionValidationRequired",
                adminPool.isIsConnectionValidationRequired() + "",
                "Is connection validation required",
                "java.lang.String"));

        propList.add(new EnvironmentProperty("ValidationMethod",
                adminPool.getConnectionValidationMethod() == null ? "" :
                        adminPool.getConnectionValidationMethod(),
                "How the connection is validated",
                "java.lang.String"));

        propList.add(new EnvironmentProperty("ValidationTableName",
                adminPool.getValidationTableName() == null ?
                        "" : adminPool.getValidationTableName(),
                "Validation Table name",
                "java.lang.String"));

        propList.add(new EnvironmentProperty("TransactionIsolation",
                adminPool.getTransactionIsolationLevel() == null ? "" :
                        adminPool.getTransactionIsolationLevel(),
                "Transaction Isolatin Level",
                "java.lang.String"));

        propList.add(new EnvironmentProperty("GuaranteeIsolationLevel",
                adminPool.isIsIsolationLevelGuaranteed() + "",
                "Transaction Isolation Guarantee",
                "java.lang.String"));

        propList.add(new EnvironmentProperty("StatementWrapping",
                adminPool.isWrapJdbcObjects() + "",
                "Statement Wrapping",
                "java.lang.String"));


        propList.add(new EnvironmentProperty("StatementTimeout",
                adminPool.getStatementTimeoutInSeconds() + "",
                "Statement Timeout",
                "java.lang.String"));

        //dump user defined poperties into the list
        Set connDefDescSet = connDesc.getOutboundResourceAdapter().
                getConnectionDefs();
        //since this a 1.0 RAR, we will have only 1 connDefDesc
        if (connDefDescSet.size() != 1) {
            throw new MissingResourceException("Only one connDefDesc present",
                    null, null);
        }

        Iterator iter = connDefDescSet.iterator();

        //Now get the set of MCF config properties associated with each
        //connection-definition . Each element here is an EnviromnentProperty
        Set mcfConfigProps = null;
        while (iter.hasNext()) {
            mcfConfigProps = ((ConnectionDefDescriptor) iter.next()).
                    getConfigProperties();
        }
        if (mcfConfigProps != null) {

            Map mcfConPropKeys = new HashMap();
            Iterator mcfConfigPropsIter = mcfConfigProps.iterator();
            while (mcfConfigPropsIter.hasNext()) {
                String key = ((EnvironmentProperty) mcfConfigPropsIter.next()).
                        getName();
                mcfConPropKeys.put(key.toUpperCase(), key);
            }

            String driverProperties = "";
            for (ElementProperty rp : adminPool.getElementProperty()) {
                if (rp == null) {
                    continue;
                }
                String name = rp.getName();

                //The idea here is to convert the Environment Properties coming from
                //the admin connection pool to standard pool properties thereby
                //making it easy to compare in the event of a reconfig
                if ("MATCHCONNECTIONS".equals(name.toUpperCase())) {
                    //JDBC - matchConnections if not set is decided by the ConnectionManager
                    //so default is false
                    conConnPool.setMatchConnections(ConnectionPoolObjectsUtils.toBoolean(rp.getValue(), false));
                    logFine("MATCHCONNECTIONS");

                } else if ("CONNECTION-CREATION-THREAD-WAITTIMEOUT-IN-SECONDS".equals(name.toUpperCase())) {
                    conConnPool.setConnectionCreationThreadWaitTimeout(ConnectionPoolObjectsUtils.toLong(rp.getValue()));
                    logFine("CONNECTION-CREATION-THREAD-WAITTIMEOUT-IN-SECONDS");

                } else if ("LAZYCONNECTIONASSOCIATION".equals(name.toUpperCase())) {
                    ConnectionPoolObjectsUtils.setLazyEnlistAndLazyAssocProperties(rp.getValue(), adminPool, conConnPool);
                    logFine("LAZYCONNECTIONASSOCIATION");

                } else if ("LAZYCONNECTIONENLISTMENT".equals(name.toUpperCase())) {
                    conConnPool.setLazyConnectionEnlist(ConnectionPoolObjectsUtils.toBoolean(rp.getValue(), false));
                    logFine("LAZYCONNECTIONENLISTMENT");

                } else if ("ASSOCIATEWITHTHREAD".equals(name.toUpperCase())) {
                    conConnPool.setAssociateWithThread(ConnectionPoolObjectsUtils.toBoolean(rp.getValue(), false));
                    logFine("ASSOCIATEWITHTHREAD");

                } else if ("USERNAME".equals(name.toUpperCase()) ||
                        "USER".equals(name.toUpperCase())) {

                    propList.add(new EnvironmentProperty("User",
                            rp.getValue(), "user name", "java.lang.String"));

                } else if ("PASSWORD".equals(name.toUpperCase())) {

                    propList.add(new EnvironmentProperty("Password",
                            rp.getValue(), "Password", "java.lang.String"));

                } else if ("JDBC30DATASOURCE".equals(name.toUpperCase())) {

                    propList.add(new EnvironmentProperty("JDBC30DataSource",
                            rp.getValue(), "JDBC30DataSource", "java.lang.String"));

                } else if ("PREFER-VALIDATE-OVER-RECREATE".equals(name.toUpperCase())) {
                    conConnPool.setPreferValidateOverRecreate(ConnectionPoolObjectsUtils.toBoolean(rp.getValue(), false));
                    logFine("PREFER-VALIDATE-OVER-RECREATE");
                }
                else if (mcfConPropKeys.containsKey(name.toUpperCase())) {

                    propList.add(new EnvironmentProperty(
                            (String) mcfConPropKeys.get(name.toUpperCase()),
                            rp.getValue() == null ? "" : rp.getValue(),
                            "Some property",
                            "java.lang.String"));
                } else {
                    driverProperties = driverProperties + "set" + escape(name)
                            + "#" + escape(rp.getValue()) + "##";
                }
            }

            if (!driverProperties.equals("")) {
                propList.add(new EnvironmentProperty("DriverProperties",
                        driverProperties,
                        "some proprietarty properties",
                        "java.lang.String"));
            }
        }


        propList.add(new EnvironmentProperty("Delimiter",
                "#", "delim", "java.lang.String"));

        propList.add(new EnvironmentProperty("EscapeCharacter",
                "\\", "escapeCharacter", "java.lang.String"));

        //create an array of EnvironmentProperties from above list
        EnvironmentProperty[] eProps = new EnvironmentProperty[propList.size()];
        ListIterator propListIter = propList.listIterator();
View Full Code Here

                                                       
        Set set = wmd.getContextParametersSet();
        Iterator iterator = set.iterator();
         
        ContextEnvironmentDecorator decorator;
        EnvironmentProperty envRef;
        while (iterator.hasNext()){
            envRef = (EnvironmentProperty)iterator.next();
            decorator = new ContextEnvironmentDecorator(envRef);
            webModule.addEnvironment(decorator);
        }
View Full Code Here

      new Object[0] :
      defaultMCFProps.toArray();

        for (int i =0; i< defaultProps.length; i++) {
      if (rarName.trim().equals(ConnectorRuntime.DEFAULT_JMS_ADAPTER)){
            EnvironmentProperty ep1 = (EnvironmentProperty)defaultProps[i];
                 if (ep1.getName().equals("AddressList")
                        && ep1.getValue().equals("localhost")) {
                     continue;
                  }
             }
       mergedSet.add(defaultProps[i]);
        }

        for (int i =0; i< props.length; i++) {
       if ( props[i] != null ) {
           EnvironmentProperty ep = new EnvironmentProperty(
                  props[i].getName(),props[i].getValue(),null);
           if (defaultMCFProps.contains(ep)) {
               mergedSet.remove(ep);
           }
           mergedSet.add(ep);
View Full Code Here

        getEnvEntryContainer().addEnvironmentProperty(envEntry);

    }
                                              
    public EnvironmentProperty getEnvEntry(String name) {
        EnvironmentProperty envEntry = null;
        try {
            envEntry = getEnvEntryContainer().
                getEnvironmentPropertyByName(name);
            // annotation has a corresponding env-entry
            // in xml.  Just add annotation info and continue.
View Full Code Here

        if (envEntries==null || !envEntries.hasNext())
            return;
       
        EnvEntryNode subNode = new EnvEntryNode();
        for (;envEntries.hasNext();) {           
            EnvironmentProperty envProp = (EnvironmentProperty) envEntries.next();
            subNode.writeDescriptor(parentNode, TagNames.ENVIRONMENT_PROPERTY, envProp);
        }
    }       
View Full Code Here

            appendTextChild(ejbRefNode, EjbTagNames.REMOTE, descriptor.getEjbInterface());
        }
        appendTextChild(ejbRefNode, EjbTagNames.EJB_LINK, descriptor.getLinkName());       

        if( descriptor instanceof EnvironmentProperty) {
            EnvironmentProperty envProp = (EnvironmentProperty)descriptor;
            appendTextChild(ejbRefNode, TagNames.MAPPED_NAME, envProp.getMappedName());
        }
        if( descriptor.isInjectable() ) {
            InjectionTargetNode ijNode = new InjectionTargetNode();
            for (InjectionTarget target : descriptor.getInjectionTargets()) {
                ijNode.writeDescriptor(ejbRefNode, TagNames.INJECTION_TARGET, target);
View Full Code Here

           
        Set<EnvironmentProperty> envEntriesSet =
            new HashSet<EnvironmentProperty>();

        for (int i = 0; i < rcContexts.length; i++) {
            EnvironmentProperty envEntry =
                rcContexts[i].getEnvEntry(logicalName);
            // For @Resource declarations that map to env-entries, if there
            // is no corresponding deployment descriptor entry that has a
            // value, it's treated as if the declaration doesn't exist. 
            // A common case is that the @Resource is applied to a field
            // with a default value which was not overridden by the deployer.
            if ((envEntry != null) && (envEntry.hasAValue()) ) {
                envEntriesSet.add(envEntry);
            }
        }

        return envEntriesSet.toArray(new EnvironmentProperty[] {});
View Full Code Here

            } else if (element.getQName().equals(
                TagNames.ENVIRONMENT_PROPERTY_VALUE)) {
                Object envEntryDesc = topNode.getDescriptor();
                if (envEntryDesc != null &&
                    envEntryDesc instanceof EnvironmentProperty) {
                    EnvironmentProperty envProp =
                        (EnvironmentProperty)envEntryDesc;  
                    // we need to preserve white space for env-entry-value
                    // if the env-entry-type is java.lang.String or
                    // java.lang.Character
                    if (envProp.getType() != null &&
                        (envProp.getType().equals("java.lang.String") ||
                         envProp.getType().equals("java.lang.Character"))) {
                        topNode.setElementValue(element,
                                        elementData.toString());
                    } else {
                        topNode.setElementValue(element,
                                        elementData.toString().trim());
View Full Code Here

  
    static void addInitParam(Node parentNode, String nodeName, Set initParams) {
        if (!initParams.isEmpty()) {
            InitParamNode initParamNode = new InitParamNode();
            for (Iterator e=initParams.iterator();e.hasNext();) {
                EnvironmentProperty ep = (EnvironmentProperty) e.next();
                initParamNode.writeDescriptor(parentNode, nodeName, ep);
            }
        }   
    }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deployment.EnvironmentProperty

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.