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


     */
    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

                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));
                _logger.log(Level.INFO, "endpoint.determine.destinationtype", new
                        Object[]{descriptor_.getDestinationType(), jndiName, descriptor_.getName()});
            } else if (isValidDestination(destination) &&
                    ConnectorConstants.DEFAULT_JMS_ADAPTER.equals(destination.getResourceAdapterName())) {
                descriptor_.putRuntimeActivationConfigProperty(
                        new EnvironmentProperty(DESTINATION_TYPE,
                                destination.getClassName(), null));
                _logger.log(Level.INFO, "endpoint.determine.destinationtype", new
                        Object[]{destination.getClassName(), destination.getName(), descriptor_.getName()});
            } 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 {
                    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"));
         }
        }

        //Set SE/EE specific MQ-RA ActivationSpec properties
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 properties = descriptor.getConfigProperties();
        Iterator iterator = properties.iterator();
        // let's add the propery name
        HashSet<String> hs = new HashSet<String>();
        while (iterator.hasNext()) {
            EnvironmentProperty ep = (EnvironmentProperty) iterator.next();
            if (hs.add(ep.getName())==false) {
                // duplicate name...
                result.addErrorDetails(smh.getLocalString
               ("tests.componentNameConstructor",
          "For [ {0} ]",
          new Object[] {compName.toString()}));
    result.failed(smh.getLocalString(getClass().getName() + ".failed",
                "Error: More than one propery has a duplicate name [ {0} ] in the deployment descriptors",
    new Object[] {ep.getName()}));                    
                return result;
            }           
        }
        // success
        result.addGoodDetails(smh.getLocalString
View Full Code Here

                ServletFilterDescriptor filter = (ServletFilterDescriptor) filterEnum.nextElement();
                Vector epVector = filter.getInitializationParameters();

                if (epVector.size() != 0) {
                    for ( int i = 0; i < epVector.size(); i++) {
                        EnvironmentProperty ep = (EnvironmentProperty)epVector.elementAt(i);
                        String epValue = ep.getValue();
                        if (epValue.length() != 0) {
                            onePassed=true;
                            addGoodDetails(result, compName);
                            result.addGoodDetails(smh.getLocalString
                                              ("com.sun.enterprise.tools.verifier.tests.web.FilterInitParamValue" + ".passed",
View Full Code Here

      {
        props.put(properties[i].getName(), properties[i]);
      }
      while(propIter.hasNext())
      {
        EnvironmentProperty envProp = (EnvironmentProperty) propIter.next();
        String name = envProp.getName();
        String type = envProp.getType();

        PropertyDescriptor propDesc = (PropertyDescriptor) props.get(
            name.substring(0,1).toLowerCase() + name.substring(1));
        if(propDesc != null)
        {
View Full Code Here

    ServletFilterDescriptor filter = (ServletFilterDescriptor)filterEnum.nextElement();
                HashSet<String> envSet = new HashSet<String>();
                Vector epVector = filter.getInitializationParameters();             
                for ( int i = 0; i < epVector.size(); i++) {
                   
                    EnvironmentProperty ep = (EnvironmentProperty)epVector.elementAt(i);
                    String epName = ep.getName();
                   
                    if (epName.length() == 0) {
                        oneFailed = true;
      result.addErrorDetails(smh.getLocalString
             ("tests.componentNameConstructor",
View Full Code Here

        // not much we can do without the class, the superclass should have
        // set the error code now, just abandon
        return result;
    }
    while (propIterator.hasNext()) {
        EnvironmentProperty ep = (EnvironmentProperty) propIterator.next();
       
        // Set method first
        String propertyName = Character.toUpperCase(ep.getName().charAt(0)) + ep.getName().substring(1);
        String setMethodName = "set" + propertyName;
        Class[] parmTypes = new Class[] { ep.getValueType() };
        Method m = getMethod(mcf, setMethodName, parmTypes);
        if (m!=null) {
      result.addGoodDetails(smh.getLocalString
                ("tests.componentNameConstructor",
                 "For [ {0} ]",
                 new Object[] {compName.toString()}));
      result.addGoodDetails(smh.getLocalString(getClass().getName() + ".passed",
                 "Found a JavaBeans compliant accessor method [ {0} ] for the config-property [ {1} ]",
                 new Object[] {  m, ep.getName()}));              
        } else {
      oneFailed=true;
      result.addErrorDetails(smh.getLocalString
                 ("tests.componentNameConstructor",
            "For [ {0} ]",
            new Object[] {compName.toString()}));
      result.addErrorDetails(smh.getLocalString
                 (getClass().getName() + ".failed",
            "Error: There is no JavaBeans compliant accessor method [ {0} ] implemented in [ {1} ] for the config-property [ {2} ]",
            new Object[] {  "public void "+ setMethodName+"("+ep.getValueType().getName()+")",
                    mcf.getName(),
                    ep.getName()}));                     
        }
        String getMethodName = "get" + propertyName;
        m = getMethod(mcf, getMethodName, null);
        if (m!=null) {     
      result.addGoodDetails(smh.getLocalString
                ("tests.componentNameConstructor",
                 "For [ {0} ]",
                 new Object[] {compName.toString()}));
      result.addGoodDetails(smh.getLocalString(getClass().getName() + ".passed",
                 "Found a JavaBeans compliant accessor method [ {0} ] for the config-property [ {1} ]",
                 new Object[] {  m, ep.getName()}));  
        } else {
      oneFailed=true;
      result.addErrorDetails(smh.getLocalString
                 ("tests.componentNameConstructor",
            "For [ {0} ]",
            new Object[] {compName.toString()}));
      result.addErrorDetails(smh.getLocalString
                 (getClass().getName() + ".failed",
            "Error: There is no JavaBeans compliant accessor method [ {0} ] implemented in [ {1} ] for the config-property [ {2} ]",
            new Object[] {  "public " + ep.getValueType().getName() + " " + getMethodName,
                    mcf.getName(),
                    ep.getName()}));                    
        }                               
    }           
      }
  }
        if (oneFailed) {
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.