01: /*
02: * Copyright (C) The MX4J Contributors.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the MX4J License version 1.0.
06: * See the terms of the MX4J License in the documentation provided with this software.
07: */
08:
09: package mx4j.tools.remote.local;
10:
11: import java.lang.reflect.Method;
12: import java.lang.reflect.Proxy;
13: import java.security.AccessControlContext;
14: import java.util.Map;
15: import javax.security.auth.Subject;
16:
17: import mx4j.tools.remote.SubjectInvoker;
18:
19: /**
20: * @version $Revision: 1.4 $
21: */
22: class LocalSubjectInvoker extends SubjectInvoker {
23: static LocalConnection newInstance(LocalConnection target,
24: Subject subject, AccessControlContext context,
25: Map environment) {
26: LocalSubjectInvoker handler = new LocalSubjectInvoker(target,
27: subject, context, environment);
28: return (LocalConnection) Proxy.newProxyInstance(handler
29: .getClass().getClassLoader(),
30: new Class[] { LocalConnection.class }, handler);
31: }
32:
33: private LocalSubjectInvoker(LocalConnection target,
34: Subject subject, AccessControlContext context,
35: Map environment) {
36: super (target, subject, context, environment);
37: }
38:
39: protected boolean isPlainInvoke(Method method) {
40: boolean plain = super .isPlainInvoke(method);
41: if (plain)
42: return plain;
43:
44: String methodName = method.getName();
45: // LocalConnection methods that does not require the delegate subject
46: if ("close".equals(methodName))
47: return true;
48: return false;
49: }
50: }
|