comparison src/org/dancres/blitz/remote/debug/DebugILFactory.java @ 0:3dc0c5604566

Initial checkin of blitz 2.0 fcs - no installer yet.
author Dan Creswell <dan.creswell@gmail.com>
date Sat, 21 Mar 2009 11:00:06 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:3dc0c5604566
1 package org.dancres.blitz.remote.debug;
2
3 import java.rmi.Remote;
4
5 import java.rmi.server.ExportException;
6
7 import java.lang.reflect.InvocationHandler;
8 import java.lang.reflect.Method;
9
10 import net.jini.jeri.ProxyTrustILFactory;
11 import net.jini.jeri.ObjectEndpoint;
12
13 import net.jini.core.constraint.MethodConstraints;
14
15 /**
16 <p>A custom <code>InvocationLayerFactory</code> for JERI which allows a
17 Blitz instance to be debugged or monitored in custom fashions. Simply
18 replace the <code>BasicILFactory</code> or <code>ProxyTrustILFactory</code>
19 in the configuration file with an instance of <code>DebugILFactory</code>
20 (which accepts the same paramters).</p>
21
22 <p>This factory inserts a custom <code>InvocationHandler</code>,
23 <code>TimingInvocationHandler</code>. </p>
24
25 @see org.dancres.blitz.remote.test.debug.TimingInvocationHandler
26 */
27 public class DebugILFactory extends ProxyTrustILFactory {
28
29 public DebugILFactory(MethodConstraints aConstraints,
30 Class aPermissionsClass) {
31 super(aConstraints, aPermissionsClass, null);
32 }
33
34 public DebugILFactory(MethodConstraints aConstraints,
35 Class aPermissionsClass,
36 ClassLoader aLoader) {
37 super(aConstraints, aPermissionsClass, aLoader);
38 }
39
40 protected InvocationHandler
41 createInvocationHandler(Class[] aSetOfInterfaces, Remote anImpl,
42 ObjectEndpoint anEndpoint)
43 throws ExportException {
44
45 for (int i = aSetOfInterfaces.length; --i >= 0; ) {
46 if (aSetOfInterfaces[i] == null) {
47 throw new NullPointerException();
48 }
49 }
50 if (anImpl == null) {
51 throw new NullPointerException();
52 }
53 return new TimingInvocationHandler(anEndpoint, getServerConstraints());
54 }
55 }