Package com.sun.enterprise.config.serverbeans

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


        List httpListeners = new ArrayList();
        if (virtualServers==null) {
            vServers = httpService.getVirtualServer();
            if (vServers!=null) {
                for (int i=0;i<vServers.length;i++) {
                    VirtualServer vs = vServers[i];
                    // admin virtual server does not count
                    if (vs.getId().equals(com.sun.enterprise.web.VirtualServer.ADMIN_VS))
                        continue;
                   
                    String httpListenersString = vs.getHttpListeners();
                    if (httpListenersString!=null) {
                        String[] httpListenerIDs = httpListenersString.split(",");
                        if (httpListenerIDs!=null) {
                            for (int j=0;j<httpListenerIDs.length;j++) {
                                httpListeners.add(httpService.getHttpListenerById(httpListenerIDs[j]));
                            }
                        }
                    }
                }
            }
        } else {
            String virtualServerNames[] = virtualServers.split(",");
            if (virtualServerNames!=null) {
                for (int i=0;i<virtualServerNames.length;i++) {
                    VirtualServer vs = httpService.getVirtualServerById(virtualServerNames[i]);
                    String httpListenersString = vs.getHttpListeners();
                    if (httpListenersString!=null) {
                        String[] httpListenerIDs = httpListenersString.split(",");
                        if (httpListenerIDs!=null) {
                            for (int j=0;j<httpListenerIDs.length;j++) {
                                httpListeners.add(httpService.getHttpListenerById(httpListenerIDs[i]));
View Full Code Here


            Config config  = (Config) ConfigBeansFactory.getConfigBeanByXPath(
                getConfigContext(), ServerXPathHelper.XPATH_CONFIG);
            HttpService httpService = config.getHttpService();
            VirtualServer[] virtualServers = httpService.getVirtualServer();
            for (int j = 0; j < virtualServers.length; j++) {
                VirtualServer aServer   = virtualServers[j];
                String defWebModule     = aServer.getDefaultWebModule();
                if ((defWebModule != null) &&
                (defWebModule.equals(webModuleName))) {
                    virtualServerIds.add(aServer.getId());
                }
            }
        } catch (Exception e) {
            throw new IASDeploymentException(e);
        }      
View Full Code Here

            }
        } else if (choice.equals(StaticTest.UPDATE)) {
            if (cce.getName().equals("enabled") && ConfigBean.toBoolean((String) cce.getObject())){
                final HttpListener h = (HttpListener) cce.getClassObject();
                final Config c = (Config) ((HttpService) h.parent()).parent();
                final VirtualServer vs = getDefaultVirtualServer(h.getDefaultVirtualServer(), c);
                if (null != vs && !vs.getState().equals("on")){
                    result.failed(smh.getLocalString(getClass().getName() + ".cannotUpdateVSNotOn",
                                                     "Cannot enable this HttpListener \"{0}\" because its virtual server \"{1}\" has a state other than \"on\" ({2})",
                                                     new Object[]{h.getId(), vs.getId(), vs.getState()}));
                                                    
                }
            } else if (ServerTags.ENABLED.equals(cce.getName()) && ! ConfigBean.toBoolean((String) cce.getObject())) {
                final HttpListener h = (HttpListener) cce.getClassObject();
                if (com.sun.enterprise.config.serverbeans.ServerHelper.ADMIN_HTTP_LISTNER_ID.equals(h.getId())) {
View Full Code Here

       
        return result;
    }

    private final boolean isVirtualServerOn(final HttpListener h, final Config c, final Result result){
        final VirtualServer vs = getDefaultVirtualServer(h.getDefaultVirtualServer(), c);
        return (null != vs && vs.getState().equals("on"));
    }
View Full Code Here

    public Result validate(ConfigContextEvent cce) {
        Result result = super.validate(cce); // Before doing custom validation do basic validation
        try{
            if(cce.getChoice().equals(StaticTest.ADD) || cce.getChoice().equals(StaticTest.VALIDATE)) {
                ConfigContext context = cce.getConfigContext();
                VirtualServer virtual =  (VirtualServer) cce.getValidationTarget();
          
                    // For an ADD operation the virtual server is being
                    // added to an http-service, which is the
                    // configcontextevents class object. Therefore the config is
                    // the parent of the class object:
                final Config config = (Config) ((HttpService) cce.getClassObject()).parent();
                validateAttribute(ServerTags.HTTP_LISTENERS,virtual.getHttpListeners(),config, result);
                //validateAttribute(ServerTags.HOSTS,virtual.getHosts(),config, result);
            } else if(cce.getChoice().equals("UPDATE")) {
                    // For an UPDATE operation the class object is the
                    // virtual server whose attributes are being
                    // updated. Therefore the config is the parent of the
                    // parent of this object:
                final VirtualServer vs = (VirtualServer) cce.getClassObject();
                final Config config = (Config) vs.parent().parent();
                String name = cce.getName();
                String value = (String) cce.getObject();
                validateAttribute(name,value,config, result);
                    // IF the state is being turned off then this can only
                    // occur if there's no http-listener which has this
View Full Code Here

        //ms1  Server rootElement = ServerBeansFactory.getServerBean(context);
        Config config  = (Config) ConfigBeansFactory.getConfigBeanByXPath(getConfigContext(),ServerXPathHelper.XPATH_CONFIG);
        HttpService httpService = config.getHttpService();
        VirtualServer[] virtualServers = httpService.getVirtualServer();
        for (int j = 0; j < virtualServers.length; j++) {
            VirtualServer aServer   = virtualServers[j];
            String defWebModule     = aServer.getDefaultWebModule();
            if ((defWebModule != null) &&
            (defWebModule.equals(webModuleName))) {
                virtualServerIds.add(aServer.getId());
            }
        }

        if (!virtualServerIds.isEmpty()) {
            throw new ConfigException(localStrings.getString(
View Full Code Here

        return listener;
    }

    protected VirtualServer getVirtualServer(String id) throws ConfigException
    {
        VirtualServer vs = config.getHttpService().getVirtualServerById(id);
        checkArg(vs, strMgr.getString("http_listener_vs_assoc_mgr.no_such_element", id));
        return vs;
    }
View Full Code Here

                                   
            if ( config == null) return;
           
            ConfigAdd configAdd = null;
            ArrayList configChangeList = event.getConfigChangeList();
            VirtualServer vsBean = null;
            String xpath = null;
            Server serverBean = ServerBeansFactory.getServerBean(configContext);
            ElementProperty elementProperty = null;
            Object object;
            Object configObject;
View Full Code Here

            if ( config == null) return;
           
            ConfigChange configChange = null;
            ArrayList<ConfigChange> configChangeList =
                event.getConfigChangeList();
            VirtualServer vsBean = null;
            String xpath = null;
            String parentXpath = null;
            Server serverBean = ServerBeansFactory.getServerBean(configContext);
            ElementProperty elementProperty = null;
            Object object;          
View Full Code Here

            final ContainerMapper containerMapper = new ContainerMapper(grizzlyService, this);
            containerMapper.setMapper(mapper);
            containerMapper.setDefaultHost(http.getDefaultVirtualServer());
            containerMapper.configureMapper();

            VirtualServer vs = null;
            String webAppRootPath = null;

            final Collection<VirtualServer> list = grizzlyService.getHabitat().getAllServices(VirtualServer.class);
            final String vsName = http.getDefaultVirtualServer();
            for (final VirtualServer virtualServer : list) {
                if (virtualServer.getId().equals(vsName)) {
                    vs = virtualServer;
                    webAppRootPath = vs.getDocroot();

                    if (!grizzlyService.hasMapperUpdateListener() && vs.getProperty() != null
                            && !vs.getProperty().isEmpty()) {
                        for (final Property p : vs.getProperty()) {
                            final String propertyName = p.getName();
                            if (propertyName.startsWith("alternatedocroot")) {
                                String value = p.getValue();
                                String[] mapping = value.split(" ");
View Full Code Here

TOP

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

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.