Package com.sun.enterprise.config.serverbeans

Examples of com.sun.enterprise.config.serverbeans.Server$CreateDecorator


            try {
                ConfigContext configContext =
                ApplicationServer.getServerContext().getConfigContext();
                assert(configContext != null);
               
                Server configBean =
                ServerBeansFactory.getServerBean(configContext);
                assert(configBean != null);
               
                SecurityService securityBean =
                ServerBeansFactory.getSecurityServiceBean(configContext);
View Full Code Here


                config = _configContext;
            }
            ConfigBean app = ApplicationHelper.findApplication(config,
                moduleName);
            Server server = ServerBeansFactory.getServerBean(config);
            ApplicationRef appRef = server.getApplicationRefByRef(moduleName);

            return ((app != null && app.isEnabled()) &&
                        (appRef != null && appRef.isEnabled()));
        } catch (ConfigException e) {
            _logger.log(Level.WARNING, "Error finding " + moduleName, e);
View Full Code Here

     * @return true if the names application is referenced by this server
     */
    private boolean isReferenced(String appName) {

        Servers servers = domain.getServers();
        Server server = servers.getServerByName(
                                _serverContext.getInstanceName());

        ApplicationRef ref = server.getApplicationRefByRef(appName);
        return (ref == null) ? false : true;
    }
View Full Code Here

                target.getName());
            addProperties(result, cluster.getSystemProperty());
        } else if (target.getType() == TargetType.SERVER ||
            target.getType() == TargetType.DAS) {           
            //list server properties
            final Server server = ServerHelper.getServerByName(configContext,
                target.getName());
            if (inherit) {
                final Domain domain = ConfigAPIHelper.getDomainConfigBean(configContext);           
                addProperties(result, domain.getSystemProperty());

                final Config config = ConfigAPIHelper.getConfigByName(configContext, server.getConfigRef());
                addProperties(result, config.getSystemProperty());
                if (ServerHelper.isServerClustered(configContext, target.getName()))  {
                    final Cluster cluster = ClusterHelper.getClusterForInstance(configContext,
                        target.getName());
                    addProperties(result, cluster.getSystemProperty());
                }       
            }
            addProperties(result, server.getSystemProperty());
        } else {
            //list node agent properties. Shouldnt happen.
            throw new ConfigException(_strMgr.getString("invalidPropertyTarget",
                target.getName()));
        }    
View Full Code Here

        throws Exception
    {
        final ConfigContext configContext = getConfigContext();
       
        //create instance property                      
        final Server server = ServerHelper.getServerByName(configContext,
            target.getName());  
        //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
                StringManagerBase sm = StringManagerBase.getStringManager(
View Full Code Here

                //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
                 *is also being defined in another instance (on same machine).
                 *Ideally we want to check if this system-property is being referenced in any of
View Full Code Here

            ServerRef[] servers = clusters[i].getServerRef();
            for (int j = 0; j < servers.length; j++) {
                if (servers[j].getRef().equals(instanceName)) {
                    // check to see if the server exists as a sanity check.
                    // NOTE: we are not checking for duplicate server instances here.
                    Server server = ServerHelper.getServerByName(configContext, instanceName);
                    return (clusters[i]);
                }
            }
        }
        throw new ConfigException(_strMgr.getString("noSuchClusteredInstance",
View Full Code Here

            ePoints = TargetHelperBase.createEndPoints(servers, ctx);

        } else if ( isServer(t, ctx) ) { // server destination

            Server server =
                ServerHelper.getServerByName(ctx, t);

            ePoints = new EndPoint[1];
            ePoints[0] = new EndPoint(server, ctx);
View Full Code Here

                DEFAULT_CONFIGURATION_NAME));
        }

        //Check to ensure that the configuration is not the configuration
        //of the domain administration server
        final Server das = ServerHelper.getDAS(configContext);
        final Config dasConfig = ServerHelper.getConfigForServer(configContext, das.getName());    
        final String dasConfigName = dasConfig.getName();
        if (configName.equals(dasConfigName)) {
            throw new InstanceException(_strMgr.getString("cannotReferenceDASConfig",
                dasConfigName));
        }
View Full Code Here

    public String listDASServerInstanceAsString(boolean andStatus) throws InstanceException
    {
        final ConfigContext configContext = getConfigContext();
        String dasName = null;
        try {
            final Server das = ServerHelper.getDAS(configContext);
            dasName = das.getName();
            return listServerInstancesAsString(dasName, andStatus)[0];
        } catch (Exception ex) {
            throw getExceptionHandler().handleInstanceException(
                ex, "eeadmin.listInstances.Exception", dasName);
        }   
View Full Code Here

TOP

Related Classes of com.sun.enterprise.config.serverbeans.Server$CreateDecorator

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.