diff options
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | gnu/CORBA/Interceptor/IORInterceptors.java | 83 | ||||
-rw-r--r-- | gnu/CORBA/Interceptor/gnuIorInfo.java | 42 | ||||
-rw-r--r-- | gnu/CORBA/OrbRestricted.java | 3 | ||||
-rw-r--r-- | gnu/CORBA/Poa/AOM.java | 9 | ||||
-rw-r--r-- | gnu/CORBA/Poa/ORB_1_4.java | 4 | ||||
-rw-r--r-- | gnu/CORBA/Poa/gnuPOA.java | 381 | ||||
-rw-r--r-- | gnu/CORBA/Poa/gnuPOAManager.java | 60 | ||||
-rw-r--r-- | org/omg/PortableInterceptor/IORInfoOperations.java | 41 | ||||
-rw-r--r-- | org/omg/PortableInterceptor/IORInterceptorOperations.java | 6 | ||||
-rw-r--r-- | org/omg/PortableInterceptor/IORInterceptor_3_0.java | 59 | ||||
-rw-r--r-- | org/omg/PortableInterceptor/IORInterceptor_3_0Helper.java | 195 | ||||
-rw-r--r-- | org/omg/PortableInterceptor/IORInterceptor_3_0Holder.java | 106 | ||||
-rw-r--r-- | org/omg/PortableInterceptor/IORInterceptor_3_0Operations.java | 90 | ||||
-rw-r--r-- | org/omg/PortableInterceptor/ORBInitInfoOperations.java | 17 | ||||
-rw-r--r-- | org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java | 11 | ||||
-rw-r--r-- | org/omg/PortableInterceptor/_IORInterceptor_3_0Stub.java | 272 |
17 files changed, 1262 insertions, 137 deletions
@@ -1,3 +1,23 @@ +2005-11-11 Audrius Meskauskas <AudriusA@Bioinformatics.org> + + * org/omg/PortableInterceptor/IORInterceptor_3_0.java, + org/omg/PortableInterceptor/IORInterceptor_3_0Helper.java, + org/omg/PortableInterceptor/IORInterceptor_3_0Holder.java, + org/omg/PortableInterceptor/IORInterceptor_3_0Operations.java, + org/omg/PortableInterceptor/_IORInterceptor_3_0Stub.java: New files. + * gnu/CORBA/Interceptor/IORInterceptors.java, + gnu/CORBA/Interceptor/gnuIorInfo.java, + gnu/CORBA/OrbRestricted.java, + gnu/CORBA/Poa/AOM.java, + gnu/CORBA/Poa/ORB_1_4.java, + gnu/CORBA/Poa/gnuPOA.java, + gnu/CORBA/Poa/gnuPOAManager.java, + org/omg/PortableInterceptor/IORInfoOperations.java, + org/omg/PortableInterceptor/IORInterceptorOperations.java, + org/omg/PortableInterceptor/ORBInitInfoOperations.java, + org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java: + Rewritten to support the IORInterceptor_3_0. + 2005-11-10 Lillian Angel <langel@redhat.com> * javax/swing/plaf/metal/MetalRadioButtonUI.java diff --git a/gnu/CORBA/Interceptor/IORInterceptors.java b/gnu/CORBA/Interceptor/IORInterceptors.java index 88756988c..2b77de58e 100644 --- a/gnu/CORBA/Interceptor/IORInterceptors.java +++ b/gnu/CORBA/Interceptor/IORInterceptors.java @@ -38,16 +38,20 @@ exception statement from your version. */ package gnu.CORBA.Interceptor; +import org.omg.CORBA.OBJ_ADAPTER; +import org.omg.CORBA.OMGVMCID; import org.omg.PortableInterceptor.IORInfo; import org.omg.PortableInterceptor.IORInterceptor; import org.omg.PortableInterceptor.IORInterceptorOperations; +import org.omg.PortableInterceptor.IORInterceptor_3_0Operations; +import org.omg.PortableInterceptor.ObjectReferenceTemplate; /** * A block of the all registered IOR interceptors. * * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) */ -public class IORInterceptors implements IORInterceptorOperations +public class IORInterceptors implements IORInterceptor_3_0Operations { /** * The array of all registered IOR interceptors. @@ -106,4 +110,81 @@ public class IORInterceptors implements IORInterceptorOperations { return getClass().getName(); } + + /** + * Call this method for all registered CORBA 3.0 interceptors. + */ + public void adapter_manager_state_changed(int adapterManagerId, short adapterState) + { + for (int i = 0; i < interceptors.length; i++) + { + try + { + if (interceptors[i] instanceof IORInterceptor_3_0Operations) + { + ((IORInterceptor_3_0Operations) interceptors[i]). + adapter_manager_state_changed(adapterManagerId, adapterState); + } + } + catch (Exception exc) + { + OBJ_ADAPTER oa = new OBJ_ADAPTER("components_established failed"); + oa.initCause(exc); + oa.minor = 6 | OMGVMCID.value; + throw oa; + } + } + } + + /** + * Call this method for all registered CORBA 3.0 interceptors. + */ + public void adapter_state_changed(ObjectReferenceTemplate[] adapters, short adaptersState) + { + for (int i = 0; i < interceptors.length; i++) + { + try + { + if (interceptors[i] instanceof IORInterceptor_3_0Operations) + { + ((IORInterceptor_3_0Operations) interceptors[i]). + adapter_state_changed(adapters, adaptersState); + } + } + catch (Exception exc) + { + OBJ_ADAPTER oa = new OBJ_ADAPTER("components_established failed"); + oa.initCause(exc); + oa.minor = 6 | OMGVMCID.value; + throw oa; + } + } + } + + /** + * Call this method for all registered CORBA 3.0 interceptors. + * + * @throws OBJ_ADAPTER minor 6 on any failure (as defined by OMG specs). + */ + public void components_established(IORInfo info) + { + for (int i = 0; i < interceptors.length; i++) + { + try + { + if (interceptors[i] instanceof IORInterceptor_3_0Operations) + { + ((IORInterceptor_3_0Operations) interceptors[i]). + components_established(info); + } + } + catch (Exception exc) + { + OBJ_ADAPTER oa = new OBJ_ADAPTER("components_established failed"); + oa.initCause(exc); + oa.minor = 6 | OMGVMCID.value; + throw oa; + } + } + } }
\ No newline at end of file diff --git a/gnu/CORBA/Interceptor/gnuIorInfo.java b/gnu/CORBA/Interceptor/gnuIorInfo.java index 1c406cb5e..b552189a9 100644 --- a/gnu/CORBA/Interceptor/gnuIorInfo.java +++ b/gnu/CORBA/Interceptor/gnuIorInfo.java @@ -40,12 +40,14 @@ package gnu.CORBA.Interceptor; import gnu.CORBA.IOR; import gnu.CORBA.Poa.ORB_1_4; +import gnu.CORBA.Poa.gnuPOA; import org.omg.CORBA.LocalObject; import org.omg.CORBA.Policy; import org.omg.IOP.TaggedComponent; import org.omg.PortableInterceptor.IORInfo; -import org.omg.PortableServer.POA; +import org.omg.PortableInterceptor.ObjectReferenceFactory; +import org.omg.PortableInterceptor.ObjectReferenceTemplate; /** * Implements IORInfo. @@ -67,7 +69,7 @@ public class gnuIorInfo extends LocalObject implements IORInfo /** * The POA, to that IOR is related. */ - public final POA poa; + public final gnuPOA poa; /** * The IOR itself. @@ -77,7 +79,7 @@ public class gnuIorInfo extends LocalObject implements IORInfo /** * Create an instance. */ - public gnuIorInfo(ORB_1_4 an_orb, POA a_poa, IOR an_ior) + public gnuIorInfo(ORB_1_4 an_orb, gnuPOA a_poa, IOR an_ior) { orb = an_orb; poa = a_poa; @@ -117,4 +119,38 @@ public class gnuIorInfo extends LocalObject implements IORInfo { return (short) poa.the_POAManager().get_state().value(); } + + /** + * Get the adapter template, associated with this poa. + */ + public ObjectReferenceTemplate adapter_template() + { + return poa.getReferenceTemplate(); + } + + /** + * Get the object factory of the current POA. + */ + public ObjectReferenceFactory current_factory() + { + return poa.getReferenceFactory(); + } + + /** + * Set the object factory of the current POA. + */ + public void current_factory(ObjectReferenceFactory factory) + { + poa.setReferenceFactory(factory); + } + + /** + * The method currently uses system identity hashcode that should be + * different for each object. + */ + public int manager_id() + { + // The System.identityHashCode is also called in gnuPoaManager. + return System.identityHashCode(poa.the_POAManager()); + } }
\ No newline at end of file diff --git a/gnu/CORBA/OrbRestricted.java b/gnu/CORBA/OrbRestricted.java index 783ced080..c0401800a 100644 --- a/gnu/CORBA/OrbRestricted.java +++ b/gnu/CORBA/OrbRestricted.java @@ -64,6 +64,7 @@ import org.omg.CORBA.portable.OutputStream; import org.omg.CORBA.portable.ValueFactory; import org.omg.PortableInterceptor.ClientRequestInterceptorOperations; import org.omg.PortableInterceptor.IORInterceptorOperations; +import org.omg.PortableInterceptor.IORInterceptor_3_0Operations; import org.omg.PortableInterceptor.ServerRequestInterceptorOperations; import java.applet.Applet; @@ -97,7 +98,7 @@ public class OrbRestricted extends org.omg.CORBA_2_3.ORB * The cumulated listener for all IOR interceptors. Interceptors are used by * {@link gnu.CORBA.Poa.ORB_1_4}. */ - public IORInterceptorOperations iIor; + public IORInterceptor_3_0Operations iIor; /** * The cumulated listener for all server request interceptors. Interceptors diff --git a/gnu/CORBA/Poa/AOM.java b/gnu/CORBA/Poa/AOM.java index db98043d0..9faf0883d 100644 --- a/gnu/CORBA/Poa/AOM.java +++ b/gnu/CORBA/Poa/AOM.java @@ -40,7 +40,6 @@ package gnu.CORBA.Poa; import gnu.CORBA.ByteArrayComparator; -import org.omg.PortableServer.POA; import org.omg.PortableServer.Servant; import java.util.Iterator; @@ -67,7 +66,7 @@ public class AOM /** * Create an initialised instance. */ - Obj(org.omg.CORBA.Object _object, byte[] _key, Servant _servant, POA _poa) + Obj(org.omg.CORBA.Object _object, byte[] _key, Servant _servant, gnuPOA _poa) { object = _object; key = _key; @@ -96,7 +95,7 @@ public class AOM /** * The POA, where the object is connected. */ - public final POA poa; + public final gnuPOA poa; /** * The object key. @@ -258,7 +257,7 @@ public class AOM * * @return the newly created object record. */ - public Obj add(org.omg.CORBA.Object object, Servant servant, POA poa) + public Obj add(org.omg.CORBA.Object object, Servant servant, gnuPOA poa) { return add(generateObjectKey(object), object, servant, poa); } @@ -272,7 +271,7 @@ public class AOM * @param poa the POA, where the object is connected. */ public Obj add(byte[] key, org.omg.CORBA.Object object, Servant servant, - POA poa + gnuPOA poa ) { Obj rec = new Obj(object, key, servant, poa); diff --git a/gnu/CORBA/Poa/ORB_1_4.java b/gnu/CORBA/Poa/ORB_1_4.java index be97b7935..bb00aab70 100644 --- a/gnu/CORBA/Poa/ORB_1_4.java +++ b/gnu/CORBA/Poa/ORB_1_4.java @@ -58,7 +58,6 @@ import org.omg.CORBA.Policy; import org.omg.CORBA.PolicyError; import org.omg.CORBA.portable.ObjectImpl; import org.omg.PortableInterceptor.PolicyFactory; -import org.omg.PortableServer.POA; import org.omg.PortableServer.Servant; import org.omg.PortableServer.POAManagerPackage.State; import org.omg.PortableServer.POAPackage.InvalidPolicy; @@ -206,7 +205,7 @@ public class ORB_1_4 { AOM.Obj obj = rootPOA.findIorKey(ior.key); - POA poa; + gnuPOA poa; // Null means that the object was connected to the ORB directly. if (obj == null) @@ -218,6 +217,7 @@ public class ORB_1_4 // This may modify the ior. iIor.establish_components(info); + iIor.components_established(info); } return ior; } diff --git a/gnu/CORBA/Poa/gnuPOA.java b/gnu/CORBA/Poa/gnuPOA.java index f4a263eaf..6f2a019a3 100644 --- a/gnu/CORBA/Poa/gnuPOA.java +++ b/gnu/CORBA/Poa/gnuPOA.java @@ -49,10 +49,15 @@ import org.omg.CORBA.LocalObject; import org.omg.CORBA.NO_IMPLEMENT; import org.omg.CORBA.OBJ_ADAPTER; import org.omg.CORBA.ORB; +import org.omg.CORBA.Object; import org.omg.CORBA.Policy; import org.omg.CORBA.SetOverrideType; import org.omg.CORBA.TRANSIENT; import org.omg.CORBA.portable.ObjectImpl; +import org.omg.PortableInterceptor.NON_EXISTENT; +import org.omg.PortableInterceptor.ObjectReferenceFactory; +import org.omg.PortableInterceptor.ObjectReferenceTemplate; +import org.omg.PortableInterceptor.ObjectReferenceTemplateHelper; import org.omg.PortableServer.AdapterActivator; import org.omg.PortableServer.ForwardRequest; import org.omg.PortableServer.IdAssignmentPolicy; @@ -87,6 +92,8 @@ import org.omg.PortableServer.POAPackage.ServantAlreadyActive; import org.omg.PortableServer.POAPackage.ServantNotActive; import org.omg.PortableServer.POAPackage.WrongAdapter; import org.omg.PortableServer.POAPackage.WrongPolicy; + +import gnu.CORBA.OrbFunctional; import gnu.CORBA.CDR.BufferredCdrInput; import gnu.CORBA.CDR.BufferedCdrOutput; @@ -97,9 +104,105 @@ import gnu.CORBA.CDR.BufferedCdrOutput; */ public class gnuPOA extends LocalObject - implements POA + implements POA, ObjectReferenceFactory { /** + * The object reference template, associated with this POA. + * + * @since 1.5 + */ + class RefTemplate implements ObjectReferenceTemplate + { + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1; + + RefTemplate() + { + // The adapter name is computed once. + ArrayList names = new ArrayList(); + names.add(the_name()); + + POA poa = the_parent(); + while (poa != null) + { + names.add(poa.the_name()); + poa = poa.the_parent(); + } + + // Fill in the string array in reverse (more natural) order, + // root POA first. + m_adapter_name = new String[names.size()]; + + for (int i = 0; i < m_adapter_name.length; i++) + m_adapter_name[i] = (String) names.get(m_adapter_name.length - i - 1); + } + + /** + * The adapter name + */ + final String[] m_adapter_name; + + /** + * Get the name of this POA. + */ + public String[] adapter_name() + { + return (String[]) m_adapter_name.clone(); + } + + /** + * Get the ORB id. + */ + public String orb_id() + { + return m_orb.orb_id; + } + + /** + * Get the server id. + */ + public String server_id() + { + return OrbFunctional.server_id; + } + + /** + * Create the object. + */ + public Object make_object(String repositoryId, byte[] objectId) + { + return create_reference_with_id(objectId, repositoryId); + } + + /** + * Get the array of truncatible repository ids. + */ + public String[] _truncatable_ids() + { + return ref_template_ids; + } + } + + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1; + + /** + * The adapter reference template. + */ + ObjectReferenceTemplate refTemplate; + + /** + * The reference template repository ids. Defined outside the class as it + * cannot have static members. + */ + final static String[] ref_template_ids = + new String[] { ObjectReferenceTemplateHelper.id() }; + + /** * The active object map, mapping between object keys, objects and servants. */ public final AOM aom = new AOM(); @@ -182,6 +285,12 @@ public class gnuPOA * necessity of the frequent checks. */ public final boolean retain_servant; + + /** + * The object reference factory, used to create the new object + * references. + */ + ObjectReferenceFactory m_object_factory = this; /** * Create a new abstract POA. @@ -228,6 +337,8 @@ public class gnuPOA retain_servant = applies(ServantRetentionPolicyValue.RETAIN); validatePolicies(a_policies); + + refTemplate = new RefTemplate(); } /** @@ -422,24 +533,24 @@ public class gnuPOA } /** - * Generate the Object Id for the given servant and add the servant to - * the Active Object Map using this Id a a key. If the servant - * activator is set, its incarnate method will be called. - * - * @param a_servant a servant that would serve the object with the - * returned Object Id. If null is passed, under apporoprate policies the - * servant activator is invoked. - * + * Generate the Object Id for the given servant and add the servant to the + * Active Object Map using this Id a a key. If the servant activator is set, + * its incarnate method will be called. + * + * @param a_servant a servant that would serve the object with the returned + * Object Id. If null is passed, under apporoprate policies the servant + * activator is invoked. + * * @return the generated objert Id for the given servant. - * - * @throws ServantAlreadyActive if this servant is already in the - * Active Object Map and the UNIQUE_ID policy applies. - * - * @throws WrongPolicy if the required policies SYSTEM_ID and RETAIN - * do not apply to this POA. + * + * @throws ServantAlreadyActive if this servant is already in the Active + * Object Map and the UNIQUE_ID policy applies. + * + * @throws WrongPolicy if the required policies SYSTEM_ID and RETAIN do not + * apply to this POA. */ public byte[] activate_object(Servant a_servant) - throws ServantAlreadyActive, WrongPolicy + throws ServantAlreadyActive, WrongPolicy { checkDiscarding(); required(ServantRetentionPolicyValue.RETAIN); @@ -465,27 +576,29 @@ public class gnuPOA } byte[] object_key = AOM.getFreeId(); - ServantDelegateImpl delegate = new ServantDelegateImpl(a_servant, this, object_key); - connectDelegate(object_key, delegate); + ServantDelegateImpl delegate = new ServantDelegateImpl(a_servant, this, + object_key); + create_and_connect(object_key, + a_servant._all_interfaces(this, object_key)[0], delegate); return object_key; } /** - * Add the given servant to the Active Object Map as a servant for the - * object with the provided Object Id. If the servant activator is - * set, its incarnate method will be called. - * + * Add the given servant to the Active Object Map as a servant for the object + * with the provided Object Id. If the servant activator is set, its incarnate + * method will be called. + * * @param an_Object_Id an object id for the given object. - * @param a_servant a servant that will serve the object with the given - * Object Id. If null is passed, under apporoprate policies the - * servant activator is invoked. - * - * @throws ObjectAlreadyActive if the given object id is already in the - * Active Object Map. - * @throws ServantAlreadyActive if the UNIQUE_ID policy applies and - * this servant is already in use. - * @throws WrongPolicy if the required RETAIN policy does not apply to - * this POA. + * @param a_servant a servant that will serve the object with the given Object + * Id. If null is passed, under apporoprate policies the servant activator is + * invoked. + * + * @throws ObjectAlreadyActive if the given object id is already in the Active + * Object Map. + * @throws ServantAlreadyActive if the UNIQUE_ID policy applies and this + * servant is already in use. + * @throws WrongPolicy if the required RETAIN policy does not apply to this + * POA. * @throws BAD_PARAM if the passed object id is invalid due any reason. */ public void activate_object_with_id(byte[] an_Object_Id, Servant a_servant) @@ -496,16 +609,14 @@ public class gnuPOA } /** - * Same as activate_object_with_id, but permits gnuForwardRequest - * forwarding exception. This is used when the activation is called - * from the remote invocation context and we have possibility - * to return the forwarding message. + * Same as activate_object_with_id, but permits gnuForwardRequest forwarding + * exception. This is used when the activation is called from the remote + * invocation context and we have possibility to return the forwarding + * message. */ public void activate_object_with_id(byte[] an_Object_Id, Servant a_servant, - boolean use_forwarding - ) - throws ServantAlreadyActive, ObjectAlreadyActive, - WrongPolicy + boolean use_forwarding) + throws ServantAlreadyActive, ObjectAlreadyActive, WrongPolicy { checkDiscarding(); required(ServantRetentionPolicyValue.RETAIN); @@ -537,23 +648,24 @@ public class gnuPOA } else { - ServantDelegateImpl delegate = - new ServantDelegateImpl(a_servant, this, an_Object_Id); - connectDelegate(an_Object_Id, delegate); + ServantDelegateImpl delegate = new ServantDelegateImpl(a_servant, this, + an_Object_Id); + create_and_connect(an_Object_Id, a_servant._all_interfaces(this, + an_Object_Id)[0], delegate); } } /** * Locate the servant for this object Id and connect it to ORB. - * + * * @param an_Object_Id the object id. * @param a_servant the servant (may be null). * @param exists an existing active object map entry. - * @param use_forwarding allow to throw the gnuForwardRequest - * if the activator throws ForwardRequest. - * - * @throws OBJ_ADAPTER minor 4 if the servant cannot be located - * (the required servant manager may be missing). + * @param use_forwarding allow to throw the gnuForwardRequest if the activator + * throws ForwardRequest. + * + * @throws OBJ_ADAPTER minor 4 if the servant cannot be located (the required + * servant manager may be missing). */ private void locateServant(byte[] an_Object_Id, Servant a_servant, AOM.Obj exists, boolean use_forwarding @@ -662,8 +774,8 @@ public class gnuPOA * servant. */ public org.omg.CORBA.Object create_reference_with_id(byte[] an_object_id, - String a_repository_id - ) + String a_repository_id + ) { String[] ids; if (a_repository_id == null) @@ -1047,27 +1159,27 @@ public class gnuPOA } /** - * <p>Converts the given servant to the object reference. - * The servant will serve all methods, invoked on the returned object. - * The returned object reference can be passed to the remote client, - * enabling remote invocations. - * </p><p> - * If the specified servant is active, it is returned. Otherwise, - * if the POA has the IMPLICIT_ACTIVATION policy the method activates - * the servant. In this case, if the servant activator is set, - * the {@link ServantActivatorOperations#incarnate} method will be called. + * <p> + * Converts the given servant to the object reference. The servant will serve + * all methods, invoked on the returned object. The returned object reference + * can be passed to the remote client, enabling remote invocations. * </p> - * + * <p> + * If the specified servant is active, it is returned. Otherwise, if the POA + * has the IMPLICIT_ACTIVATION policy the method activates the servant. In + * this case, if the servant activator is set, the + * {@link ServantActivatorOperations#incarnate} method will be called. + * </p> + * * @throws ServantNotActive if the servant is inactive and no * IMPLICIT_ACTIVATION policy applies. * @throws WrongPolicy This method needs the RETAIN policy and either the * UNIQUE_ID or IMPLICIT_ACTIVATION policies. - * + * * @return the object, exposing the given servant in the context of this POA. */ public org.omg.CORBA.Object servant_to_reference(Servant the_Servant) - throws ServantNotActive, - WrongPolicy + throws ServantNotActive, WrongPolicy { required(ServantRetentionPolicyValue.RETAIN); @@ -1092,17 +1204,17 @@ public class gnuPOA else return exists.object; } - if (exists == null && - applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION) - ) + if (exists == null + && applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION)) { checkDiscarding(); byte[] object_key = AOM.getFreeId(); - ServantDelegateImpl delegate = - new ServantDelegateImpl(the_Servant, this, object_key); - connectDelegate(object_key, delegate); + ServantDelegateImpl delegate = new ServantDelegateImpl(the_Servant, + this, object_key); + create_and_connect(object_key, the_Servant._all_interfaces(this, + object_key)[0], delegate); return delegate.object; } @@ -1111,20 +1223,20 @@ public class gnuPOA } /** - * Incarnate in cases when request forwarding is not expected - * because the servant must be provided by the servant activator. - * - * @param x the aom entry, where the object is replaced by - * value, returned by servant activator (if not null). - * + * Incarnate in cases when request forwarding is not expected because the + * servant must be provided by the servant activator. + * + * @param x the aom entry, where the object is replaced by value, returned by + * servant activator (if not null). + * * @param key the object key. - * + * * @param a_servant the servant that was passed as a parameter in the * activation method. - * - * @param use_forwarding if true, the gnuForwardRequest is throw - * under the forwarding exception (for remote client). Otherwise, the - * request is internally redirected (for local invocation). + * + * @param use_forwarding if true, the gnuForwardRequest is throw under the + * forwarding exception (for remote client). Otherwise, the request is + * internally redirected (for local invocation). */ private Servant incarnate(AOM.Obj x, byte[] object_key, Servant a_servant, boolean use_forwarding @@ -1281,34 +1393,46 @@ public class gnuPOA } /** - * <p> Destroy this POA and all descendant POAs. The destroyed POAs can be - * later re-created via {@link AdapterActivator} or by invoking - * {@link #create_POA}. - * This differs from {@link PoaManagerOperations#deactivate} that does - * not allow recreation of the deactivated POAs. After deactivation, - * recreation is only possible if the POAs were later destroyed. - * </p><p> - * The remote invocation on the target, belonging to the POA that is - * currently destroyed return the remote exception ({@link TRANSIENT}, - * minor code 4). + * <p> + * Destroy this POA and all descendant POAs. The destroyed POAs can be later + * re-created via {@link AdapterActivator} or by invoking {@link #create_POA}. + * This differs from {@link PoaManagerOperations#deactivate} that does not + * allow recreation of the deactivated POAs. After deactivation, recreation is + * only possible if the POAs were later destroyed. + * </p> + * <p> + * The remote invocation on the target, belonging to the POA that is currently + * destroyed return the remote exception ({@link TRANSIENT}, minor code 4). * </p> + * * @param etherealize_objects if true, and POA has RETAIN policy, and the * servant manager is available, the servant manager method - * {@link ServantActivatorOperations#etherealize} is called for each - * <i>active</i> object in the Active Object Map. This method should not - * try to access POA being destroyed. If <code>destroy</code> is called - * multiple times before the destruction completes, - * the etherialization should be invoked only once. - * + * {@link ServantActivatorOperations#etherealize} is called for each <i>active</i> + * object in the Active Object Map. This method should not try to access POA + * being destroyed. If <code>destroy</code> is called multiple times before + * the destruction completes, the etherialization should be invoked only once. + * * @param wait_for_completion if true, the method waits till the POA being - * destroyed completes all current requests and etherialization. If false, - * the method returns immediately. + * destroyed completes all current requests and etherialization. If false, the + * method returns immediately. */ public void destroy(boolean etherealize_objects, boolean wait_for_completion) { + // Notify the IOR interceptors about that the POA is destroyed. + if (m_orb.iIor != null) + m_orb.iIor.adapter_state_changed( + new ObjectReferenceTemplate[] { getReferenceTemplate() }, + NON_EXISTENT.value); + if (wait_for_completion) waitWhileRunning(); + // Nofify the IOR interceptors that the POA is destroyed. + if (m_manager instanceof gnuPOAManager) + { + ((gnuPOAManager) m_manager).poaDestroyed(this); + } + // Put the brake instead of manager, preventing the subsequent // requests. gnuPOAManager g = new gnuPOAManager(); @@ -1348,7 +1472,7 @@ public class gnuPOA POA[] ch = the_children(); for (int i = 0; i < ch.length; i++) { - ch [ i ].destroy(etherealize_objects, wait_for_completion); + ch[i].destroy(etherealize_objects, wait_for_completion); } } @@ -1430,13 +1554,14 @@ public class gnuPOA } /** - * Connect the given delegate under the given key, also calling - * incarnate. + * Connect the given delegate under the given key, also calling incarnate. */ - private void connectDelegate(byte[] object_key, ServantDelegateImpl delegate) + private void create_and_connect(byte[] object_key, String repository_id, + ServantDelegateImpl delegate) { aom.add(delegate); - connect_to_orb(object_key, delegate.object); + connect_to_orb(object_key, getReferenceFactory().make_object(repository_id, + object_key)); if (servant_activator != null) incarnate(null, object_key, delegate.servant, false); } @@ -1631,5 +1756,51 @@ public class gnuPOA } } return h; - } + } + + /** + * Get the object reference template of this POA. + * Instantiate a singleton instance, if required. + */ + public ObjectReferenceTemplate getReferenceTemplate() + { + if (refTemplate == null) + refTemplate = new RefTemplate(); + + return refTemplate; + } + + public ObjectReferenceFactory getReferenceFactory() + { + return m_object_factory; + } + + public void setReferenceFactory(ObjectReferenceFactory factory) + { + m_object_factory = factory; + } + + /** + * Create the object (needed by the factory interface). + */ + public Object make_object(String a_repository_id, byte[] an_object_id) + { + AOM.Obj existing = aom.get(an_object_id); + // The object may already exist. In this case, it is just returned. + if (existing != null && existing.object != null) + return existing.object; + else + { + return new gnuServantObject(new String[] { a_repository_id }, + an_object_id, this, m_orb); + } + } + + /** + * Required by object reference factory ops. + */ + public String[] _truncatable_ids() + { + return ref_template_ids; + } }
\ No newline at end of file diff --git a/gnu/CORBA/Poa/gnuPOAManager.java b/gnu/CORBA/Poa/gnuPOAManager.java index 6c1b5644f..7710306b7 100644 --- a/gnu/CORBA/Poa/gnuPOAManager.java +++ b/gnu/CORBA/Poa/gnuPOAManager.java @@ -40,6 +40,8 @@ package gnu.CORBA.Poa; import org.omg.CORBA.BAD_INV_ORDER; import org.omg.CORBA.LocalObject; +import org.omg.PortableInterceptor.NON_EXISTENT; +import org.omg.PortableInterceptor.ObjectReferenceTemplate; import org.omg.PortableServer.POAManager; import org.omg.PortableServer.POAManagerPackage.AdapterInactive; import org.omg.PortableServer.POAManagerPackage.State; @@ -59,18 +61,22 @@ public class gnuPOAManager extends LocalObject implements POAManager { + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1; + /** - * The POAs, controlled by this manager. The members must be instances of - * the gnuAbstractPOA. + * The POAs, controlled by this manager. */ - HashSet POAs = new HashSet(); + private HashSet POAs = new HashSet(); /** * The state of the manager. The newly created manager is always * in the holding state. */ State state = State.HOLDING; - + /** * Get the state of the POA manager. */ @@ -94,6 +100,8 @@ public class gnuPOAManager state = State.ACTIVE; else throw new AdapterInactive(); + + notifyInterceptors(state.value()); } /** @@ -113,6 +121,9 @@ public class gnuPOAManager state = State.HOLDING; else throw new AdapterInactive(); + + notifyInterceptors(state.value()); + if (wait_for_completion) waitForIdle(); } @@ -144,6 +155,9 @@ public class gnuPOAManager if (state == State.INACTIVE) throw new AdapterInactive("Repetetive inactivation"); state = State.INACTIVE; + + notifyInterceptors(state.value()); + if (wait_for_completion) waitForIdle(); @@ -178,6 +192,9 @@ public class gnuPOAManager state = State.DISCARDING; else throw new AdapterInactive(); + + notifyInterceptors(state.value()); + if (wait_for_completion) waitForIdle(); } @@ -193,11 +210,13 @@ public class gnuPOAManager { if (state == State.ACTIVE) throw new BAD_INV_ORDER("The state is active"); - + + gnuPOA poa; Iterator iter = POAs.iterator(); + while (iter.hasNext()) { - gnuPOA poa = (gnuPOA) iter.next(); + poa = (gnuPOA) iter.next(); poa.waitWhileRunning(); } } @@ -222,4 +241,33 @@ public class gnuPOAManager { POAs.remove(poa); } + + /** + * This method is called when POA is destryed. The interceptors are + * notified. + */ + public void poaDestroyed(gnuPOA poa) + { + notifyInterceptors(NON_EXISTENT.value); + } + + /** + * Notify CORBA 3.0 interceptors about the status change. + */ + public synchronized void notifyInterceptors(int new_state) + { + gnuPOA poa; + Iterator iter = POAs.iterator(); + + // The System.identityHashCode is also called in gnuIorInfo. + while (iter.hasNext()) + { + poa = (gnuPOA) iter.next(); + if (poa.m_orb.iIor != null) + { + poa.m_orb.iIor.adapter_manager_state_changed( + System.identityHashCode(this), (short) new_state); + } + } + } }
\ No newline at end of file diff --git a/org/omg/PortableInterceptor/IORInfoOperations.java b/org/omg/PortableInterceptor/IORInfoOperations.java index 58ef02fb0..6cc374bfb 100644 --- a/org/omg/PortableInterceptor/IORInfoOperations.java +++ b/org/omg/PortableInterceptor/IORInfoOperations.java @@ -73,7 +73,7 @@ public interface IORInfoOperations void add_ior_component(TaggedComponent tagged_component); /** - * Get the server side policy for an IOR being constructed. The method returns + * Get the server side policy for an IOR being constructed. The method returns * policies applying for POA where the object, represented by this IOR, is * connected. * @@ -85,4 +85,43 @@ public interface IORInfoOperations * @see org.omg.PortableServer.POAOperations#create_POA */ Policy get_effective_policy(int policy_type); + + /** + * Get the adapter template that is associated with the object POA. + * The template is also a reference factory and can produce the new object + * references. + * + * @since 1.5 + */ + public ObjectReferenceTemplate adapter_template(); + + /** + * The current_factory is the factory, used by the adapter to create + * object references. This factory is initially the same as the + * adapter_template. + * + * @since 1.5 + */ + public ObjectReferenceFactory current_factory(); + + /** + * Set the current object reference factory, used to produce the new objects. + * + * The current factory can only be set during the call to the + * {@link IORInterceptor_3_0Operations#components_established(IORInfo)}. + * + * @since 1.5 + */ + public void current_factory(ObjectReferenceFactory factory); + + /** + * Get the POA manager Id. + * + * @return Id that uniquely refers to the poa manager, used by this POA. + * + * @since 1.5 + * + * @see IORInterceptor_3_0Operations#adapter_manager_state_changed + */ + public int manager_id(); }
\ No newline at end of file diff --git a/org/omg/PortableInterceptor/IORInterceptorOperations.java b/org/omg/PortableInterceptor/IORInterceptorOperations.java index 868fcab6c..746d139cf 100644 --- a/org/omg/PortableInterceptor/IORInterceptorOperations.java +++ b/org/omg/PortableInterceptor/IORInterceptorOperations.java @@ -47,12 +47,12 @@ package org.omg.PortableInterceptor; public interface IORInterceptorOperations extends InterceptorOperations { /** - * A server side ORB calls this method on all registered IORInterceptor's when + * A server side ORB calls this method on all registered IORInterceptor's when * creating the object reference (IOR). The interceptors have the possibility * to add additional tags to the IOR being created. * - * @param info the interface class providing methods to insert additional tags - * into IOR being constructed. The same instan + * @param info the interface class providing methods to insert additional tags + * into IOR being constructed. */ public void establish_components(IORInfo info); }
\ No newline at end of file diff --git a/org/omg/PortableInterceptor/IORInterceptor_3_0.java b/org/omg/PortableInterceptor/IORInterceptor_3_0.java new file mode 100644 index 000000000..4b2093d40 --- /dev/null +++ b/org/omg/PortableInterceptor/IORInterceptor_3_0.java @@ -0,0 +1,59 @@ +/* IORInterceptor_3_0.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * The IORInterceptor_3_0 adds to {@link Interceptor} functionality, available + * since CORBA 3.0. These new operations are defined separately in + * {@link IORInterceptor_3_0Operations}. + * + * IORInterceptor_3_0 is registered exactly in the same way as the + * {@link IORInterceptor}. The ORB calls the additional methods to all + * IOR interceptors that implement this extended interface. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IORInterceptor_3_0 + extends IORInterceptor_3_0Operations, IDLEntity, IORInterceptor +{ +}
\ No newline at end of file diff --git a/org/omg/PortableInterceptor/IORInterceptor_3_0Helper.java b/org/omg/PortableInterceptor/IORInterceptor_3_0Helper.java new file mode 100644 index 000000000..565242477 --- /dev/null +++ b/org/omg/PortableInterceptor/IORInterceptor_3_0Helper.java @@ -0,0 +1,195 @@ +/* IORInterceptor_3_0Helper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import gnu.CORBA.Minor; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for the CORBA object {@link IORInterceptor_3_0}. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class IORInterceptor_3_0Helper +{ + /** + * The cached {@link IORInterceptor_3_0} typecode, computed once. + */ + private static TypeCode typeCode; + + /** + * Get the type code of the {@link IORInterceptor_3_0}. + */ + public static TypeCode type() + { + if (typeCode == null) + typeCode = ORB.init().create_interface_tc(id(), "IORInterceptor_3_0"); + return typeCode; + } + + /** + * Insert the IORInterceptor_3_0 into the given Any. + * + * @param any the Any to insert into. + * @param that the IORInterceptor_3_0 to insert. + */ + public static void insert(Any any, IORInterceptor_3_0 that) + { + any.insert_Streamable(new IORInterceptor_3_0Holder(that)); + } + + /** + * Extract the IORInterceptor_3_0 from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain + * IORInterceptor_3_0. + */ + public static IORInterceptor_3_0 extract(Any any) + { + try + { + IORInterceptor_3_0Holder holder = (IORInterceptor_3_0Holder) + any.extract_Streamable(); + return holder.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("IORInterceptor_3_0 expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the IORInterceptor_3_0 repository id. + * + * @return "IDL:omg.org/PortableInterceptor/IORInterceptor_3_0:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/IORInterceptor_3_0:1.0"; + } + + /** + * Narrow the passed object into the IORInterceptor_3_0. If the object has a + * different java type, create an instance of the _IORInterceptor_3_0Stub, + * using the same delegate, as for the passed parameter. Hence, unlike java + * type cast, this method may return a different object, than has been passed. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a IORInterceptor_3_0. + */ + public static IORInterceptor_3_0 narrow(org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof IORInterceptor_3_0) + return (IORInterceptor_3_0) obj; + else if (!obj._is_a(id())) + throw new BAD_PARAM("Not a IORInterceptor_3_0"); + else + { + Delegate delegate = ((ObjectImpl) obj)._get_delegate(); + return new _IORInterceptor_3_0Stub(delegate); + } + } + + /** + * Narrow the passed object into the IORInterceptor_3_0. No type-checking is + * performed to verify that the object actually supports the requested type. + * The {@link BAD_OPERATION} will be thrown if unsupported operations are + * invoked on the new returned reference, but no failure is expected at the + * time of the unchecked_narrow. For instance, the narrowing of the + * remote instance of the {@link IORInterceptor} will work as long as only the + * methods, inherited from this parent, are invoked. + * + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a IORInterceptor_3_0. + */ + public static IORInterceptor_3_0 unchecked_narrow(org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof IORInterceptor_3_0) + return (IORInterceptor_3_0) obj; + else + { + Delegate delegate = ((ObjectImpl) obj)._get_delegate(); + return new _IORInterceptor_3_0Stub(delegate); + } + } + + + /** + * Read the IORInterceptor_3_0 from the CDR intput stream (IOR profile + * expected). + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static IORInterceptor_3_0 read(InputStream input) + { + return unchecked_narrow(input.read_Object()); + } + + /** + * Write the IORInterceptor_3_0 to the CDR output stream (as IOR profile). + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, IORInterceptor_3_0 value) + { + output.write_Object(value); + } +}
\ No newline at end of file diff --git a/org/omg/PortableInterceptor/IORInterceptor_3_0Holder.java b/org/omg/PortableInterceptor/IORInterceptor_3_0Holder.java new file mode 100644 index 000000000..dc7ecf23f --- /dev/null +++ b/org/omg/PortableInterceptor/IORInterceptor_3_0Holder.java @@ -0,0 +1,106 @@ +/* IORInterceptor_3_0Holder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for the object {@link IORInterceptor_3_0}. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class IORInterceptor_3_0Holder + implements Streamable +{ + /** + * The stored IORInterceptor_3_0 value. + */ + public IORInterceptor_3_0 value; + + /** + * Create the unitialised instance, leaving the value field with default + * <code>null</code> value. + */ + public IORInterceptor_3_0Holder() + { + } + + /** + * Create the initialised instance. + * + * @param initialValue the value that will be assigned to the + * <code>value</code> field. + */ + public IORInterceptor_3_0Holder(IORInterceptor_3_0 initialValue) + { + value = initialValue; + } + + /** + * Fill in the {@link value} by data from the CDR stream. + * + * @param input the org.omg.CORBA.portable stream to read. + */ + public void _read(InputStream input) + { + value = IORInterceptor_3_0Helper.read(input); + } + + /** + * Write the stored value into the CDR stream. + * + * @param output the org.omg.CORBA.portable stream to write. + */ + public void _write(OutputStream output) + { + IORInterceptor_3_0Helper.write(output, value); + } + + /** + * Get the typecode of the IORInterceptor_3_0. + */ + public org.omg.CORBA.TypeCode _type() + { + return IORInterceptor_3_0Helper.type(); + } +}
\ No newline at end of file diff --git a/org/omg/PortableInterceptor/IORInterceptor_3_0Operations.java b/org/omg/PortableInterceptor/IORInterceptor_3_0Operations.java new file mode 100644 index 000000000..ce6575a4c --- /dev/null +++ b/org/omg/PortableInterceptor/IORInterceptor_3_0Operations.java @@ -0,0 +1,90 @@ +/* IORInterceptor_3_0Operations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +/** + * Defines the operations, applicable to the IORInterceptor_3_0. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IORInterceptor_3_0Operations + extends IORInterceptorOperations +{ + /** + * This method is invoked on all registered IORInterceptor_3_0 instances when + * the state of the adapter manager changes. + * + * @param adapterManagerId the Id of the adapter manager that has changed the + * state. The same value is returned by + * {@link IORInfoOperations#manager_id()}. + * + * @param adapterState the new state of the adapter manager, one of the + * {@link HOLDING#value}, {@link DISCARDING#value}, {@link INACTIVE#value} + * or {@link NON_EXISTENT#value}. + */ + void adapter_manager_state_changed(int adapterManagerId, short adapterState); + + /** + * Notifies the interceptor about the adapter state changes that are unrelated + * to adapter manager state changes. This method is invoked on all registered + * IORInterceptor_3_0 instances. The only currently possible change of state + * is when POA is destroyed. In this case, the method is invoked passing the + * single element array witn the reference template of the POA being destroyed + * and the {@link NON_EXISTENT#value} state. + * + * @param adapters identifies the object adapters that have changed they + * state. + * @param adaptersState the new state of the adapters, one of the + * {@link HOLDING#value}, {@link DISCARDING#value}, {@link INACTIVE#value} + * or {@link NON_EXISTENT#value}. + */ + void adapter_state_changed(ObjectReferenceTemplate[] adapters, + short adaptersState); + + /** + * This metod is invoked after the + * {@link IORInterceptorOperations#establish_components} have been called on + * all registered interceptor instances. At this stage, it is possible to set + * the object reference factory using + * {@link IORInfo#current_factory(ObjectReferenceFactory )}. + */ + void components_established(IORInfo info); +}
\ No newline at end of file diff --git a/org/omg/PortableInterceptor/ORBInitInfoOperations.java b/org/omg/PortableInterceptor/ORBInitInfoOperations.java index 9cffbe1b5..7b545ff81 100644 --- a/org/omg/PortableInterceptor/ORBInitInfoOperations.java +++ b/org/omg/PortableInterceptor/ORBInitInfoOperations.java @@ -55,7 +55,7 @@ public interface ORBInitInfoOperations * * @param interceptor the interceptor to register. * - * @throws DuplicateName if the interceptor name is not an empty string and an + * @throws DuplicateName if the interceptor name is not an empty string and an * interceptor with this name is already registered with the ORB being * created. */ @@ -63,11 +63,14 @@ public interface ORBInitInfoOperations throws DuplicateName; /** - * Register the IOR (object reference) interceptor. - * + * Register the IOR (object reference) interceptor. If the registered + * interceptor implements the extended {@link IORInterceptor_3_0} interface, + * ORB will call its additional methods, defined in the + * {@link IORInterceptor_3_0Operations}. + * * @param interceptor the interceptor to register. - * - * @throws DuplicateName if the interceptor name is not an empty string and an + * + * @throws DuplicateName if the interceptor name is not an empty string and an * interceptor with this name is already registered with the ORB being * created. */ @@ -79,7 +82,7 @@ public interface ORBInitInfoOperations * * @param interceptor the interceptor to register. * - * @throws DuplicateName if the interceptor name is not an empty string and an + * @throws DuplicateName if the interceptor name is not an empty string and an * interceptor with this name is already registered with the ORB being * created. */ @@ -90,7 +93,7 @@ public interface ORBInitInfoOperations * Allocate a slot on a {@link PortableInterceptor.Current}. While slots can * be allocated by this method, they cannot be initialized. * {@link CurrentOperations#get_slot} and {@link CurrentOperations#set_slot} - * throw {@link org.omg.CORBA.BAD_INV_ORDER} while called from the interceptor + * throw {@link org.omg.CORBA.BAD_INV_ORDER} while called from the interceptor * initializer. * * @return the index to the slot that has been allocated. diff --git a/org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java b/org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java index d2ce61423..b5d912d12 100644 --- a/org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java +++ b/org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java @@ -53,11 +53,16 @@ public interface ObjectReferenceFactoryOperations /** * Create an object with the given repository and object ids. This interface * does not specify where and how the returned object must be connected and - * activated. - * + * activated. The derived {@link ObjectReferenceTemplate} interface assumes + * the the object must be connected to the POA that is specific to that + * template (name can be obtained). + * + * If the object with this objectId already exists in the given context, it is + * found and returned; the new object is <i>not</i> created. + * * @param repositoryId the repository id of the object being created, defines * the type of the object. - * + * * @param objectId the byte array, defining the identity of the object. */ org.omg.CORBA.Object make_object(String repositoryId, byte[] objectId); diff --git a/org/omg/PortableInterceptor/_IORInterceptor_3_0Stub.java b/org/omg/PortableInterceptor/_IORInterceptor_3_0Stub.java new file mode 100644 index 000000000..52856407a --- /dev/null +++ b/org/omg/PortableInterceptor/_IORInterceptor_3_0Stub.java @@ -0,0 +1,272 @@ +/* _IORInterceptor_3_0Stub.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.ApplicationException; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.RemarshalException; + +import java.io.Serializable; + +/** + * The IORInterceptor_3_0 stub (proxy), used on the client side. The + * {@link IORInterceptor_3_0} methods contain the code for remote invocaton. The + * stub is required by {@link IORInterceptor_3_0Helper} .read, .narrow and + * .unchecked_narrow methods. + * + * @specnote Being not specified in 1.5 API, this class is package private. + * From that happened to some other stubs, it will likely to appear in the 1.6 + * or later. Because of this, it is placed here. + * + * @specnote The stub and the helper support the existence of the interceptor + * on the remote side only. To support the corresponding support on the side + * where the ORB is registered with this interceptor, you also need + * _IORInfoStub, IORInfoHelper and either servants or implementation bases + * for both POA and IORInfo. These classes are not defined in the 1.5 API, + * hence they are not included. You may need to generate the manually from + * the IDL descriptions, available from + * http://www.omg.org/docs/formal/04-03-12.pdf. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +class _IORInterceptor_3_0Stub + extends ObjectImpl + implements IORInterceptor_3_0, Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1; + + /** + * Create the IORInterceptor_3_0 stub. To get the stub working, you must later + * set the delegate with {@link ObjectImpl#_set_delegate(Delegate)}. + */ + public _IORInterceptor_3_0Stub() + { + } + + /** + * Create the naming context stub with the given delegate. + */ + public _IORInterceptor_3_0Stub(Delegate delegate) + { + _set_delegate(delegate); + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { IORInterceptor_3_0Helper.id() }; + } + + /** {@inheritDoc} */ + public void adapter_manager_state_changed(int adapterManagerId, + short adapterState) + { + InputStream input = null; + try + { + OutputStream output = _request("adapter_manager_state_changed", true); + output.write_long(adapterManagerId); + output.write_short(adapterState); + input = _invoke(output); + + } + catch (ApplicationException ex) + { + input = ex.getInputStream(); + String id = ex.getId(); + throw new MARSHAL(id); + } + catch (RemarshalException remarsh) + { + adapter_manager_state_changed(adapterManagerId, adapterState); + } + finally + { + _releaseReply(input); + } + } + + /** {@inheritDoc} */ + public void adapter_state_changed(ObjectReferenceTemplate[] adapters, + short adaptersState) + { + InputStream input = null; + try + { + OutputStream output = _request("adapter_state_changed", true); + output.write_long(adapters.length); + for (int i0 = 0; i0 < adapters.length; i0++) + ObjectReferenceTemplateHelper.write(output, adapters[i0]); + output.write_short(adaptersState); + input = _invoke(output); + + } + catch (ApplicationException ex) + { + input = ex.getInputStream(); + String id = ex.getId(); + throw new MARSHAL(id); + } + catch (RemarshalException remarsh) + { + adapter_state_changed(adapters, adaptersState); + } + finally + { + _releaseReply(input); + } + } + + /** {@inheritDoc} */ + public void components_established(IORInfo info) + { + InputStream input = null; + try + { + OutputStream output = _request("components_established", true); + output.write_Object(info); + input = _invoke(output); + + } + catch (ApplicationException ex) + { + input = ex.getInputStream(); + String id = ex.getId(); + throw new MARSHAL(id); + } + catch (RemarshalException remarsh) + { + components_established(info); + } + finally + { + _releaseReply(input); + } + } + + /** {@inheritDoc} */ + public void establish_components(IORInfo info) + { + InputStream input = null; + try + { + OutputStream output = _request("establish_components", true); + output.write_Object(info); + input = _invoke(output); + + } + catch (ApplicationException ex) + { + input = ex.getInputStream(); + String id = ex.getId(); + throw new MARSHAL(id); + } + catch (RemarshalException remarsh) + { + establish_components(info); + } + finally + { + _releaseReply(input); + } + } + + /** {@inheritDoc} */ + public String name() + { + InputStream input = null; + try + { + OutputStream output = _request("name", true); + input = _invoke(output); + String returns = input.read_string(); + + return returns; + } + catch (ApplicationException ex) + { + input = ex.getInputStream(); + String id = ex.getId(); + throw new MARSHAL(id); + } + catch (RemarshalException remarsh) + { + return name(); + } + finally + { + _releaseReply(input); + } + } + + /** {@inheritDoc} */ + public void destroy() + { + InputStream input = null; + try + { + OutputStream output = _request("destroy", true); + input = _invoke(output); + + } + catch (ApplicationException ex) + { + input = ex.getInputStream(); + String id = ex.getId(); + throw new MARSHAL(id); + } + catch (RemarshalException remarsh) + { + destroy(); + } + finally + { + _releaseReply(input); + } + } +}
\ No newline at end of file |