Package com.sun.enterprise.config.serverbeans

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


        Engine[] engines = _embedded.getEngines();
        String docroot = null;
        MimeMap mm = null;
        String vs_id = vse.getId();

        ElementProperty element = vse.getElementPropertyByName("docroot");
        if (element != null) {
            docroot = element.getValue();
        } else {
            docroot = vse.getDocroot();
        }
       
        validateDocroot(docroot,
                        vs_id,
                        vse.getDefaultWebModule());

        VirtualServer vs = createVS(vs_id, vse, docroot,
                                    vse.getLogFile(), mm,
                                    httpService.getHttpProtocol());

        // cache control
        ElementProperty cacheProp = vse.getElementPropertyByName(
                                                    "setCacheControl");
        if ( cacheProp != null ){
            vs.configureCacheControl(cacheProp.getValue());  
        }

        PEAccessLogValve accessLogValve = vs.getAccessLogValve();
        boolean startAccessLog = accessLogValve.configure(
            vs_id, vse, httpService, domain, instance,
View Full Code Here


        /*
         * Update each virtual server with the sso-enabled and
         * access logging related properties of the updated http-service
         */ 
        ElementProperty ssoEnabled = null;
        ElementProperty accessLoggingEnabled = null;
        ElementProperty accessLogWriteInterval = null;
        ElementProperty accessLogBufferSize = null;
        ElementProperty[] props = httpService.getElementProperty();
        if (props != null) {
            for (int i=0; i<props.length; i++) {
                if (Constants.SSO_ENABLED.equals(props[i].getName())) {
                    ssoEnabled = props[i];
                    globalSSOEnabled = ConfigBean.toBoolean(
                            props[i].getValue());
                } else if (Constants.ACCESS_LOGGING_ENABLED.equals(
                                props[i].getName())) {
                    accessLoggingEnabled = props[i];
                    globalAccessLoggingEnabled = ConfigBean.toBoolean(
                                props[i].getValue());
                } else if (Constants.ACCESS_LOG_WRITE_INTERVAL_PROPERTY.equals(
                                props[i].getName())) {
                    accessLogWriteInterval = props[i];
                    globalAccessLogWriteInterval = props[i].getValue();
                } else if (Constants.ACCESS_LOG_BUFFER_SIZE_PROPERTY.equals(
                                props[i].getName())) {
                    accessLogBufferSize = props[i];
                    globalAccessLogBufferSize = props[i].getValue();
                }
            }
        }

        com.sun.enterprise.config.serverbeans.VirtualServer[] virtualServers =
            httpService.getVirtualServer();
        if (virtualServers != null
                && (ssoEnabled != null || accessLoggingEnabled != null
                    || accessLogWriteInterval != null
                    || accessLogBufferSize != null)) {
            for (int i=0; i<virtualServers.length; i++) {
                if (ssoEnabled != null) {
                    updateHostProperties(virtualServers[i],
                                         ssoEnabled.getName(),
                                         ssoEnabled.getValue(),
                                         httpService,
                                         null);
                }
                if (accessLoggingEnabled != null) {
                    updateHostProperties(virtualServers[i],
                                         accessLoggingEnabled.getName(),
                                         accessLoggingEnabled.getValue(),
                                         httpService,
                                         null);
                }
                if (accessLogWriteInterval != null) {
                    updateHostProperties(virtualServers[i],
                                         accessLogWriteInterval.getName(),
                                         accessLogWriteInterval.getValue(),
                                         httpService,
                                         null);
                }
                if (accessLogBufferSize != null) {
                    updateHostProperties(virtualServers[i],
                                         accessLogBufferSize.getName(),
                                         accessLogBufferSize.getValue(),
                                         httpService,
                                         null);
                }
            }
        }
View Full Code Here

    {
        sLogger.log(Level.FINEST, MSG_BASE_GET_PROPERTY, propertyName);

        ConfigBean baseBean = getBaseConfigBean();
        Class cl = baseBean.getClass();
        ElementProperty prop;
        try
        {
           Method method = cl.getDeclaredMethod("getElementPropertyByName", new Class[]{Class.forName("java.lang.String")});
           prop = (ElementProperty)method.invoke(baseBean, new Object[]{propertyName});
        }
        catch (Exception e)
        {
      String msg = localStrings.getString( "admin.server.core.mbean.config.getattribute.undefined_properties_in_base_element", propertyName );
            throw new MBeanException(new MBeanConfigException( msg ));
        }
        if(prop==null) {
      String msg = localStrings.getString( "admin.server.core.mbean.config.getattribute_properties_not_found_in_base_element", propertyName );
            throw new MBeanException(new MBeanConfigException( msg ));
    }
        return prop.getValue();
    }
View Full Code Here

        sLogger.log(Level.FINEST, MSG_BASE_SET_PROPERTY, new Object[]{propertyName, value});
       
        ConfigBean baseBean = getBaseConfigBean();

        Class cl = baseBean.getClass();
        ElementProperty prop;
        try
        {
           Method method = cl.getDeclaredMethod("getElementPropertyByName", new Class[]{Class.forName("java.lang.String")});
           prop = (ElementProperty)method.invoke(baseBean, new Object[]{propertyName});
        }
        catch (Exception e)
        {
      String msg = localStrings.getString( "admin.server.core.mbean.config.setattribute_undefined_properties_in_base_element", propertyName );
            throw new MBeanException(new MBeanConfigException( msg ));
        }
        if(prop==null && value!=null && (bAllowsEmptyValue || !value.equals("")))
        {
            prop = new ElementProperty();
            prop.setName(propertyName);
            prop.setValue(value);
            try
            {
                Method method = cl.getDeclaredMethod("addElementProperty", new Class[]{prop.getClass()});
                method.invoke(baseBean, new Object[]{prop});
            }
            catch (Exception e)
            {
        String msg = localStrings.getString( "admin.server.core.mbean.config.setproperty_invoke_error", propertyName );
                throw new MBeanException(new MBeanConfigException( msg ));
            }
        }
        else
        {
            if(value==null || (!bAllowsEmptyValue && value.equals("")))
            {
                try
                {
                    Method method = cl.getDeclaredMethod("removeElementProperty", new Class[]{prop.getClass()});
                    method.invoke(baseBean, new Object[]{prop});
                }
                catch (Exception e)
                {
          String msg = localStrings.getString( "admin.server.core.mbean.config.setproperty_could_not_remove_propery", propertyName );
                    throw new MBeanException(new MBeanConfigException( msg ));
                }
            }
            else
                prop.setValue(value);
        }
       
        try
        {
            m_configContext.flush();
View Full Code Here

                event.getConfigChangeList();
            HttpListener httpBean = null;
            String xpath = null;
            String parentXpath = null;
            Object object;
            ElementProperty elementProperty = null;

            for (int i=0; i < configChangeList.size(); i++){
                configChange = configChangeList.get(i);
                xpath = configChange.getXPath();
                if (xpath != null) {
View Full Code Here

            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;
           
            for (int i=0; i < configChangeList.size(); i++){
                configObject = configChangeList.get(i);

                if ( configObject instanceof ConfigAdd) {
                    configAdd = (ConfigAdd)configObject;
                    xpath = configAdd.getXPath();
                    if( xpath != null){
                        object = configContext.exactLookup(xpath);

                        if ( object instanceof VirtualServer){
                            vsBean = (VirtualServer)object;
                            webContainer.createHost(vsBean,configContext,true);
                        } else if (object instanceof ElementProperty) {
                            xpath = xpath.substring(0,xpath.lastIndexOf("/"));
                            vsBean = (VirtualServer)configContext.exactLookup(xpath);                      
                            elementProperty = (ElementProperty)object;
                            webContainer.updateHostProperties(
                                       vsBean,
                                       elementProperty.getName(),
                                       elementProperty.getValue(),
                                       config.getHttpService(),
                                       config.getSecurityService());
                        }
                    }
                }
View Full Code Here

                event.getConfigChangeList();
            VirtualServer vsBean = null;
            String xpath = null;
            String parentXpath = null;
            Server serverBean = ServerBeansFactory.getServerBean(configContext);
            ElementProperty elementProperty = null;
            Object object;          

            for (int i=0; i < configChangeList.size(); i++){
                configChange = configChangeList.get(i);
               
                xpath = configChange.getXPath();
                if (xpath != null) {
                    object = configContext.exactLookup(xpath);
                    if (object != null) {
                        if ( object instanceof VirtualServer){
                            webContainer.updateHost((VirtualServer)object,
                                                    config.getHttpService(),
                                                    serverBean);
                        } else if (object instanceof ElementProperty) {
                            // Property has been added or updated
                            parentXpath = configChange.getParentXPath();
                            if (parentXpath == null) {
                                parentXpath =
                                    xpath.substring(0, xpath.lastIndexOf("/"));
                            }
                            vsBean = (VirtualServer)
                                configContext.exactLookup(parentXpath);
                            elementProperty = (ElementProperty)object;
                            webContainer.updateHostProperties(
                                       vsBean,
                                       elementProperty.getName(),
                                       elementProperty.getValue(),
                                       config.getHttpService(),
                                       config.getSecurityService());
                        }

                    } else {
View Full Code Here

            Config cfg = ServerBeansFactory.getConfigBean(_configContext);
            logService = cfg.getLogService();
            initLogLevel(logService);
            initMonitoringLevel(cfg.getMonitoringService());

            ElementProperty maxDepth
                = ServerBeansFactory.getWebContainerBean(_configContext).getElementPropertyByName(DISPATCHER_MAX_DEPTH);
            if (maxDepth != null && maxDepth.getValue() != null) {

                int depth = -1;
                try {
                    depth = Integer.parseInt(maxDepth.getValue());
                } catch (Exception e) {}

                if (depth > 0) {
                    CoyoteRequest.setMaxDispatchDepth(depth);
                    if (_logger.isLoggable(Level.FINE)) {
                        _logger.fine("Maximum depth for nested request "
                                     + "dispatches set to "
                                     + maxDepth.getValue());
                    }
                }
            }

        } catch (ConfigException e) {
View Full Code Here

                em.setName(moduleName);
                       
                // If the bundle descriptor has no context root, then
                // its not a converged app. There is no contextRoot set.
                try {
                    ElementProperty isConvergedProperty = new ElementProperty();
                    isConvergedProperty.setName("isConverged");
                    if(wbd.getContextRoot() != null) {
                        ElementProperty contextRootProperty =
                            new ElementProperty();
                        contextRootProperty.setName("contextRoot");
                        contextRootProperty.setValue(wbd.getContextRoot());
                        isConvergedProperty.setValue("true");
                        em.addElementProperty(contextRootProperty);
                        em.addElementProperty(isConvergedProperty);
                    } else {
                        isConvergedProperty.setValue("false");
View Full Code Here

        String eventName = "*";
        String ipAddress = "*";
        String callerPrincipal = "*";
        String componentName = "*";
        for( int i = 0; i < properties.length; i++ ){
            ElementProperty property = properties[i];
            String propertyName = property.getName( ).toLowerCase( );
            if( propertyName.equals(PROPERTY_TRACE_NAME)) {
                eventName = "trace." + property.getValue( ).toLowerCase( );
                if (!TraceEvent.isValidType(eventName))
                    throw new IllegalArgumentException(
                            sm.getString(PROPERTY_TRACE_NAME,
                            "selfmgmt_event.invalid_event_property",EVENT_TRACE));
            }
            if(propertyName.equals(PROPERTY_TRACE_IPADDRESS)) {
                ipAddress = property.getValue( ).toLowerCase( );
            }
            if(propertyName.equals(PROPERTY_TRACE_CALLERPRINCIPAL)) {
                callerPrincipal  = property.getValue( ).toLowerCase( );
            }
            if(propertyName.equals(PROPERTY_TRACE_COMPONENTNAME)) {
                componentName  = property.getValue( ).toLowerCase( );
            }
        }
        return new TraceEvent(eventName,
                   new TraceEventNotificationFilter(eventName, ipAddress, callerPrincipal, componentName),
                   description);
View Full Code Here

TOP

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

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.