Methods Summary |
---|
private boolean | isAuthenticated(Identifier id)
return Identifier.isAuthenticated(id);
|
public Identifier | login(java.lang.String uid, java.lang.String pw)
authenticator.authenticate(uid, pw);
return new Identifier(uid);
|
public Identifier | login(java.lang.String uid, java.lang.String pw, AuthenticationRole r)
authenticator.authenticate(uid, pw, r);
return new Identifier(uid, r);
|
public Home | lookup(Identifier id, java.lang.String cname)
String hname;
Home home;
int len;
if( !isAuthenticated(id) ) {
return null;
}
len = cname.length();
if( len > 4 ) {
if( cname.substring(len-4).equals("Impl") ) {
hname = cname.substring(0, len-4);
}
else if( len > 6 ) {
if( cname.substring(len-6).equals("Facade") ) {
hname = cname.substring(0, len-6);
}
else {
hname = cname;
}
}
else {
hname = cname;
}
}
else {
hname = cname;
}
hname = hname + "HomeImpl";
synchronized( homes ) {
if( homes.containsKey(hname) ) {
return (Home)homes.get(hname);
}
try {
home = (Home)Class.forName(hname).newInstance();
}
catch( ClassCastException e ) {
throw new LookupException(e.getMessage());
}
catch( ClassNotFoundException e ) {
throw new LookupException(e.getMessage());
}
catch( IllegalAccessException e ) {
throw new LookupException(e.getMessage());
}
catch( InstantiationException e ) {
throw new LookupException(e.getMessage());
}
homes.put(hname, home);
return home;
}
|
public static void | main(java.lang.String[] args)
try {
String bundle = System.getProperty(LWPProperties.PROPS_BUNDLE);
Thread t;
t = new Thread() {
public void run() {
Identifier id = Identifier.getServerID();
}
};
t.setPriority(Thread.MIN_PRIORITY);
t.start();
if( bundle != null ) {
PropertyReader r = new PropertyReader();
r.read(bundle);
}
else {
String fname = System.getProperty(LWPProperties.PROPS_FILE);
if( fname != null ) {
PropertyReader r = new PropertyReader();
r.read(new File(fname));
}
}
Naming.rebind(System.getProperty(LWPProperties.RMI_URL),
new ObjectServerImpl());
}
catch( Exception e ) {
e.printStackTrace();
}
|
public Session | startSession(Identifier id, java.lang.String cname)
String sname;
int len;
if( !isAuthenticated(id) ) {
return null;
}
len = cname.length();
if( len > 7 ) {
if( cname.substring(len-7).equals("Session") ) {
sname = cname.substring(0, len-7);
}
else {
sname = cname;
}
}
else {
sname = cname;
}
sname = sname + "Session";
try {
return (Session)Class.forName(sname).newInstance();
}
catch( ClassCastException e ) {
throw new LookupException(e.getMessage());
}
catch( ClassNotFoundException e ) {
throw new LookupException(e.getMessage());
}
catch( IllegalAccessException e ) {
throw new LookupException(e.getMessage());
}
catch( InstantiationException e ) {
throw new LookupException(e.getMessage());
}
|