微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

org.apache.catalina.ServerFactory的实例源码

项目:lams    文件MapperListener.java   
/**
 * Register host.
 */
private void registerHost(ObjectName objectName)
    throws Exception {
    String name=objectName.getKeyProperty("host");
    if( name != null ) {        
        Host host = (Host) ServerFactory.getServer().findService(
                domain).getContainer().findChild(name);
        String[] aliases = host.findaliases();
        mapper.addHost(name,aliases,objectName);
        host.addContainerListener(this);
        if(log.isDebugEnabled())
            log.debug(sm.getString
                 ("mapperListener.registerHost",name,domain));

    }
}
项目:lams    文件Mbeanfactory.java   
/**
 * Create a new StandardService.
 *
 * @param parent MBean Name of the associated parent component
 * @param name Unique name of this StandardService
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createStandardService(String parent,String name,String domain)
    throws Exception {

    // Create a new StandardService instance
    StandardService service = new StandardService();
    service.setName(name);

    // Add the new instance to its parent component
    Server server = ServerFactory.getServer();
    server.addService(service);

    // Return the corresponding MBean name
    return (service.getobjectName().toString());

}
项目:lams    文件StandardServer.java   
/**
 * Construct a default instance of this class.
 */
public StandardServer() {

    super();
    ServerFactory.setServer(this);

    globalNamingResources = new NamingResources();
    globalNamingResources.setContainer(this);

    if (isUseNaming()) {
        if (namingContextListener == null) {
            namingContextListener = new NamingContextListener();
            addLifecycleListener(namingContextListener);
        }
    }

}
项目:lams    文件ClusterListener.java   
/**
 * Reset configuration for a particular proxy following an error.
 */
protected void reset(int pos) {

    Service[] services = ServerFactory.getServer().findServices();
    for (int i = 0; i < services.length; i++) {
        Engine engine = (Engine) services[i].getContainer();
        removeAll((Engine) services[i].getContainer(),pos);
        config(engine,pos);
        Container[] children = engine.findChildren();
        for (int j = 0; j < children.length; j++) {
            Container[] children2 = children[j].findChildren();
            for (int k = 0; k < children2.length; k++) {
                addContext((Context) children2[k],pos);
            }
        }
    }

}
项目:jerrydog    文件Mbeanfactory.java   
/**
 * Create a new StandardEngine.
 *
 * @param parent MBean Name of the associated parent component
 * @param name Unique name of this Engine
 * @param defaultHost Default hostname of this Engine
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createStandardEngine(String parent,String defaultHost)
    throws Exception {

    // Create a new StandardEngine instance
    StandardEngine engine = new StandardEngine();
    engine.setName(name);
    engine.setDefaultHost(defaultHost);

    // Add the new instance to its parent component
    ObjectName pname = new ObjectName(parent);
    Server server = ServerFactory.getServer();
    Service service = server.findService(pname.getKeyProperty("name"));
    service.setContainer(engine);

    // Return the corresponding MBean name
    ManagedBean managed = registry.findManagedBean("StandardEngine");
    ObjectName oname =
        MBeanUtils.createObjectName(managed.getDomain(),engine);
    return (oname.toString());

}
项目:jerrydog    文件Mbeanfactory.java   
/**
 * Create a new StandardService.
 *
 * @param parent MBean Name of the associated parent component
 * @param name Unique name of this StandardService
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createStandardService(String parent,String name)
    throws Exception {

    // Create a new StandardService instance
    StandardService service = new StandardService();
    service.setName(name);

    // Add the new instance to its parent component
    Server server = ServerFactory.getServer();
    server.addService(service);

    // Return the corresponding MBean name
    ManagedBean managed = registry.findManagedBean("StandardService");
    ObjectName oname =
        MBeanUtils.createObjectName(managed.getDomain(),service);
    return (oname.toString());

}
项目:jerrydog    文件Mbeanfactory.java   
/**
 * Remove an existing Context.
 *
 * @param name MBean Name of the comonent to remove
 *
 * @exception Exception if a component cannot be removed
 */
public void removeContext(String name) throws Exception {
    // Acquire a reference to the component to be removed
    ObjectName oname = new ObjectName(name);
    String serviceName = oname.getKeyProperty("service");
    String hostName = oname.getKeyProperty("host");
    String contextName = getPathStr(oname.getKeyProperty("path"));
    Server server = ServerFactory.getServer();
    Service service = server.findService(serviceName);
    Engine engine = (Engine) service.getContainer();
    Host host = (Host) engine.findChild(hostName);
    Context context = (Context) host.findChild(contextName);

    // Remove this component from its parent component
    host.removeChild(context);

}
项目:jerrydog    文件Mbeanfactory.java   
/**
 * Remove an existing Host.
 *
 * @param name MBean Name of the comonent to remove
 *
 * @exception Exception if a component cannot be removed
 */
public void removeHost(String name) throws Exception {

    // Acquire a reference to the component to be removed
    ObjectName oname = new ObjectName(name);
    String serviceName = oname.getKeyProperty("service");
    String hostName = oname.getKeyProperty("host");
    Server server = ServerFactory.getServer();
    Service service = server.findService(serviceName);
    Engine engine = (Engine) service.getContainer();
    Host host = (Host) engine.findChild(hostName);

    // Remove this component from its parent component
    engine.removeChild(host);

}
项目:jerrydog    文件UserDatabaseRealm.java   
/**
 * Prepare for active use of the public methods of this Component.
 *
 * @exception LifecycleException if this component detects a Fatal error
 *  that prevents it from being started
 */
public synchronized void start() throws LifecycleException {

    try {
        StandardServer server = (StandardServer) ServerFactory.getServer();
        Context context = server.getGlobalNamingContext();
        database = (UserDatabase) context.lookup(resourceName);
    } catch (Throwable e) {
        e.printstacktrace();
        log(sm.getString("userDatabaseRealm.lookup",resourceName),e);
        database = null;
    }
    if (database == null) {
        throw new LifecycleException
            (sm.getString("userDatabaseRealm.noDatabase",resourceName));
    }

    // Perform normal superclass initialization
    super.start();

}
项目:jerrydog    文件StandardServer.java   
/**
 * Construct a default instance of this class.
 */
public StandardServer() {

    super();
    ServerFactory.setServer(this);

    globalNamingResources = new NamingResources();
    globalNamingResources.setContainer(this);

    if (isUseNaming()) {
        if (namingContextListener == null) {
            namingContextListener = new NamingContextListener();
            namingContextListener.setDebug(getDebug());
            addLifecycleListener(namingContextListener);
        }
    }

}
项目:HowTomcatWorks    文件Mbeanfactory.java   
/**
 * Create a new StandardEngine.
 *
 * @param parent MBean Name of the associated parent component
 * @param name Unique name of this Engine
 * @param defaultHost Default hostname of this Engine
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createStandardEngine(String parent,engine);
    return (oname.toString());

}
项目:HowTomcatWorks    文件Mbeanfactory.java   
/**
 * Create a new StandardService.
 *
 * @param parent MBean Name of the associated parent component
 * @param name Unique name of this StandardService
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createStandardService(String parent,service);
    return (oname.toString());

}
项目:HowTomcatWorks    文件Mbeanfactory.java   
/**
 * Remove an existing Context.
 *
 * @param name MBean Name of the comonent to remove
 *
 * @exception Exception if a component cannot be removed
 */
public void removeContext(String name) throws Exception {
    // Acquire a reference to the component to be removed
    ObjectName oname = new ObjectName(name);
    String serviceName = oname.getKeyProperty("service");
    String hostName = oname.getKeyProperty("host");
    String contextName = getPathStr(oname.getKeyProperty("path"));
    Server server = ServerFactory.getServer();
    Service service = server.findService(serviceName);
    Engine engine = (Engine) service.getContainer();
    Host host = (Host) engine.findChild(hostName);
    Context context = (Context) host.findChild(contextName);

    // Remove this component from its parent component
    host.removeChild(context);

}
项目:HowTomcatWorks    文件Mbeanfactory.java   
/**
 * Remove an existing Host.
 *
 * @param name MBean Name of the comonent to remove
 *
 * @exception Exception if a component cannot be removed
 */
public void removeHost(String name) throws Exception {

    // Acquire a reference to the component to be removed
    ObjectName oname = new ObjectName(name);
    String serviceName = oname.getKeyProperty("service");
    String hostName = oname.getKeyProperty("host");
    Server server = ServerFactory.getServer();
    Service service = server.findService(serviceName);
    Engine engine = (Engine) service.getContainer();
    Host host = (Host) engine.findChild(hostName);

    // Remove this component from its parent component
    engine.removeChild(host);

}
项目:HowTomcatWorks    文件UserDatabaseRealm.java   
/**
 * Prepare for active use of the public methods of this Component.
 *
 * @exception LifecycleException if this component detects a Fatal error
 *  that prevents it from being started
 */
public synchronized void start() throws LifecycleException {

    try {
        StandardServer server = (StandardServer) ServerFactory.getServer();
        Context context = server.getGlobalNamingContext();
        database = (UserDatabase) context.lookup(resourceName);
    } catch (Throwable e) {
        e.printstacktrace();
        log(sm.getString("userDatabaseRealm.lookup",resourceName));
    }

    // Perform normal superclass initialization
    super.start();

}
项目:HowTomcatWorks    文件StandardServer.java   
/**
 * Construct a default instance of this class.
 */
public StandardServer() {

    super();
    ServerFactory.setServer(this);

    globalNamingResources = new NamingResources();
    globalNamingResources.setContainer(this);

    if (isUseNaming()) {
        if (namingContextListener == null) {
            namingContextListener = new NamingContextListener();
            namingContextListener.setDebug(getDebug());
            addLifecycleListener(namingContextListener);
        }
    }

}
项目:smonitor    文件JBoss5ConnectorService.java   
public JBoss5ConnectorService() {
    super("JBoss 5");

    // get the server version
    try {
        MBeanServer mBeanServer = MBeanServerFactory.findMBeanServer(null).get(0);
        version = (String) mBeanServer.getAttribute(new ObjectName("jboss.system:type=Server"),"Version");
    } catch (Exception ex) {
       throw new RuntimeException("Error get the version of the server",ex);
    }  

    // get the tomcat server
    server = ServerFactory.getServer();

    // get the tomcat server service
    service = server.findService("jboss.web");
}
项目:smonitor    文件Tomcat6ConnectorService.java   
public Tomcat6ConnectorService() {
    super("Tomcat 6");

    // get the server version
    try {
        MBeanServer mBeanServer = MBeanServerFactory.findMBeanServer(null).get(0);
        version = (String) mBeanServer.getAttribute(new ObjectName("jboss.system:type=Server"),ex);
    }  

    // get the tomcat server
    server = ServerFactory.getServer();

    // get the tomcat server service
    service = server.findService("Catalina");
}
项目:lams    文件StandardServerMBean.java   
/**
 * Write the configuration information for this entire <code>Server</code>
 * out to the server.xml configuration file.
 *
 * @exception InstanceNotFoundException if the managed resource object
 *  cannot be found
 * @exception MBeanException if the initializer of the object throws
 *  an exception,or persistence is not supported
 * @exception RuntimeOperationsException if an exception is reported
 *  by the persistence mechanism
 */
public synchronized void store() throws InstanceNotFoundException,MBeanException,RuntimeOperationsException {

    Server server = ServerFactory.getServer();
    if (server instanceof StandardServer) {
        try {
            ((StandardServer) server).storeConfig();
        } catch (Exception e) {
            throw new MBeanException(e,"Error updating conf/server.xml");
        }
    }

}
项目:lams    文件Mbeanfactory.java   
/**
 * Create a new StandardEngine.
 *
 * @param parent MBean Name of the associated parent component
 * @param engineName Unique name of this Engine
 * @param defaultHost Default hostname of this Engine
 * @param serviceName Unique name of this Service
 *
 * @exception Exception if an MBean cannot be created or registered
 */

public Vector createStandardEngineservice(String parent,String engineName,String defaultHost,String serviceName)
    throws Exception {

    // Create a new StandardService instance
    StandardService service = new StandardService();
    service.setName(serviceName);
    // Create a new StandardEngine instance
    StandardEngine engine = new StandardEngine();
    engine.setName(engineName);
    engine.setDefaultHost(defaultHost);
    // Need to set engine before adding it to server in order to set domain
    service.setContainer(engine);
    // Add the new instance to its parent component
    Server server = ServerFactory.getServer();
    server.addService(service);
    Vector onames = new Vector();
    // FIXME service & engine.getobjectName
    //ObjectName oname = engine.getobjectName();
    ObjectName oname = 
        MBeanUtils.createObjectName(engineName,engine);
    onames.add(0,oname);
    //oname = service.getobjectName();
    oname = 
        MBeanUtils.createObjectName(engineName,service);
    onames.add(1,oname);
    return (onames);

}
项目:lams    文件Mbeanfactory.java   
/**
 * Remove an existing Connector.
 *
 * @param name MBean Name of the component to remove
 *
 * @exception Exception if a component cannot be removed
 */
public void removeConnector(String name) throws Exception {

    // Acquire a reference to the component to be removed
    ObjectName oname = new ObjectName(name);
    Server server = ServerFactory.getServer();
    Service service = getService(oname);
    String port = oname.getKeyProperty("port");
    //String address = oname.getKeyProperty("address");

    Connector conns[] = (Connector[]) service.findConnectors();

    for (int i = 0; i < conns.length; i++) {
        String connAddress = String.valueOf(conns[i].getProperty("address"));
        String connPort = ""+conns[i].getPort();

        // if (((address.equals("null")) &&
        if ((connAddress==null) && port.equals(connPort)) {
            service.removeConnector(conns[i]);
            conns[i].destroy();
            break;
        }
        // } else if (address.equals(connAddress))
        if (port.equals(connPort)) {
            // Remove this component from its parent component
            service.removeConnector(conns[i]);
            conns[i].destroy();
            break;
        }
    }

}
项目:lams    文件Mbeanfactory.java   
/**
 * Remove an existing Service.
 *
 * @param name MBean Name of the component to remove
 *
 * @exception Exception if a component cannot be removed
 */
public void removeService(String name) throws Exception {

    // Acquire a reference to the component to be removed
    ObjectName oname = new ObjectName(name);
    String serviceName = oname.getKeyProperty("serviceName");
    Server server = ServerFactory.getServer();
    Service service = server.findService(serviceName);

    // Remove this component from its parent component
    server.removeService(service);

}
项目:lams    文件ClusterListener.java   
/**
 * disable all webapps for all engines. To be used through JMX or similar.
 */
public boolean disable() {
    Service[] services = ServerFactory.getServer().findServices();
    for (int i = 0; i < services.length; i++) {
        Engine engine = (Engine) services[i].getContainer();
        HashMap<String,String> parameters = new HashMap<String,String>();
        parameters.put("JVMRoute",engine.getJvmRoute());
        // Send disABLE-APP * request
        sendRequest("disABLE-APP",true,parameters);
    }
    return (proxies[0].state == State.OK);
}
项目:lams    文件ClusterListener.java   
/**
 * Enable all webapps for all engines. To be used through JMX or similar.
 */
public boolean enable() {
    Service[] services = ServerFactory.getServer().findServices();
    for (int i = 0; i < services.length; i++) {
        Engine engine = (Engine) services[i].getContainer();
        HashMap<String,engine.getJvmRoute());
        // Send ENABLE-APP * request
        sendRequest("ENABLE-APP",parameters);
    }
    return (proxies[0].state == State.OK);
}
项目:jerrydog    文件ManagerServlet.java   
/**
 * Process a PUT request for the specified resource.
 *
 * @param request The servlet request we are processing
 * @param response The servlet response we are creating
 *
 * @exception IOException if an input/output error occurs
 * @exception servletexception if a servlet-specified error occurs
 */
public void doPut(HttpServletRequest request,HttpServletResponse response)
    throws IOException,servletexception {

    // Verify that we were not accessed using the invoker servlet
    if (request.getAttribute(Globals.INVOKED_ATTR) != null)
        throw new UnavailableException
            (sm.getString("managerServlet.cannotinvoke"));

    // Identify the request parameters that we need
    String command = request.getPathInfo();
    if (command == null)
        command = request.getServletPath();
    String path = request.getParameter("path");

    // Prepare our output writer to generate the response message
    response.setContentType("text/plain");
    Locale locale = Locale.getDefault();
    response.setLocale(locale);
    PrintWriter writer = response.getWriter();

    // Process the requested command
    if (command == null) {
        writer.println(sm.getString("managerServlet.noCommand"));
    } else if (command.equals("/deploy")) {
        deploy(writer,path,request);
    } else {
        writer.println(sm.getString("managerServlet.unkNownCommand",command));
    }

    // Saving configuration
    Server server = ServerFactory.getServer();
    if ((server != null) && (server instanceof StandardServer)) {
        try {
            ((StandardServer) server).store();
        } catch (Exception e) {
            writer.println(sm.getString("managerServlet.saveFail",e.getMessage()));
        }
    }

    // Finish up the response
    writer.flush();
    writer.close();

}
项目:jerrydog    文件StandardServerMBean.java   
/**
 * Write the configuration information for this entire <code>Server</code>
 * out to the server.xml configuration file.
 *
 * @exception InstanceNotFoundException if the managed resource object
 *  cannot be found
 * @exception MBeanException if the initializer of the object throws
 *  an exception,RuntimeOperationsException {

    Server server = ServerFactory.getServer();
    if (server instanceof StandardServer) {
        try {
            ((StandardServer) server).store();
        } catch (Exception e) {
            throw new MBeanException(e,"Error updating conf/server.xml");
        }
    }

}
项目:jerrydog    文件Mbeanfactory.java   
/**
 * Create a new DefaultContext.
 *
 * @param parent MBean Name of the associated parent component
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createDefaultContext(String parent)
    throws Exception {

    // Create a new StandardDefaultContext instance
    StandardDefaultContext context = new StandardDefaultContext();

    // Add the new instance to its parent component
    ObjectName pname = new ObjectName(parent);
    String type = pname.getKeyProperty("type");
    Server server = ServerFactory.getServer();
    String serviceName = pname.getKeyProperty("service");
    if (serviceName == null) {
        serviceName = pname.getKeyProperty("name");
    }
    Service service = server.findService(serviceName);
    Engine engine = (Engine) service.getContainer();
    String hostName = pname.getKeyProperty("host");
    if (hostName == null) { //if DefaultContext is nested in Engine
        context.setParent(engine);
        engine.addDefaultContext(context);
    } else {                // if DefaultContext is nested in Host
        Host host = (Host) engine.findChild(hostName);
        context.setParent(host);
        host.addDefaultContext(context);
    }

    // Return the corresponding MBean name
    ManagedBean managed = registry.findManagedBean("DefaultContext");
    ObjectName oname =
        MBeanUtils.createObjectName(managed.getDomain(),context);
    return (oname.toString());

}
项目:jerrydog    文件Mbeanfactory.java   
/**
 * Create a new StandardContext.
 *
 * @param parent MBean Name of the associated parent component
 * @param path The context path for this Context
 * @param docBase Document base directory (or WAR) for this Context
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createStandardContext(String parent,String path,String docBase)
    throws Exception {

    // Create a new StandardContext instance
    StandardContext context = new StandardContext();    
    path = getPathStr(path);
    context.setPath(path);
    context.setDocBase(docBase);
    ContextConfig contextConfig = new ContextConfig();
    context.addLifecycleListener(contextConfig);

    // Add the new instance to its parent component
    ObjectName pname = new ObjectName(parent);
    Server server = ServerFactory.getServer();
    Service service = server.findService(pname.getKeyProperty("service"));
    Engine engine = (Engine) service.getContainer();
    Host host = (Host) engine.findChild(pname.getKeyProperty("host"));

    // Add context to the host
    host.addChild(context);

    // Return the corresponding MBean name
    ManagedBean managed = registry.findManagedBean("StandardContext");

    ObjectName oname =
        MBeanUtils.createObjectName(managed.getDomain(),context);
    return (oname.toString());

}
项目:jerrydog    文件Mbeanfactory.java   
/**
 * Create a new StandardHost.
 *
 * @param parent MBean Name of the associated parent component
 * @param name Unique name of this Host
 * @param appBase Application base directory name
 * @param autoDeploy Should we auto deploy?
 * @param deployXML Should we deploy Context XML config files property?
 * @param liveDeploy Should we live deploy?
 * @param unpackWARs Should we unpack WARs when auto deploying?
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createStandardHost(String parent,String appBase,boolean autoDeploy,boolean deployXML,boolean liveDeploy,boolean unpackWARs)
    throws Exception {

    // Create a new StandardHost instance
    StandardHost host = new StandardHost();
    host.setName(name);
    host.setAppBase(appBase);
    host.setAutoDeploy(autoDeploy);
    host.setDeployXML(deployXML);
    host.setLiveDeploy(liveDeploy);
    host.setUnpackWARs(unpackWARs);

    // Add the new instance to its parent component
    ObjectName pname = new ObjectName(parent);
    Server server = ServerFactory.getServer();
    Service service = server.findService(pname.getKeyProperty("service"));
    Engine engine = (Engine) service.getContainer();
    engine.addChild(host);

    // Return the corresponding MBean name
    ManagedBean managed = registry.findManagedBean("StandardHost");
    ObjectName oname =
        MBeanUtils.createObjectName(managed.getDomain(),host);
    return (oname.toString());

}
项目:jerrydog    文件Mbeanfactory.java   
/**
 * Remove an existing Connector.
 *
 * @param name MBean Name of the comonent to remove
 *
 * @param serviceName Service name of the connector to remove
 *
 * @exception Exception if a component cannot be removed
 */
public void removeConnector(String name) throws Exception {

    // Acquire a reference to the component to be removed
    ObjectName oname = new ObjectName(name);
    Server server = ServerFactory.getServer();
    String serviceName = oname.getKeyProperty("service");
    Service service = server.findService(serviceName);
    String port = oname.getKeyProperty("port");
    String address = oname.getKeyProperty("address");

    Connector conns[] = (Connector[]) service.findConnectors();

    for (int i = 0; i < conns.length; i++) {
        Class cls = conns[i].getClass();
        Method getAddrMeth = cls.getmethod("getAddress",null);
        Object addrObj = getAddrMeth.invoke(conns[i],null);
        String connAddress = null;
        if (addrObj != null) {
            connAddress = addrObj.toString();
        } 
        Method getPortMeth = cls.getmethod("getPort",null);
        Object portObj = getPortMeth.invoke(conns[i],null);
        String connPort = new String();
        if (portObj != null) {
            connPort = portObj.toString();
        }
        if (((address.equals("null")) && (connAddress==null)) && port.equals(connPort)) {
            service.removeConnector(conns[i]);
            break;
        } else if (address.equals(connAddress) && port.equals(connPort)) {
            // Remove this component from its parent component
            service.removeConnector(conns[i]);
            break;
        } 
    }

}
项目:jerrydog    文件Mbeanfactory.java   
/**
 * Remove an existing Service.
 *
 * @param name MBean Name of the component to remove
 *
 * @exception Exception if a component cannot be removed
 */
public void removeService(String name) throws Exception {

    // Acquire a reference to the component to be removed
    ObjectName oname = new ObjectName(name);
    String serviceName = oname.getKeyProperty("name");
    Server server = ServerFactory.getServer();
    Service service = server.findService(serviceName);

    // Remove this component from its parent component
    server.removeService(service);

}
项目:parabuild-ci    文件ManagerServlet.java   
/**
 * Process a PUT request for the specified resource.
 *
 * @param request  The servlet request we are processing
 * @param response The servlet response we are creating
 * @throws IOException      if an input/output error occurs
 * @throws servletexception if a servlet-specified error occurs
 */
public void doPut(final HttpServletRequest request,final HttpServletResponse response)
        throws IOException,servletexception {

  // Verify that we were not accessed using the invoker servlet
  if (request.getAttribute(Globals.INVOKED_ATTR) != null) {
    throw new UnavailableException
            (sm.getString("managerServlet.cannotinvoke"));
  }

  // Identify the request parameters that we need
  String command = request.getPathInfo();
  if (command == null) {
    command = request.getServletPath();
  }
  final String path = request.getParameter("path");

  // Prepare our output writer to generate the response message
  response.setContentType("text/plain");
  final Locale locale = Locale.getDefault();
  response.setLocale(locale);
  final PrintWriter writer = response.getWriter();

  // Process the requested command
  if (command == null) {
    writer.println(sm.getString("managerServlet.noCommand"));
  } else if (command.equals("/deploy")) {
    deploy(writer,request);
  } else {
    writer.println(sm.getString("managerServlet.unkNownCommand",command));
  }

  // Saving configuration
  final Server server = ServerFactory.getServer();
  if (server != null && server instanceof StandardServer) {
    try {
      ((StandardServer) server).store();
    } catch (Exception e) {
      writer.println(sm.getString("managerServlet.saveFail",e.getMessage()));
    }
  }

  // Finish up the response
  writer.flush();
  writer.close();

}
项目:Telepathology    文件RealmAuthentication.java   
public RealmAuthentication()
  {
    // Todo: Fix this! 
    // For Now,log in to the Realm
realms = new HashMap<String,VistaAccessverifyRealm>();
    StandardServer server = (StandardServer)ServerFactory.getServer();
    for (Service service : server.findServices())
    {
        addVistaRealmsToList(service);
    }
  }
项目:Telepathology    文件SpecificRealmAuthentication.java   
private synchronized static List<Realm> getRealms()
{
    if(realms == null)
    {
        realms = new ArrayList<Realm>();
        StandardServer server = (StandardServer)ServerFactory.getServer();
        for (Service service : server.findServices())
        {
            addVistaRealmsToList(service);
        }
    }
    return realms;
}
项目:Telepathology    文件TomcatNamingServer.java   
public javax.naming.Context getGlobalContext()
{
    Server server = ServerFactory.getServer();
    javax.naming.Context globalContext = null; 

    if( (server != null) && (server instanceof StandardServer) )
        globalContext = ((StandardServer) server).getGlobalNamingContext();

    return globalContext;
}
项目:HowTomcatWorks    文件StandardServerMBean.java   
/**
 * Write the configuration information for this entire <code>Server</code>
 * out to the server.xml configuration file.
 *
 * @exception InstanceNotFoundException if the managed resource object
 *  cannot be found
 * @exception MBeanException if the initializer of the object throws
 *  an exception,"Error updating conf/server.xml");
        }
    }

}
项目:HowTomcatWorks    文件Mbeanfactory.java   
/**
 * Create a new DefaultContext.
 *
 * @param parent MBean Name of the associated parent component
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createDefaultContext(String parent)
    throws Exception {

    // Create a new StandardDefaultContext instance
    StandardDefaultContext context = new StandardDefaultContext();

    // Add the new instance to its parent component
    ObjectName pname = new ObjectName(parent);
    String type = pname.getKeyProperty("type");
    Server server = ServerFactory.getServer();
    String serviceName = pname.getKeyProperty("service");
    if (serviceName == null) {
        serviceName = pname.getKeyProperty("name");
    }
    Service service = server.findService(serviceName);
    Engine engine = (Engine) service.getContainer();
    String hostName = pname.getKeyProperty("host");
    if (hostName == null) { //if DefaultContext is nested in Engine
        context.setParent(engine);
        engine.addDefaultContext(context);
    } else {                // if DefaultContext is nested in Host
        Host host = (Host) engine.findChild(hostName);
        context.setParent(host);
        host.addDefaultContext(context);
    }

    // Return the corresponding MBean name
    ManagedBean managed = registry.findManagedBean("DefaultContext");
    ObjectName oname =
        MBeanUtils.createObjectName(managed.getDomain(),context);
    return (oname.toString());

}
项目:HowTomcatWorks    文件Mbeanfactory.java   
/**
 * Create a new StandardContext.
 *
 * @param parent MBean Name of the associated parent component
 * @param path The context path for this Context
 * @param docBase Document base directory (or WAR) for this Context
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createStandardContext(String parent,context);
    return (oname.toString());

}
项目:HowTomcatWorks    文件Mbeanfactory.java   
/**
 * Create a new StandardHost.
 *
 * @param parent MBean Name of the associated parent component
 * @param name Unique name of this Host
 * @param appBase Application base directory name
 * @param autoDeploy Should we auto deploy?
 * @param deployXML Should we deploy Context XML config files property?
 * @param liveDeploy Should we live deploy?
 * @param unpackWARs Should we unpack WARs when auto deploying?
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createStandardHost(String parent,host);
    return (oname.toString());

}
项目:HowTomcatWorks    文件Mbeanfactory.java   
/**
 * Remove an existing Connector.
 *
 * @param name MBean Name of the comonent to remove
 *
 * @param serviceName Service name of the connector to remove
 *
 * @exception Exception if a component cannot be removed
 */
public void removeConnector(String name) throws Exception {

    // Acquire a reference to the component to be removed
    ObjectName oname = new ObjectName(name);
    Server server = ServerFactory.getServer();
    String serviceName = oname.getKeyProperty("service");
    Service service = server.findService(serviceName);
    String port = oname.getKeyProperty("port");
    String address = oname.getKeyProperty("address");

    Connector conns[] = (Connector[]) service.findConnectors();

    for (int i = 0; i < conns.length; i++) {
        Class cls = conns[i].getClass();
        Method getAddrMeth = cls.getmethod("getAddress",null);
        String connPort = new String();
        if (portObj != null) {
            connPort = portObj.toString();
        }
        if (((address.equals("null")) && (connAddress==null)) && port.equals(connPort)) {
            service.removeConnector(conns[i]);
            break;
        } else if (address.equals(connAddress) && port.equals(connPort)) {
            // Remove this component from its parent component
            service.removeConnector(conns[i]);
            break;
        } 
    }

}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。