KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > resource > GlobalResourceDeployer


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
24 /*
25  * ResourceDeployer.java
26  *
27  * Created on December 12, 2003, 12:35 PM
28  */

29
30 package com.sun.enterprise.resource;
31
32 import com.sun.enterprise.Switch;
33 import com.sun.enterprise.config.serverbeans.ElementProperty;
34
35 /**
36  *
37  * @author Rob Ruyak
38  */

39 public abstract class GlobalResourceDeployer {
40     
41     /**
42      * Gets the application server Switch object for accessing env. objects.
43      * This is an internal method created to eliminate dependency for other
44      * methods. This enables one to develop unit tests for this class.
45      *
46      * @return Switch singleton containing appserver runtime objects.
47      */

48     Switch getAppServerSwitchObject() {
49         return Switch.getSwitch();
50     }
51     
52     /**
53      * Return an the element property names as an array of strings.
54      *
55      * @param props An array of ElementProperty objects.
56      * @return The names within the element as an array of strings.
57      */

58     String JavaDoc[] getPropNamesAsStrArr(ElementProperty [] props) {
59         if (props == null) {
60             return null;
61         } else {
62             String JavaDoc [] result = new String JavaDoc[props.length];
63             for(int i = 0; i < props.length; i++) {
64                 result[i] = props[i].getName();
65             }
66             return result;
67         }
68     }
69     
70     /**
71      * Return an the element property values as an array of strings.
72      *
73      * @param props An array of ElementProperty objects.
74      * @return The values within the element as an array of strings.
75      */

76     String JavaDoc[] getPropValuesAsStrArr(ElementProperty [] props) {
77         if (props == null) {
78             return null;
79         } else {
80             String JavaDoc [] result = new String JavaDoc[props.length];
81             for(int i = 0; i < props.length; i++) {
82                 result[i] = props[i].getValue();
83             }
84             return result;
85         }
86     }
87    
88 }
89
Popular Tags