Package com.sun.enterprise.deployment

Examples of com.sun.enterprise.deployment.EnvironmentProperty


    static void addInitParam(Node parentNode, String nodeName,
        Enumeration initParams) {
        InitParamNode initParamNode = new InitParamNode();

        while (initParams.hasMoreElements()) {
            EnvironmentProperty ep = (EnvironmentProperty) initParams.nextElement();
            initParamNode.writeDescriptor(parentNode, nodeName, ep);
        }
    }
View Full Code Here


        return this.environmentEntries;
    }

    public EnvironmentProperty getEnvironmentPropertyByName(String name) {
        for (Iterator itr = this.environmentEntries.iterator(); itr.hasNext();) {
            EnvironmentProperty ev = (EnvironmentProperty) itr.next();

            if (ev.getName().equals(name)) {
                return ev;
            }
        }

        return null;
View Full Code Here

    public Object run() throws Exception {
      synchronized(staticObjectLock) {
        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 = null;
                try {
                    meth = getMutatorMethod(propName, type);
                    if (meth != null) {
                      logger.log(Level.FINER, "Invoking" + meth + " on "
                                   + bean.getClass().getName() + "with " +
                                   "value [" + prop.getResolvedValueObject().getClass()
                                   + "  , " + getFilteredPropValue(prop) +" ] ");
                        meth.invoke(bean,new Object[] {prop.getResolvedValueObject()});
                    } else {
                        //log WARNING, deployment can continue.
                        logger.log(Level.WARNING, "rardeployment.no_setter_method",
                                        new Object[]{prop.getName(), bean.getClass().getName()});
                    }
                } catch (IllegalArgumentException ia) {
                    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());
                        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

        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

      {
        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

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

        PropertyDescriptor propDesc = props.get(name);
        if(propDesc != null)
        {
          if (propDesc.getReadMethod()==null || propDesc.getWriteMethod()==null)
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

        if (properties.size()!=0) {
            Iterator iterator = properties.iterator();
            // let's add the propery name
            // HashSet hs = new HashSet();
            while (iterator.hasNext()) {
                EnvironmentProperty ep = (EnvironmentProperty) iterator.next();
                String type = ep.getType();
                if (type == null) {
                    result.addErrorDetails(smh.getLocalString
                            ("tests.componentNameConstructor",
                                    "For [ {0} ]",
                                    new Object[] {compName.toString()}));
                    result.failed(smh.getLocalString(getClass().getName() + ".notdefined",
                            "Error: The configuration property named [ {0} ] has no type ",
                            new Object[] {ep.getName()}));
                    return result;
                }
                Class typeClass = null;
                // is it loadable ?
                try {
                    typeClass = Class.forName(type);
                } catch (Throwable t) {
                    result.addErrorDetails(smh.getLocalString
                            ("tests.componentNameConstructor",
                                    "For [ {0} ]",
                                    new Object[] {compName.toString()}));
                    result.failed(smh.getLocalString(getClass().getName() + ".nonexist",
                            "Error: The type [ {0} ] of the configuration property named [ {1} ] cannot be loaded",
                            new Object[] {ep.getType(), ep.getName()}));
                    return result;
                }
                boolean allowedType = false;
                for (int i = 0; i < allowedTypes.length; i++) {
                    if (allowedTypes[i].equals(typeClass)) {
                        allowedType = true;
                        break;
                    }
                }
                if (!allowedType) {
                    oneFailed = true;
                    result.addErrorDetails(smh.getLocalString
                            ("tests.componentNameConstructor",
                                    "For [ {0} ]",
                                    new Object[] {compName.toString()}));
                    result.failed(smh.getLocalString(getClass().getName() + ".failed",
                            "Error: The type [ {0} ] for the configuration property named [ {1} ] is not allowed",
                            new Object[] {ep.getType(), ep.getName()}));
                    return result;
                }
            }
            // for failure, result has been set before
            if (!oneFailed) {
View Full Code Here

    {
      props.put(properties[i].getName(), properties[i]);
    }
    while(propIter.hasNext())
    {
      EnvironmentProperty envProp = (EnvironmentProperty) propIter.next();
      String name = Introspector.decapitalize(envProp.getName());
      String type = envProp.getType();
      PropertyDescriptor propDesc = props.get(name);
      if(propDesc != null)
      {
        if (propDesc.getReadMethod()==null || propDesc.getWriteMethod()==null)
        {
View Full Code Here

   
        boolean same = false;
        Iterator iter = mcfConfigProps.iterator();
   
        while( iter.hasNext() ) {
            EnvironmentProperty prop = (EnvironmentProperty)iter.next();
            //see if this property is in our list of excludes
            if (excluded.contains( prop.getName()) ) {
                //_logger.finest("mcfProp ignored : " + prop.getName() );
                continue;
            }
     
            Iterator iter2 = mcfConfigProperties_.iterator();
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.