/[classpath]/classpath/gnu/CORBA/GIOP/ServiceContext.java
ViewVC logotype

Diff of /classpath/gnu/CORBA/GIOP/ServiceContext.java

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

revision 1.1.2.3 by gnu_andrew, Sat Sep 10 15:31:35 2005 UTC revision 1.1.2.4 by gnu_andrew, Wed Nov 2 00:43:25 2005 UTC
# Line 38  exception statement from your version. * Line 38  exception statement from your version. *
38    
39  package gnu.CORBA.GIOP;  package gnu.CORBA.GIOP;
40    
41  import gnu.CORBA.CDR.cdrInput;  import gnu.CORBA.CDR.AbstractCdrInput;
42  import gnu.CORBA.CDR.cdrOutput;  import gnu.CORBA.CDR.AbstractCdrOutput;
43    
44  import org.omg.CORBA.BAD_INV_ORDER;  import org.omg.CORBA.BAD_INV_ORDER;
45  import org.omg.CORBA.BAD_PARAM;  import org.omg.CORBA.BAD_PARAM;
# Line 48  import org.omg.CORBA.portable.IDLEntity; Line 48  import org.omg.CORBA.portable.IDLEntity;
48    
49  /**  /**
50   * Contains the ORB service data being passed.   * Contains the ORB service data being passed.
51   *   *
52   * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)   * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
53   */   */
54  public class ServiceContext  public class ServiceContext
# Line 59  public class ServiceContext Line 59  public class ServiceContext
59     */     */
60    private static final long serialVersionUID = 1;    private static final long serialVersionUID = 1;
61    
62      /* Standard values for the context_id. */
63      public static final int TransactionService = 0;
64    
65      /**
66       * Defines code sets, used to encode wide and narrow characters. Required for
67       * messages with data structures, involving wide characters.
68       */
69      public static final int CodeSets = 1;
70    
71      public static final int ChainBypassCheck = 2;
72    
73      public static final int ChainBypassInfo = 3;
74    
75      public static final int LogicalThreadId = 4;
76    
77      public static final int BI_DIR_IIOP = 5;
78    
79      public static final int SendingContextRunTime = 6;
80    
81      public static final int INVOCATION_POLICIES = 7;
82    
83      public static final int FORWARDED_IDENTITY = 8;
84    
85      /**
86       * Contains exception details if exception being transferred is other than
87       * System or User exception. javax.rmi uses this context to transfer arbitrary
88       * java exceptions as CORBA value types.
89       */
90      public static final int UnknownExceptionInfo = 9;
91    
92      public static final int RTCorbaPriority = 10;
93    
94      public static final int RTCorbaPriorityRange = 11;
95    
96      public static final int FT_GROUP_VERSION = 12;
97    
98      public static final int FT_REQUEST = 13;
99    
100      public static final int ExceptionDetailMessage = 14;
101    
102      public static final int SecurityAttributeService = 15;
103    
104      public static final int ActivityService = 16;
105    
106    /**    /**
107     * The context id (for instance, 0x1 for code sets context). At the moment of     * The context id (for instance, 0x1 for code sets context). At the moment of
108     * writing, the OMG defines 16 standard values and provides rules to register     * writing, the OMG defines 16 standard values and provides rules to register
# Line 90  public class ServiceContext Line 134  public class ServiceContext
134    
135    /**    /**
136     * Read the context values from the stream.     * Read the context values from the stream.
137     *     *
138     * @param istream a stream to read from.     * @param istream a stream to read from.
139     */     */
140    public static ServiceContext read(cdrInput istream)    public static ServiceContext read(AbstractCdrInput istream)
141    {    {
142      int id = istream.read_ulong();      int id = istream.read_ulong();
143    
144      switch (id)      switch (id)
145        {        {
146          case cxCodeSet.ID:          case CodeSetServiceContext.ID:
147    
148            cxCodeSet codeset = new cxCodeSet();            CodeSetServiceContext codeset = new CodeSetServiceContext();
149            codeset.readContext(istream);            codeset.readContext(istream);
150            return codeset;            return codeset;
151    
# Line 117  public class ServiceContext Line 161  public class ServiceContext
161    /**    /**
162     * Read a sequence of contexts from the input stream.     * Read a sequence of contexts from the input stream.
163     */     */
164    public static ServiceContext[] readSequence(cdrInput istream)    public static ServiceContext[] readSequence(AbstractCdrInput istream)
165    {    {
166      int size = istream.read_long();      int size = istream.read_long();
167      ServiceContext[] value = new gnu.CORBA.GIOP.ServiceContext[size];      ServiceContext[] value = new gnu.CORBA.GIOP.ServiceContext[size];
# Line 128  public class ServiceContext Line 172  public class ServiceContext
172    
173    /**    /**
174     * Write the context values into the stream.     * Write the context values into the stream.
175     *     *
176     * @param ostream a stream to write the data to.     * @param ostream a stream to write the data to.
177     */     */
178    public void write(cdrOutput ostream)    public void write(AbstractCdrOutput ostream)
179    {    {
180      ostream.write_ulong(context_id);      ostream.write_ulong(context_id);
181      ostream.write_sequence(context_data);      ostream.write_sequence(context_data);
# Line 140  public class ServiceContext Line 184  public class ServiceContext
184    /**    /**
185     * Write the sequence of contexts into the input stream.     * Write the sequence of contexts into the input stream.
186     */     */
187    public static void writeSequence(cdrOutput ostream, ServiceContext[] value)    public static void writeSequence(AbstractCdrOutput ostream, ServiceContext[] value)
188    {    {
189      ostream.write_long(value.length);      ostream.write_long(value.length);
190      for (int i = 0; i < value.length; i++)      for (int i = 0; i < value.length; i++)
# Line 172  public class ServiceContext Line 216  public class ServiceContext
216          // Replace context.          // Replace context.
217          if (!replace)          if (!replace)
218            throw new BAD_INV_ORDER("Repetetive setting of the context "            throw new BAD_INV_ORDER("Repetetive setting of the context "
219                                    + service_context.context_id, 15,              + service_context.context_id, 15, CompletionStatus.COMPLETED_NO);
             CompletionStatus.COMPLETED_NO);  
220          else          else
221            cx[exists] = service_context;            cx[exists] = service_context;
222        }        }
# Line 205  public class ServiceContext Line 248  public class ServiceContext
248          // Replace context.          // Replace context.
249          if (!replace)          if (!replace)
250            throw new BAD_INV_ORDER("Repetetive setting of the context "            throw new BAD_INV_ORDER("Repetetive setting of the context "
251                                    + service_context.context_id, 15,              + service_context.context_id, 15, CompletionStatus.COMPLETED_NO);
             CompletionStatus.COMPLETED_NO);  
252          else          else
253            cx[exists] = new ServiceContext(service_context);            cx[exists] = new ServiceContext(service_context);
254          return cx;          return cx;
255        }        }
256    }    }
257    
   
258    /**    /**
259     * Find context with the given name in the context array.     * Find context with the given name in the context array.
260     */     */
# Line 227  public class ServiceContext Line 268  public class ServiceContext
268    }    }
269    
270    /**    /**
271     * Find context with the given name in the context array,     * Find context with the given name in the context array, converting into
272     * converting into org.omg.IOP.ServiceContext.     * org.omg.IOP.ServiceContext.
273     */     */
274    public static org.omg.IOP.ServiceContext findContext(int ctx_name,    public static org.omg.IOP.ServiceContext findContext(int ctx_name,
275      ServiceContext[] cx)      ServiceContext[] cx)
# Line 240  public class ServiceContext Line 281  public class ServiceContext
281    }    }
282    
283    /**    /**
284       * Find context with the given name in the context array without conversions.
285       */
286      public static ServiceContext find(int ctx_name, ServiceContext[] cx)
287      {
288        for (int i = 0; i < cx.length; i++)
289          if (cx[i].context_id == ctx_name)
290            return cx[i];
291        return null;
292      }
293    
294      /**
295     * Return a string representation.     * Return a string representation.
296     */     */
297    public String toString()    public String toString()

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

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