KickJava   Java API By Example, From Geeks To Geeks.

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


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 * this class contains runtime information for the web bundle
30 * it was kept to be backward compatible with the schema2beans descriptors
31 * generated by iAS 7.0 engineering team.
32 *
33 * @author Jerome Dochez
34 */

35 public class ConstraintField extends RuntimeDescriptor
36 {
37     
38     static public final String JavaDoc VALUE = "Value"; // NOI18N
39
static public final String JavaDoc NAME = "Name";
40     static public final String JavaDoc SCOPE = "Scope";
41     static public final String JavaDoc MATCH_EXPR = "MatchExpr";
42     static public final String JavaDoc CACHE_ON_MATCH = "CacheOnMatch";
43     static public final String JavaDoc CACHE_ON_MATCH_FAILURE = "CacheOnMatchFailure";
44         
45     public ConstraintField(ConstraintField other)
46     {
47     super(other);
48     }
49
50     public ConstraintField()
51     {
52     setAttributeValue(SCOPE, "request.parameter");
53     setAttributeValue(CACHE_ON_MATCH, "true");
54     setAttributeValue(CACHE_ON_MATCH_FAILURE, "false");
55     }
56     
57     // This attribute is an array, possibly empty
58
public void setValue(int index, String JavaDoc value)
59     {
60     this.setValue(VALUE, index, value);
61     }
62     
63     //
64
public String JavaDoc getValue(int index)
65     {
66     return (String JavaDoc)this.getValue(VALUE, index);
67     }
68     
69     // This attribute is an array, possibly empty
70
public void setValue(String JavaDoc[] value)
71     {
72     this.setValue(VALUE, value);
73     }
74     
75     //
76
public String JavaDoc[] getValue()
77     {
78     return (String JavaDoc[])this.getValues(VALUE);
79     }
80     
81     // Return the number of properties
82
public int sizeValue()
83     {
84     return this.size(VALUE);
85     }
86     
87     // Add a new element returning its index in the list
88
public int addValue(String JavaDoc value)
89     {
90     int index = this.addValue(VALUE, value);
91     if (getAttributeValue(VALUE, index, MATCH_EXPR)==null)
92         setAttributeValue(VALUE, index, MATCH_EXPR, "equals");
93     if (getAttributeValue(VALUE, index, CACHE_ON_MATCH)==null)
94         setAttributeValue(VALUE, index, CACHE_ON_MATCH, "true");
95     if (getAttributeValue(VALUE, index, CACHE_ON_MATCH_FAILURE)==null)
96         setAttributeValue(VALUE, index, CACHE_ON_MATCH_FAILURE, "false");
97     return index;
98     }
99     
100     //
101
// Remove an element using its reference
102
// Returns the index the element had in the list
103
//
104
public int removeValue(String JavaDoc value)
105     {
106     return this.removeValue(VALUE, value);
107     }
108     
109     // This method verifies that the mandatory properties are set
110
public boolean verify()
111     {
112     return true;
113     }
114 }
115
Popular Tags