Examples of SystemProperty


Examples of com.netfever.verify.impl.SystemProperty

    private void populateMap() {
      IPropertyAdapter property;
     
      this.map = new HashMap<String, IPropertyAdapter>();
    for (Entry<String, String> entry: System.getenv().entrySet()) {
      property = new SystemProperty();
      property.adapt("system." + entry.getKey(), entry.getValue());
     
      this.map.put("system." + entry.getKey(), property);     
    }
   
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.SystemProperty

    public Object getSystemPropertyValue(String propertyNamethrows MBeanException,AttributeNotFoundException {
        _sLogger.log(Level.FINEST, MSG_BASE_GET_PROPERTY, propertyName);
       
        ConfigBean baseBean = getBaseConfigBean();
        Class cl = baseBean.getClass();
        SystemProperty prop = null;
        try {
            Method method = cl.getDeclaredMethod("getSystemPropertyByName", new Class[]{Class.forName("java.lang.String")});
            prop = (SystemProperty)method.invoke(baseBean, new Object[]{propertyName});
        }
        catch (Exception e) {
            wrapAndThrowMBeanException(e, "getattribute.undefined_properties_in_base_element");
        }
        if(prop==null) {
            wrapAndThrowMBeanException(null, "getattribute_properties_not_found_in_base_element", propertyName );
        }
        return prop.getValue();
    }   
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.SystemProperty

        _sLogger.log(Level.FINEST, MSG_BASE_SET_PROPERTY, new Object[]{propertyName, value});
       
        ConfigBean baseBean = getBaseConfigBean();
       
        Class cl = baseBean.getClass();
        SystemProperty prop=null;
        try {
            Method method = cl.getDeclaredMethod("getSystemPropertyByName", new Class[]{Class.forName("java.lang.String")});
            prop = (SystemProperty)method.invoke(baseBean, new Object[]{propertyName});
        }
        catch (Exception e) {
            wrapAndThrowMBeanException(e, "setattribute_undefined_properties_in_base_element", propertyName );
        }
        if(prop==null && value!=null && (bAllowsEmptyValue || !value.equals(""))) {
            prop = new SystemProperty();
            prop.setName(propertyName);
            if(ConfigMBeanHelper.PROPERTY_SPECIAL_EMPTY_VALUE.equals(value))
               prop.setValue("");
            else
               prop.setValue(value);
            try {
                Method method = cl.getDeclaredMethod("addSystemProperty", new Class[]{prop.getClass()});
                method.invoke(baseBean, new Object[]{prop});
            }
            catch (Exception e) {
                wrapAndThrowMBeanException(e, "setproperty_invoke_error", propertyName );
            }
        }
        else {
            if(value==null || (!bAllowsEmptyValue && value.equals(""))) {
                try {
                    Method method = cl.getDeclaredMethod("removeSystemProperty", new Class[]{prop.getClass()});
                    method.invoke(baseBean, new Object[]{prop});
                }
                catch (Exception e) {
                    wrapAndThrowMBeanException(e, "setproperty_could_not_remove_propery", propertyName );
                }
            }
            else
            {
                if(ConfigMBeanHelper.PROPERTY_SPECIAL_EMPTY_VALUE.equals(value))
                   prop.setValue("");
                else
                   prop.setValue(value);
            }
        }
/*
        try {
            m_configContext.flush();
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.SystemProperty

                if (props != null) {           
                    for (Enumeration e = props.propertyNames(); e.hasMoreElements() ;) {
                        String propName = (String)e.nextElement();
                        String propValue = (String)props.getProperty(propName);
                        if (propValue != null) {
                            SystemProperty ep = new SystemProperty();
                            ep.setName(propName);
                            ep.setValue(propValue);                   
                            cluster.addSystemProperty(ep, OVERWRITE);
                        }
                    }
                }
            } else {
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.SystemProperty

                String name = (String)e.nextElement();
                String value = (String)props.getProperty(name);               
                //Add the new property
                if (value != null) {
                    //Remove the property if it already exists
                    SystemProperty sysProp = server.getSystemPropertyByName(name);
                    if (sysProp != null) {                       
                        server.removeSystemProperty(sysProp, OVERWRITE);
                    }
                    SystemProperty ep = new SystemProperty();
                    ep.setName(name);
                    ep.setValue(value);
                    server.addSystemProperty(ep, OVERWRITE);                   
                }
            }
        }
    }          
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.SystemProperty

        }
    }
   
    private SystemProperty getSystemProperty(Properties props, String name)
    {               
        SystemProperty sysProp = new SystemProperty();
        sysProp.setName(name);
        sysProp.setValue((String)props.getProperty(name));
        return sysProp;
    }
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.SystemProperty

        //Add the properties       
        final ArrayList removedProperties = new ArrayList();
        for (Enumeration e = props.propertyNames(); e.hasMoreElements();) {
            final String name = (String)e.nextElement();
            //If the property exists, remove it
            final SystemProperty sysProp = server.getSystemPropertyByName(name);
            if (sysProp != null) {               
                //Keep track of the properties we have removed in case we have
                //to "rollback". WARNING: after calling removeSystemProperty, the
                //sysProp will be side affected (with null contents), so make a
                //copy of it first.
                SystemProperty newProp = new SystemProperty();
                newProp.setName(sysProp.getName());
                newProp.setValue(sysProp.getValue());               
                server.removeSystemProperty(sysProp, OVERWRITE);
                removedProperties.add(newProp);
            }         
            server.addSystemProperty(getSystemProperty(props, name),
                OVERWRITE);                   
        }   
        //Check for a port conflict after modifying server. If a port conflict occurs,
        //we "rollback" the addition of the system properties.
        try {
            PortConflictCheckerConfigBean portChecker = getPortConflictCheckerConfigBean();  
            ServersConfigBean scb = getServersConfigBean();           
            portChecker.checkForPortConflicts(server, props,
                scb.isRunning(server.getName()));
        } catch (Exception ex2) {                    
            try {
                //Delete all the properties that we have added
                for (Enumeration e = props.propertyNames(); e.hasMoreElements();) {
                    final String name = (String)e.nextElement();
                    final SystemProperty sysProp = server.getSystemPropertyByName(name);
                    if (sysProp != null) {
                        server.removeSystemProperty(sysProp, OVERWRITE)
                    }
                }
                //Re-add any of the overwritten properties that were deleted.
                for (int i = 0; i < removedProperties.size(); i++) {
                    SystemProperty sysProp = (SystemProperty)removedProperties.get(i);                   
                    server.addSystemProperty((SystemProperty)removedProperties.get(i),
                        OVERWRITE);
                }
            } catch (Exception ex3) {
                //Log
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.SystemProperty

                final Domain domain = ConfigAPIHelper.getDomainConfigBean(configContext);                  
                //Add the properties
                for (Enumeration e = props.propertyNames(); e.hasMoreElements();) {
                    final String name = (String)e.nextElement();
                    //If the property exists, remove it
                    final SystemProperty sysProp = domain.getSystemPropertyByName(name);
                    if (sysProp != null) {
                        domain.removeSystemProperty(sysProp, OVERWRITE);
                    }
                    domain.addSystemProperty(getSystemProperty(props, name),
                        OVERWRITE);
                }     
            } else if (target.getType() == TargetType.CONFIG) {
                final Config config = ConfigAPIHelper.getConfigByName(configContext, 
                    target.getName());                  
                //Add the properties
                for (Enumeration e = props.propertyNames(); e.hasMoreElements();) {
                    final String name = (String)e.nextElement();
                    //If the property exists, remove it
                    final SystemProperty sysProp = config.getSystemPropertyByName(name);
                    if (sysProp != null) {
                        config.removeSystemProperty(sysProp, OVERWRITE);
                    }
                    config.addSystemProperty(getSystemProperty(props, name),
                        OVERWRITE);
                }                     
            } else if (target.getType() == TargetType.CLUSTER) {
                final Cluster cluster = ClusterHelper.getClusterByName(configContext,
                    target.getName());
                //Add the properties
                for (Enumeration e = props.propertyNames(); e.hasMoreElements();) {
                    final String name = (String)e.nextElement();
                    //If the property exists, remove it
                    final SystemProperty sysProp = cluster.getSystemPropertyByName(name);
                    if (sysProp != null) {
                        cluster.removeSystemProperty(sysProp, OVERWRITE);
                    }                                    
                    cluster.addSystemProperty(getSystemProperty(props, name),
                        OVERWRITE);
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.SystemProperty

            final Target target = TargetBuilder.INSTANCE.createTarget(VALID_TYPES, targetName,
                configContext);                          
            if (target.getType().equals(TargetType.DOMAIN)) {
                //create domain property
                final Domain domain = ConfigAPIHelper.getDomainConfigBean(configContext);
                final SystemProperty sysProp = domain.getSystemPropertyByName(propertyName);
                //Ensure that the property specified exists
                if (sysProp == null) {
                    throw new ConfigException(_strMgr.getString("propertyDoesNotExist",
                        propertyName, target.getName()));
                }
                //Remove the property
                domain.removeSystemProperty(sysProp, OVERWRITE);
            } else if (target.getType().equals(TargetType.CONFIG)){
                //create configuration property           
                final Config config = ConfigAPIHelper.getConfigByName(configContext, 
                    target.getName());  
                final SystemProperty sysProp = config.getSystemPropertyByName(propertyName);
                //Ensure that the property specified exists
                if (sysProp == null) {
                    throw new ConfigException(_strMgr.getString("propertyDoesNotExist",
                        propertyName, target.getName()));
                }
                //Remove the property
                config.removeSystemProperty(sysProp, OVERWRITE);
            } else if (target.getType().equals(TargetType.CLUSTER)) {
                //create instance property                      
                final Cluster cluster = ClusterHelper.getClusterByName(configContext,
                    target.getName());
                final SystemProperty sysProp = cluster.getSystemPropertyByName(propertyName);
                //Ensure that the property specified exists
                if (sysProp == null) {
                    throw new ConfigException(_strMgr.getString("propertyDoesNotExist",
                        propertyName, target.getName()));
                }
                //Remove the property
                cluster.removeSystemProperty(sysProp, OVERWRITE);
            } else if (target.getType().equals(TargetType.SERVER) ||
                target.getType().equals(TargetType.DAS)) {
                //create instance property                      
                final Server server = ServerHelper.getServerByName(configContext, target.getName());
                final SystemProperty sysProp = server.getSystemPropertyByName(propertyName);
                //Ensure that the property specified exists
                if (sysProp == null) {
                    throw new ConfigException(_strMgr.getString("propertyDoesNotExist",
                        propertyName, target.getName()));
                }
                SystemProperty removedProp = new SystemProperty();
                removedProp.setName(sysProp.getName());
                removedProp.setValue(sysProp.getValue());
                //Remove the property
                server.removeSystemProperty(sysProp, OVERWRITE);
                /*
                 *Fix for bug 6303353
                 *We do not have to check if the system-property being deleted in this server-instance
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.SystemProperty

        if (props != null) {           
            for (Enumeration e = props.propertyNames(); e.hasMoreElements() ;) {
                String propName = (String)e.nextElement();
                String propValue = (String)props.getProperty(propName);
                if (propValue != null) {
                    SystemProperty epOriginal = configuration.getSystemPropertyByName(
                        propName);
                    if (epOriginal != null) {
                        configuration.removeSystemProperty(epOriginal,
                            OVERWRITE);
                    }
                    SystemProperty ep = new SystemProperty();
                    ep.setName(propName);
                    ep.setValue(propValue);                   
                    configuration.addSystemProperty(ep, OVERWRITE);
                }
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.