Package com.sun.enterprise.deployment

Examples of com.sun.enterprise.deployment.EnvironmentProperty


    }
    void copy(Set s) {
        Iterator i = s.iterator();
        defaults = new Properties();
        while ( i.hasNext() ) {
            EnvironmentProperty p = (EnvironmentProperty)i.next();
            if ( p.getName().startsWith(ejb10Prefix) ) {
                String newName = p.getName().substring(ejb10Prefix.length());
                defaults.put(newName, p.getValue());
            }
        }
    }
View Full Code Here


        Set runtimeProps = msgDesc.getRuntimeActivationConfigProperties();
        if (runtimeProps != null) {
            Iterator iter = runtimeProps.iterator();
            while (iter.hasNext()) {
                EnvironmentProperty entry = (EnvironmentProperty) iter.next();
                mergedProps.add(entry);
                String propName = (String) entry.getName();
                runtimePropNames.add(propName);
            }
        }

        Set standardProps = msgDesc.getActivationConfigProperties();
        if (standardProps != null) {
            Iterator iter = standardProps.iterator();
            while (iter.hasNext()) {
                EnvironmentProperty entry = (EnvironmentProperty) iter.next();
                String propName = (String) entry.getName();
                if (runtimePropNames.contains(propName))
                    continue;
                mergedProps.add(entry);
            }
        }
View Full Code Here

   
            String destName = getPhysicalDestinationFromConfiguration(jndiName, appName, moduleName);
   
            //1.3 jndi-name ==> 1.4 setDestination
            descriptor_.putRuntimeActivationConfigProperty(
                    new EnvironmentProperty(DESTINATION,
                            destName, null));
   
   
            //1.3 (standard) destination-type == 1.4 setDestinationType
            //XXX Do we really need this???
            if (descriptor_.getDestinationType() != null &&
                    !"".equals(descriptor_.getDestinationType())) {
                descriptor_.putRuntimeActivationConfigProperty(
                        new EnvironmentProperty(DESTINATION_TYPE,
                                descriptor_.getDestinationType(), null));
            } else {
                /*
                 * If destination type is not provided by the MDB component
                 * [typically used by EJB3.0 styled MDBs which create MDBs without
                 * a destination type activation-config property] and the MDB is for
                 * the default JMS RA, attempt to infer the destination type by trying
                 * to find out if there has been any JMS destination resource already
                 * defined for default JMS RA. This is a best attempt guess and if there
                 * are no JMS destination resources/admin-objects defined, AS would pass
                 * the properties as defined by the MDB.
                 */
                try {
                        String instanceName = getServerEnvironment().getInstanceName();
                        List serversList = getServers().getServer();
                        Server server = null;
                        for (int j =0; j < serversList.size(); j ++){
                           if (instanceName.equals(((Server)serversList.get(j)).getName())){
                               server = (Server) serversList.get(j);
                           }
                        }
     /* 
                     AdminObjectResource[] adminObjectResources =
                                ResourcesUtil.createInstance().getEnabledAdminObjectResources(ConnectorConstants.DEFAULT_JMS_ADAPTER);
                    for (int i = 0; i < adminObjectResources.length; i++) {
                        AdminObjectResource aor = adminObjectResources[i];
                        if (aor.getJndiName().equals(jndiName)) {
                            descriptor_.putRuntimeActivationConfigProperty(
                                    new EnvironmentProperty(DESTINATION_TYPE,
                                            aor.getResType(), null));
                            _logger.log(Level.INFO, "endpoint.determine.destinationtype", new
                                    Object[]{aor.getResType() , aor.getJndiName() , descriptor_.getName()});
                        }
                    }
     */
                    AdminObjectResource aor = (AdminObjectResource)
                            ResourcesUtil.createInstance().getResource(jndiName, appName, moduleName, AdminObjectResource.class);
                    if(aor != null && ConnectorConstants.DEFAULT_JMS_ADAPTER.equals(aor.getResAdapter())){
                        descriptor_.putRuntimeActivationConfigProperty(
                                new EnvironmentProperty(DESTINATION_TYPE,
                                        aor.getResType(), null));
                        _logger.log(Level.INFO, "endpoint.determine.destinationtype", new
                                Object[]{aor.getResType() , aor.getJndiName() , descriptor_.getName()});
                    }
   
                } catch (Exception e) {
   
                }
            }
        }


        //1.3 durable-subscription-name == 1.4 setSubscriptionName
        descriptor_.putRuntimeActivationConfigProperty(
                new EnvironmentProperty(SUBSCRIPTION_NAME,
                        descriptor_.getDurableSubscriptionName(), null));

        String mdbCF = null;
    try {
        mdbCF = descriptor_.getMdbConnectionFactoryJndiName();
    } catch(NullPointerException ne ) {
        // Dont process connection factory.
    }

        if (mdbCF != null && mdbCF != "") {
        setValuesFromConfiguration(mdbCF, descriptor_);
        }

        // a null object is passes as a PoolDescriptor during recovery.
        // See com/sun/enterprise/resource/ResourceInstaller

        if (poolDescriptor != null) {
        descriptor_.putRuntimeActivationConfigProperty
            (new EnvironmentProperty (MAXPOOLSIZE, ""+
                 poolDescriptor.getMaxPoolSize(),"", "java.lang.Integer" ));
        descriptor_.putRuntimeActivationConfigProperty
            (new EnvironmentProperty (MINPOOLSIZE,""+
                 poolDescriptor.getSteadyPoolSize(),"", "java.lang.Integer"));
        descriptor_.putRuntimeActivationConfigProperty
            (new EnvironmentProperty (RESIZECOUNT,""+
                 poolDescriptor.getPoolResizeQuantity(),"", "java.lang.Integer"));
        descriptor_.putRuntimeActivationConfigProperty
            (new EnvironmentProperty (RESIZETIMEOUT,""+
                 poolDescriptor.getPoolIdleTimeoutInSeconds(),"", "java.lang.Integer"));
         /**
          * The runtime activation config property holds all the
          * vendor specific properties, unfortunately the vendor
          * specific way of configuring exception count and the
          * standard way of configuring redelivery attempts is
          * through the same property REDELIVERYCOUNT . So, we first
          * check if the user (MDB assember) has configured a value
          * if not we set the one from mdb-container props
          * We have to check for both cases here because it has been
          * documented as "endpointExceptionRedeliveryAttempts" but
          * used in the code as "EndpointExceptionRedeliveryAttempts"
          */
         if ((descriptor_.getActivationConfigValue
                          (REDELIVERYCOUNT) == null)
                    && (descriptor_.getActivationConfigValue
                                (LOWERCASE_REDELIVERYCOUNT) == null))  {
             descriptor_.putRuntimeActivationConfigProperty
                 (new EnvironmentProperty (REDELIVERYCOUNT,""+
                         MdbContainerProps.getMaxRuntimeExceptions(),"", "java.lang.Integer"));
         }
        }
    }
View Full Code Here

     * @throws Exception
     */
    private void setClusterActivationSpecProperties(EjbMessageBeanDescriptor
                    descriptor_) throws Exception {
        //Set MDB Identifier in a clustered instance.
        descriptor_.putRuntimeActivationConfigProperty(new
                        EnvironmentProperty(MDBIDENTIFIER,""+
                        getMDBIdentifier(descriptor_),"MDB Identifier",
                        "java.lang.String"));
        logFine("CLUSTERED instance - setting MDB identifier as" +
                        getMDBIdentifier(descriptor_));
View Full Code Here

        String val = prop.getValue();
        if (val == null || val.equals("")) {
        continue;
        }
            descriptor_.putRuntimeActivationConfigProperty(
                new EnvironmentProperty(name, val, null));
    }

    }
View Full Code Here

   
            String destName = getPhysicalDestinationFromConfiguration(jndiName, appName, moduleName, descriptor_);
   
            //1.3 jndi-name ==> 1.4 setDestination
            descriptor_.putRuntimeActivationConfigProperty(
                    new EnvironmentProperty(DESTINATION,
                            destName, null));
   
   
            //1.3 (standard) destination-type == 1.4 setDestinationType
            //XXX Do we really need this???
            if (descriptor_.getDestinationType() != null &&
                    !"".equals(descriptor_.getDestinationType())) {
                descriptor_.putRuntimeActivationConfigProperty(
                        new EnvironmentProperty(DESTINATION_TYPE,
                                descriptor_.getDestinationType(), null));
            } else {
                /*
                 * If destination type is not provided by the MDB component
                 * [typically used by EJB3.0 styled MDBs which create MDBs without
                 * a destination type activation-config property] and the MDB is for
                 * the default JMS RA, attempt to infer the destination type by trying
                 * to find out if there has been any JMS destination resource already
                 * defined for default JMS RA. This is a best attempt guess and if there
                 * are no JMS destination resources/admin-objects defined, AS would pass
                 * the properties as defined by the MDB.
                 */
                try {
                        String instanceName = getServerEnvironment().getInstanceName();
                        List serversList = getServers().getServer();
                        Server server = null;
                        for (int j =0; j < serversList.size(); j ++){
                           if (instanceName.equals(((Server)serversList.get(j)).getName())){
                               server = (Server) serversList.get(j);
                           }
                        }
     /* 
                     AdminObjectResource[] adminObjectResources =
                                ResourcesUtil.createInstance().getEnabledAdminObjectResources(ConnectorConstants.DEFAULT_JMS_ADAPTER);
                    for (int i = 0; i < adminObjectResources.length; i++) {
                        AdminObjectResource aor = adminObjectResources[i];
                        if (aor.getJndiName().equals(jndiName)) {
                            descriptor_.putRuntimeActivationConfigProperty(
                                    new EnvironmentProperty(DESTINATION_TYPE,
                                            aor.getResType(), null));
                            _logger.log(Level.INFO, "endpoint.determine.destinationtype", new
                                    Object[]{aor.getResType() , aor.getJndiName() , descriptor_.getName()});
                        }
                    }
     */
                    AdminObjectResource aor = (AdminObjectResource)
                            ResourcesUtil.createInstance().getResource(jndiName, appName, moduleName, AdminObjectResource.class);
                    if(aor != null && ConnectorConstants.DEFAULT_JMS_ADAPTER.equals(aor.getResAdapter())){
                        descriptor_.putRuntimeActivationConfigProperty(
                                new EnvironmentProperty(DESTINATION_TYPE,
                                        aor.getResType(), null));
                        _logger.log(Level.INFO, "endpoint.determine.destinationtype", new
                                Object[]{aor.getResType() , aor.getJndiName() , descriptor_.getName()});
                    }
   
                } catch (Exception e) {
   
                }
            }
        }


        //1.3 durable-subscription-name == 1.4 setSubscriptionName
        descriptor_.putRuntimeActivationConfigProperty(
                new EnvironmentProperty(SUBSCRIPTION_NAME,
                        descriptor_.getDurableSubscriptionName(), null));

        String mdbCF = null;
    try {
        mdbCF = descriptor_.getMdbConnectionFactoryJndiName();
    } catch(NullPointerException ne ) {
        // Dont process connection factory.
    }

        if (mdbCF != null && mdbCF != "") {
        setValuesFromConfiguration(mdbCF, descriptor_);
        }

        // a null object is passes as a PoolDescriptor during recovery.
        // See com/sun/enterprise/resource/ResourceInstaller

        if (poolDescriptor != null) {
        descriptor_.putRuntimeActivationConfigProperty
            (new EnvironmentProperty (MAXPOOLSIZE, ""+
                 poolDescriptor.getMaxPoolSize(),"", "java.lang.Integer" ));
        descriptor_.putRuntimeActivationConfigProperty
            (new EnvironmentProperty (MINPOOLSIZE,""+
                 poolDescriptor.getSteadyPoolSize(),"", "java.lang.Integer"));
        descriptor_.putRuntimeActivationConfigProperty
            (new EnvironmentProperty (RESIZECOUNT,""+
                 poolDescriptor.getPoolResizeQuantity(),"", "java.lang.Integer"));
        descriptor_.putRuntimeActivationConfigProperty
            (new EnvironmentProperty (RESIZETIMEOUT,""+
                 poolDescriptor.getPoolIdleTimeoutInSeconds(),"", "java.lang.Integer"));
         /**
          * The runtime activation config property holds all the
          * vendor specific properties, unfortunately the vendor
          * specific way of configuring exception count and the
          * standard way of configuring redelivery attempts is
          * through the same property REDELIVERYCOUNT . So, we first
          * check if the user (MDB assember) has configured a value
          * if not we set the one from mdb-container props
          * We have to check for both cases here because it has been
          * documented as "endpointExceptionRedeliveryAttempts" but
          * used in the code as "EndpointExceptionRedeliveryAttempts"
          */
         if ((descriptor_.getActivationConfigValue
                          (REDELIVERYCOUNT) == null)
                    && (descriptor_.getActivationConfigValue
                                (LOWERCASE_REDELIVERYCOUNT) == null))  {
             descriptor_.putRuntimeActivationConfigProperty
                 (new EnvironmentProperty (REDELIVERYCOUNT,""+
                         MdbContainerProps.getMaxRuntimeExceptions(),"", "java.lang.Integer"));
         }
        }
    }
View Full Code Here

     * @throws Exception
     */
    private void setClusterActivationSpecProperties(EjbMessageBeanDescriptor
                    descriptor_) throws Exception {
        //Set MDB Identifier in a clustered instance.
        descriptor_.putRuntimeActivationConfigProperty(new
                        EnvironmentProperty(MDBIDENTIFIER,""+
                        getMDBIdentifier(descriptor_),"MDB Identifier",
                        "java.lang.String"));
        logFine("CLUSTERED instance - setting MDB identifier as" +
                        getMDBIdentifier(descriptor_));
View Full Code Here

        String val = prop.getValue();
        if (val == null || val.equals("")) {
        continue;
        }
            descriptor_.putRuntimeActivationConfigProperty(
                new EnvironmentProperty(name, val, null));
    }

    }
View Full Code Here

       
        Set runtimeProps = msgDesc.getRuntimeActivationConfigProperties();
        if(runtimeProps != null){
            Iterator iter = runtimeProps.iterator();
            while (iter.hasNext()) {
                EnvironmentProperty entry = (EnvironmentProperty) iter.next();
                mergedProps.add(entry);
                String propName = (String) entry.getName();
                runtimePropNames.add(propName);
            }
        }
       
        Set standardProps = msgDesc.getActivationConfigProperties();
        if(standardProps != null){
            Iterator iter = standardProps.iterator();
            while (iter.hasNext()) {
                EnvironmentProperty entry = (EnvironmentProperty) iter.next();
                String propName = (String) entry.getName();
                if (runtimePropNames.contains(propName))
                    continue;
                mergedProps.add(entry);
            }
        }
View Full Code Here

     */
    public Object run() throws Exception {
        Iterator it = props.iterator();
        methods = bean.getClass().getMethods();
        while (it.hasNext()) {
            EnvironmentProperty prop = (EnvironmentProperty) it.next();
            String propName = prop.getName();
            Class type = getTypeOf(prop);
            //If there were no getter, use the EnvironmentProperty's
            //property type
            if (type == null) {
                type = Class.forName(prop.getType());
            }

            if (prop.getResolvedValue() != null &&
                    prop.getResolvedValue().trim().length() != 0) {
                Method meth = getMutatorMethod(propName, type);
               
                if (meth == null) {
                    //log WARNING, deployment can continue.
                    logger.log(Level.WARNING, "rardeployment.no_setter_method",
                            new Object[]{prop.getName(), bean.getClass().getName()});
                } else {
                    try {
                        if(logger.isLoggable(Level.FINER)) {
                            logger.log(Level.FINER, "Invoking" + meth + " on "
                                + bean.getClass().getName() + "with " +
                                "value [" + prop.getResolvedValueObject().getClass()
                                + "  , " + getFilteredPropValue(prop) + " ] ");
                        }
                        meth.invoke(bean, new Object[]{prop.getResolvedValueObject()});
                    } catch (IllegalArgumentException ia) {
                        if (logger.isLoggable(Level.FINE)) {
                            logger.log(Level.FINE, "IllegalException while trying to set "
                                    + prop.getName() + " and value " + getFilteredPropValue(prop),
                                    ia + " on an instance of " + bean.getClass()
                                    + " -- trying again with the type from bean");
                        }
                        boolean prevBoundsChecking = EnvironmentProperty.isBoundsChecking();
                        try {
                            EnvironmentProperty.setBoundsChecking(false);
                            prop.setType(type.getName());
                            if (logger.isLoggable(Level.FINE)) {
                                logger.log(Level.FINE, "2nd try :: Invoking" + meth + " on "
                                        + bean.getClass().getName() + "with value ["
                                        + prop.getResolvedValueObject().getClass()
                                        + "  , " + getFilteredPropValue(prop) + " ] ");
                            }
                            meth.invoke(bean, new Object[]{prop.getResolvedValueObject()});
                        } catch (Exception e) {
                            handleException(e, prop, bean);
                        } finally {
                            //restore boundsChecking
                            EnvironmentProperty.setBoundsChecking(prevBoundsChecking);
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.