Package com.sun.enterprise.config.serverbeans

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


        return ( lsm.getString("web.contexts.msg", crs) );
    }
   
    private String getJmxServiceUrlMessage() throws ConfigException {
        String url = "";
        final JmxConnector sjc = ServerHelper.getServerSystemConnector(cc, sn);
        if (sjc != null) {
            url += ServerHelper.getJmxServiceUrl(sjc);
        }
        return ( lsm.getString("jmx.connector.msg", url) );
    }
View Full Code Here


            Server das = ServerHelper.getDAS(getConfigContext());
            String dasConfigName = das.getConfigRef();
            if(!getParentConfigName().equals(dasConfigName))
                return false; //from another config

            JmxConnector jmxc = ServerHelper.getServerSystemConnector(
                    getConfigContext(),
                    das.getName());
            return jmxc.getAuthRealmName().equals(getName());
        } catch (Exception e) {
            throw new MBeanConfigException(e.getMessage());
        }
    }
View Full Code Here

        //don't set the port as it is "tokenized" appropriately
    }
   
    private static void addClientHostNameProperty2SystemJmxConnector(final Config someConfig) throws ConfigException {
        final com.sun.enterprise.config.serverbeans.AdminService as = someConfig.getAdminService();
        final JmxConnector jc    = as.getJmxConnectorByName(IAdminConstants.SYSTEM_CONNECTOR_NAME);
        final String hostValue   = System.getProperty(SystemPropertyConstants.HOST_NAME_PROPERTY);
        final String hostName    = IAdminConstants.HOST_PROPERTY_NAME;
        ElementProperty ep       = jc.getElementPropertyByName(hostName);

        if (ep == null) {
            ep = new ElementProperty();
            ep.setName(hostName);
            ep.setValue(hostValue);           
            jc.addElementProperty(ep);
        } else {
            ep.setValue(hostValue);
        }
    }
View Full Code Here

        JMXServiceURL url =
        JmxServiceUrlFactory.forJconsoleOverRmiWithJndiInAppserver(
                HOST_HOLDER_VALUE, PORT_HOLDER_VALUE);
        String strUrl  = url.toString();
        //now - modify it
        JmxConnector bean = (JmxConnector)this.getBaseConfigBean();
        String host = bean.getAddress();
        if(host!=null && host.trim().equals("0.0.0.0"))
        {
           //host = InetAddress.getLocalHost().getHostName();   
           host = null; //left <host-name> placeholder in url
        }
        if(host!=null)
            strUrl = strUrl.replaceAll(HOST_HOLDER_VALUE, host);
        try {
           int port = Integer.parseInt(bean.getPort());
           strUrl = strUrl.replaceAll(String.valueOf(PORT_HOLDER_VALUE),
                   String.valueOf(port));
        } catch (Exception e)
        {
           strUrl = strUrl.replaceAll(String.valueOf(PORT_HOLDER_VALUE),
View Full Code Here

            //Read in domain.xml. This will fail with a ConfigException if there is no domain.xml
            final PEFileLayout layout = getFileLayout(config);
            ConfigContext configContext = getConfigContext(config);
            //Fetch the name of the realm for the DAS system jmx connector
            String dasName = ServerHelper.getDAS(configContext).getName();           
            JmxConnector conn = ServerHelper.getServerSystemConnector(configContext,
                dasName);
            String realmName = conn.getAuthRealmName();
            SecurityService security = ServerHelper.getConfigForServer(configContext,
                dasName).getSecurityService();     
            //Load in the file realm
            //Before loading the realm, we must ensure that com.sun.aas.instanceRoot
            //is set correcty, since the keyfile is most likely referenced using this.
View Full Code Here

    public static JmxConnector getNodeAgentSystemConnector(ConfigContext configContext, String agentName)
        throws ConfigException
     {
        final NodeAgent controller = getNodeAgentByName(configContext, agentName);       
        final String systemConnectorName = controller.getSystemJmxConnectorName();
        final JmxConnector connector = controller.getJmxConnector();
        if (connector == null) {
            throw new ConfigException(_strMgr.getString("noAgentSystemConnector", agentName,
                systemConnectorName));
        }
        return connector;
View Full Code Here

     * Returns mbean server connection info for the named node agent.
     */
    public static JMXConnectorConfig getJMXConnectorInfo(ConfigContext configContext, String nodeAgentName)
        throws ConfigException
    {       
        JmxConnector connector = NodeAgentHelper.getNodeAgentSystemConnector(
            configContext, nodeAgentName);       
        String adminUser = IdentityManager.getUser();
        String adminPassword = IdentityManager.getPassword();    
        ElementProperty hostProp = connector.getElementPropertyByName(HOST_PROPERTY_NAME);   

        if (adminUser == null || adminPassword == null || hostProp == null) {
            throw new ConfigException(_strMgr.getString("missingAgentConnectorAuth", nodeAgentName));
        }
        return new JMXConnectorConfig(hostProp.getValue(), connector.getPort(),                
            adminUser, adminPassword, connector.getProtocol());
    }
View Full Code Here

    private void setJMXConnectorInfo(String newHost, String newPort
    throws ConfigException {    
        AdminService as = ServerHelper.getAdminServiceForServer(
                            getConfigContext(), "server");
        JmxConnector jmxConn = as.getJmxConnectorByName(
                                as.getSystemJmxConnectorName());
        jmxConn.setPort(newPort);

        ElementProperty clientHostname =
            jmxConn.getElementPropertyByName(HOST_PROPERTY_NAME);
        clientHostname.setValue(HOST_PROPERTY_NAME, newHost);

        getConfigContext().flush(true);
      
    }
View Full Code Here

                ": Trying to start jmx connector:" + "service:jmx:" + protocol
              + "://" + host + ":"  + port);

        /* TODO - changes required here ... */       
        ConfigContext configContext = getConfigContext();
        JmxConnector connector = NodeAgentHelper.getNodeAgentSystemConnector(
            configContext, getNodeAgentName());       
        final int iPort = Integer.parseInt(port);       
        final JmxConnectorServerDriver dr = new JmxConnectorServerDriver();
        dr.setAuthentication(true);
        dr.setAuthenticator(createJMXAuthenticator(connector));
        dr.setMBeanServer(_server);
        dr.setBindAddress(connector.getAddress());
        dr.setPort(iPort);
        dr.setProtocol(RemoteJmxProtocol.instance(protocol));
        handleSsl(dr, connector);
        dr.setLogger(_logger);
        dr.setRmiRegistrySecureFlag(false); //TODO
        final JMXConnectorServer serverEnd = dr.startConnectorServer();
        getLogger().log(Level.INFO, "NodeAgent url  = " +
                                      "service:jmx:" + connector.getProtocol() +
                                      "://" + connector.getAddress() +
                                      ":"  + connector.getPort());

        registerMBean(serverEnd, JMX_SERVER_MBEAN_PREFIX + port);
        if (bDebug) query();
    }
View Full Code Here

            if (getNodeAgentPropertyReader().isBound()) {
                // go through domain.xml and register connector
                com.sun.enterprise.config.serverbeans.NodeAgent nodeController
                    = getNodeAgentConfigBean(getConfigContext());
                if (nodeController != null) {
                    final JmxConnector jmxConnector =
                        nodeController.getJmxConnector();
                    if (jmxConnector != null) {
                        initializeSecurity(jmxConnector, nodeController);
                        if (!isPortRegistered(
                                vtCurrent, jmxConnector.getPort())) {
                            // if not registered in mbean server,
                            // create and register it
                            registerJmxConnector(jmxConnector.getProtocol(),
                                                 jmxConnector.getAddress(),
                                                 jmxConnector.getPort());
                        }                                                          
                    }
                }
            } else {
                // register default jmx connector
View Full Code Here

TOP

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

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.