 |
CS 696 Emerging Technologies: Distributed Objects |
|
|---|
Spring Semester, 1998
Using OrbixWeb on Rohan
To Lecture Notes Index
© 1998, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 21-Apr-98
Contents of Doc 25, Using OrbixWeb on Rohan
- References
- Settings
- Example
- IDL
- Programmer Created Classes
- The steps
- Notes for Rohan
- Other Commands
- Implementation Repository (IR)
OrbixWeb Programmer's Guide, IONA Technologies PLC, November 1997,
various chapters
To your classpath add:
/opt/OrbixWeb3.0/classes
Make the following changes in your environment (.cshrc etc.)
setenv ORBIXWEB_HOME /opt/OrbixWeb3.0
setenv IT_CONFIG_PATH $ORBIXWEB_HOME
setenv LD_LIBRARY_PATH $ORBIXWEB_HOME/bin::/usr/local/lib:/usr/openwin/lib:/usr/lib:/usr/ucblib:/usr/dt/lib
set path = ($ORBIXWEB_HOME/bin $path)
#
if (${?MANPATH} == 1) then
setenv MANPATH $ORBIXWEB_HOME/man:$MANPATH
else
setenv MANPATH $ORBIXWEB_HOME/man
endif
interface Greeter
{
string name();
};
class InheritedGreeter extends _GreeterImplBase
{
protected String name;
public InheritedGreeter( String name)
{
this.name = name;
}
public String name() { return name;}
}
class TieGreeter implements _GreeterOperations
{
protected String name;
public TieGreeter( String name)
{
this.name = name;
}
public String name() { return name;}
}
Server
import IE.Iona.OrbixWeb._CORBA;
import IE.Iona.OrbixWeb.CORBA.ORB;
public class GreeterServer {
public static void main (String args[]) {
org.omg.CORBA.ORB orb =
org.omg.CORBA.ORB.init();
Greeter upTown = null;
Greeter mountain = null;
try {
upTown =
new _tie_Greeter( new TieGreeter( "Upton"), "up");
mountain = new InheritedGreeter( "Mike", "high");
_CORBA.Orbix.impl_is_ready( "WhitneyTest" );
System.out.println("Server going Down");
}
catch ( org.omg.CORBA.SystemException corbaError) {
System.out.println("Exception " + corbaError);
}
}
}
Client
import IE.Iona.OrbixWeb._CORBA;
import org.omg.CORBA.ORB;
public class GreeterClient
{
public static void main(String args[])
{
_CORBA.Orbix.setDiagnostics(3);
ORB.init();
String hostname = "rohan.sdsu.edu";
Greeter serverObject;
serverObject = GreeterHelper.bind( ":WhitneyTest",
hostname);
System.out.println( ":WhitneyTest\n" +
serverObject.name() );
serverObject = GreeterHelper.bind( "up:WhitneyTest",
hostname);
System.out.println( "up:WhitneyTest\n" +
serverObject.name() );
serverObject = GreeterHelper.bind( "high:WhitneyTest",
hostname);
System.out.println( "high:WhitneyTest\n" +
serverObject.name() );
}
}
1. Compile the idl
idl Greeter.idl
2.
Place the implementation files from above into the java_output directory
created from above
3. Compile the classes in java_output
javac *.java
4.
Register the server
putit WhitneyTest -j -addpath /home/ma/whitney/languages/java/whitney/corba/examples/firstExample/java_output GreeterServer
Note the command format is:
putit ServeName -j -addpath paths_to_add_to_the_classpath_for_the_server ServerClass
5. Run the server
java GreeterServer
6. Run the client
java GreeterClient
1. The OrbixWeb daemon is already running
- There is no need to start it
2. You need to add the proper classpath to your code via the -addpath flag
3. The name service is running
4. prepend your name or userid to your server names to avoid name clashes
5. Your .class files must be world readable before OrbixWeb will activate your
servers for you (I still have some trouble with activation on rohan)
General Notes
_CORBA.Orbix.setDiagnostics(X);
X = 0 -> no debug output
X = 1 -> just connections made
X = 2 -> useful debug level
X = 3 -> highest level
catit ServerName
- Lists the Implementation Repository (IR) of the server
killit ServerName
- Kills the running server
lsit
- Lists all items in the IR
pingit
- Pings the OrbixWeb daemon
psit
- Lists all server processes currently active
rmit ServerName
- Removes an item from the IR
For each registered server (via putit) there is one file in the IR that
contains information about the server
This information is used to restart the server if it is down when a client
requests it
Located in /opt/OrbixWeb/config/Repository
While Orbix (via orbixd) supports subdirectories in the IR, OrbixWeb (orbixdj)
does not support subdirectories at this time
WhitneyTest.imp
Name : WhitneyTest
Comms : xdr/tcp
Activation : shared
Owner : whitney
Launch : ;
Invoke : ;
ImpRep Version : 2
no. of servers : 1
server's port : 0
Marker Launch Command
* ###ORBIXWEB### -addpath /home/ma/whitney/languages/java/whitney/corba/examples/firstExample/java_output GreeterServer
visitors since 31-Mar-98