/[classpath]/classpath/gnu/CORBA/Restricted_ORB.java
ViewVC logotype

Diff of /classpath/gnu/CORBA/Restricted_ORB.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.4 by gnu_andrew, Tue Aug 16 16:22:35 2005 UTC revision 1.1.2.5 by gnu_andrew, Sat Sep 10 15:31:35 2005 UTC
# Line 58  import org.omg.CORBA.TypeCodePackage.Bad Line 58  import org.omg.CORBA.TypeCodePackage.Bad
58  import org.omg.CORBA.UnionMember;  import org.omg.CORBA.UnionMember;
59  import org.omg.CORBA.portable.OutputStream;  import org.omg.CORBA.portable.OutputStream;
60  import org.omg.CORBA.portable.ValueFactory;  import org.omg.CORBA.portable.ValueFactory;
61    import org.omg.PortableInterceptor.ClientRequestInterceptorOperations;
62    import org.omg.PortableInterceptor.IORInterceptorOperations;
63    import org.omg.PortableInterceptor.ServerRequestInterceptorOperations;
64    
65  import java.applet.Applet;  import java.applet.Applet;
66    
# Line 66  import java.util.Properties; Line 69  import java.util.Properties;
69    
70  /**  /**
71   * This class implements so-called Singleton ORB, a highly restricted version   * This class implements so-called Singleton ORB, a highly restricted version
72   * that cannot communicate over network. This ORB is provided   * that cannot communicate over network. This ORB is provided for the
73   * for the potentially malicious applets with heavy security restrictions.   * potentially malicious applets with heavy security restrictions. It, however,
74   * It, however, supports some basic features that might be needed even   * supports some basic features that might be needed even when the network
75   * when the network access is not granted.   * access is not granted.
76   *   *
77   * This ORB can only create typecodes,   * This ORB can only create typecodes, {@link Any}, {@link ContextList},
78   * {@link Any}, {@link ContextList}, {@link NVList} and   * {@link NVList} and {@link org.omg.CORBA.portable.OutputStream} that writes to
79   * {@link org.omg.CORBA.portable.OutputStream} that writes to an   * an internal buffer.
  * internal buffer.  
80   *   *
81   * All other methods throw the {@link NO_IMPLEMENT} exception.   * All other methods throw the {@link NO_IMPLEMENT} exception.
82   *   *
83   * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)   * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
84   */   */
85  public class Restricted_ORB  public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
   extends org.omg.CORBA_2_3.ORB  
86  {  {
87    /**    /**
88     * The singleton instance of this ORB.     * The singleton instance of this ORB.
# Line 89  public class Restricted_ORB Line 90  public class Restricted_ORB
90    public static final ORB Singleton = new Restricted_ORB();    public static final ORB Singleton = new Restricted_ORB();
91    
92    /**    /**
93       * The cumulated listener for all IOR interceptors. Interceptors are used by
94       * {@link gnu.CORBA.Poa.ORB_1_4}.
95       */
96      public IORInterceptorOperations iIor;
97    
98      /**
99       * The cumulated listener for all server request interceptors. Interceptors
100       * are used by {@link gnu.CORBA.Poa.ORB_1_4}.
101       */
102      public ServerRequestInterceptorOperations iServer;
103    
104      /**
105       * The cumulated listener for all client request interceptros. Interceptors
106       * are used by {@link gnu.CORBA.Poa.ORB_1_4}.
107       */
108      public ClientRequestInterceptorOperations iClient;
109    
110      /**
111       * The required size of the interceptor slot array.
112       */
113      public int icSlotSize = 0;
114    
115      /**
116     * The value factories.     * The value factories.
117     */     */
118    protected Hashtable factories = new Hashtable();    protected Hashtable factories = new Hashtable();
119    
120    /**    /**
121     * Create a new instance of the RestrictedORB. This is used     * The policy factories.
122     * in derived classes only.     */
123      protected Hashtable policyFactories = new Hashtable();
124    
125      /**
126           * Create a new instance of the RestrictedORB. This is used in derived classes
127       * only.
128     */     */
129    protected Restricted_ORB()    protected Restricted_ORB()
130    {    {
# Line 159  public class Restricted_ORB Line 188  public class Restricted_ORB
188    
189    /** {@inheritDoc} */    /** {@inheritDoc} */
190    public TypeCode create_exception_tc(String id, String name,    public TypeCode create_exception_tc(String id, String name,
191                                        StructMember[] members      StructMember[] members
192                                       )    )
193    {    {
194      recordTypeCode r = new recordTypeCode(TCKind.tk_except);      recordTypeCode r = new recordTypeCode(TCKind.tk_except);
195      r.setId(id);      r.setId(id);
# Line 224  public class Restricted_ORB Line 253  public class Restricted_ORB
253    
254    /** {@inheritDoc} */    /** {@inheritDoc} */
255    public TypeCode create_struct_tc(String id, String name,    public TypeCode create_struct_tc(String id, String name,
256                                     StructMember[] members      StructMember[] members
257                                    )    )
258    {    {
259      recordTypeCode r = new recordTypeCode(TCKind.tk_struct);      recordTypeCode r = new recordTypeCode(TCKind.tk_struct);
260      r.setId(id);      r.setId(id);
# Line 241  public class Restricted_ORB Line 270  public class Restricted_ORB
270    
271    /** {@inheritDoc} */    /** {@inheritDoc} */
272    public TypeCode create_union_tc(String id, String name,    public TypeCode create_union_tc(String id, String name,
273                                    TypeCode discriminator_type,      TypeCode discriminator_type, UnionMember[] members
274                                    UnionMember[] members    )
                                  )  
275    {    {
276      recordTypeCode r = new recordTypeCode(TCKind.tk_union);      recordTypeCode r = new recordTypeCode(TCKind.tk_union);
277      r.setId(id);      r.setId(id);
# Line 277  public class Restricted_ORB Line 305  public class Restricted_ORB
305      catch (BadKind ex)      catch (BadKind ex)
306        {        {
307          throw new BAD_PARAM("This is not a primitive type code: " +          throw new BAD_PARAM("This is not a primitive type code: " +
308                              tcKind.value()            tcKind.value()
309                             );          );
310        }        }
311    }    }
312    
# Line 307  public class Restricted_ORB Line 335  public class Restricted_ORB
335    /**    /**
336     * This method is not allowed for a RestrictedORB.     * This method is not allowed for a RestrictedORB.
337     *     *
338     * @throws InvalidName never in this class, but it is thrown     * @throws InvalidName never in this class, but it is thrown in the derived
339     * in the derived classes.     * classes.
340     *     *
341     * @throws NO_IMPLEMENT, always.     * @throws NO_IMPLEMENT, always.
342     */     */
343    public org.omg.CORBA.Object resolve_initial_references(String name)    public org.omg.CORBA.Object resolve_initial_references(String name)
344                                                    throws InvalidName      throws InvalidName
345    {    {
346      no();      no();
347      throw new InternalError();      throw new InternalError();
# Line 369  public class Restricted_ORB Line 397  public class Restricted_ORB
397    }    }
398    
399    /**    /**
400     * Throws an exception, stating that the given method is not supported     * Throws an exception, stating that the given method is not supported by the
401     * by the Restricted ORB.     * Restricted ORB.
402     */     */
403    private final void no()    private final void no()
404    {    {
# Line 384  public class Restricted_ORB Line 412  public class Restricted_ORB
412     *     *
413     * @throws NO_IMPLEMENT, always.     * @throws NO_IMPLEMENT, always.
414     */     */
415    public Request get_next_response()    public Request get_next_response() throws org.omg.CORBA.WrongTransaction
                             throws org.omg.CORBA.WrongTransaction  
416    {    {
417      no();      no();
418      throw new InternalError();      throw new InternalError();
# Line 426  public class Restricted_ORB Line 453  public class Restricted_ORB
453     * Register the value factory under the given repository id.     * Register the value factory under the given repository id.
454     */     */
455    public ValueFactory register_value_factory(String repository_id,    public ValueFactory register_value_factory(String repository_id,
456                                               ValueFactory factory      ValueFactory factory
457                                              )    )
458    {    {
459      factories.put(repository_id, factory);      factories.put(repository_id, factory);
460      return factory;      return factory;
# Line 443  public class Restricted_ORB Line 470  public class Restricted_ORB
470    
471    /**    /**
472     * Look for the value factory for the value, having the given repository id.     * Look for the value factory for the value, having the given repository id.
473     * The implementation checks for the registered value factories first.         * The implementation checks for the registered value factories first. If none
474     * If none found, it tries to load and instantiate the class, mathing the         * found, it tries to load and instantiate the class, mathing the given naming
475     * given naming convention. If this faild, null is returned.     * convention. If this faild, null is returned.
476     *     *
477     * @param repository_id a repository id.     * @param repository_id a repository id.
478     *     *
# Line 455  public class Restricted_ORB Line 482  public class Restricted_ORB
482    {    {
483      ValueFactory f = (ValueFactory) factories.get(repository_id);      ValueFactory f = (ValueFactory) factories.get(repository_id);
484      if (f != null)      if (f != null)
485        return f;        {
486            return f;
487          }
488    
489      f = (ValueFactory) ObjectCreator.createObject(repository_id,      f = (ValueFactory) ObjectCreator.createObject(repository_id,
490                                                    "DefaultFactory"          "DefaultFactory"
491                                                   );        );
492      if (f != null)      if (f != null)
493        factories.put(repository_id, f);        {
494            factories.put(repository_id, f);
495          }
496      return f;      return f;
497    }    }
498    
499      /**
500       * Destroy the interceptors, if they are present.
501       */
502      public void destroy()
503      {
504        if (iIor != null)
505          {
506            iIor.destroy();
507            iIor = null;
508          }
509    
510        if (iServer != null)
511          {
512            iServer.destroy();
513            iServer = null;
514          }
515    
516        if (iClient != null)
517          {
518            iClient.destroy();
519            iClient = null;
520          }
521    
522        super.destroy();
523      }
524  }  }

Legend:
Removed from v.1.1.2.4  
changed lines
  Added in v.1.1.2.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26