classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: unchecked_narrow metod (1.5) in CORBA helpers.


From: Meskauskas Audrius
Subject: [cp-patches] FYI: unchecked_narrow metod (1.5) in CORBA helpers.
Date: Tue, 25 Oct 2005 13:18:04 +0200
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

All helpers in jdk 1.5 contain the additional unchecked_narrow method, discussed in http://www.omg.org/issues/issue4158.txt.

This path adds the method to our helper classes.

2005-10-25  Audrius Meskauskas  <address@hidden>

* org/omg/CosNaming/BindingIteratorHelper.java,
org/omg/CosNaming/NamingContextExtHelper.java,
org/omg/CosNaming/NamingContextHelper.java,
org/omg/DynamicAny/DynAnyFactoryHelper.java,
org/omg/DynamicAny/DynAnyHelper.java,
org/omg/DynamicAny/DynArrayHelper.java,
org/omg/DynamicAny/DynEnumHelper.java,
org/omg/DynamicAny/DynFixedHelper.java,
org/omg/DynamicAny/DynSequenceHelper.java,
org/omg/DynamicAny/DynStructHelper.java,
org/omg/DynamicAny/DynUnionHelper.java,
org/omg/DynamicAny/DynValueHelper.java,
org/omg/IOP/CodecFactoryHelper.java,
org/omg/PortableInterceptor/CurrentHelper.java,
org/omg/PortableServer/ServantActivatorHelper.java,
org/omg/PortableServer/ServantLocatorHelper.java: Added
unchecked_narrow method.

Index: org/omg/CosNaming/BindingIteratorHelper.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/org/omg/CosNaming/BindingIteratorHelper.java,v
retrieving revision 1.4
diff -u -r1.4 BindingIteratorHelper.java
--- org/omg/CosNaming/BindingIteratorHelper.java        5 Oct 2005 16:25:42 
-0000       1.4
+++ org/omg/CosNaming/BindingIteratorHelper.java        25 Oct 2005 10:43:40 
-0000
@@ -124,6 +124,35 @@
         return new _BindingIteratorStub(delegate);
       }
   }
+  
+  /**
+   * Narrow the given object to the BindingIterator. No type-checking is
+   * performed to verify that the object actually supports the requested type.
+   * The address@hidden 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.
+   * 
+   * @param obj the object to cast.
+   * 
+   * @return the casted binding iterator.
+   * 
+   * @since 1.5 
+   * 
+   * @see OMG issue 4158.
+   */
+  public static BindingIterator unchecked_narrow(org.omg.CORBA.Object obj)
+  {
+    if (obj == null)
+      return null;
+    else if (obj instanceof BindingIterator)
+      return (BindingIterator) obj;
+    else
+      {
+        // Do not call the _is_a(..).
+        Delegate delegate = ((ObjectImpl) obj)._get_delegate();
+        return new _BindingIteratorStub(delegate);
+      }    
+  }
 
   /**
    * Read the exception from the given CDR stream.
Index: org/omg/CosNaming/NamingContextExtHelper.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/org/omg/CosNaming/NamingContextExtHelper.java,v
retrieving revision 1.4
diff -u -r1.4 NamingContextExtHelper.java
--- org/omg/CosNaming/NamingContextExtHelper.java       5 Oct 2005 16:25:42 
-0000       1.4
+++ org/omg/CosNaming/NamingContextExtHelper.java       25 Oct 2005 10:43:24 
-0000
@@ -125,6 +125,35 @@
         return new _NamingContextExtStub(delegate);
       }
   }
+  
+  /**
+   * Narrow the given object to the NamingContextExt. No type-checking is
+   * performed to verify that the object actually supports the requested type.
+   * The address@hidden 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.
+   * 
+   * @param obj the object to cast.
+   * 
+   * @return the casted NamingContextExt
+   * 
+   * @since 1.5 
+   * 
+   * @see OMG issue 4158.
+   */
+  public static NamingContextExt unchecked_narrow(org.omg.CORBA.Object obj)
+  {
+    if (obj == null)
+      return null;
+    else if (obj instanceof NamingContextExt)
+      return (NamingContextExt) obj;
+    else
+      {
+        // Do not call the _is_a(..).
+        Delegate delegate = ((ObjectImpl) obj)._get_delegate();
+        return new _NamingContextExtStub(delegate);
+      }    
+  }
 
   /**
    * Read the extended naming context from the given CDR input stream.
Index: org/omg/CosNaming/NamingContextHelper.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/org/omg/CosNaming/NamingContextHelper.java,v
retrieving revision 1.4
diff -u -r1.4 NamingContextHelper.java
--- org/omg/CosNaming/NamingContextHelper.java  5 Oct 2005 16:25:42 -0000       
1.4
+++ org/omg/CosNaming/NamingContextHelper.java  25 Oct 2005 10:51:34 -0000
@@ -133,6 +133,35 @@
     else
       throw new BAD_PARAM();
   }
+  
+  /**
+   * Narrow the given object to the NamingContext. No type-checking is 
performed
+   * to verify that the object actually supports the requested type. The
+   * address@hidden 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.
+   * 
+   * @param obj the object to cast.
+   * 
+   * @return the casted NamingContext.
+   * 
+   * @since 1.5 
+   * 
+   * @see OMG issue 4158.
+   */
+  public static NamingContext unchecked_narrow(org.omg.CORBA.Object obj)
+  {
+    if (obj == null)
+      return null;
+    else if (obj instanceof NamingContext)
+      return (NamingContext) obj;
+    else
+      {
+        // Do not call the _is_a(..).
+        Delegate delegate = ((ObjectImpl) obj)._get_delegate();
+        return new _NamingContextStub(delegate);
+      }    
+  }  
 
   /**
    * Read the naming context from the given CDR input stream.
Index: org/omg/DynamicAny/DynAnyFactoryHelper.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/org/omg/DynamicAny/DynAnyFactoryHelper.java,v
retrieving revision 1.3
diff -u -r1.3 DynAnyFactoryHelper.java
--- org/omg/DynamicAny/DynAnyFactoryHelper.java 4 Oct 2005 17:58:15 -0000       
1.3
+++ org/omg/DynamicAny/DynAnyFactoryHelper.java 25 Oct 2005 10:51:44 -0000
@@ -82,6 +82,25 @@
                             + " is not a DynAnyFactory");
       }
   }
+  
+  /**
+   * Narrow the given object to the DynAnyFactory. For the objects that are
+   * always local, this operation does not differ from the ordinary
+   * address@hidden #narrow} (ClassCastException will be thrown if narrowing 
something
+   * different).
+   * 
+   * @param obj the object to cast.
+   * 
+   * @return the casted DynAnyFactory.
+   * 
+   * @since 1.5 
+   * 
+   * @see OMG issue 4158.
+   */
+  public static DynAnyFactory unchecked_narrow(org.omg.CORBA.Object obj)
+  {
+    return narrow(obj);
+  }    
 
   /**
    * Get the final_type code of the address@hidden DynAnyFactory}.
Index: org/omg/DynamicAny/DynAnyHelper.java
===================================================================
RCS file: /cvsroot/classpath/classpath/org/omg/DynamicAny/DynAnyHelper.java,v
retrieving revision 1.1
diff -u -r1.1 DynAnyHelper.java
--- org/omg/DynamicAny/DynAnyHelper.java        2 Aug 2005 08:25:40 -0000       
1.1
+++ org/omg/DynamicAny/DynAnyHelper.java        25 Oct 2005 10:51:34 -0000
@@ -79,6 +79,25 @@
         throw new BAD_PARAM(obj.getClass().getName() + " is not a DynAny");
       }
   }
+  
+  /**
+   * Narrow the given object to the DynAny. For the objects that are
+   * always local, this operation does not differ from the ordinary
+   * address@hidden #narrow} (ClassCastException will be thrown if narrowing 
something
+   * different).
+   * 
+   * @param obj the object to cast.
+   * 
+   * @return the casted DynAny.
+   * 
+   * @since 1.5 
+   * 
+   * @see OMG issue 4158.
+   */
+  public static DynAny unchecked_narrow(org.omg.CORBA.Object obj)
+  {
+    return narrow(obj);
+  }    
 
   /**
    * Get the type code of the address@hidden DynAny}.
Index: org/omg/DynamicAny/DynArrayHelper.java
===================================================================
RCS file: /cvsroot/classpath/classpath/org/omg/DynamicAny/DynArrayHelper.java,v
retrieving revision 1.1
diff -u -r1.1 DynArrayHelper.java
--- org/omg/DynamicAny/DynArrayHelper.java      2 Aug 2005 08:25:40 -0000       
1.1
+++ org/omg/DynamicAny/DynArrayHelper.java      25 Oct 2005 10:51:34 -0000
@@ -78,6 +78,25 @@
         throw new BAD_PARAM(obj.getClass().getName() + " is not a DynArray");
       }
   }
+  
+  /**
+   * Narrow the given object to the DynArray. For the objects that are
+   * always local, this operation does not differ from the ordinary
+   * address@hidden #narrow} (ClassCastException will be thrown if narrowing 
something
+   * different).
+   * 
+   * @param obj the object to cast.
+   * 
+   * @return the casted DynArray.
+   * 
+   * @since 1.5 
+   * 
+   * @see OMG issue 4158.
+   */
+  public static DynArray unchecked_narrow(org.omg.CORBA.Object obj)
+  {
+    return narrow(obj);
+  }    
 
   /**
    * Get the type code of the address@hidden DynArray}.
Index: org/omg/DynamicAny/DynEnumHelper.java
===================================================================
RCS file: /cvsroot/classpath/classpath/org/omg/DynamicAny/DynEnumHelper.java,v
retrieving revision 1.1
diff -u -r1.1 DynEnumHelper.java
--- org/omg/DynamicAny/DynEnumHelper.java       2 Aug 2005 08:25:40 -0000       
1.1
+++ org/omg/DynamicAny/DynEnumHelper.java       25 Oct 2005 10:51:06 -0000
@@ -79,6 +79,25 @@
         throw new BAD_PARAM(obj.getClass().getName() + " is not a DynEnum");
       }
   }
+  
+  /**
+   * Narrow the given object to the DynEnum. For the objects that are
+   * always local, this operation does not differ from the ordinary
+   * address@hidden #narrow} (ClassCastException will be thrown if narrowing 
something
+   * different).
+   * 
+   * @param obj the object to cast.
+   * 
+   * @return the casted DynEnum.
+   * 
+   * @since 1.5 
+   * 
+   * @see OMG issue 4158.
+   */
+  public static DynEnum unchecked_narrow(org.omg.CORBA.Object obj)
+  {
+    return narrow(obj);
+  }    
 
   /**
    * Get the type code of the address@hidden DynEnum}.
Index: org/omg/DynamicAny/DynFixedHelper.java
===================================================================
RCS file: /cvsroot/classpath/classpath/org/omg/DynamicAny/DynFixedHelper.java,v
retrieving revision 1.1
diff -u -r1.1 DynFixedHelper.java
--- org/omg/DynamicAny/DynFixedHelper.java      2 Aug 2005 08:25:40 -0000       
1.1
+++ org/omg/DynamicAny/DynFixedHelper.java      25 Oct 2005 10:54:54 -0000
@@ -79,6 +79,25 @@
         throw new BAD_PARAM(obj.getClass().getName() + " is not a DynFixed");
       }
   }
+  
+  /**
+   * Narrow the given object to the DynFixed. For the objects that are
+   * always local, this operation does not differ from the ordinary
+   * address@hidden #narrow} (ClassCastException will be thrown if narrowing 
something
+   * different).
+   * 
+   * @param obj the object to cast.
+   * 
+   * @return the casted DynFixed.
+   * 
+   * @since 1.5 
+   * 
+   * @see OMG issue 4158.
+   */
+  public static DynFixed unchecked_narrow(org.omg.CORBA.Object obj)
+  {
+    return narrow(obj);
+  }    
 
   /**
    * Get the type code of the address@hidden DynFixed}.
Index: org/omg/DynamicAny/DynSequenceHelper.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/org/omg/DynamicAny/DynSequenceHelper.java,v
retrieving revision 1.1
diff -u -r1.1 DynSequenceHelper.java
--- org/omg/DynamicAny/DynSequenceHelper.java   2 Aug 2005 08:25:40 -0000       
1.1
+++ org/omg/DynamicAny/DynSequenceHelper.java   25 Oct 2005 10:55:40 -0000
@@ -78,6 +78,25 @@
         throw new BAD_PARAM(obj.getClass().getName() + " is not a 
DynSequence");
       }
   }
+  
+  /**
+   * Narrow the given object to the DynSequence. For the objects that are
+   * always local, this operation does not differ from the ordinary
+   * address@hidden #narrow} (ClassCastException will be thrown if narrowing 
something
+   * different).
+   * 
+   * @param obj the object to cast.
+   * 
+   * @return the casted DynSequence.
+   * 
+   * @since 1.5 
+   * 
+   * @see OMG issue 4158.
+   */
+  public static DynSequence unchecked_narrow(org.omg.CORBA.Object obj)
+  {
+    return narrow(obj);
+  }    
 
   /**
    * Get the type code of the address@hidden DynSequence}.
Index: org/omg/DynamicAny/DynStructHelper.java
===================================================================
RCS file: /cvsroot/classpath/classpath/org/omg/DynamicAny/DynStructHelper.java,v
retrieving revision 1.1
diff -u -r1.1 DynStructHelper.java
--- org/omg/DynamicAny/DynStructHelper.java     2 Aug 2005 08:25:40 -0000       
1.1
+++ org/omg/DynamicAny/DynStructHelper.java     25 Oct 2005 10:56:32 -0000
@@ -78,6 +78,25 @@
         throw new BAD_PARAM(obj.getClass().getName() + " is not a DynStruct");
       }
   }
+  
+  /**
+   * Narrow the given object to the DynStruct. For the objects that are
+   * always local, this operation does not differ from the ordinary
+   * address@hidden #narrow} (ClassCastException will be thrown if narrowing 
something
+   * different).
+   * 
+   * @param obj the object to cast.
+   * 
+   * @return the casted DynStruct.
+   * 
+   * @since 1.5 
+   * 
+   * @see OMG issue 4158.
+   */
+  public static DynStruct unchecked_narrow(org.omg.CORBA.Object obj)
+  {
+    return narrow(obj);
+  }    
 
   /**
    * Get the type code of the address@hidden DynStruct}.
Index: org/omg/DynamicAny/DynUnionHelper.java
===================================================================
RCS file: /cvsroot/classpath/classpath/org/omg/DynamicAny/DynUnionHelper.java,v
retrieving revision 1.1
diff -u -r1.1 DynUnionHelper.java
--- org/omg/DynamicAny/DynUnionHelper.java      2 Aug 2005 08:25:40 -0000       
1.1
+++ org/omg/DynamicAny/DynUnionHelper.java      25 Oct 2005 10:57:10 -0000
@@ -78,6 +78,25 @@
         throw new BAD_PARAM(obj.getClass().getName() + " is not a DynUnion");
       }
   }
+  
+  /**
+   * Narrow the given object to the DynUnion. For the objects that are
+   * always local, this operation does not differ from the ordinary
+   * address@hidden #narrow} (ClassCastException will be thrown if narrowing 
something
+   * different).
+   * 
+   * @param obj the object to cast.
+   * 
+   * @return the casted DynUnion.
+   * 
+   * @since 1.5 
+   * 
+   * @see OMG issue 4158.
+   */
+  public static DynUnion unchecked_narrow(org.omg.CORBA.Object obj)
+  {
+    return narrow(obj);
+  }    
 
   /**
    * Get the type code of the address@hidden DynUnion}.
Index: org/omg/DynamicAny/DynValueHelper.java
===================================================================
RCS file: /cvsroot/classpath/classpath/org/omg/DynamicAny/DynValueHelper.java,v
retrieving revision 1.1
diff -u -r1.1 DynValueHelper.java
--- org/omg/DynamicAny/DynValueHelper.java      2 Aug 2005 08:25:40 -0000       
1.1
+++ org/omg/DynamicAny/DynValueHelper.java      25 Oct 2005 10:57:48 -0000
@@ -78,6 +78,25 @@
         throw new BAD_PARAM(obj.getClass().getName() + " is not a DynValue");
       }
   }
+  
+  /**
+   * Narrow the given object to the DynValue. For the objects that are
+   * always local, this operation does not differ from the ordinary
+   * address@hidden #narrow} (ClassCastException will be thrown if narrowing 
something
+   * different).
+   * 
+   * @param obj the object to cast.
+   * 
+   * @return the casted DynValue.
+   * 
+   * @since 1.5 
+   * 
+   * @see OMG issue 4158.
+   */
+  public static DynValue unchecked_narrow(org.omg.CORBA.Object obj)
+  {
+    return narrow(obj);
+  }    
 
   /**
    * Get the type code of the address@hidden DynValue}.
Index: org/omg/IOP/CodecFactoryHelper.java
===================================================================
RCS file: /cvsroot/classpath/classpath/org/omg/IOP/CodecFactoryHelper.java,v
retrieving revision 1.2
diff -u -r1.2 CodecFactoryHelper.java
--- org/omg/IOP/CodecFactoryHelper.java 2 Jul 2005 20:33:00 -0000       1.2
+++ org/omg/IOP/CodecFactoryHelper.java 25 Oct 2005 10:53:36 -0000
@@ -120,6 +120,25 @@
         throw bad;
       }
   }
+  
+  /**
+   * Narrow the given object to the CodecFactory. For the objects that are
+   * always local, this operation does not differ from the ordinary
+   * address@hidden #narrow} (ClassCastException will be thrown if narrowing 
something
+   * different).
+   * 
+   * @param obj the object to cast.
+   * 
+   * @return the casted CodecFactory.
+   * 
+   * @since 1.5 
+   * 
+   * @see OMG issue 4158.
+   */
+  public static CodecFactory unchecked_narrow(org.omg.CORBA.Object obj)
+  {
+    return narrow(obj);
+  }    
 
   /**
    * This should read the CodecFactory from the CDR intput stream,
Index: org/omg/PortableInterceptor/CurrentHelper.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/org/omg/PortableInterceptor/CurrentHelper.java,v
retrieving revision 1.2
diff -u -r1.2 CurrentHelper.java
--- org/omg/PortableInterceptor/CurrentHelper.java      4 Oct 2005 17:58:16 
-0000       1.2
+++ org/omg/PortableInterceptor/CurrentHelper.java      25 Oct 2005 10:46:40 
-0000
@@ -47,6 +47,7 @@
 import org.omg.CORBA.TypeCode;
 import org.omg.CORBA.portable.InputStream;
 import org.omg.CORBA.portable.OutputStream;
+import org.omg.PortableServer.ServantActivator;
 
 /**
  * The helper operations for the CORBA object address@hidden Current}.
@@ -125,6 +126,25 @@
         throw new BAD_PARAM("Not a Current");
       }
   }
+  
+  /**
+   * Narrow the given object to the Current. For the objects that are
+   * always local, this operation does not differ from the ordinary
+   * address@hidden #narrow} (ClassCastException will be thrown if narrowing 
something
+   * different).
+   * 
+   * @param obj the object to cast.
+   * 
+   * @return the casted Current.
+   * 
+   * @since 1.5 
+   * 
+   * @see OMG issue 4158.
+   */
+  public static Current unchecked_narrow(org.omg.CORBA.Object obj)
+  {
+    return narrow(obj);
+  }    
 
   /**
    * Not supported for compatibility reasons.
Index: org/omg/PortableServer/ServantActivatorHelper.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/org/omg/PortableServer/ServantActivatorHelper.java,v
retrieving revision 1.3
diff -u -r1.3 ServantActivatorHelper.java
--- org/omg/PortableServer/ServantActivatorHelper.java  4 Oct 2005 17:58:16 
-0000       1.3
+++ org/omg/PortableServer/ServantActivatorHelper.java  25 Oct 2005 10:51:34 
-0000
@@ -41,6 +41,7 @@
 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.MARSHAL;
 import org.omg.CORBA.ORB;
@@ -114,6 +115,26 @@
         throw bad;
       }
   }
+  
+  /**
+   * Narrow the given object to the ServantActivator. For the objects that are
+   * always local, this operation does not differ from the ordinary
+   * address@hidden #narrow} (ClassCastException will be thrown if narrowing 
something
+   * different).
+   * 
+   * @param obj the object to cast.
+   * 
+   * @return the casted ServantActivator.
+   * 
+   * @since 1.5 
+   * 
+   * @see OMG issue 4158.
+   */
+  public static ServantActivator unchecked_narrow(org.omg.CORBA.Object obj)
+  {
+    return narrow(obj);
+  }  
+  
 
   /**
    * This should read the servant activator, but it cannot be transferred
Index: org/omg/PortableServer/ServantLocatorHelper.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/org/omg/PortableServer/ServantLocatorHelper.java,v
retrieving revision 1.4
diff -u -r1.4 ServantLocatorHelper.java
--- org/omg/PortableServer/ServantLocatorHelper.java    5 Oct 2005 16:25:42 
-0000       1.4
+++ org/omg/PortableServer/ServantLocatorHelper.java    25 Oct 2005 10:51:34 
-0000
@@ -115,6 +115,25 @@
         throw bad;
       }
   }
+  
+  /**
+   * Narrow the given object to the ServantLocator. For the objects that are
+   * always local, this operation does not differ from the ordinary
+   * address@hidden #narrow} (ClassCastException will be thrown if narrowing 
something
+   * different).
+   * 
+   * @param obj the object to cast.
+   * 
+   * @return the casted ServantLocator.
+   * 
+   * @since 1.5
+   * 
+   * @see OMG issue 4158.
+   */
+  public static ServantLocator unchecked_narrow(org.omg.CORBA.Object obj)
+  {
+    return narrow(obj);
+  }    
 
   /**
    * This should read the servant locator, but it cannot be transferred

reply via email to

[Prev in Thread] Current Thread [Next in Thread]