src/share/classes/com/sun/corba/se/impl/oa/poa/minor_code_example.txt

Wed, 28 Mar 2012 02:50:50 -0700

author
mbankal
date
Wed, 28 Mar 2012 02:50:50 -0700
changeset 371
e324dfb90c9e
parent 0
7ef37b2cdcad
permissions
-rw-r--r--

7079902: Refine CORBA data models
Reviewed-by: coffeys

aoqi@0 1 package @PKGNAME@ ;
aoqi@0 2
aoqi@0 3 import org.omg.CORBA.OMGVMCID ;
aoqi@0 4 import org.omg.CORBA.CompletionStatus ;
aoqi@0 5
aoqi@0 6 import org.omg.CORBA.@SYSEX@ ;
aoqi@0 7
aoqi@0 8 public abstract class StandardException {
aoqi@0 9 // @SYSEX@ BAD_CONTEXT
aoqi@0 10
aoqi@0 11 public void IdlContextNotFound( CompletionStatus completed )
aoqi@0 12 {
aoqi@0 13 throw new BAD_CONTEXT( "IDL context not found",
aoqi@0 14 OMGVMCID.value + 1, completed ) ;
aoqi@0 15 }
aoqi@0 16
aoqi@0 17 public void IdlContextNotFound( )
aoqi@0 18 {
aoqi@0 19 IdlContextNotFound( CompletionStatus.COMPLETED_NO ) ;
aoqi@0 20 }
aoqi@0 21
aoqi@0 22 Data structures: list[ ... ] vector[ ... ] ( record )
aoqi@0 23
aoqi@0 24 list[ ( string{exception name} list[ ( string{code name} int{value} string{description} ] ) ]
aoqi@0 25
aoqi@0 26 Processing:
aoqi@0 27
aoqi@0 28
aoqi@0 29 open file (fname)
aoqi@0 30 fr = new FileReader( fname )
aoqi@0 31 br = new BufferedReader( fr )
aoqi@0 32 br.readLine() returns null at EOF
aoqi@0 33
aoqi@0 34 want a BufferedReader
aoqi@0 35
aoqi@0 36 while not eol read line
aoqi@0 37 if (line start with spaces)
aoqi@0 38 add to current index
aoqi@0 39 else
aoqi@0 40 new exception
aoqi@0 41
aoqi@0 42 create StandardException class
aoqi@0 43
aoqi@0 44 foreach ( excname vec ) in data
aoqi@0 45 add import statement for execname to output
aoqi@0 46
aoqi@0 47 foreach ( codename value descr ) in vec
aoqi@0 48 generate full method
aoqi@0 49 generate short method
aoqi@0 50
aoqi@0 51
aoqi@0 52 (define (read-file fname)
aoqi@0 53 (begin
aoqi@0 54 (let port (open-input-port fname))
aoqi@0 55 (let obj (read port))
aoqi@0 56 obj
aoqi@0 57 )
aoqi@0 58 )
aoqi@0 59
aoqi@0 60
aoqi@0 61

mercurial