KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployment > runtime > web > WebPropertyContainer


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 package com.sun.enterprise.deployment.runtime.web;
25
26 import com.sun.enterprise.deployment.runtime.RuntimeDescriptor;
27
28 /**
29 * Interface for all web property containers
30 *
31 * @author Jerome Dochez
32 */

33 public class WebPropertyContainer extends RuntimeDescriptor {
34     
35     static public final String JavaDoc NAME = "Name"; // NOI18N
36
static public final String JavaDoc VALUE = "Value"; // NOI18N
37
static public final String JavaDoc PROPERTY = "WebProperty"; // NOI18N
38

39     // copy constructor
40
public WebPropertyContainer(WebPropertyContainer other)
41     {
42     super(other);
43     }
44
45     // constructor
46
public WebPropertyContainer()
47     {
48     super();
49     }
50
51     // This attribute is an array, possibly empty
52
public void setWebProperty(int index, WebProperty value)
53     {
54     this.setValue(PROPERTY, index, value);
55     }
56     
57     //
58
public WebProperty getWebProperty(int index)
59     {
60     return (WebProperty)this.getValue(PROPERTY, index);
61     }
62     
63     // This attribute is an array, possibly empty
64
public void setWebProperty(WebProperty[] value)
65     {
66     this.setValue(PROPERTY, value);
67     }
68     
69     //
70
public WebProperty[] getWebProperty()
71     {
72     WebProperty[] props = (WebProperty[])this.getValues(PROPERTY);
73         if (props==null) {
74             return new WebProperty[0];
75         } else {
76             return props;
77         }
78     }
79     
80     // Return the number of properties
81
public int sizeWebProperty()
82     {
83     return this.size(PROPERTY);
84     }
85     
86     // Add a new element returning its index in the list
87
public int addWebProperty(WebProperty value)
88     {
89     return this.addValue(PROPERTY, value);
90     }
91     
92     //
93
// Remove an element using its reference
94
// Returns the index the element had in the list
95
//
96
public int removeWebProperty(WebProperty value)
97     {
98     return this.removeValue(PROPERTY, value);
99     }
100     
101     // This method verifies that the mandatory properties are set
102
public boolean verify()
103     {
104     return true;
105     }
106 }
107
Popular Tags