com.sun.jini.tool.envcheck.plugins
Class CheckPolicy

java.lang.Object
  extended by com.sun.jini.tool.envcheck.AbstractPlugin
      extended by com.sun.jini.tool.envcheck.plugins.CheckPolicy
All Implemented Interfaces:
Plugin

public class CheckPolicy
extends AbstractPlugin

Check the security policy for existence, for valid syntax, and that it does not grant AllPermissions to all protection domains.


Nested Class Summary
static class CheckPolicy.AllPermissionsTask
          Task the check the policy in a child VM.
 
Field Summary
private  EnvCheck envCheck
          the plugin container
 
Constructor Summary
CheckPolicy()
           
 
Method Summary
private  void checkDescriptor(ServiceDescriptor d)
          Check the policy file provided in any ServiceDescriptor
private  void checkProperty()
          Check existence and accessibility of the policy file.
private static String loadPolicy()
          Load the policy and capture any error text generated.
private  boolean policyAccessible(String policy, String source)
          Check accessibility of the policy file.
 void run(EnvCheck envCheck)
          Perform policy file checks for the current VM and all service descriptors.
 
Methods inherited from class com.sun.jini.tool.envcheck.AbstractPlugin
getBundle, getString, getString, getString, getString, handleUnexpectedSubtaskReturn, isPluginOption, taskName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

envCheck

private EnvCheck envCheck
the plugin container

Constructor Detail

CheckPolicy

public CheckPolicy()
Method Detail

run

public void run(EnvCheck envCheck)
Perform policy file checks for the current VM and all service descriptors.

Parameters:
envCheck - a reference to the driver instance.

checkProperty

private void checkProperty()
Check existence and accessibility of the policy file. If accessible, check for syntax errors. If none, check for AllPermission being granted. The syntax errors (and allpermissions) are checked in a subtask to ensure that the policy has not already been loaded.


loadPolicy

private static String loadPolicy()
Load the policy and capture any error text generated. The call to getPolicy must be the first one made in the VM since subsequent calls to getPolicy are silent

Returns:
the error text produced, or a zero-length string if none

policyAccessible

private boolean policyAccessible(String policy,
                                 String source)
Check accessibility of the policy file.

Parameters:
policy - the name of the policy file
source - source of the policy file
Returns:
true if accessible

checkDescriptor

private void checkDescriptor(ServiceDescriptor d)
Check the policy file provided in any ServiceDescriptor

Parameters:
d - the descriptor


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.