Package com.sun.enterprise.config.serverbeans

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


            final NodeAgent controller = target.getNodeAgents()[0];
           
            //Remove the server instance
            final Domain domain = ConfigAPIHelper.getDomainConfigBean(configContext);           
            final Servers servers = domain.getServers();
            final Server server = target.getServers()[0];
            boolean isReachable = true;

            try {               
                ServerRuntimeMBean serverMBean = InstanceProxy.getInstanceProxy(serverName);
                Status status = serverMBean.getRuntimeStatus().getStatus();
            } catch (Exception ex) {
                if (InstanceProxy.isUnreachable(ex)) {
                    isReachable = false;
                }
            }

            if(isReachable)
                throw new InstanceException(_strMgr.getString("serverIsNotStopped",
                    serverName));
           
            if (ServerHelper.isServerStandAlone(configContext, serverName)) {
                //If the server instance is stand-alone, we must remove its stand alone
                //configuration after removing the server instance (since a configuration
                //can only be deleted if it is unreferenced). Unfortunately, if
                //this fails, we leave an unreferenced standalone configurtion.               
                String configName = server.getConfigRef();
                // remove the server
                servers.removeServer(server, OVERWRITE);           
                //remove the standalone configuration               
                //FIXTHIS: One issue is that the call below will result in a call to flushAll
                //which is also called below. This must be taken into account when we
View Full Code Here


           
            //Ensure that server specified by serverName does not already exist.
            //Given that we've already checked for uniqueness earlier, this should never
            //be the case, but we'll be extra safe here.
            Servers servers = domain.getServers();
            Server server = servers.getServerByName(serverName);
            if (server != null) {
                throw new InstanceException(_strMgr.getString("serverAlreadyExists",
                    serverName));
            }                           
           
            //Create the new server instance
            server = new Server();           
            server.setNodeAgentRef(nodeAgentName);
            server.setName(serverName);                               
           
            if (configName != null) {
                createSharedServerInstance(configName, server, props);
            } else if (clusterName != null) {
                createClusteredServerInstance(clusterName, server, props);
View Full Code Here

            }

      // Ensure that the name is a valid target meaning that there are no
      // servers and clusters with the same name                    
      Servers servers = domain.getServers();
      Server server = servers.getServerByName(newConfigName);
            if (server != null) {
                throw new ConfigException(_strMgr.getString(
                    "configurationNameAlreadyExistsAsServer", newConfigName));
            }
View Full Code Here

        final ConfigContext configCtx = getConfigContext();
        final ArrayList servers = new ArrayList();
        final Server[] allServers = ServerHelper.getServersInDomain(
            configCtx);
        for (int i = 0; i < allServers.length; i++) {
            final Server s = allServers[i];
            boolean isDAS = ServerHelper.isDAS(configCtx, s);
            if (isDAS && includeDAS) {
                servers.add(s);
            } else if (!isDAS && isServerRunningOnDASHost(s)) {
                servers.add(s);
View Full Code Here

        if ( timeout < 0 ) {
            String msg = _strMgr.getString("InvalidNumber");
            throw new MBeanException ( new ConfigException(msg));
        }

        Server s = null;
        try {
            ConfigContext ctx = AdminService.getAdminService().getAdminContext()
                                    .getAdminConfigContext();
            s = ServerHelper.getServerByName(ctx, serverName);
        } catch(ConfigException ce) {
            throw new MBeanException(ce);
        }
        if (s == null ) {
            String msg = _strMgr.getString("ServerNotDefined", serverName);
            throw new MBeanException ( new ConfigException(msg));
        }
        ApplicationRef appRef = s.getApplicationRefByRef(appName);
        if (appRef == null ) {
            String msg = _strMgr.getString("AppRefNotDefined", appName,
                            serverName);
            throw new MBeanException ( new ConfigException(msg));
        }
View Full Code Here

    }
   
    private void enableApplicationForServer(String appName,String serverName)
            throws MBeanException
    {         
        Server s = null;
        try {
            ConfigContext ctx = AdminService.getAdminService().getAdminContext()
                                    .getAdminConfigContext();
            s = ServerHelper.getServerByName(ctx, serverName);
        } catch(ConfigException ce) {
            throw new MBeanException(ce);
        }
        if (s == null ) {
            String msg = _strMgr.getString("ServerNotDefined", serverName);
            throw new MBeanException ( new ConfigException(msg));
        }
        ApplicationRef appRef = s.getApplicationRefByRef(appName);
        if (appRef == null ) {
            String msg = _strMgr.getString("AppRefNotDefined", appName);
            throw new MBeanException ( new ConfigException(msg));
        }
        boolean enabled = appRef.isLbEnabled();
View Full Code Here

                    String msg = _strMgr.getString("NotCluster", target);
                    throw new MBeanException( new ConfigException(msg));
                }
            }
            Cluster c = null;
            Server s = null;
            if (ClusterHelper.isACluster(ctx, target)) {
                c = ClusterHelper.getClusterByName(ctx, target);
                if (c == null ) {
                    String msg = _strMgr.getString("ClusterNotDefined", target);
                    throw new MBeanException( new ConfigException(msg));
                }
            }else{
                s = ServerHelper.getServerByName(ctx, target);
                if (s == null ) {
                    String msg = _strMgr.getString("ServerNotDefined", target);
                    throw new MBeanException( new ConfigException(msg));
                }
            }
            createLBRef(target,configName);
            if(hcURL != null ){
                try{
                    createHealthChecker(hcURL, hcInterval, hcTimeout, configName, target);
                }catch(MBeanException e){
                    String msg = _strMgr.getString("HealthCheckerExists",target);
                    _logger.log(Level.WARNING, msg);
                }
            }
            if(enableInstances) {
                enableServer(target);
            }
            if(enableApps || lbPolicy != null || lbPolicyModule != null ) {
                ApplicationRef[] appRefs = null;
                LbConfig lbConfig = getLbConfig(configName);
                if (ClusterHelper.isACluster(ctx, target)) {
                    appRefs = c.getApplicationRef();
                   
                }else{
                    appRefs = s.getApplicationRef();
                }
                if (appRefs != null && enableApps ) {
                    for(ApplicationRef ref:appRefs) {
                        //enable only user applications
                        if(!ApplicationHelper.isSystemApp(ctx, ref.getRef()))
View Full Code Here

        if (sRef.isLbEnabled()) {
            String msg = _strMgr.getString("ServerNeedsToBeDisabled", serverName);
            throw new MBeanException ( new ConfigException(msg));
        }
        // check if its applications are LB disabled.
        Server s = null;
        try {
            ConfigContext ctx =AdminService.getAdminService().getAdminContext()
                                    .getAdminConfigContext();
            s = ServerHelper.getServerByName(ctx, sRef.getRef());
        } catch(ConfigException ce) {
            throw new MBeanException(ce);
        }
        if (s == null ) {
            String msg = _strMgr.getString("ServerNotDefined", serverName);
            throw new MBeanException ( new ConfigException(msg));
        }
        ApplicationRef[] appRef = s.getApplicationRef();
        if (appRef == null ) {
            String msg = _strMgr.getString("AppRefsNotDefined", serverName);
            throw new MBeanException ( new ConfigException(msg));
        }
        int i =0;
View Full Code Here

                ServerRef[] sRefs = c.getServerRef();

                for (int i = 0; i < sRefs.length; i++)
                    sRefs[i].setLbEnabled(lbEnableInstances);
            } else {
                Server s = ServerHelper.getServerByName(ctx, target);

                if (s == null) {
                    String msg = _strMgr.getString("InstanceNotFound", target);
                    throw new MBeanException(new ConfigException(msg));
                }

                appRefs = s.getApplicationRef();

                ServerRef sRef = clbConfig.getServerRefByRef(target);
                sRef.setLbEnabled(lbEnableInstances);
            }
        } catch (ConfigException ce) {
View Full Code Here

            String msg = _strMgr.getString("ServerNeedsToBeDisabled", serverName);
            throw new MBeanException(new ConfigException(msg));
        }

        // check if its applications are LB disabled.
        Server s = null;

        try {
            ConfigContext ctx = AdminService.getAdminService().getAdminContext()
                                            .getAdminConfigContext();
            s = ServerHelper.getServerByName(ctx, sRef.getRef());
        } catch (ConfigException ce) {
            throw new MBeanException(ce);
        }

        if (s == null) {
            String msg = _strMgr.getString("ServerNotDefined", serverName);
            throw new MBeanException(new ConfigException(msg));
        }

        ApplicationRef[] appRef = s.getApplicationRef();

        if (appRef == null) {
            String msg = _strMgr.getString("AppRefsNotDefined", serverName);
            throw new MBeanException(new ConfigException(msg));
        }
View Full Code Here

TOP

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

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.