private void initializePermissions ( ) { // Set the default restrictable permissions int count = 0 ; if ( tc . isDebugEnabled ( ) ) { if ( isServer ) { Tr . debug ( tc , "running on server " ) ; } else { Tr . debug ( tc , "running on client " ) ; } } if ( isServer ) { count = DEFAULT_SERVER_RESTRICTABLE_PERMISSIONS . length ; originationFile = SERVER_XML ; } else { count = DEFAULT_CLIENT_RESTRICTABLE_PERMISSIONS . length ; originationFile = CLIENT_XML ; } for ( int i = 0 ; i < count ; i ++ ) { if ( isServer ) { restrictablePermissions . add ( DEFAULT_SERVER_RESTRICTABLE_PERMISSIONS [ i ] ) ; } else { restrictablePermissions . add ( DEFAULT_CLIENT_RESTRICTABLE_PERMISSIONS [ i ] ) ; } } // Iterate through the configured Permissions. if ( permissions != null && ! permissions . isEmpty ( ) ) { Iterable < JavaPermissionsConfiguration > javaPermissions = permissions . services ( ) ; if ( javaPermissions != null ) { for ( JavaPermissionsConfiguration permission : javaPermissions ) { String permissionClass = String . valueOf ( permission . get ( JavaPermissionsConfiguration . PERMISSION ) ) ; String target = String . valueOf ( permission . get ( JavaPermissionsConfiguration . TARGET_NAME ) ) ; String action = String . valueOf ( permission . get ( JavaPermissionsConfiguration . ACTIONS ) ) ; String credential = String . valueOf ( permission . get ( JavaPermissionsConfiguration . SIGNED_BY ) ) ; String principalType = String . valueOf ( permission . get ( JavaPermissionsConfiguration . PRINCIPAL_TYPE ) ) ; String principalName = String . valueOf ( permission . get ( JavaPermissionsConfiguration . PRINCIPAL_NAME ) ) ; String codebase = normalize ( String . valueOf ( permission . get ( JavaPermissionsConfiguration . CODE_BASE ) ) ) ; // Create the permission object Permission perm = createPermissionObject ( permissionClass , target , action , credential , principalType , principalName , originationFile ) ; boolean isRestriction = false ; // Is this a restriciton or a grant? if ( permission . get ( JavaPermissionsConfiguration . RESTRICTION ) != null ) { isRestriction = ( ( Boolean ) permission . get ( JavaPermissionsConfiguration . RESTRICTION ) ) . booleanValue ( ) ; } if ( isRestriction ) { // If this is a restriction if ( perm != null ) { restrictablePermissions . add ( perm ) ; } } else { // If this is not a restriction, then set is a grant if ( perm != null ) { // if codebase is present, then set the permission on the shared lib classloader if ( codebase != null && ! codebase . equalsIgnoreCase ( "null" ) ) { setCodeBasePermission ( codebase , perm ) ; } else { grantedPermissions . add ( perm ) ; } } } } if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "restrictablePermissions : " + restrictablePermissions ) ; Tr . debug ( tc , "grantedPermissions : " + grantedPermissions ) ; } } } setSharedLibraryPermission ( ) ; }
InvocationTargetException . class NoSuchMethodException . class SecurityException . class } )