Package org.apache.catalina.core

Examples of org.apache.catalina.core.StandardEngine


        String hostName = oname.getKeyProperty("host");
       
        String path = oname.getKeyProperty("path");
        Server server = ServerFactory.getServer();
        Service service = server.findService(serviceName);
        StandardEngine engine = (StandardEngine) service.getContainer();
        if (hostName == null) {             // if logger's container is Engine
            Logger logger = engine.getLogger();
            Container container = logger.getContainer();
            if (container instanceof StandardEngine) {
                String sname =
                    ((StandardEngine)container).getService().getName();
                if (sname.equals(serviceName)) {
                    engine.setLogger(null);
                }
            }
        } else if (path == null) {      // if logger's container is Host
            StandardHost host = (StandardHost) engine.findChild(hostName);
            Logger logger = host.getLogger();
            Container container = logger.getContainer();
            if (container instanceof StandardHost) {
                String hn = ((StandardHost)container).getName();
                StandardEngine se =
                    (StandardEngine) ((StandardHost)container).getParent();
                String sname = se.getService().getName();
                if (sname.equals(serviceName) && hn.equals(hostName)) {
                    host.setLogger(null);
                }
            }
        } else {                // logger's container is Context
            StandardHost host = (StandardHost) engine.findChild(hostName);
            path = getPathStr(path);
            StandardContext context = (StandardContext) host.findChild(path);
            Logger logger = context.getLogger();
            Container container = logger.getContainer();
            if (container instanceof StandardContext) {
                String pathName = ((StandardContext)container).getName();
                StandardHost sh =
                    (StandardHost)((StandardContext)container).getParent();
                String hn = sh.getName();;
                StandardEngine se = (StandardEngine)sh.getParent();
                String sname = se.getService().getName();
                if ((sname.equals(serviceName) && hn.equals(hostName)) &&
                        pathName.equals(path)) {
                    context.setLogger(null);
                }
            }
View Full Code Here


        String serviceName = oname.getKeyProperty("service");
        String hostName = oname.getKeyProperty("host");
        String path = oname.getKeyProperty("path");
        Server server = ServerFactory.getServer();
        Service service = server.findService(serviceName);
        StandardEngine engine = (StandardEngine) service.getContainer();
        if (hostName == null) {             // if realm's container is Engine
            Realm realm = engine.getRealm();
            Container container = realm.getContainer();
            if (container instanceof StandardEngine) {
                String sname =
                    ((StandardEngine)container).getService().getName();
                if (sname.equals(serviceName)) {
                    engine.setRealm(null);
                }
            }
        } else if (path == null) {      // if realm's container is Host
            StandardHost host = (StandardHost) engine.findChild(hostName);
            Realm realm = host.getRealm();
            Container container = realm.getContainer();
            if (container instanceof StandardHost) {
                String hn = ((StandardHost)container).getName();
                StandardEngine se =
                    (StandardEngine) ((StandardHost)container).getParent();
                String sname = se.getService().getName();
                if (sname.equals(serviceName) && hn.equals(hostName)) {
                    host.setRealm(null);
                }
            }
        } else {                // realm's container is Context
            StandardHost host = (StandardHost) engine.findChild(hostName);
            path = getPathStr(path);
            StandardContext context = (StandardContext) host.findChild(path);
            Realm realm = context.getRealm();
            Container container = realm.getContainer();
            if (container instanceof StandardContext) {
                String pathName = ((StandardContext)container).getName();
                StandardHost sh =
                    (StandardHost)((StandardContext)container).getParent();
                String hn = sh.getName();;
                StandardEngine se = (StandardEngine)sh.getParent();
                String sname = se.getService().getName();
                if ((sname.equals(serviceName) && hn.equals(hostName)) &&
                        pathName.equals(path)) {
                    context.setRealm(null);
                }
            }
View Full Code Here

        String hostName = oname.getKeyProperty("host");
        String path = oname.getKeyProperty("path");
        String sequence = oname.getKeyProperty("sequence");
        Server server = ServerFactory.getServer();
        Service service = server.findService(serviceName);
        StandardEngine engine = (StandardEngine) service.getContainer();
        if (hostName == null) {             // if valve's container is Engine
            Valve [] valves = engine.getValves();
            for (int i = 0; i < valves.length; i++) {
                Container container = ((ValveBase)valves[i]).getContainer();
                if (container instanceof StandardEngine) {
                    String sname =
                        ((StandardEngine)container).getService().getName();
                    Integer sequenceInt = new Integer(valves[i].hashCode());
                    if (sname.equals(serviceName) &&
                        sequence.equals(sequenceInt.toString())){
                        engine.removeValve(valves[i]);
                        break;
                    }
                }
            }
        } else if (path == null) {      // if valve's container is Host
            StandardHost host = (StandardHost) engine.findChild(hostName);
            Valve [] valves = host.getValves();
            for (int i = 0; i < valves.length; i++) {
                Container container = ((ValveBase)valves[i]).getContainer();
                if (container instanceof StandardHost) {
                    String hn = ((StandardHost)container).getName();
                    StandardEngine se =
                        (StandardEngine) ((StandardHost)container).getParent();
                    String sname = se.getService().getName();
                    Integer sequenceInt = new Integer(valves[i].hashCode());
                    if ((sname.equals(serviceName) && hn.equals(hostName)) &&
                        sequence.equals(sequenceInt.toString())){
                        host.removeValve(valves[i]);
                        break;
                    }
                }
            }
        } else {                // valve's container is Context
            StandardHost host = (StandardHost) engine.findChild(hostName);
            path = getPathStr(path);
            StandardContext context = (StandardContext) host.findChild(path);
            Valve [] valves = context.getValves();
            for (int i = 0; i < valves.length; i++) {
                Container container = ((ValveBase)valves[i]).getContainer();
                if (container instanceof StandardContext) {
                    String pathName = ((StandardContext)container).getName();
                    StandardHost sh =
                        (StandardHost)((StandardContext)container).getParent();
                    String hn = sh.getName();;
                    StandardEngine se = (StandardEngine)sh.getParent();
                    String sname = se.getService().getName();
                    Integer sequenceInt = new Integer(valves[i].hashCode());
                    if (((sname.equals(serviceName) && hn.equals(hostName)) &&
                        pathName.equals(path)) &&
                        sequence.equals(sequenceInt.toString())){
                        context.removeValve(valves[i]);
View Full Code Here

        this.initialized = true;

        if( oname == null && (container instanceof StandardEngine)) {
            try {
                // we are loaded directly, via API - and no name was given to us
                StandardEngine cb=(StandardEngine)container;
                oname = createObjectName(cb.getName(), "Connector");
                Registry.getRegistry(null, null)
                    .registerComponent(this, oname, null);
            } catch (Exception e) {
                log ("Error registering connector " + e.toString());
            }
View Full Code Here

        this.initialized = true;

        if( oname == null && (container instanceof StandardEngine)) {
            try {
                // we are loaded directly, via API - and no name was given to us
                StandardEngine cb=(StandardEngine)container;
                String encodedAddr = null;
                if (getAddress() != null) {
                    encodedAddr = URLEncoder.encode(getAddress());
                }
                String addSuffix=(getAddress()==null) ?"": ",address=" + encodedAddr;
                oname=new ObjectName(cb.getName() + ":type=Connector,port="+
                        getPort() + addSuffix);
                Registry.getRegistry(null, null)
                    .registerComponent(this, oname, null);
                controller=oname;
            } catch (Exception e) {
View Full Code Here

    public Engine createEngine() {

        if( log.isDebugEnabled() )
            log.debug("Creating engine");

        StandardEngine engine = new StandardEngine();

        engine.setDebug(debug);
        // Default host will be set to the first host added
        engine.setLogger(logger);       // Inherited by all children
        engine.setRealm(realm);         // Inherited by all children

        return (engine);

    }
View Full Code Here

        throws Exception {
       
        String type = pname.getKeyProperty("type");
        if (type.equals("DefaultContext")) {
            Service service = getService(pname);
            StandardEngine engine = (StandardEngine) service.getContainer();
            String hostName = pname.getKeyProperty("host");
            if (hostName!=null) {
                StandardHost host =
                    (StandardHost) engine.findChild(hostName);
                return host.getDefaultContext();
            } else {
                return engine.getDefaultContext();
            }
        }
        return null;
    }
View Full Code Here

        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);
            String path = name.substring(i);
            Host host = (Host) engine.findChild(hostName);
            String pathStr = getPathStr(path);
            StandardContext context = (StandardContext)host.findChild(pathStr);
            return context;
        } else if (type != null) {
            if (type.equals("Engine")) {
                return engine;
            } else if (type.equals("Host")) {
                String hostName = pname.getKeyProperty("host");
                StandardHost host = (StandardHost) engine.findChild(hostName);
                return host;
            }
        }
        return null;
       
View Full Code Here

        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
            StandardHost host = (StandardHost) engine.findChild(hostName);
            return host;
        } else {               
            // child's container is Context
            StandardHost host = (StandardHost) engine.findChild(hostName);
            path = getPathStr(path);
            StandardContext context = (StandardContext) host.findChild(path);
            return context;
        }
    }
View Full Code Here

        // 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);
View Full Code Here

TOP

Related Classes of org.apache.catalina.core.StandardEngine

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.