1 #!/usr/bin/env python 2 3 import java.lang 4 5 class AccessControlContext(java.lang.Object): 6 def __init__(self): 7 # NOTE: Python-only method. 8 self.acc = None 9 self.combiner = None 10 self.context = None 11 def init__acc_combiner(self, acc, combiner): 12 self.acc = acc 13 self.combiner = combiner 14 self.context = None 15 def init__context(self, context): 16 self.acc = None 17 self.combiner = None 18 self.context = context 19 def checkPermission(self, perm): 20 # NOTE: Implement properly. 21 pass 22 checkPermission___java__security__Permission = checkPermission 23 def equals(self, obj): 24 return self.context == obj.context 25 equals___java__lang__Object = equals 26 def getDomainCombiner(self): 27 return self.combiner 28 getDomainCombiner___java__security__DomainCombiner = getDomainCombiner 29 def hashCode(self): 30 # NOTE: Using Python hash function. 31 return hash(self) 32 hashCode___ = hashCode 33 34 setattr(AccessControlContext, "__init_____java__security__AccessControlContext___java__security__DomainCombiner", 35 AccessControlContext.init__acc_combiner) 36 setattr(AccessControlContext, "__init_____java__security__ProtectionDomain_array_", AccessControlContext.init__context) 37 38 class AccessController(java.lang.Object): 39 def checkPermission(perm): 40 # NOTE: Implement properly. 41 pass 42 checkPermission___java__security__Permission = staticmethod(checkPermission) 43 def doPrivileged(action, context=None): 44 # NOTE: Implement properly. 45 return action.run___() 46 doPrivileged___java__security__PrivilegedAction = staticmethod(doPrivileged) 47 doPrivileged___java__security__PrivilegedAction___java__security__AccessControlContext = staticmethod(doPrivileged) 48 def getContext(): 49 # NOTE: Implement properly. 50 return AccessControlContext() 51 52 # vim: tabstop=4 expandtab shiftwidth=4