Physical Constructors |
The physical constructors of the Java components are recognized in the third page of the Method Lookup Wizard by their syntax. Their syntax is: this=new <Java package name><method name>([arguments])
The "new" keyword and the Java package name are in front of the constructor method name and the default name used for the instance is simply "this". The example here shows that the constructor can contain more lines if needed. For example, to construct an EJB client instance, the complete physical method is: props=new java.util.Hashtable() props.put((O)javax.naming.Context.INITIAL_CONTEXT_FACTORY,(O):0) props.put((O)javax.naming.Context.PROVIDER_URL,(O):1) ctx=new javax.naming.InitialContext(props) ref=ctx.lookup(:2) this=ref.create()
In this constructor, a hash table is first created and filled with the required properties to identify an Enterprise Java Beans server like the provider URL. Then a context is created and a lookup is done to get a reference to the client bean. An instance of the client bean is created from this reference and assigned to the name "this". After this constructor manipulation, the physical methods of the RDMI component use the "this" reference in their own definition, for example: this.getStockPrice((U):0) |