KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > pluggable > ClientPluggableFeatureFactoryImpl


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.admin.pluggable;
24
25 import com.sun.enterprise.pluggable.PluggableFeatureFactoryBaseImpl;
26
27 import java.lang.reflect.InvocationHandler JavaDoc;
28 import java.lang.reflect.Method JavaDoc;
29 import java.lang.reflect.Proxy JavaDoc;
30 import java.util.Properties JavaDoc;
31 import java.util.logging.Level JavaDoc;
32 import java.util.logging.Logger JavaDoc;
33
34 /**
35  * An implementation of ClientPluggableFeatureFactory interface using dynamic
36  * proxies. This class does not directly implement the interface
37  * PluggableFeatureFactory, but an proxy instance implementing the interface
38  * can be obtained by a call to the static method getInstance(). In reality,
39  * this class implements InvocationHnalder interface used to handle method
40  * invocations on a dynamic proxy object.
41  */

42 public class ClientPluggableFeatureFactoryImpl extends PluggableFeatureFactoryBaseImpl {
43     /**
44      * Private constructor. The public instances of this object are not
45      * available. The instance of this class is however used as invocation
46      * handler for dynamic proxy returned by static method getInstance().
47      */

48     public ClientPluggableFeatureFactoryImpl(Logger JavaDoc logger) {
49         super(logger);
50     }
51
52     protected String JavaDoc getDefaultFeatureFactoryPropertyName() {
53         return System.getProperty(
54             ClientPluggableFeatureFactory.PLUGGABLE_FEATURES_PROPERTY_NAME);
55     }
56
57     protected Object JavaDoc createFeatureFactory(InvocationHandler JavaDoc handler) {
58         return Proxy.newProxyInstance(
59                 ClientPluggableFeatureFactory.class.getClassLoader(),
60                 new Class JavaDoc[] { ClientPluggableFeatureFactory.class },
61                 handler);
62     }
63 }
64
Popular Tags