Package org.apache.catalina

Examples of org.apache.catalina.Service


    private ContainerBase getParentContainerFromParent(ObjectName pname)
        throws Exception {
       
        String type = pname.getKeyProperty("type");
        String j2eeType = pname.getKeyProperty("j2eeType");
        Service service = getService(pname);
        StandardEngine engine = (StandardEngine) service.getContainer();
        if ((j2eeType!=null) && (j2eeType.equals("WebModule"))) {
            String name = pname.getKeyProperty("name");
            name = name.substring(2);
            int i = name.indexOf("/");
            String hostName = name.substring(0,i);
View Full Code Here


    private ContainerBase getParentContainerFromChild(ObjectName oname)
        throws Exception {
       
        String hostName = oname.getKeyProperty("host");
        String path = oname.getKeyProperty("path");
        Service service = getService(oname);
        StandardEngine engine = (StandardEngine) service.getContainer();
        if (hostName == null) {            
            // child's container is Engine
            return engine;
        } else if (path == null) {     
            // child's container is Host
View Full Code Here

            arglist3[0] = new String("org.apache.jk.server.JkCoyoteHandler");
            meth3.invoke(retobj, arglist3);

            // Add the new instance to its parent component
            ObjectName pname = new ObjectName(parent);
            Service service = getService(pname);
            service.addConnector((Connector)retobj);
            Method getObjectName = cls.getMethod("getObjectName", null);
           
            // Return the corresponding MBean name
            //ObjectName coname = (ObjectName)getObjectName.invoke(retobj, null);
            ObjectName coname =
View Full Code Here

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

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        Service service = getService(pname);      
        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
View Full Code Here

            Object arglist2[] = new Object[1];
            arglist2[0] = new Integer(port);
            meth2.invoke(retobj, arglist2);
            // Add the new instance to its parent component
            ObjectName pname = new ObjectName(parent);
            Service service = getService(pname);
            service.addConnector((Connector)retobj);
            Method getObjectName = cls.getMethod("getObjectName", null);
           
            // Return the corresponding MBean name
            ObjectName coname = (ObjectName)getObjectName.invoke(retobj, null);
            //ObjectName coname =
View Full Code Here

        }

        try {
            // Add the new instance to its parent component
            ObjectName pname = new ObjectName(parent);
            Service service = getService(pname);
            service.addConnector((Connector)retobj);
            Method getObjectName = cls.getMethod("getObjectName", null);
           
            // Return the corresponding MBean name
            //ObjectName coname = (ObjectName)getObjectName.invoke(retobj, null);
            ObjectName coname =
View Full Code Here

        ContextConfig contextConfig = new ContextConfig();
        context.addLifecycleListener(contextConfig);

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        Service service = getService(pname);
        Engine engine = (Engine) service.getContainer();
        Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
        host.addChild(context);

        // Return the corresponding MBean name
        ObjectName oname =
View Full Code Here

        HostConfig hostConfig = new HostConfig();
        host.addLifecycleListener(hostConfig);

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        Service service = getService(pname);
        Engine engine = (Engine) service.getContainer();
        engine.addChild(host);

        // Return the corresponding MBean name
        return (host.getObjectName().toString());
View Full Code Here

    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++) {
            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")) &&
            if ((connAddress==null) && port.equals(connPort)) {
                service.removeConnector(conns[i]);
                ((CoyoteConnector)conns[i]).destroy();
                break;
            }
            // } else if (address.equals(connAddress))
            if (port.equals(connPort)) {
                // Remove this component from its parent component
                service.removeConnector(conns[i]);
                ((CoyoteConnector)conns[i]).destroy();
                break;
            }
        }
View Full Code Here

    public void removeHost(String name) throws Exception {

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

        // Remove this component from its parent component
        engine.removeChild(host);
View Full Code Here

TOP

Related Classes of org.apache.catalina.Service

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.