diff options
author | Mark Wielaard <mark@gcc.gnu.org> | 2006-01-17 18:09:40 +0000 |
---|---|---|
committer | Mark Wielaard <mark@gcc.gnu.org> | 2006-01-17 18:09:40 +0000 |
commit | 2127637945ea6b763966398130e0770fa993c860 (patch) | |
tree | c976ca91e3ef0bda3b34b37c0195145638d8d08e /libjava/classpath/gnu/CORBA | |
parent | bcb36c3e02e3bd2843aad1b9888513dfb5d6e337 (diff) | |
download | gcc-2127637945ea6b763966398130e0770fa993c860.zip gcc-2127637945ea6b763966398130e0770fa993c860.tar.gz gcc-2127637945ea6b763966398130e0770fa993c860.tar.bz2 |
Imported GNU Classpath 0.20
Imported GNU Classpath 0.20
* Makefile.am (AM_CPPFLAGS): Add classpath/include.
* java/nio/charset/spi/CharsetProvider.java: New override file.
* java/security/Security.java: Likewise.
* sources.am: Regenerated.
* Makefile.in: Likewise.
From-SVN: r109831
Diffstat (limited to 'libjava/classpath/gnu/CORBA')
-rw-r--r-- | libjava/classpath/gnu/CORBA/Poa/AOM.java | 58 | ||||
-rw-r--r-- | libjava/classpath/gnu/CORBA/Poa/gnuPOA.java | 76 |
2 files changed, 84 insertions, 50 deletions
diff --git a/libjava/classpath/gnu/CORBA/Poa/AOM.java b/libjava/classpath/gnu/CORBA/Poa/AOM.java index 9faf088..70e787a 100644 --- a/libjava/classpath/gnu/CORBA/Poa/AOM.java +++ b/libjava/classpath/gnu/CORBA/Poa/AOM.java @@ -40,6 +40,8 @@ package gnu.CORBA.Poa; import gnu.CORBA.ByteArrayComparator; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.ObjectImpl; import org.omg.PortableServer.Servant; import java.util.Iterator; @@ -66,7 +68,7 @@ public class AOM /** * Create an initialised instance. */ - Obj(org.omg.CORBA.Object _object, byte[] _key, Servant _servant, gnuPOA _poa) + Obj(gnuServantObject _object, byte[] _key, Servant _servant, gnuPOA _poa) { object = _object; key = _key; @@ -77,7 +79,7 @@ public class AOM /** * The object. */ - public final org.omg.CORBA.Object object; + public final gnuServantObject object; /** * The servant, serving the given object. @@ -158,14 +160,13 @@ public class AOM Map objects = new TreeMap(new ByteArrayComparator()); /** - * Get the record of the stored object. If the object is mapped - * several times under the different keys, one of the mappings - * is used. - * + * Get the record of the stored object. If the object is mapped several times + * under the different keys, one of the mappings is used. + * * @param object the stored object - * - * @return the record about the stored object, null if - * this object is not stored here. + * + * @return the record about the stored object, null if this object is not + * stored here. */ public Obj findObject(org.omg.CORBA.Object stored_object) { @@ -173,9 +174,33 @@ public class AOM return null; Map.Entry item; - Iterator iter = objects.entrySet().iterator(); + Iterator iter; Obj ref; + if (stored_object instanceof ObjectImpl) + { + // If the delegate is available, search by delegate. + Delegate d = ((ObjectImpl) stored_object)._get_delegate(); + Delegate d2; + + if (d != null) + { + iter = objects.entrySet().iterator(); + while (iter.hasNext()) + { + item = (Map.Entry) iter.next(); + ref = (Obj) item.getValue(); + d2 = ref.object._get_delegate(); + + if (d == d2 || (d2 != null && d2.equals(d))) + return ref; + } + } + } + + // For other objects (or if not possible to get the delegate), + // search by .equals + iter = objects.entrySet().iterator(); while (iter.hasNext()) { item = (Map.Entry) iter.next(); @@ -187,12 +212,11 @@ public class AOM } /** - * Find the reference info for the given servant. - * If the servant is mapped to several objects, this - * returns the first found occurence. - * + * Find the reference info for the given servant. If the servant is mapped to + * several objects, this returns the first found occurence. + * * @param servant a servant to find. - * + * * @return the servant/object/POA binding or null if no such found. */ public Obj findServant(Servant servant) @@ -257,7 +281,7 @@ public class AOM * * @return the newly created object record. */ - public Obj add(org.omg.CORBA.Object object, Servant servant, gnuPOA poa) + public Obj add(gnuServantObject object, Servant servant, gnuPOA poa) { return add(generateObjectKey(object), object, servant, poa); } @@ -270,7 +294,7 @@ public class AOM * @param servant a servant, serving the given object. * @param poa the POA, where the object is connected. */ - public Obj add(byte[] key, org.omg.CORBA.Object object, Servant servant, + public Obj add(byte[] key, gnuServantObject object, Servant servant, gnuPOA poa ) { diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java b/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java index 6f2a019..460a0a6 100644 --- a/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java +++ b/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java @@ -1052,12 +1052,12 @@ public class gnuPOA /** * Returns the servant that is serving this object. - * - * @return if the RETAIN policy applies and the object is in the Active - * Object Map, the method returns the servant, associated with this object. + * + * @return if the RETAIN policy applies and the object is in the Active Object + * Map, the method returns the servant, associated with this object. * Otherwise, if the USE_DEFAULT_SERVANT policy applies, the method returns * the default servant (if one was set). - * + * * @throws ObjectNotActive if none of the conditions above are satisfied. * @throws WrongAdapter if the object reference was not created with this POA. * @throws WrongPolicy. This method requires either RETAIN or @@ -1065,14 +1065,26 @@ public class gnuPOA * apply to this POA. */ public Servant reference_to_servant(org.omg.CORBA.Object the_Object) - throws ObjectNotActive, WrongPolicy, - WrongAdapter + throws ObjectNotActive, WrongPolicy, WrongAdapter { if (applies(ServantRetentionPolicyValue.RETAIN)) { AOM.Obj ref = aom.findObject(the_Object); if (ref == null) - throw new WrongAdapter(); + { + String object; + if (the_Object == null) + object = "null passed"; + else if (the_Object instanceof gnuServantObject) + { + gnuServantObject gs = (gnuServantObject) the_Object; + object = "Wrong owner POA " + gs.poa.the_name(); + } + else + object = "Unknown " + the_Object.getClass().getName(); + + throw new WrongAdapter(object + " for '" + the_name() + "'"); + } else if (ref.isDeactiveted() || ref.servant == null) { if (default_servant != null) @@ -1092,32 +1104,30 @@ public class gnuPOA } /** - * Returns the id of the object, served by the given servant - * (assuming that the servant serves only one object). - * The id is found in one of the following ways. - * <ul> - * <li>If the POA has both the RETAIN and the UNIQUE_ID policy and - * the specified servant is active, the method return the Object Id associated - * with that servant. - * </li><li> - * If the POA has both the RETAIN and the IMPLICIT_ACTIVATION policy and - * either the POA has the MULTIPLE_ID policy or the specified servant is - * inactive, the method activates the servant using a POA-generated Object Id - * and the Interface Id associated with the servant, and returns that - * Object Id. - * </li> - * <li>If the POA has the USE_DEFAULT_SERVANT policy, the servant specified - * is the default servant, and the method is being invoked in the context of - * executing a request on the default servant, the method returns the - * ObjectId associated with the current invocation. - * </li> - * </ul> - * @throws ServantNotActive in all cases, not listed in the list above. - * @throws WrongPolicy The method requres USE_DEFAULT_SERVANT policy or - * a combination of the RETAIN policy and either the UNIQUE_ID or - * IMPLICIT_ACTIVATION policies and throws the WrongPolicy if these conditions - * are not satisfied. - */ + * Returns the id of the object, served by the given servant (assuming that + * the servant serves only one object). The id is found in one of the + * following ways. + * <ul> + * <li>If the POA has both the RETAIN and the UNIQUE_ID policy and the + * specified servant is active, the method return the Object Id associated + * with that servant. </li> + * <li> If the POA has both the RETAIN and the IMPLICIT_ACTIVATION policy and + * either the POA has the MULTIPLE_ID policy or the specified servant is + * inactive, the method activates the servant using a POA-generated Object Id + * and the Interface Id associated with the servant, and returns that Object + * Id. </li> + * <li>If the POA has the USE_DEFAULT_SERVANT policy, the servant specified + * is the default servant, and the method is being invoked in the context of + * executing a request on the default servant, the method returns the ObjectId + * associated with the current invocation. </li> + * </ul> + * + * @throws ServantNotActive in all cases, not listed in the list above. + * @throws WrongPolicy The method requres USE_DEFAULT_SERVANT policy or a + * combination of the RETAIN policy and either the UNIQUE_ID or + * IMPLICIT_ACTIVATION policies and throws the WrongPolicy if these conditions + * are not satisfied. + */ public byte[] servant_to_id(Servant the_Servant) throws ServantNotActive, WrongPolicy { |