01: package demo.poa_monitor.user_poa;
02:
03: import demo.poa_monitor.foox.*;
04: import org.omg.PortableServer.*;
05: import org.omg.PortableServer.ServantLocatorPackage.CookieHolder;
06:
07: public class FooServantLocatorImpl extends
08: org.omg.PortableServer._ServantLocatorLocalBase {
09: private FooImpl foo = new FooImpl("0");
10:
11: public void postinvoke(byte[] oid, POA adapter, String operation,
12: java.lang.Object cookie, Servant servant) {
13: String oidStr = new String(oid);
14: if (!oidStr.equals(cookie)) {
15: System.out.println("[ postinvoke " + operation
16: + " for oid: " + oidStr + ": cookie is unknown ]");
17: throw new org.omg.CORBA.OBJECT_NOT_EXIST();
18: }
19: }
20:
21: public Servant preinvoke(byte[] oid, POA adapter, String operation,
22: CookieHolder cookie) throws ForwardRequest {
23: String oidStr = new String(oid);
24: int oidInt = Integer.parseInt(oidStr);
25: if (oidInt >= 1000) {
26: cookie.value = oidStr;
27: return foo;
28: }
29: return null;
30: }
31: }
|