KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > management > config > HTTPAccessLogConfigFactory


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.enterprise.management.config;
24
25 import java.util.Map JavaDoc;
26 import java.util.Collections JavaDoc;
27
28 import javax.management.ObjectName JavaDoc;
29 import javax.management.AttributeList JavaDoc;
30
31
32 import com.sun.appserv.management.base.XTypes;
33 import com.sun.enterprise.management.config.AMXConfigImplBase;
34 import com.sun.enterprise.management.support.Delegate;
35 import com.sun.enterprise.management.support.oldconfig.OldVirtualServerMBean;
36 import com.sun.appserv.management.config.VirtualServerConfig;
37
38 import com.sun.appserv.management.util.misc.MapUtil;
39
40 /**
41     Configuration for the <virtual-server> element.
42 */

43
44
45 public final class HTTPAccessLogConfigFactory extends ConfigFactory
46 {
47     private final OldVirtualServerMBean mOldVirtualServerMBean;
48     
49         public
50     HTTPAccessLogConfigFactory(
51         final ConfigFactoryCallback callbacks )
52     {
53         super( callbacks );
54         
55         mOldVirtualServerMBean =
56             getOldConfigProxies().getOldVirtualServerMBean(
57                 getConfigName(), getContainerName() );
58     }
59
60     /** Key used in createHTTPAccessLog() */
61     public static final String JavaDoc LOG_DIRECTORY_KEY = "LogDirectory";
62     /** Key used in createHTTPAccessLog() */
63     public static final String JavaDoc IP_ONLY_KEY = "IPOnly";
64     
65     static private final Map JavaDoc<String JavaDoc,String JavaDoc> PARAM_NAME_OVERRIDES =
66         Collections.unmodifiableMap( MapUtil.newMap( IP_ONLY_KEY, "iponly" ) );
67         
68         protected Map JavaDoc<String JavaDoc,String JavaDoc>
69     getParamNameOverrides()
70     {
71         return( PARAM_NAME_OVERRIDES );
72     }
73     
74     /**
75      */

76         public ObjectName JavaDoc
77     create(
78         final boolean ipOnly,
79         final String JavaDoc logDirectory,
80         final Map JavaDoc<String JavaDoc,String JavaDoc> reserved )
81     {
82         final String JavaDoc[] requiredParams = new String JavaDoc[]
83         {
84             IP_ONLY_KEY, "" + ipOnly,
85             LOG_DIRECTORY_KEY, logDirectory,
86         };
87         
88         final Map JavaDoc<String JavaDoc,String JavaDoc> params = initParams( requiredParams, reserved );
89
90         final ObjectName JavaDoc amxName = createChild( params );
91         
92         return( amxName );
93     }
94
95
96         protected void
97     internalRemove( final ObjectName JavaDoc objectName)
98     {
99         mOldVirtualServerMBean.removeHttpAccessLog();
100     }
101
102         protected ObjectName JavaDoc
103     createOldChildConfig( final AttributeList JavaDoc attrs )
104     {
105         return( mOldVirtualServerMBean.createHttpAccessLog( attrs ) );
106     }
107 }
108
109
110
111
112
Popular Tags