KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jorm > naming > lib > BasicPName


1 /**
2  * JORM: an implementation of a generic mapping system for persistent Java
3  * objects. Two mapping are supported: to RDBMS and to binary files.
4  * Copyright (C) 2001-2003 France Telecom R&D - INRIA
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  * Contact: jorm-team@objectweb.org
21  *
22  */

23
24 package org.objectweb.jorm.naming.lib;
25
26 import java.math.BigDecimal JavaDoc;
27 import java.math.BigInteger JavaDoc;
28 import java.util.Date JavaDoc;
29
30 import org.objectweb.jorm.api.PException;
31 import org.objectweb.jorm.naming.api.PExceptionNaming;
32 import org.objectweb.jorm.naming.api.PName;
33 import org.objectweb.jorm.naming.api.PNameManager;
34 import org.objectweb.jorm.naming.api.PNamingContext;
35 import org.objectweb.jorm.type.api.PType;
36
37 /**
38  * This basic implementation of a PName delegates all calls to its methods
39  * to the PNamingContext it references. The only calls that are not delegated are
40  * calls to isNull, getPNamingContext.
41  * @author P. D?chamboux
42  */

43 public abstract class BasicPName implements PName {
44
45     
46     public String JavaDoc toString() {
47         return super.toString()
48                 + " / pnc: " + (pnc == null
49                 ? "no assigned "
50                 : (pnc.getPType() == null
51                 ? "null PType"
52                 : pnc.getPType().getJormName()));
53     }
54
55     /**
56      * The PNamingContext that manages this PName
57      */

58     protected transient PNameManager pnc = null;
59     
60     public void setPNamingContext(PNamingContext pnc) {
61         this.pnc = pnc;
62     }
63
64     public boolean codingSupported(int codingtype) {
65         return pnc.codingSupported(codingtype);
66     }
67
68     public byte[] encode() throws PExceptionNaming {
69         return pnc.encode(this);
70     }
71
72     public Object JavaDoc encodeAbstract() throws PExceptionNaming, UnsupportedOperationException JavaDoc {
73         return pnc.encodeAbstract(this);
74     }
75
76     public byte encodeByte() throws PExceptionNaming, UnsupportedOperationException JavaDoc {
77         return pnc.encodeByte(this);
78     }
79
80     public Byte JavaDoc encodeObyte() throws PExceptionNaming, UnsupportedOperationException JavaDoc {
81         return pnc.encodeObyte(this);
82     }
83
84     public char encodeChar() throws PExceptionNaming, UnsupportedOperationException JavaDoc {
85         return pnc.encodeChar(this);
86     }
87
88     public Character JavaDoc encodeOchar() throws PExceptionNaming, UnsupportedOperationException JavaDoc {
89         return pnc.encodeOchar(this);
90     }
91
92     public int encodeInt() throws PExceptionNaming, UnsupportedOperationException JavaDoc {
93         return pnc.encodeInt(this);
94     }
95
96     public Integer JavaDoc encodeOint() throws PExceptionNaming, UnsupportedOperationException JavaDoc {
97         return pnc.encodeOint(this);
98     }
99
100     public long encodeLong() throws PExceptionNaming, UnsupportedOperationException JavaDoc {
101         return pnc.encodeLong(this);
102     }
103
104     public Long JavaDoc encodeOlong() throws PExceptionNaming, UnsupportedOperationException JavaDoc {
105         return pnc.encodeOlong(this);
106     }
107
108     public short encodeShort() throws PExceptionNaming, UnsupportedOperationException JavaDoc {
109         return pnc.encodeShort(this);
110     }
111
112     public Short JavaDoc encodeOshort() throws PExceptionNaming, UnsupportedOperationException JavaDoc {
113         return pnc.encodeOshort(this);
114     }
115
116     public String JavaDoc encodeString() throws PExceptionNaming {
117         return pnc.encodeString(this);
118     }
119
120     public char[] encodeCharArray() throws PExceptionNaming {
121         return pnc.encodeCharArray(this);
122     }
123
124     public Date JavaDoc encodeDate() throws PExceptionNaming {
125         return pnc.encodeDate(this);
126     }
127
128     public BigInteger JavaDoc encodeBigInteger() throws PExceptionNaming {
129         return pnc.encodeBigInteger(this);
130     }
131
132     public BigDecimal JavaDoc encodeBigDecimal() throws PExceptionNaming {
133         return pnc.encodeBigDecimal(this);
134     }
135
136     public PName export(Object JavaDoc conn, PNamingContext pnc) throws PException {
137         return pnc.export(conn, this);
138     }
139
140     public PName export(Object JavaDoc conn, PNamingContext pnc, Object JavaDoc hints)
141             throws PException {
142         return pnc.export(conn, this, hints);
143     }
144
145     public PNameManager getPNameManager() {
146         return pnc;
147     }
148
149     public PType getPType() {
150         return pnc.getPType();
151     }
152
153     public PName resolve(Object JavaDoc conn) throws UnsupportedOperationException JavaDoc, PException {
154         if (pnc instanceof PNamingContext) {
155             return ((PNamingContext) pnc).resolve(conn, this);
156         }
157         throw new UnsupportedOperationException JavaDoc();
158     }
159
160     public void unexport(Object JavaDoc conn) throws PException {
161         pnc.unexport(conn, this);
162     }
163
164     public void unexport(Object JavaDoc conn, Object JavaDoc hints) throws PException {
165         pnc.unexport(conn, this, hints);
166     }
167 }
168
Popular Tags