001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.iiop.rmi.ir;
023:
024: import org.omg.CORBA.ModuleDefOperations;
025: import org.omg.CORBA.ModuleDefPOATie;
026: import org.omg.CORBA.ModuleDefHelper;
027: import org.omg.CORBA.Any;
028: import org.omg.CORBA.IRObject;
029: import org.omg.CORBA.Contained;
030: import org.omg.CORBA.ContainedOperations;
031: import org.omg.CORBA.ContainedPackage.Description;
032: import org.omg.CORBA.Container;
033: import org.omg.CORBA.IDLType;
034: import org.omg.CORBA.DefinitionKind;
035: import org.omg.CORBA.StructMember;
036: import org.omg.CORBA.UnionMember;
037: import org.omg.CORBA.InterfaceDef;
038: import org.omg.CORBA.ConstantDef;
039: import org.omg.CORBA.EnumDef;
040: import org.omg.CORBA.ValueDef;
041: import org.omg.CORBA.ValueBoxDef;
042: import org.omg.CORBA.Initializer;
043: import org.omg.CORBA.StructDef;
044: import org.omg.CORBA.UnionDef;
045: import org.omg.CORBA.ModuleDef;
046: import org.omg.CORBA.AliasDef;
047: import org.omg.CORBA.NativeDef;
048: import org.omg.CORBA.ExceptionDef;
049: import org.omg.CORBA.ModuleDescription;
050: import org.omg.CORBA.ModuleDescriptionHelper;
051: import org.omg.PortableServer.POA;
052:
053: /**
054: * Abstract base class for all contained IR entities.
055: *
056: * @author <a href="mailto:osh@sparre.dk">Ole Husgaard</a>
057: * @version $Revision: 57194 $
058: */
059: class ModuleDefImpl extends ContainedImpl implements
060: ModuleDefOperations, LocalContainer {
061: // Constants -----------------------------------------------------
062:
063: // Attributes ----------------------------------------------------
064:
065: // Static --------------------------------------------------------
066:
067: // Constructors --------------------------------------------------
068:
069: ModuleDefImpl(String id, String name, String version,
070: LocalContainer defined_in, RepositoryImpl repository) {
071: super (id, name, version, defined_in, DefinitionKind.dk_Module,
072: repository);
073:
074: this .delegate = new ContainerImplDelegate(this );
075: }
076:
077: // Public --------------------------------------------------------
078:
079: // LocalContainer implementation ---------------------------------
080:
081: public LocalContained _lookup(String search_name) {
082: return delegate._lookup(search_name);
083: }
084:
085: public LocalContained[] _contents(DefinitionKind limit_type,
086: boolean exclude_inherited) {
087: return delegate._contents(limit_type, exclude_inherited);
088: }
089:
090: public LocalContained[] _lookup_name(String search_name,
091: int levels_to_search, DefinitionKind limit_type,
092: boolean exclude_inherited) {
093: return delegate._lookup_name(search_name, levels_to_search,
094: limit_type, exclude_inherited);
095: }
096:
097: public void add(String name, LocalContained contained)
098: throws IRConstructionException {
099: delegate.add(name, contained);
100: }
101:
102: // ContainerOperations implementation ----------------------------
103:
104: public Contained lookup(String search_name) {
105: return delegate.lookup(search_name);
106: }
107:
108: public Contained[] contents(DefinitionKind limit_type,
109: boolean exclude_inherited) {
110: return delegate.contents(limit_type, exclude_inherited);
111: }
112:
113: public Contained[] lookup_name(String search_name,
114: int levels_to_search, DefinitionKind limit_type,
115: boolean exclude_inherited) {
116: return delegate.lookup_name(search_name, levels_to_search,
117: limit_type, exclude_inherited);
118: }
119:
120: public org.omg.CORBA.ContainerPackage.Description[] describe_contents(
121: DefinitionKind limit_type, boolean exclude_inherited,
122: int max_returned_objs) {
123: return delegate.describe_contents(limit_type,
124: exclude_inherited, max_returned_objs);
125: }
126:
127: public ModuleDef create_module(String id, String name,
128: String version) {
129: return delegate.create_module(id, name, version);
130: }
131:
132: public ConstantDef create_constant(String id, String name,
133: String version, IDLType type, Any value) {
134: return delegate.create_constant(id, name, version, type, value);
135: }
136:
137: public StructDef create_struct(String id, String name,
138: String version, StructMember[] members) {
139: return delegate.create_struct(id, name, version, members);
140: }
141:
142: public UnionDef create_union(String id, String name,
143: String version, IDLType discriminator_type,
144: UnionMember[] members) {
145: return delegate.create_union(id, name, version,
146: discriminator_type, members);
147: }
148:
149: public EnumDef create_enum(String id, String name, String version,
150: String[] members) {
151: return delegate.create_enum(id, name, version, members);
152: }
153:
154: public AliasDef create_alias(String id, String name,
155: String version, IDLType original_type) {
156: return delegate.create_alias(id, name, version, original_type);
157: }
158:
159: public InterfaceDef create_interface(String id, String name,
160: String version, InterfaceDef[] base_interfaces,
161: boolean is_abstract) {
162: return delegate.create_interface(id, name, version,
163: base_interfaces, is_abstract);
164: }
165:
166: public ValueDef create_value(String id, String name,
167: String version, boolean is_custom, boolean is_abstract,
168: ValueDef base_value, boolean is_truncatable,
169: ValueDef[] abstract_base_values,
170: InterfaceDef[] supported_interfaces,
171: Initializer[] initializers) {
172: return delegate.create_value(id, name, version, is_custom,
173: is_abstract, base_value, is_truncatable,
174: abstract_base_values, supported_interfaces,
175: initializers);
176: }
177:
178: public ValueBoxDef create_value_box(String id, String name,
179: String version, IDLType original_type_def) {
180: return delegate.create_value_box(id, name, version,
181: original_type_def);
182: }
183:
184: public ExceptionDef create_exception(String id, String name,
185: String version, StructMember[] members) {
186: return delegate.create_exception(id, name, version, members);
187: }
188:
189: public NativeDef create_native(String id, String name,
190: String version) {
191: return delegate.create_native(id, name, version);
192: }
193:
194: // LocalIRObject implementation ----------------------------------
195:
196: public IRObject getReference() {
197: if (ref == null) {
198: ref = org.omg.CORBA.ModuleDefHelper
199: .narrow(servantToReference(new ModuleDefPOATie(this )));
200: }
201: return ref;
202: }
203:
204: public void allDone() throws IRConstructionException {
205: getReference();
206: delegate.allDone();
207: }
208:
209: public void shutdown() {
210: delegate.shutdown();
211: super .shutdown();
212: }
213:
214: // ContainedImpl implementation ----------------------------------
215:
216: public Description describe() {
217: String defined_in_id = "IR";
218:
219: if (defined_in instanceof ContainedOperations)
220: defined_in_id = ((ContainedOperations) defined_in).id();
221:
222: ModuleDescription md = new ModuleDescription(name, id,
223: defined_in_id, version);
224:
225: Any any = getORB().create_any();
226:
227: ModuleDescriptionHelper.insert(any, md);
228:
229: return new Description(DefinitionKind.dk_Module, any);
230: }
231:
232: // Y overrides ---------------------------------------------------
233:
234: // Package protected ---------------------------------------------
235:
236: // Protected -----------------------------------------------------
237:
238: // Private -------------------------------------------------------
239:
240: /**
241: * My delegate for Container functionality.
242: */
243: private ContainerImplDelegate delegate;
244:
245: /**
246: * My CORBA reference.
247: */
248: private ModuleDef ref = null;
249:
250: // Inner classes -------------------------------------------------
251: }
|