KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mx4j > tools > remote > local > LocalSubjectInvoker


1 /*
2  * Copyright (C) The MX4J Contributors.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the MX4J License version 1.0.
6  * See the terms of the MX4J License in the documentation provided with this software.
7  */

8
9 package mx4j.tools.remote.local;
10
11 import java.lang.reflect.Method JavaDoc;
12 import java.lang.reflect.Proxy JavaDoc;
13 import java.security.AccessControlContext JavaDoc;
14 import java.util.Map JavaDoc;
15 import javax.security.auth.Subject JavaDoc;
16
17 import mx4j.tools.remote.SubjectInvoker;
18
19 /**
20  * @version $Revision: 1.4 $
21  */

22 class LocalSubjectInvoker extends SubjectInvoker
23 {
24    static LocalConnection newInstance(LocalConnection target, Subject JavaDoc subject, AccessControlContext JavaDoc context, Map JavaDoc environment)
25    {
26       LocalSubjectInvoker handler = new LocalSubjectInvoker(target, subject, context, environment);
27       return (LocalConnection)Proxy.newProxyInstance(handler.getClass().getClassLoader(), new Class JavaDoc[]{LocalConnection.class}, handler);
28    }
29
30    private LocalSubjectInvoker(LocalConnection target, Subject JavaDoc subject, AccessControlContext JavaDoc context, Map JavaDoc environment)
31    {
32       super(target, subject, context, environment);
33    }
34
35    protected boolean isPlainInvoke(Method JavaDoc method)
36    {
37       boolean plain = super.isPlainInvoke(method);
38       if (plain) return plain;
39
40       String JavaDoc methodName = method.getName();
41       // LocalConnection methods that does not require the delegate subject
42
if ("close".equals(methodName)) return true;
43       return false;
44    }
45 }
46
Popular Tags