net.sf.container.imp
Class AbstractPolicyFactory

java.lang.Object
  extended by net.sf.container.imp.AbstractParseListener
      extended by net.sf.container.imp.AbstractPolicyFactory
All Implemented Interfaces:
ContainerFactory, PolicyParseListener
Direct Known Subclasses:
CertificateAuthorityFactory, CodebaseFactory

public abstract class AbstractPolicyFactory
extends AbstractParseListener
implements ContainerFactory

Default implementation of ContainerFactory.

It implements also ParseListener for the purpose of implementing easily a particular algorithm for Container instantiation.

Subclasses have to define the actual contanerId-PermissionSet relationship logic. created on Jun 10, 2005

Since:
Version:
$Revision: 1.1 $
Author:
fiykov
See Also:
CodebaseFactory, CertificateAuthorityFactory

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.container.imp.AbstractParseListener
AbstractParseListener.GrantEntry
 
Constructor Summary
AbstractPolicyFactory()
          instantiate a factory with empty policies
AbstractPolicyFactory(java.net.URL policyFile)
          instantiate a factory with policies defined in the policy file
AbstractPolicyFactory(java.net.URL policyFile, PolicyParser parser)
          instantiate a factory with policies defined in the policy file
 
Method Summary
protected  Container newContainer(java.security.ProtectionDomain[] pds)
          template method: create new container out of protection domains list
 void setPolicies(java.net.URL policyFile)
          set policies to be used by this factory while creating containers it uses PolicyParser file parser.
 void setPolicies(java.net.URL policyFile, PolicyParser parser)
          set policies to be used by this factory while creating containers
 
Methods inherited from class net.sf.container.imp.AbstractParseListener
beginParsing, endGrant, endParsing, endPolicyFile, getAllKeyStores, getAllPolicies, getKeyStores, getProtectionDomains, lookupCertificate, lookupCertificatesList, newGrant, newKeystore, newPermission, newPolicyFile, newUrlInputSteam, parseEnvVars, replaceCurrentUrlPosition, resolveKsInputSteam, spreadDefaultGrants, toExternalForm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.container.ContainerFactory
newContainer
 
Methods inherited from interface net.sf.container.PolicyParseListener
getContainerFactory
 

Constructor Detail

AbstractPolicyFactory

public AbstractPolicyFactory()
instantiate a factory with empty policies


AbstractPolicyFactory

public AbstractPolicyFactory(java.net.URL policyFile)
                      throws java.io.FileNotFoundException,
                             PolicyParseException,
                             java.io.IOException
instantiate a factory with policies defined in the policy file

Parameters:
policyFile -
Throws:
java.io.FileNotFoundException
PolicyParseException
java.io.IOException
See Also:
setPolicies(URL)

AbstractPolicyFactory

public AbstractPolicyFactory(java.net.URL policyFile,
                             PolicyParser parser)
                      throws java.io.FileNotFoundException,
                             PolicyParseException,
                             java.io.IOException
instantiate a factory with policies defined in the policy file

Parameters:
policyFile -
Throws:
java.io.FileNotFoundException
PolicyParseException
java.io.IOException
See Also:
setPolicies(URL, PolicyParser)
Method Detail

setPolicies

public void setPolicies(java.net.URL policyFile)
                 throws java.io.FileNotFoundException,
                        PolicyParseException,
                        java.io.IOException
set policies to be used by this factory while creating containers

it uses PolicyParser file parser.

Specified by:
setPolicies in interface ContainerFactory
Parameters:
policyFile - with all permission sets
Throws:
java.io.FileNotFoundException - in case the resource does not exists
PolicyParseException - if the fail format is not recognized by the parser
java.io.IOException - in case of error while reading

setPolicies

public void setPolicies(java.net.URL policyFile,
                        PolicyParser parser)
                 throws java.io.FileNotFoundException,
                        PolicyParseException,
                        java.io.IOException
set policies to be used by this factory while creating containers

Specified by:
setPolicies in interface ContainerFactory
Parameters:
policyFile - with all permission sets
parser - to use to parse the policyFile
Throws:
java.io.FileNotFoundException - in case the resource does not exists
PolicyParseException - if the fail format is not recognized by the parser
java.io.IOException - in case of error while reading

newContainer

protected Container newContainer(java.security.ProtectionDomain[] pds)
template method: create new container out of protection domains list

Parameters:
pds - to be used by this container
Returns:
new Container object


Copyright © 2007 Nikolay Fiykov. All Rights Reserved.