1 package org.sapia.ubik.rmi.examples.interceptor; 2 3 import org.sapia.ubik.rmi.interceptor.Interceptor; 4 import org.sapia.ubik.rmi.server.Hub; 5 import org.sapia.ubik.rmi.server.invocation.ServerPreInvokeEvent; 6 7 8 16 public class SecurityServiceImpl implements SecurityService, Interceptor { 17 20 public void call() { 21 System.out.println("call performed..."); 22 } 23 24 public void onServerPreInvokeEvent(ServerPreInvokeEvent evt) { 25 throw new RuntimeException ("call forbidden"); 26 } 27 28 public static void main(String [] args) { 29 try { 30 SecurityServiceImpl svc = new SecurityServiceImpl(); 31 Hub.serverRuntime.addInterceptor(ServerPreInvokeEvent.class, svc); 32 Hub.exportObject(svc, 6767); 33 34 while (true) { 35 Thread.sleep(10000); 36 } 37 } catch (Exception e) { 38 e.printStackTrace(); 39 } 40 } 41 } 42 | Popular Tags |