42 |
|
|
43 |
import org.omg.CORBA.Any; |
import org.omg.CORBA.Any; |
44 |
import org.omg.CORBA.BAD_PARAM; |
import org.omg.CORBA.BAD_PARAM; |
|
import org.omg.CORBA.CompletionStatus; |
|
45 |
import org.omg.CORBA.MARSHAL; |
import org.omg.CORBA.MARSHAL; |
|
import org.omg.CORBA.NO_IMPLEMENT; |
|
46 |
import org.omg.CORBA.ORB; |
import org.omg.CORBA.ORB; |
47 |
import org.omg.CORBA.TCKind; |
import org.omg.CORBA.TCKind; |
48 |
import org.omg.CORBA.TypeCode; |
import org.omg.CORBA.TypeCode; |
|
import org.omg.CORBA.TypeCodePackage.*; |
|
49 |
import org.omg.CORBA.VM_TRUNCATABLE; |
import org.omg.CORBA.VM_TRUNCATABLE; |
50 |
import org.omg.CORBA.portable.OutputStream; |
import org.omg.CORBA.portable.OutputStream; |
51 |
import org.omg.CORBA.portable.ValueFactory; |
import org.omg.CORBA.portable.ValueFactory; |
66 |
* |
* |
67 |
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) |
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) |
68 |
*/ |
*/ |
69 |
public class gnuDynValue |
public class gnuDynValue extends abstractRecord implements DynValue, |
70 |
extends abstractRecord |
Serializable |
|
implements DynValue, Serializable |
|
71 |
{ |
{ |
72 |
/** |
/** |
73 |
* Use serialVersionUID for interoperability. |
* Use serialVersionUID for interoperability. |
82 |
/** |
/** |
83 |
* Create an instance. |
* Create an instance. |
84 |
*/ |
*/ |
85 |
public gnuDynValue(TypeCode oType, TypeCode aType, gnuDynAnyFactory aFactory, |
public gnuDynValue(TypeCode oType, TypeCode aType, |
86 |
ORB anOrb |
gnuDynAnyFactory aFactory, ORB anOrb |
87 |
) |
) |
88 |
{ |
{ |
89 |
super(oType, aType, aFactory, anOrb); |
super(oType, aType, aFactory, anOrb); |
90 |
|
|
112 |
// Add members of ancestor in front of the curren members. |
// Add members of ancestor in front of the curren members. |
113 |
DynValue anc = (DynValue) ancestor; |
DynValue anc = (DynValue) ancestor; |
114 |
anc.set_to_value(); |
anc.set_to_value(); |
115 |
|
|
116 |
NameDynAnyPair[] aar = anc.get_members_as_dyn_any(); |
NameDynAnyPair[] aar = anc.get_members_as_dyn_any(); |
117 |
inheritFields(aar); |
inheritFields(aar); |
118 |
} |
} |
125 |
} |
} |
126 |
else |
else |
127 |
throw new BAD_PARAM("The parent of " + final_type.id() + ", " + |
throw new BAD_PARAM("The parent of " + final_type.id() + ", " + |
128 |
parent.id() + |
parent.id() + ", is not structure nor value." |
129 |
", is not structure nor value." |
); |
|
); |
|
130 |
} |
} |
131 |
} |
} |
132 |
catch (Exception e) |
catch (Exception e) |
164 |
} |
} |
165 |
|
|
166 |
/** @inheritDoc */ |
/** @inheritDoc */ |
167 |
public TCKind current_member_kind() |
public TCKind current_member_kind() throws TypeMismatch, InvalidValue |
|
throws TypeMismatch, InvalidValue |
|
168 |
{ |
{ |
169 |
if (isNull) |
if (isNull) |
170 |
throw new TypeMismatch(ISNULL); |
throw new TypeMismatch(ISNULL); |
174 |
; |
; |
175 |
|
|
176 |
/** @inheritDoc */ |
/** @inheritDoc */ |
177 |
public String current_member_name() |
public String current_member_name() throws TypeMismatch, InvalidValue |
|
throws TypeMismatch, InvalidValue |
|
178 |
{ |
{ |
179 |
if (isNull) |
if (isNull) |
180 |
throw new TypeMismatch(ISNULL); |
throw new TypeMismatch(ISNULL); |
184 |
; |
; |
185 |
|
|
186 |
/** @inheritDoc */ |
/** @inheritDoc */ |
187 |
public NameDynAnyPair[] get_members_as_dyn_any() |
public NameDynAnyPair[] get_members_as_dyn_any() throws InvalidValue |
|
throws InvalidValue |
|
188 |
{ |
{ |
189 |
if (isNull) |
if (isNull) |
190 |
throw new InvalidValue(ISNULL); |
throw new InvalidValue(ISNULL); |
193 |
; |
; |
194 |
|
|
195 |
/** @inheritDoc */ |
/** @inheritDoc */ |
196 |
public NameValuePair[] get_members() |
public NameValuePair[] get_members() throws InvalidValue |
|
throws InvalidValue |
|
197 |
{ |
{ |
198 |
if (isNull) |
if (isNull) |
199 |
throw new InvalidValue(ISNULL); |
throw new InvalidValue(ISNULL); |
204 |
|
|
205 |
/** @inheritDoc */ |
/** @inheritDoc */ |
206 |
public void set_members_as_dyn_any(NameDynAnyPair[] value) |
public void set_members_as_dyn_any(NameDynAnyPair[] value) |
207 |
throws TypeMismatch, InvalidValue |
throws TypeMismatch, InvalidValue |
208 |
{ |
{ |
209 |
super.set_members_as_dyn_any(value); |
super.set_members_as_dyn_any(value); |
210 |
isNull = false; |
isNull = false; |
213 |
|
|
214 |
/** @inheritDoc */ |
/** @inheritDoc */ |
215 |
public void set_members(NameValuePair[] value) |
public void set_members(NameValuePair[] value) |
216 |
throws TypeMismatch, InvalidValue |
throws TypeMismatch, InvalidValue |
217 |
{ |
{ |
218 |
super.set_members(value); |
super.set_members(value); |
219 |
isNull = false; |
isNull = false; |
244 |
* Create a new instance. |
* Create a new instance. |
245 |
*/ |
*/ |
246 |
protected abstractRecord newInstance(TypeCode oType, TypeCode aType, |
protected abstractRecord newInstance(TypeCode oType, TypeCode aType, |
247 |
gnuDynAnyFactory aFactory, ORB anOrb |
gnuDynAnyFactory aFactory, ORB anOrb |
248 |
) |
) |
249 |
{ |
{ |
250 |
gnuDynValue v = new gnuDynValue(oType, aType, aFactory, anOrb); |
gnuDynValue v = new gnuDynValue(oType, aType, aFactory, anOrb); |
251 |
if (isNull) |
if (isNull) |
275 |
/** |
/** |
276 |
* Get the focused component, throwing exception if the current value is null. |
* Get the focused component, throwing exception if the current value is null. |
277 |
*/ |
*/ |
278 |
protected DynAny focused() |
protected DynAny focused() throws InvalidValue, TypeMismatch |
|
throws InvalidValue, TypeMismatch |
|
279 |
{ |
{ |
280 |
if (isNull) |
if (isNull) |
281 |
throw new TypeMismatch(ISNULL); |
throw new TypeMismatch(ISNULL); |
302 |
((org.omg.CORBA_2_3.ORB) orb).lookup_value_factory(official_type.id()); |
((org.omg.CORBA_2_3.ORB) orb).lookup_value_factory(official_type.id()); |
303 |
if (factory == null) |
if (factory == null) |
304 |
throw new MARSHAL("Factory for " + official_type.id() + |
throw new MARSHAL("Factory for " + official_type.id() + |
305 |
" not registered." |
" not registered." |
306 |
); |
); |
307 |
|
|
308 |
OutputStream out = orb.create_output_stream(); |
OutputStream out = orb.create_output_stream(); |
309 |
|
|
328 |
} |
} |
329 |
|
|
330 |
/** @inheritDoc */ |
/** @inheritDoc */ |
331 |
public void assign(DynAny from) |
public void assign(DynAny from) throws TypeMismatch |
|
throws TypeMismatch |
|
332 |
{ |
{ |
333 |
checkType(official_type, from.type()); |
checkType(official_type, from.type()); |
334 |
|
|
366 |
} |
} |
367 |
|
|
368 |
/** {@inheritDoc} */ |
/** {@inheritDoc} */ |
369 |
public Serializable get_val() |
public Serializable get_val() throws TypeMismatch, InvalidValue |
|
throws TypeMismatch, InvalidValue |
|
370 |
{ |
{ |
371 |
return to_any().extract_Value(); |
return to_any().extract_Value(); |
372 |
} |
} |
373 |
|
|
|
|
|
374 |
/** {@inheritDoc} */ |
/** {@inheritDoc} */ |
375 |
public void insert_val(Serializable a_x) |
public void insert_val(Serializable a_x) throws InvalidValue, TypeMismatch |
|
throws InvalidValue, TypeMismatch |
|
376 |
{ |
{ |
377 |
Any a = to_any(); |
Any a = to_any(); |
378 |
a.insert_Value(a_x); |
a.insert_Value(a_x); |