KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jts > pi > OTSPolicyImpl


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  * Copyright 2004-2005 Sun Microsystems, Inc. All rights reserved.
26  * Use is subject to license terms.
27  */

28
29 package com.sun.jts.pi;
30
31 import org.omg.CORBA.Policy JavaDoc;
32 import org.omg.CORBA.LocalObject JavaDoc;
33
34 import org.omg.CosTransactions.ADAPTS;
35 import org.omg.CosTransactions.FORBIDS;
36 import org.omg.CosTransactions.REQUIRES;
37 import org.omg.CosTransactions.OTSPolicy;
38 import org.omg.CosTransactions.OTS_POLICY_TYPE;
39
40 /**
41  * This is the OTSPolicy object which holds an appropriate policy value.
42  *
43  * @author Ram Jeyaraman 11/11/2000
44  * @version 1.0
45  */

46 public class OTSPolicyImpl extends LocalObject JavaDoc implements OTSPolicy {
47
48     // class constants
49

50     public static OTSPolicy _ADAPTS = new OTSPolicyImpl(ADAPTS.value);
51     public static OTSPolicy _FORBIDS = new OTSPolicyImpl(FORBIDS.value);
52     public static OTSPolicy _REQUIRES = new OTSPolicyImpl(REQUIRES.value);
53
54     // instance variables
55

56     private short value = FORBIDS.value;
57
58     // constructor
59

60     public OTSPolicyImpl() {
61         this.value = FORBIDS.value;
62     }
63
64     public OTSPolicyImpl(short value) {
65         this.value = value;
66     }
67
68     // org.omg.CosTransactions.OTSPolicyOperations implementation
69

70     public short value() {
71         return this.value;
72     }
73
74     // org.omg.CORBA.PolicyOperations implementation
75

76     public int policy_type() {
77     return OTS_POLICY_TYPE.value;
78     }
79
80     public Policy JavaDoc copy() {
81     return new OTSPolicyImpl(this.value);
82     }
83
84     public void destroy() {
85     value = FORBIDS.value;
86     }
87
88     public String JavaDoc toString() {
89     return "OTSPolicy[" + this.value + "]";
90     }
91 }
92
Popular Tags