Package com.sun.enterprise.config.serverbeans

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


            //Get the node controller specified by nodeAgentName and ensure that it does not
            //already exist
            Domain domain = ServerBeansFactory.getDomainBean(configContext);
            NodeAgents controllers =domain.getNodeAgents();
            NodeAgent controller = controllers.getNodeAgentByName(nodeAgentName);
            if (controller != null) {
                throw new AgentException(_strMgr.getString("agentAlreadyExists", nodeAgentName));
            }

            // add in "0.0.0.0"  as use host as clientHostName has a place holder until CLI is decided ???
View Full Code Here


            //Get the node controller specified by nodeAgentName and ensure that it does not
            //already exist
            Domain domain = ServerBeansFactory.getDomainBean(configContext);
            NodeAgents controllers =domain.getNodeAgents();
            NodeAgent controller = controllers.getNodeAgentByName(nodeAgentName);

            if (controller != null) {
               ElementProperty rendezvousProperty = controller.getElementPropertyByName(RENDEZVOUS_PROPERTY_NAME);
               String rendezvous=rendezvousProperty.getValue();
               if (rendezvous != null && rendezvousProperty.getValue().equals(Boolean.TRUE.toString())) {
                    // should only rendezvous once, not the same, throw exception
                    throw new AgentException(_strMgr.getString("agentAlreadyExists", nodeAgentName));
                }
View Full Code Here

            }

            NodeAgents controllers = ServerBeansFactory.getDomainBean(configContext).getNodeAgents();

            //Create the new node controller
            NodeAgent controller = new NodeAgent();
            controller.setName(nodeAgentName);

            ElementProperty rendezvousProperty = new ElementProperty();
            rendezvousProperty.setName(RENDEZVOUS_PROPERTY_NAME);
            rendezvousProperty.setValue(rendezvousOccurred.toString());
            controller.addElementProperty(rendezvousProperty);

            JmxConnector connector = new JmxConnector();
            connector.setName(SYSTEM_CONNECTOR_NAME);
            connector.setAddress(host);
            connector.setPort(port);
            connector.setProtocol(protocol);           
            Ssl ssl = new Ssl();
            ssl.setCertNickname(KeystoreManager.CERTIFICATE_ALIAS);
            connector.setSsl(ssl);

            ElementProperty hostnameProperty = new ElementProperty();
            hostnameProperty.setName(HOST_PROPERTY_NAME);
            hostnameProperty.setValue(clientHostName);
            connector.addElementProperty(hostnameProperty);

            //ISSUE: Not sure how to set the realm name here??? The realm name in the jmx-connector
            //element refers to a realm in the security-service which is associated with a configuration.
            //Unfortunately, the node-agent does not reference a configuration!!!!!!
            connector.setAuthRealmName("admin-realm");
            controller.setJmxConnector(connector);

            // TODO: need to reconcile authrealms ???
            AuthRealm[] authRealms = new AuthRealm[1];
            authRealms[0]=new AuthRealm();
            authRealms[0].setName("admin-realm");
            authRealms[0].setClassname("com.sun.enterprise.security.auth.realm.file.FileRealm");
            ElementProperty fileProperty = new ElementProperty();
            fileProperty.setName("file");
            fileProperty.setValue("${com.sun.aas.instanceRoot}/config/admin-keyfile");
            authRealms[0].addElementProperty(fileProperty);
            ElementProperty jaasContextProperty = new ElementProperty();
            jaasContextProperty.setName("jaas-context");
            jaasContextProperty.setValue("fileRealm");
            authRealms[0].addElementProperty(jaasContextProperty);
            controller.setAuthRealm(authRealms[0]);

            controller.setSystemJmxConnectorName(SYSTEM_CONNECTOR_NAME);

            LogService log = new LogService();
            ModuleLogLevels logLevels = new ModuleLogLevels();
            log.setModuleLogLevels(logLevels);
            log.setFile("${com.sun.aas.instanceRoot}/logs/server.log");
            controller.setLogService(log);

            controllers.addNodeAgent(controller, OVERWRITE);

            //Notify the Node Agent to rendezvous
            //FIXTHIS: We force persistence, clear any notifications, and update the
View Full Code Here

                    VALID_TYPES, serverName, configContext);  
            } catch (Exception e) {
                throw new InstanceException(
                    _strMgr.getString("noSuchInstance", serverName));
            }
            NodeAgent controller = target.getNodeAgents()[0];
            String agentName = controller.getName();
                                   
            // Call the Node Agent to start the server instance remotely
            NodeAgentsConfigBean ncb = getNodeAgentsConfigBean();
            if (ncb.isRunning(agentName)) {
                if (isRunning(serverName)) {
View Full Code Here

        try {
            final ConfigContext configContext = getConfigContext();
            //validate that the server exists and return its node agent
            final Target target = TargetBuilder.INSTANCE.createTarget(
                VALID_TYPES, serverName, configContext);  
            NodeAgent controller = target.getNodeAgents()[0];
            String agentName = controller.getName();
                      
            // Call the Node Agent to stop the server instance remotely
            NodeAgentsConfigBean ncb = getNodeAgentsConfigBean();
            if (ncb.isRunning(agentName)) {
                    NodeAgentMBean agentMBean =
View Full Code Here

            final ConfigContext configContext = getConfigContext();
            ConfigContextImpl.lock();
            //validate that the server exists and return its node agent
            final Target target = TargetBuilder.INSTANCE.createTarget(
                VALID_TYPES, serverName, configContext);  
            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
                //figure out the notification story.
                getConfigsConfigBean().deleteConfiguration(configName);
            } else {
                if (ServerHelper.isServerClustered(configContext, server)) {
                    //If the instance is clustered, the we must remove the server refs from
                    //the cluster.
                    deleteClusterReferences(serverName);
                }               
                //Remove the server
                servers.removeServer(server, OVERWRITE);    
            }
           
            //Remove our connction to the server instance
            InstanceRegistry.removeInstanceConnection(serverName);
           
            //Notify the node agent that a new server has been deleted to it so it can
            //resynchronize.
            //FIXTHIS: We force persistence, clear any notifications, and update the
            //Application server's config context explicitely. Until this is modelled
            //as an event notification (TBD) we need this to happen before notifying or
            //the Node Agent will not synchronize the correct data.
            //QUESTION: What happens if an exception is thrown above (e.g. in addNodeAgent). How do
            //we restore the admin config context to its previous (and unpersisted value)???
            flushAll();
            NodeAgentMBean agentMBean = NodeAgentProxy.getNodeAgentProxy(controller.getName());                       
            agentMBean.synchronizeWithDAS();
        } catch (Exception ex) {
            throw getExceptionHandler().handleInstanceException(
                ex, "eeadmin.deleteServerInstance.Exception", serverName);
        } finally {
View Full Code Here

      ConfigAPIHelper.checkLegalName(serverName);
     
            // see if nodeagent exists, if not create an empty reference
            Domain domain = ConfigAPIHelper.getDomainConfigBean(configContext);           
            NodeAgents agents=domain.getNodeAgents();
            NodeAgent agent=agents.getNodeAgentByName(nodeAgentName);
            if (agent == null) {
                // create an implnodeagent reference
                NodeAgentsConfigBean naMBean = getNodeAgentsConfigBean();
                naMBean.createNodeAgentConfig(nodeAgentName);
            }                   
View Full Code Here

                throw new ConfigException(_strMgr.getString(
                    "configurationNameAlreadyExistsAsCluster", newConfigName));
            }

      NodeAgents nas = domain.getNodeAgents();
      NodeAgent na = nas.getNodeAgentByName(newConfigName);
            if (na != null) {
                throw new ConfigException(_strMgr.getString(
                    "configurationNameAlreadyExistsAsNodeAgent", newConfigName));
            }
View Full Code Here

    {
        final ConfigContext configContext = getConfigContext();
        if (ServerHelper.isDAS(configContext, server)) {
            return true;
        } else {
            NodeAgent agent = NodeAgentHelper.getNodeAgentForServer(configContext, server.getName());           
            return NodeAgentHelper.hasNodeAgentRendezvousd(configContext, agent);
        }
    }
View Full Code Here

            //Look for other node agents on the same machine and repeat the drill. This is overkill, since
            //there really is no use case for having 2 node agents servicing the same domain on the
            //same machine.
            if (isBoundToHost) {
                NodeAgent agent = NodeAgentHelper.getNodeAgentForServer(configContext, serverName);
                NodeAgent[] agents = getOtherNodeAgentsOnSameHost(agent);
                for (int i = 0; i < agents.length; i++) {
                    servers = ServerHelper.getServersOfANodeAgent(configContext,
                        agents[i].getName());                       
                    exception = checkForServerPortPropertyConflicts(existingServerProps,
View Full Code Here

TOP

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

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.