[BUG-27751] rename some classes

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@451 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Jesse McConnell 2009-06-30 22:03:55 +00:00
parent 8db5f0f272
commit 2662001e73
10 changed files with 63 additions and 63 deletions

View File

@ -60,8 +60,8 @@ public class JettyPolicy extends Policy
// Policy files that are actively managed by the aggregate policy mechanism
private Set<String> _policies;
private Map<ProtectionDomain, PolicyEntry> pdMapping =
Collections.synchronizedMap( new HashMap<ProtectionDomain, PolicyEntry>() );
private Map<ProtectionDomain, PolicyBlock> pdMapping =
Collections.synchronizedMap( new HashMap<ProtectionDomain, PolicyBlock>() );
private PolicyContext _context = new PolicyContext();

View File

@ -23,7 +23,7 @@ import java.security.ProtectionDomain;
import java.security.cert.Certificate;
import java.util.Set;
public class PolicyEntry
public class PolicyBlock
{
public CodeSource codesource;

View File

@ -1,4 +1,4 @@
package org.eclipse.jetty.policy.component;
package org.eclipse.jetty.policy.entry;
//========================================================================
//Copyright (c) Webtide LLC
//------------------------------------------------------------------------
@ -18,7 +18,7 @@ package org.eclipse.jetty.policy.component;
import org.eclipse.jetty.policy.PolicyContext;
import org.eclipse.jetty.policy.PolicyException;
public abstract class AbstractNode
public abstract class AbstractEntry
{
private boolean isDirty = false;
private boolean isExpanded = false;

View File

@ -1,4 +1,4 @@
package org.eclipse.jetty.policy.component;
package org.eclipse.jetty.policy.entry;
//========================================================================
//Copyright (c) Webtide LLC
//------------------------------------------------------------------------
@ -32,7 +32,7 @@ import java.util.StringTokenizer;
import org.eclipse.jetty.policy.PolicyContext;
import org.eclipse.jetty.policy.PolicyException;
public class GrantNode extends AbstractNode
public class GrantEntry extends AbstractEntry
{
/**
@ -48,12 +48,12 @@ public class GrantNode extends AbstractNode
/**
* Collection of PrincipalEntries of grant clause.
*/
private Collection<PrincipalNode> principalNodes;
private Collection<PrincipalEntry> principalNodes;
/**
* Collection of PermissionEntries of grant clause.
*/
private Collection<PermissionNode> permissionNodes;
private Collection<PermissionEntry> permissionNodes;
// cached permissions
private PermissionCollection permissions;
@ -65,11 +65,11 @@ public class GrantNode extends AbstractNode
* Adds specified element to the <code>principals</code> collection. If collection does not exist yet, creates a
* new one.
*/
public void addPrincipal( PrincipalNode pe )
public void addPrincipal( PrincipalEntry pe )
{
if ( principalNodes == null )
{
principalNodes = new HashSet<PrincipalNode>();
principalNodes = new HashSet<PrincipalEntry>();
}
principalNodes.add( pe );
}
@ -85,9 +85,9 @@ public class GrantNode extends AbstractNode
if ( principalNodes != null )
{
Set<Principal> principalSet = new HashSet<Principal>();
for ( Iterator<PrincipalNode> i = principalNodes.iterator(); i.hasNext(); )
for ( Iterator<PrincipalEntry> i = principalNodes.iterator(); i.hasNext(); )
{
PrincipalNode node = i.next();
PrincipalEntry node = i.next();
node.expand( context );
principalSet.add( node.toPrincipal( context ) );
}
@ -96,9 +96,9 @@ public class GrantNode extends AbstractNode
context.setPrincipals( principals );
permissions = new Permissions();
for ( Iterator<PermissionNode> i = permissionNodes.iterator(); i.hasNext(); )
for ( Iterator<PermissionEntry> i = permissionNodes.iterator(); i.hasNext(); )
{
PermissionNode node = i.next();
PermissionEntry node = i.next();
node.expand( context );
permissions.add( node.toPermission() );
}
@ -190,12 +190,12 @@ public class GrantNode extends AbstractNode
this.codebase = codebase;
}
public void setPrincipals( Collection<PrincipalNode> principals )
public void setPrincipals( Collection<PrincipalEntry> principals )
{
this.principalNodes = principals;
}
public void setPermissions( Collection<PermissionNode> permissions )
public void setPermissions( Collection<PermissionEntry> permissions )
{
this.permissionNodes = permissions;
}

View File

@ -1,4 +1,4 @@
package org.eclipse.jetty.policy.component;
package org.eclipse.jetty.policy.entry;
//========================================================================
//Copyright (c) Webtide LLC
//------------------------------------------------------------------------
@ -22,7 +22,7 @@ import java.security.KeyStore;
import org.eclipse.jetty.policy.PolicyContext;
import org.eclipse.jetty.policy.PolicyException;
public class KeystoreNode extends AbstractNode
public class KeystoreEntry extends AbstractEntry
{
/**
* The URL part of keystore clause.

View File

@ -1,4 +1,4 @@
package org.eclipse.jetty.policy.component;
package org.eclipse.jetty.policy.entry;
//========================================================================
//Copyright (c) Webtide LLC
//------------------------------------------------------------------------
@ -27,7 +27,7 @@ import java.util.StringTokenizer;
import org.eclipse.jetty.policy.PolicyContext;
import org.eclipse.jetty.policy.PolicyException;
public class PermissionNode extends AbstractNode
public class PermissionEntry extends AbstractEntry
{
/**
* The classname part of permission clause.

View File

@ -1,4 +1,4 @@
package org.eclipse.jetty.policy.component;
package org.eclipse.jetty.policy.entry;
//========================================================================
//Copyright (c) Webtide LLC
//------------------------------------------------------------------------
@ -23,7 +23,7 @@ import java.security.cert.X509Certificate;
import org.eclipse.jetty.policy.PolicyContext;
import org.eclipse.jetty.policy.PolicyException;
public class PrincipalNode extends AbstractNode
public class PrincipalEntry extends AbstractEntry
{
/**
* Wildcard value denotes any class and/or any name. Must be asterisk, for proper general expansion and

View File

@ -31,10 +31,10 @@ import java.util.List;
import java.util.Map;
import org.eclipse.jetty.policy.PolicyContext;
import org.eclipse.jetty.policy.PolicyEntry;
import org.eclipse.jetty.policy.PolicyBlock;
import org.eclipse.jetty.policy.PolicyException;
import org.eclipse.jetty.policy.component.GrantNode;
import org.eclipse.jetty.policy.component.KeystoreNode;
import org.eclipse.jetty.policy.entry.GrantEntry;
import org.eclipse.jetty.policy.entry.KeystoreEntry;
/**
* Load the policies within the stream and resolve into protection domains and permission collections
@ -43,23 +43,23 @@ import org.eclipse.jetty.policy.component.KeystoreNode;
public class DefaultPolicyLoader
{
public static Map<ProtectionDomain, PolicyEntry> load( InputStream policyStream, PolicyContext context ) throws PolicyException
public static Map<ProtectionDomain, PolicyBlock> load( InputStream policyStream, PolicyContext context ) throws PolicyException
{
Map<ProtectionDomain, PolicyEntry> policies = new HashMap<ProtectionDomain, PolicyEntry>();
Map<ProtectionDomain, PolicyBlock> policies = new HashMap<ProtectionDomain, PolicyBlock>();
KeyStore keystore = null;
try
{
PolicyFileScanner loader = new PolicyFileScanner();
Collection<GrantNode> grantEntries = new ArrayList<GrantNode>();
List<KeystoreNode> keystoreEntries = new ArrayList<KeystoreNode>();
Collection<GrantEntry> grantEntries = new ArrayList<GrantEntry>();
List<KeystoreEntry> keystoreEntries = new ArrayList<KeystoreEntry>();
loader.scanStream( new InputStreamReader(policyStream), grantEntries, keystoreEntries );
for ( Iterator<KeystoreNode> i = keystoreEntries.iterator(); i.hasNext();)
for ( Iterator<KeystoreEntry> i = keystoreEntries.iterator(); i.hasNext();)
{
KeystoreNode node = i.next();
KeystoreEntry node = i.next();
node.expand( context );
keystore = node.toKeyStore();
@ -72,12 +72,12 @@ public class DefaultPolicyLoader
}
}
for ( Iterator<GrantNode> i = grantEntries.iterator(); i.hasNext(); )
for ( Iterator<GrantEntry> i = grantEntries.iterator(); i.hasNext(); )
{
GrantNode grant = i.next();
GrantEntry grant = i.next();
grant.expand( context );
PolicyEntry policy = new PolicyEntry();
PolicyBlock policy = new PolicyBlock();
policy.setCodeSource( grant.getCodeSource() );
policy.setPrincipals( grant.getPrincipals() );

View File

@ -27,10 +27,10 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import org.eclipse.jetty.policy.component.GrantNode;
import org.eclipse.jetty.policy.component.KeystoreNode;
import org.eclipse.jetty.policy.component.PermissionNode;
import org.eclipse.jetty.policy.component.PrincipalNode;
import org.eclipse.jetty.policy.entry.GrantEntry;
import org.eclipse.jetty.policy.entry.KeystoreEntry;
import org.eclipse.jetty.policy.entry.PermissionEntry;
import org.eclipse.jetty.policy.entry.PrincipalEntry;
/**
@ -113,7 +113,7 @@ public class PolicyFileScanner
* @throws IOException if stream reading failed
* @throws InvalidFormatException if unexpected or unknown token encountered
*/
public void scanStream( Reader r, Collection<GrantNode> grantEntries, List<KeystoreNode> keystoreEntries )
public void scanStream( Reader r, Collection<GrantEntry> grantEntries, List<KeystoreEntry> keystoreEntries )
throws IOException, InvalidFormatException
{
StreamTokenizer st = configure( new StreamTokenizer( r ) );
@ -162,10 +162,10 @@ public class PolicyFileScanner
* @throws IOException if stream reading failed
* @throws InvalidFormatException if unexpected or unknown token encountered
*/
protected KeystoreNode readKeystoreNode( StreamTokenizer st )
protected KeystoreEntry readKeystoreNode( StreamTokenizer st )
throws IOException, InvalidFormatException
{
KeystoreNode ke = new KeystoreNode();
KeystoreEntry ke = new KeystoreEntry();
if ( st.nextToken() == '"' )
{
ke.setUrl( st.sval );
@ -205,10 +205,10 @@ public class PolicyFileScanner
* @throws IOException if stream reading failed
* @throws InvalidFormatException if unexpected or unknown token encountered
*/
protected GrantNode readGrantNode( StreamTokenizer st )
protected GrantEntry readGrantNode( StreamTokenizer st )
throws IOException, InvalidFormatException
{
GrantNode ge = new GrantNode();
GrantEntry ge = new GrantEntry();
parsing: while ( true )
{
switch ( st.nextToken() )
@ -275,10 +275,10 @@ public class PolicyFileScanner
* @throws IOException if stream reading failed
* @throws InvalidFormatException if unexpected or unknown token encountered
*/
protected PrincipalNode readPrincipalNode( StreamTokenizer st )
protected PrincipalEntry readPrincipalNode( StreamTokenizer st )
throws IOException, InvalidFormatException
{
PrincipalNode pe = new PrincipalNode();
PrincipalEntry pe = new PrincipalEntry();
if ( st.nextToken() == StreamTokenizer.TT_WORD )
{
pe.setKlass( st.sval );
@ -286,7 +286,7 @@ public class PolicyFileScanner
}
else if ( st.ttype == '*' )
{
pe.setKlass( PrincipalNode.WILDCARD );
pe.setKlass( PrincipalEntry.WILDCARD );
st.nextToken();
}
if ( st.ttype == '"' )
@ -295,7 +295,7 @@ public class PolicyFileScanner
}
else if ( st.ttype == '*' )
{
pe.setName( PrincipalNode.WILDCARD );
pe.setName( PrincipalEntry.WILDCARD );
}
else
{
@ -321,10 +321,10 @@ public class PolicyFileScanner
* @throws IOException if stream reading failed
* @throws InvalidFormatException if unexpected or unknown token encountered
*/
protected Collection<PermissionNode> readPermissionEntries( StreamTokenizer st )
protected Collection<PermissionEntry> readPermissionEntries( StreamTokenizer st )
throws IOException, InvalidFormatException
{
Collection<PermissionNode> permissions = new HashSet<PermissionNode>();
Collection<PermissionEntry> permissions = new HashSet<PermissionEntry>();
parsing: while ( true )
{
switch ( st.nextToken() )
@ -332,7 +332,7 @@ public class PolicyFileScanner
case StreamTokenizer.TT_WORD:
if ( Util.equalsIgnoreCase( "permission", st.sval ) ) { //$NON-NLS-1$
PermissionNode pe = new PermissionNode();
PermissionEntry pe = new PermissionEntry();
if ( st.nextToken() == StreamTokenizer.TT_WORD )
{
pe.setKlass( st.sval );

View File

@ -25,8 +25,8 @@ import java.util.List;
import junit.framework.TestCase;
import org.eclipse.jetty.policy.component.GrantNode;
import org.eclipse.jetty.policy.component.KeystoreNode;
import org.eclipse.jetty.policy.entry.GrantEntry;
import org.eclipse.jetty.policy.entry.KeystoreEntry;
import org.eclipse.jetty.policy.loader.PolicyFileScanner;
public class TestPolicyContext
@ -52,22 +52,22 @@ public class TestPolicyContext
PolicyContext context = new PolicyContext();
PolicyFileScanner loader = new PolicyFileScanner();
List<GrantNode> grantEntries = new ArrayList<GrantNode>();
List<KeystoreNode> keystoreEntries = new ArrayList<KeystoreNode>();
List<GrantEntry> grantEntries = new ArrayList<GrantEntry>();
List<KeystoreEntry> keystoreEntries = new ArrayList<KeystoreEntry>();
File policyFile = new File( getWorkingDirectory() + "/src/test/resources/context/jetty-certificate.policy" );
loader.scanStream( new InputStreamReader( new FileInputStream( policyFile ) ), grantEntries, keystoreEntries );
for ( Iterator<KeystoreNode> i = keystoreEntries.iterator(); i.hasNext();)
for ( Iterator<KeystoreEntry> i = keystoreEntries.iterator(); i.hasNext();)
{
KeystoreNode node = i.next();
KeystoreEntry node = i.next();
node.expand( context );
context.setKeystore( node.toKeyStore() );
}
GrantNode grant = grantEntries.get( 0 );
GrantEntry grant = grantEntries.get( 0 );
grant.expand( context );
Permission perm = grant.getPermissions().elements().nextElement();
@ -80,22 +80,22 @@ public class TestPolicyContext
PolicyContext context = new PolicyContext();
PolicyFileScanner loader = new PolicyFileScanner();
List<GrantNode> grantEntries = new ArrayList<GrantNode>();
List<KeystoreNode> keystoreEntries = new ArrayList<KeystoreNode>();
List<GrantEntry> grantEntries = new ArrayList<GrantEntry>();
List<KeystoreEntry> keystoreEntries = new ArrayList<KeystoreEntry>();
File policyFile = new File( getWorkingDirectory() + "/src/test/resources/context/jetty-certificate-alias.policy" );
loader.scanStream( new InputStreamReader( new FileInputStream( policyFile ) ), grantEntries, keystoreEntries );
for ( Iterator<KeystoreNode> i = keystoreEntries.iterator(); i.hasNext();)
for ( Iterator<KeystoreEntry> i = keystoreEntries.iterator(); i.hasNext();)
{
KeystoreNode node = i.next();
KeystoreEntry node = i.next();
node.expand( context );
context.setKeystore( node.toKeyStore() );
}
GrantNode grant = grantEntries.get( 0 );
GrantEntry grant = grantEntries.get( 0 );
grant.expand( context );
Permission perm = grant.getPermissions().elements().nextElement();