![]() ![]() ![]() |
|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Help is available for each task.
Task 1
[Modify IDL file] First edit the IDL file. The StockObjects module
in the IDL file defines the interface to a stock object. But there is
currently no way for a client to create stock objects. You need to add
another interface, The interface to add is: interface StockFactory { Stock create_stock( in string symbol, in string description ); }; Task 2[Run IDL Compiler] At the command line, run the IDL compiler to generate Java code from the IDL file.
Task 3
[Compile the generated Java code] Now compile the generated Java
code using the
standard Java compiler.
Compile it in the generated
[Examine the generated Java files] All the files will be generated
into the
Look carefully at the
file
[Implement the stock factory] The skeleton code file we have given you,
An appropriate method body for the create_stock operation is:
public Stock create_stock( String symbol,String description){ StockImpl newStock = new StockImpl(symbol, description); return newStock; } Task 6
[Create Server Class] Now look at the file
There is nothing for you to do except look at the file. Look carefully
at each line.
[Create Client Class] In the file [Compile the program] Now compile the program using the standard Java compiler.
[Run the Server program]
The server needs to run as a separate process. In DOS/Windows, you
will use the The Server outputs an IOR (or stringified reference) to a file and to the console for the Stock factory object it creates. The name of the file is passed as the first argument to the server.
To run the server, use the normal Putting it all together:
[Run the Client program] The client reads the stringified object reference of the stock factory object created by your server. An file containing the stringified object reference is passed as the first argument to the client. The second and third arguments passed to the client is the stock symbol and company description of the stock to be created. Note the following commands are each on a single line.
[Kill the Server] Don't forget to kill the server.
Copyright © 1998-1999 MageLang Institute. All Rights Reserved. |