You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by gr...@apache.org on 2005/02/08 19:15:31 UTC
svn commit: r152682 [2/17] - in lenya/trunk/src: java/org/apache/lenya/ac/
java/org/apache/lenya/ac/cache/ java/org/apache/lenya/ac/file/
java/org/apache/lenya/ac/impl/ java/org/apache/lenya/ac/ldap/
java/org/apache/lenya/cms/ac/ java/org/apache/lenya/cms/ac/cocoon/
java/org/apache/lenya/cms/ac/usecase/ java/org/apache/lenya/cms/ac/usecases/
java/org/apache/lenya/cms/ac/workflow/ java/org/apache/lenya/cms/ant/
java/org/apache/lenya/cms/authoring/ java/org/apache/lenya/cms/cocoon/acting/
java/org/apache/lenya/cms/cocoon/bean/
java/org/apache/lenya/cms/cocoon/components/modules/input/
java/org/apache/lenya/cms/cocoon/flow/
java/org/apache/lenya/cms/cocoon/generation/
java/org/apache/lenya/cms/cocoon/matching/
java/org/apache/lenya/cms/cocoon/scheduler/
java/org/apache/lenya/cms/cocoon/source/
java/org/apache/lenya/cms/cocoon/task/
java/org/apache/lenya/cms/cocoon/transformation/
java/org/apache/lenya/cms/cocoon/uriparameterizer/
java/org/apache/lenya/cms/metadata/dublincore/
java/org/apache/lenya/cms/metadata/usecases/
java/org/apache/lenya/cms/publication/
java/org/apache/lenya/cms/publication/file/
java/org/apache/lenya/cms/publication/task/
java/org/apache/lenya/cms/publication/templating/
java/org/apache/lenya/cms/publication/util/
java/org/apache/lenya/cms/publishing/ java/org/apache/lenya/cms/rc/
java/org/apache/lenya/cms/scheduler/ java/org/apache/lenya/cms/scheduler/xml/
java/org/apache/lenya/cms/search/usecases/ java/org/apache/lenya/cms/site/
java/org/apache/lenya/cms/site/tree/
java/org/apache/lenya/cms/site/usecases/ java/org/apache/lenya/cms/task/
java/org/apache/lenya/cms/usecase/ java/org/apache/lenya/cms/workflow/
java/org/apache/lenya/lucene/ java/org/apache/lenya/lucene/html/
java/org/apache/lenya/lucene/index/ java/org/apache/lenya/lucene/parser/
java/org/apache/lenya/net/ java/org/apache/lenya/search/
java/org/apache/lenya/search/crawler/ java/org/apache/lenya/util/
java/org/apache/lenya/workflow/ java/org/apache/lenya/workflow/impl/
java/org/apache/lenya/xml/ test/org/apache/lenya/ac/file/
test/org/apache/lenya/ac/impl/ test/org/apache/lenya/cms/
test/org/apache/lenya/cms/authoring/
test/org/apache/lenya/cms/cocoon/generation/
test/org/apache/lenya/cms/publication/
test/org/apache/lenya/cms/publication/file/ test/org/apache/lenya/cms/rc/
test/org/apache/lenya/cms/site/tree/ test/org/apache/lenya/cms/task/
test/org/apache/lenya/cms/workflow/ test/org/apache/lenya/net/
Modified: lenya/trunk/src/java/org/apache/lenya/ac/file/FileUser.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/file/FileUser.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/file/FileUser.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/file/FileUser.java Tue Feb 8 10:13:39 2005
@@ -46,26 +46,25 @@
* Creates a new FileUser object.
*/
public FileUser() {
+ // do nothing
}
/**
* Create a FileUser
- *
- * @param configurationDirectory where the user will be attached to
+ * @param _configurationDirectory where the user will be attached to
* @param id the user id
* @param fullName the full name of the user
* @param email the users email address
* @param password the users password
*/
- public FileUser(File configurationDirectory, String id, String fullName, String email,
+ public FileUser(File _configurationDirectory, String id, String fullName, String email,
String password) {
super(id, fullName, email, password);
- setConfigurationDirectory(configurationDirectory);
+ setConfigurationDirectory(_configurationDirectory);
}
/**
* Configure this FileUser.
- *
* @param config where the user details are specified
* @throws ConfigurationException if the necessary details aren't specified in the config
*/
@@ -83,11 +82,11 @@
FileGroupManager manager = null;
try {
- manager = FileGroupManager.instance(configurationDirectory, getLogger());
+ manager = FileGroupManager.instance(this.configurationDirectory, getLogger());
} catch (AccessControlException e) {
throw new ConfigurationException(
"Exception when trying to fetch GroupManager for directory: ["
- + configurationDirectory + "]", e);
+ + this.configurationDirectory + "]", e);
}
for (int i = 0; i < groups.length; i++) {
@@ -112,7 +111,6 @@
/**
* Create a configuration from the current user details. Can be used for saving.
- *
* @return a <code>Configuration</code>
*/
protected Configuration createConfiguration() {
@@ -186,15 +184,15 @@
* @return A file object.
*/
protected File getConfigurationDirectory() {
- return configurationDirectory;
+ return this.configurationDirectory;
}
/**
* @see org.apache.lenya.ac.Item#setConfigurationDirectory(java.io.File)
*/
- public void setConfigurationDirectory(File configurationDirectory) {
- assert (configurationDirectory != null) && configurationDirectory.isDirectory();
- this.configurationDirectory = configurationDirectory;
+ public void setConfigurationDirectory(File _configurationDirectory) {
+ assert (_configurationDirectory != null) && _configurationDirectory.isDirectory();
+ this.configurationDirectory = _configurationDirectory;
}
}
Modified: lenya/trunk/src/java/org/apache/lenya/ac/file/FileUserManager.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/file/FileUserManager.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/file/FileUserManager.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/file/FileUserManager.java Tue Feb 8 10:13:39 2005
@@ -43,12 +43,12 @@
/**
* Create a UserManager
*
- * @param userTypes The supported user types.
+ * @param _userTypes The supported user types.
* @throws AccessControlException if the UserManager could not be instantiated.
*/
- private FileUserManager(UserType[] userTypes)
+ private FileUserManager(UserType[] _userTypes)
throws AccessControlException {
- this.userTypes = new HashSet(Arrays.asList(userTypes));
+ this.userTypes = new HashSet(Arrays.asList(_userTypes));
}
/**
@@ -121,7 +121,7 @@
* @see org.apache.lenya.ac.UserManager#getUserTypes()
*/
public UserType[] getUserTypes() {
- return (UserType[]) userTypes.toArray(new UserType[userTypes.size()]);
+ return (UserType[]) this.userTypes.toArray(new UserType[this.userTypes.size()]);
}
protected static final String SUFFIX = ".iml";
Modified: lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractAccessControllerResolver.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractAccessControllerResolver.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractAccessControllerResolver.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractAccessControllerResolver.java Tue Feb 8 10:13:39 2005
@@ -63,12 +63,12 @@
}
}
- synchronized (cache) {
- controller = (AccessController) cache.get(key);
+ synchronized (this.cache) {
+ controller = (AccessController) this.cache.get(key);
if (controller == null) {
getLogger().debug("No access controller in cache.");
controller = doResolveAccessController(webappUrl);
- cache.put(key, controller);
+ this.cache.put(key, controller);
} else {
getLogger().debug("Getting access controller from cache.");
}
@@ -120,9 +120,9 @@
/**
* @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
*/
- public void service(ServiceManager manager) throws ServiceException {
+ public void service(ServiceManager _manager) throws ServiceException {
getLogger().debug("Servicing [" + getClass().getName() + "]");
- this.manager = manager;
+ this.manager = _manager;
}
/**
@@ -130,7 +130,7 @@
* @return A service manager.
*/
public ServiceManager getManager() {
- return manager;
+ return this.manager;
}
}
Modified: lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractAccreditableManager.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractAccreditableManager.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractAccreditableManager.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractAccreditableManager.java Tue Feb 8 10:13:39 2005
@@ -50,23 +50,21 @@
/**
* Attaches an item manager listener to this accreditable manager.
- *
* @param listener An item manager listener.
*/
public void addItemManagerListener(ItemManagerListener listener) {
- if (!itemManagerListeners.contains(listener)) {
+ if (!this.itemManagerListeners.contains(listener)) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Adding listener: [" + listener + "]");
}
- itemManagerListeners.add(listener);
+ this.itemManagerListeners.add(listener);
}
}
/**
* Removes an item manager listener from this accreditable manager.
- *
* @param listener An item manager listener.
*/
public void removeItemManagerListener(ItemManagerListener listener) {
@@ -74,17 +72,16 @@
getLogger().debug("Removing listener: [" + listener + "]");
}
- itemManagerListeners.remove(listener);
+ this.itemManagerListeners.remove(listener);
}
/**
* Notifies the listeners that an item was added.
- *
* @param item The item that was added.
* @throws AccessControlException when a notified listener threw this exception.
*/
protected void notifyAdded(Item item) throws AccessControlException {
- List clone = new ArrayList(itemManagerListeners);
+ List clone = new ArrayList(this.itemManagerListeners);
for (Iterator i = clone.iterator(); i.hasNext();) {
ItemManagerListener listener = (ItemManagerListener) i.next();
listener.itemAdded(item);
@@ -93,13 +90,11 @@
/**
* Notifies the listeners that an item was removed.
- *
* @param item The item that was removed.
* @throws AccessControlException when a notified listener threw this exception.
*/
protected void notifyRemoved(Item item) throws AccessControlException {
-
- List clone = new ArrayList(itemManagerListeners);
+ List clone = new ArrayList(this.itemManagerListeners);
for (Iterator i = clone.iterator(); i.hasNext();) {
ItemManagerListener listener = (ItemManagerListener) i.next();
listener.itemRemoved(item);
@@ -130,16 +125,16 @@
* @see org.apache.avalon.framework.activity.Disposable#dispose()
*/
public void dispose() {
- if (userManager != null) {
- userManager.removeItemManagerListener(this);
+ if (this.userManager != null) {
+ this.userManager.removeItemManagerListener(this);
}
- if (groupManager != null) {
- groupManager.removeItemManagerListener(this);
+ if (this.groupManager != null) {
+ this.groupManager.removeItemManagerListener(this);
}
- if (ipRangeManager != null) {
+ if (this.ipRangeManager != null) {
this.ipRangeManager.removeItemManagerListener(this);
}
- if (roleManager != null) {
+ if (this.roleManager != null) {
this.roleManager.removeItemManagerListener(this);
}
@@ -152,44 +147,44 @@
* @see org.apache.lenya.ac.AccreditableManager#getUserManager()
*/
public UserManager getUserManager() throws AccessControlException {
- if (userManager == null) {
- userManager = initializeUserManager();
- userManager.addItemManagerListener(this);
+ if (this.userManager == null) {
+ this.userManager = initializeUserManager();
+ this.userManager.addItemManagerListener(this);
}
- return userManager;
+ return this.userManager;
}
/**
* @see org.apache.lenya.ac.AccreditableManager#getGroupManager()
*/
public GroupManager getGroupManager() throws AccessControlException {
- if (groupManager == null) {
- groupManager = initializeGroupManager();
- groupManager.addItemManagerListener(this);
+ if (this.groupManager == null) {
+ this.groupManager = initializeGroupManager();
+ this.groupManager.addItemManagerListener(this);
}
- return groupManager;
+ return this.groupManager;
}
/**
* @see org.apache.lenya.ac.AccreditableManager#getRoleManager()
*/
public RoleManager getRoleManager() throws AccessControlException {
- if (roleManager == null) {
- roleManager = initializeRoleManager();
- roleManager.addItemManagerListener(this);
+ if (this.roleManager == null) {
+ this.roleManager = initializeRoleManager();
+ this.roleManager.addItemManagerListener(this);
}
- return roleManager;
+ return this.roleManager;
}
/**
* @see org.apache.lenya.ac.AccreditableManager#getIPRangeManager()
*/
public IPRangeManager getIPRangeManager() throws AccessControlException {
- if (ipRangeManager == null) {
- ipRangeManager = initializeIPRangeManager();
- ipRangeManager.addItemManagerListener(this);
+ if (this.ipRangeManager == null) {
+ this.ipRangeManager = initializeIPRangeManager();
+ this.ipRangeManager.addItemManagerListener(this);
}
- return ipRangeManager;
+ return this.ipRangeManager;
}
/**
Modified: lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractGroup.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractGroup.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractGroup.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractGroup.java Tue Feb 8 10:13:39 2005
@@ -37,6 +37,7 @@
* Creates a new group.
*/
public AbstractGroup() {
+ // do nothing
}
/**
@@ -54,7 +55,7 @@
* @return An array of {@link Groupable}s.
*/
public Groupable[] getMembers() {
- return (Groupable[]) members.toArray(new Groupable[members.size()]);
+ return (Groupable[]) this.members.toArray(new Groupable[this.members.size()]);
}
/**
@@ -62,8 +63,8 @@
* @param member The member to add.
*/
public void add(Groupable member) {
- assert (member != null) && !members.contains(member);
- members.add(member);
+ assert (member != null) && !this.members.contains(member);
+ this.members.add(member);
member.addedToGroup(this);
}
@@ -72,8 +73,8 @@
* @param member The member to remove.
*/
public void remove(Groupable member) {
- assert (member != null) && members.contains(member);
- members.remove(member);
+ assert (member != null) && this.members.contains(member);
+ this.members.remove(member);
member.removedFromGroup(this);
}
@@ -81,9 +82,9 @@
* Removes all members from this group.
*/
public void removeAllMembers() {
- Groupable[] members = getMembers();
- for (int i = 0; i < members.length; i++) {
- remove(members[i]);
+ Groupable[] _members = getMembers();
+ for (int i = 0; i < _members.length; i++) {
+ remove(_members[i]);
}
}
@@ -93,7 +94,7 @@
* @return A boolean value.
*/
public boolean contains(Groupable member) {
- return members.contains(member);
+ return this.members.contains(member);
}
/**
@@ -106,7 +107,6 @@
/**
* Delete a group
- *
* @throws AccessControlException if the delete failed
*/
public void delete() throws AccessControlException {
Modified: lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractGroupable.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractGroupable.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractGroupable.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractGroupable.java Tue Feb 8 10:13:39 2005
@@ -35,6 +35,7 @@
* Ctor.
*/
public AbstractGroupable() {
+ // do nothing
}
private Set groups = new HashSet();
@@ -45,7 +46,7 @@
public void addedToGroup(Group group) {
assert group != null;
assert group.contains(this);
- groups.add(group);
+ this.groups.add(group);
}
/**
@@ -54,24 +55,24 @@
public void removedFromGroup(Group group) {
assert group != null;
assert !group.contains(this);
- groups.remove(group);
+ this.groups.remove(group);
}
/**
* @see org.apache.lenya.ac.Groupable#getGroups()
*/
public Group[] getGroups() {
- return (Group[]) groups.toArray(new Group[groups.size()]);
+ return (Group[]) this.groups.toArray(new Group[this.groups.size()]);
}
/**
* Removes this groupable from all its groups.
*/
public void removeFromAllGroups() {
- Group[] groups = getGroups();
+ Group[] _groups = getGroups();
- for (int i = 0; i < groups.length; i++) {
- groups[i].remove(this);
+ for (int i = 0; i < _groups.length; i++) {
+ _groups[i].remove(this);
}
}
@@ -82,10 +83,10 @@
Set accreditables = new HashSet();
accreditables.add(this);
- Group[] groups = getGroups();
+ Group[] _groups = getGroups();
- for (int i = 0; i < groups.length; i++) {
- Accreditable[] groupAccreditables = groups[i].getAccreditables();
+ for (int i = 0; i < _groups.length; i++) {
+ Accreditable[] groupAccreditables = _groups[i].getAccreditables();
accreditables.addAll(Arrays.asList(groupAccreditables));
}
Modified: lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractIPRange.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractIPRange.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractIPRange.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractIPRange.java Tue Feb 8 10:13:39 2005
@@ -70,9 +70,9 @@
*/
public AbstractIPRange() {
try {
- networkAddress = InetAddress.getLocalHost();
+ this.networkAddress = InetAddress.getLocalHost();
byte[] mask = null;
- int masklen = networkAddress.getAddress().length;
+ int masklen = this.networkAddress.getAddress().length;
if (masklen == 4) {
/* IPv4: */
/*
@@ -84,7 +84,7 @@
mask = new byte[masklen];
Arrays.fill(mask, (byte) -1);
}
- subnetMask = InetAddress.getByAddress(mask);
+ this.subnetMask = InetAddress.getByAddress(mask);
} catch (UnknownHostException ignore) {
/*
* FIXME? by zisch@dals.ch: Is it safe to ignore the exception and just leave the
@@ -108,26 +108,24 @@
* @return A file object.
*/
public File getConfigurationDirectory() {
- return configurationDirectory;
+ return this.configurationDirectory;
}
/**
* @see org.apache.lenya.ac.Item#setConfigurationDirectory(java.io.File)
*/
- public void setConfigurationDirectory(File configurationDirectory) {
- this.configurationDirectory = configurationDirectory;
+ public void setConfigurationDirectory(File _configurationDirectory) {
+ this.configurationDirectory = _configurationDirectory;
}
/**
* Save the IP range
- *
* @throws AccessControlException if the save failed
*/
public abstract void save() throws AccessControlException;
/**
* Delete an IP range
- *
* @throws AccessControlException if the delete failed
*/
public void delete() throws AccessControlException {
@@ -141,18 +139,15 @@
* <code>"129.168.0.32"</code>, numeric IPv6 addresses like
* <code>"1080::8:800:200C:417A"</code> as well as hostnames (if DNS resolution is available)
* like <code>"localhost"</code> or <code>"www.apache.com"</code>.
- *
* @param address a <code>String</code> like <code>"192.168.0.32"</code>,
* <code>"::1"</code>, ...
- *
* @throws AccessControlException when the conversion of the <code>String</code> to an
* <code>InetAddress</code> failed
- *
* @see #setNetworkAddress(byte[])
*/
public void setNetworkAddress(String address) throws AccessControlException {
try {
- networkAddress = InetAddress.getByName(address);
+ this.networkAddress = InetAddress.getByName(address);
} catch (UnknownHostException e) {
throw new AccessControlException("Failed to convert address [" + address + "]: ", e);
}
@@ -161,17 +156,14 @@
/**
* Sets the network address. The method accepts numeric IPv4 addresses (specified by byte arrays
* of length 4) or IPv6 addresses (specified by byte arrays of length 16).
- *
* @param address a byte array of the length 4 or 16
- *
* @throws AccessControlException when the conversion of the byte array to an InetAddress
* failed.
- *
* @see #setNetworkAddress(String)
*/
public void setNetworkAddress(byte[] address) throws AccessControlException {
try {
- networkAddress = InetAddress.getByAddress(address);
+ this.networkAddress = InetAddress.getByAddress(address);
} catch (UnknownHostException e) {
throw new AccessControlException("Failed to convert address [" + addr2string(address)
+ "]: ", e);
@@ -180,11 +172,10 @@
/**
* Returns the network address.
- *
* @return an <code>InetAddress</code> representing the network address
*/
public InetAddress getNetworkAddress() {
- return networkAddress;
+ return this.networkAddress;
}
private InetAddress subnetMask;
@@ -197,19 +188,16 @@
* Only valid subnet masks are accepted, for which the binary representation is a sequence of
* 1-bits followed by a sequence of 0-bits. For example <code>"255.128.0.0"</code> is valid
* while <code>"255.128.0.1"</code> is not.
- *
* @param mask a <code>String</code> like <code>"255.255.255.0"</code>
- *
* @throws AccessControlException when the conversion of the String to an
* <code>InetAddress</code> failed.
- *
* @see #setSubnetMask(byte[])
*/
public void setSubnetMask(String mask) throws AccessControlException {
try {
/* use setSubnetMask(...) to check the mask-format: */
setSubnetMask(InetAddress.getByName(mask).getAddress());
- } catch (UnknownHostException e) {
+ } catch (final UnknownHostException e) {
throw new AccessControlException("Failed to convert mask [" + mask + "]: ", e);
}
@@ -221,12 +209,9 @@
* Only valid subnet masks are accepted, for which the binary representation is a sequence of
* 1-bits followed by a sequence of 0-bits. For example <code>{ 255, 128, 0, 0 }</code> is
* valid while <code>{ 255, 128, 0, 1 }</code> is not.
- *
* @param mask A byte array of the length 4.
- *
* @throws AccessControlException when the conversion of the byte array to an InetAddress
* failed.
- *
* @see #setSubnetMask(String)
*/
public void setSubnetMask(byte[] mask) throws AccessControlException {
@@ -279,8 +264,8 @@
/* convert the checked mask to InetAddress: */
try {
- subnetMask = InetAddress.getByAddress(mask);
- } catch (UnknownHostException e) {
+ this.subnetMask = InetAddress.getByAddress(mask);
+ } catch (final UnknownHostException e) {
throw new AccessControlException(
"Failed to convert mask [" + addr2string(mask) + "]: ", e);
}
@@ -291,7 +276,7 @@
* @return An InetAddress value.
*/
public InetAddress getSubnetMask() {
- return subnetMask;
+ return this.subnetMask;
}
/**
@@ -299,7 +284,6 @@
* @param networkAddress The network address.
* @param subnetMask The subnet mask.
* @return A boolean value.
- *
* @deprecated This method is currently not implemented, probably not necessary.and could be
* removed in the future. Therefore it should not be used.
*/
@@ -327,10 +311,8 @@
* <code>127.0.0.0/8</code>) will <b>not </b> contain the localhost in IPv6 (
* <code>::1</code>), and the localhost in IPv4 (<code>127.0.0.1</code>) will <b>not </b>
* be contained in the local subnet in IPv6 (<code>::1/128</code>).
- *
* @param machine the machine to check for
* @return a boolean value
- *
* @see InetAddressUtil#contains
*/
public boolean contains(Machine machine) {
@@ -340,7 +322,7 @@
* about this. ;-)
*/
getLogger().debug("Checking IP range: [" + getId() + "]");
- return InetAddressUtil.contains(networkAddress, subnetMask, machine.getAddress());
+ return InetAddressUtil.contains(this.networkAddress, this.subnetMask, machine.getAddress());
}
/**
Modified: lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractItem.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractItem.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractItem.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractItem.java Tue Feb 8 10:13:39 2005
@@ -35,6 +35,7 @@
* Ctor.
*/
public AbstractItem() {
+ // do nothing
}
/**
@@ -43,7 +44,7 @@
*/
protected void setId(String string) {
assert isValidId(string);
- id = string;
+ this.id = string;
}
/**
@@ -51,7 +52,7 @@
* @return The ID.
*/
public String getId() {
- return id;
+ return this.id;
}
/**
@@ -59,16 +60,16 @@
* @return A string.
*/
public String getDescription() {
- return description;
+ return this.description;
}
/**
* Sets the description of this object.
- * @param description A string.
+ * @param _description A string.
*/
- public void setDescription(String description) {
- assert description != null;
- this.description = description;
+ public void setDescription(String _description) {
+ assert _description != null;
+ this.description = _description;
}
/**
@@ -81,21 +82,19 @@
/**
* Returns the name of this object.
- *
* @return A <code>String</code>.
*/
public String getName() {
- return name;
+ return this.name;
}
/**
* Set the full name
- *
- * @param name the new full name
+ * @param _name the new full name
*/
- public void setName(String name) {
- assert name != null;
- this.name = name;
+ public void setName(String _name) {
+ assert _name != null;
+ this.name = _name;
}
/**
@@ -117,7 +116,6 @@
AbstractItem otherManageable = (AbstractItem) otherObject;
equals = getId().equals(otherManageable.getId());
}
-
return equals;
}
Modified: lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractRole.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractRole.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractRole.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractRole.java Tue Feb 8 10:13:39 2005
@@ -32,6 +32,7 @@
* Creates a new instance of Role.
*/
public AbstractRole() {
+ // do nothing
}
/**
Modified: lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractUser.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractUser.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractUser.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/impl/AbstractUser.java Tue Feb 8 10:13:39 2005
@@ -34,40 +34,38 @@
* Creates a new User.
*/
public AbstractUser() {
+ // do nothing
}
/**
* Create a User instance
- *
* @param id the user id
* @param fullName the full name of the user
- * @param email the users email address
+ * @param _email the users email address
* @param password the users password
*/
- public AbstractUser(String id, String fullName, String email, String password) {
+ public AbstractUser(String id, String fullName, String _email, String password) {
setId(id);
setName(fullName);
- this.email = email;
+ this.email = _email;
setPassword(password);
}
/**
* Get the email address
- *
* @return a <code>String</code>
*/
public String getEmail() {
- return email;
+ return this.email;
}
/**
* Set the email address
- *
- * @param email the new email address
+ * @param _email the new email address
*/
- public void setEmail(String email) {
- this.email = email;
+ public void setEmail(String _email) {
+ this.email = _email;
}
/**
@@ -75,38 +73,34 @@
* @param plainTextPassword The plain text passwrod.
*/
public void setPassword(String plainTextPassword) {
- encryptedPassword = Password.encrypt(plainTextPassword);
+ this.encryptedPassword = Password.encrypt(plainTextPassword);
}
/**
* This method can be used for subclasses to set the password without it being encrypted again.
* Some subclass might have knowledge of the encrypted password and needs to be able to set it.
- *
- * @param encryptedPassword the encrypted password
+ * @param _encryptedPassword the encrypted password
*/
- protected void setEncryptedPassword(String encryptedPassword) {
- this.encryptedPassword = encryptedPassword;
+ protected void setEncryptedPassword(String _encryptedPassword) {
+ this.encryptedPassword = _encryptedPassword;
}
/**
* Get the encrypted password
- *
* @return the encrypted password
*/
protected String getEncryptedPassword() {
- return encryptedPassword;
+ return this.encryptedPassword;
}
/**
* Save the user
- *
* @throws AccessControlException if the save failed
*/
public abstract void save() throws AccessControlException;
/**
* Delete a user
- *
* @throws AccessControlException if the delete failed
*/
public void delete() throws AccessControlException {
@@ -116,7 +110,6 @@
/**
* Authenticate a user. This is done by encrypting the given password and comparing this to the
* encryptedPassword.
- *
* @param password to authenticate with
* @return true if the given password matches the password for this user
*/
Modified: lenya/trunk/src/java/org/apache/lenya/ac/impl/BypassableAccessController.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/impl/BypassableAccessController.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/impl/BypassableAccessController.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/impl/BypassableAccessController.java Tue Feb 8 10:13:39 2005
@@ -41,6 +41,7 @@
* Ctor.
*/
public BypassableAccessController() {
+ // do nothing
}
private List publicMatchers = new ArrayList();
@@ -59,7 +60,7 @@
String publicHref = publics[i].getValue(null);
try {
- publicMatchers.add(preparePattern(publicHref));
+ this.publicMatchers.add(preparePattern(publicHref));
} catch (PatternException pe) {
throw new ConfigurationException("invalid pattern for public hrefs", pe);
}
@@ -139,9 +140,9 @@
// Check public uris from configuration above. Should only be used during development before the implementation of a concrete authorizer.
int i = 0;
- while (!authorized && i < publicMatchers.size()) {
- getLogger().debug("Trying pattern: [" + publicMatchers.get(i) + "] with URL [" + uri + "]");
- if (preparedMatch((REProgram) publicMatchers.get(i), uri)) {
+ while (!authorized && i < this.publicMatchers.size()) {
+ getLogger().debug("Trying pattern: [" + this.publicMatchers.get(i) + "] with URL [" + uri + "]");
+ if (preparedMatch((REProgram) this.publicMatchers.get(i), uri)) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Permission granted for free: [" + uri + "]");
}
Modified: lenya/trunk/src/java/org/apache/lenya/ac/impl/ComposableAccessControllerResolver.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/impl/ComposableAccessControllerResolver.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/impl/ComposableAccessControllerResolver.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/impl/ComposableAccessControllerResolver.java Tue Feb 8 10:13:39 2005
@@ -49,8 +49,8 @@
try {
- if (selector == null) {
- selector =
+ if (this.selector == null) {
+ this.selector =
(ServiceSelector) getManager().lookup(AccessControllerResolver.ROLE + "Selector");
}
@@ -60,7 +60,7 @@
getLogger().debug("Trying to resolve AC resolver for type [" + types[i] + "]");
AccessControllerResolver resolver =
- (AccessControllerResolver) selector.select(types[i]);
+ (AccessControllerResolver) this.selector.select(types[i]);
controller = resolver.resolveAccessController(url);
setResolver(controller, resolver);
getLogger().debug("Resolved access controller [" + controller + "]");
@@ -83,7 +83,7 @@
assert controller != null;
AccessControllerResolver resolver = getResolver(controller);
resolver.release(controller);
- selector.release(resolver);
+ this.selector.release(resolver);
}
/**
@@ -94,7 +94,7 @@
*/
protected AccessControllerResolver getResolver(AccessController controller) {
AccessControllerResolver resolver =
- (AccessControllerResolver) controllerToResolver.get(controller);
+ (AccessControllerResolver) this.controllerToResolver.get(controller);
return resolver;
}
@@ -105,7 +105,7 @@
* @param resolver An AC resolver.
*/
protected void setResolver(AccessController controller, AccessControllerResolver resolver) {
- controllerToResolver.put(controller, resolver);
+ this.controllerToResolver.put(controller, resolver);
}
protected static final String RESOLVER_ELEMENT = "resolver";
@@ -119,9 +119,9 @@
*/
public void configure(Configuration configuration) throws ConfigurationException {
Configuration[] accessControllerConfigs = configuration.getChildren(RESOLVER_ELEMENT);
- resolverTypes = new String[accessControllerConfigs.length];
+ this.resolverTypes = new String[accessControllerConfigs.length];
for (int i = 0; i < accessControllerConfigs.length; i++) {
- resolverTypes[i] = accessControllerConfigs[i].getAttribute(TYPE_ATTRIBUTE);
+ this.resolverTypes[i] = accessControllerConfigs[i].getAttribute(TYPE_ATTRIBUTE);
}
}
@@ -130,15 +130,15 @@
* @return A string array.
*/
protected String[] getResolverTypes() {
- return resolverTypes;
+ return this.resolverTypes;
}
/**
* @see org.apache.avalon.framework.activity.Disposable#dispose()
*/
public void dispose() {
- if (selector != null) {
- getManager().release(selector);
+ if (this.selector != null) {
+ getManager().release(this.selector);
}
}
Modified: lenya/trunk/src/java/org/apache/lenya/ac/impl/ConfigurableAccessControllerResolver.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/impl/ConfigurableAccessControllerResolver.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/impl/ConfigurableAccessControllerResolver.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/impl/ConfigurableAccessControllerResolver.java Tue Feb 8 10:13:39 2005
@@ -41,10 +41,10 @@
try {
accessController =
(AccessController) getManager().lookup(
- AccessController.ROLE + "/" + accessControllerType);
+ AccessController.ROLE + "/" + this.accessControllerType);
if (accessController instanceof Configurable) {
- ((Configurable) accessController).configure(accessControllerConfiguration);
+ ((Configurable) accessController).configure(this.accessControllerConfiguration);
}
} catch (Exception e) {
@@ -64,8 +64,8 @@
* @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
*/
public void configure(Configuration configuration) throws ConfigurationException {
- accessControllerConfiguration = configuration.getChild(ACCESS_CONTROLLER_ELEMENT);
- accessControllerType = accessControllerConfiguration.getAttribute(TYPE_ATTRIBUTE);
+ this.accessControllerConfiguration = configuration.getChild(ACCESS_CONTROLLER_ELEMENT);
+ this.accessControllerType = this.accessControllerConfiguration.getAttribute(TYPE_ATTRIBUTE);
}
}
Modified: lenya/trunk/src/java/org/apache/lenya/ac/impl/Credential.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/impl/Credential.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/impl/Credential.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/impl/Credential.java Tue Feb 8 10:13:39 2005
@@ -36,28 +36,27 @@
/**
* Creates a new credential object.
- * @param accreditable The accreditable.
+ * @param _accreditable The accreditable.
*/
- public Credential(Accreditable accreditable) {
- setAccreditable(accreditable);
+ public Credential(Accreditable _accreditable) {
+ setAccreditable(_accreditable);
}
/**
* Sets the accreditable for this credential.
- * @param accreditable The accreditable.
+ * @param _accreditable The accreditable.
*/
- protected void setAccreditable(Accreditable accreditable) {
- assert accreditable != null;
- this.accreditable = accreditable;
+ protected void setAccreditable(Accreditable _accreditable) {
+ assert _accreditable != null;
+ this.accreditable = _accreditable;
}
/**
* Returns all roles of this credential.
- *
* @return An array of roles.
*/
public Role[] getRoles() {
- return (Role[]) roles.toArray(new Role[roles.size()]);
+ return (Role[]) this.roles.toArray(new Role[this.roles.size()]);
}
/**
@@ -66,8 +65,8 @@
*/
public void addRole(Role role) {
assert role != null;
- assert !roles.contains(role);
- roles.add(role);
+ assert !this.roles.contains(role);
+ this.roles.add(role);
}
/**
@@ -76,8 +75,8 @@
*/
public void removeRole(Role role) {
assert role != null;
- assert roles.contains(role);
- roles.remove(role);
+ assert this.roles.contains(role);
+ this.roles.remove(role);
}
/**
@@ -85,7 +84,7 @@
* @return An accreditable.
*/
public Accreditable getAccreditable() {
- return accreditable;
+ return this.accreditable;
}
/**
@@ -101,7 +100,7 @@
* @return A boolean value.
*/
public boolean contains(Role role) {
- return roles.contains(role);
+ return this.roles.contains(role);
}
/**
@@ -109,6 +108,6 @@
* @return A boolean value.
*/
public boolean isEmpty() {
- return roles.isEmpty();
+ return this.roles.isEmpty();
}
}
Modified: lenya/trunk/src/java/org/apache/lenya/ac/impl/DefaultAccessController.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/impl/DefaultAccessController.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/impl/DefaultAccessController.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/impl/DefaultAccessController.java Tue Feb 8 10:13:39 2005
@@ -97,28 +97,28 @@
getLogger().debug("Beginning authorization.");
if (hasAuthorizers()) {
- Authorizer[] authorizers = getAuthorizers();
+ Authorizer[] _authorizers = getAuthorizers();
int i = 0;
authorized = true;
- while ((i < authorizers.length) && authorized) {
+ while ((i < _authorizers.length) && authorized) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("---------------------------------------------------------");
- getLogger().debug("Invoking authorizer [" + authorizers[i] + "]");
+ getLogger().debug("Invoking authorizer [" + _authorizers[i] + "]");
}
- if (authorizers[i] instanceof PolicyAuthorizer) {
- PolicyAuthorizer authorizer = (PolicyAuthorizer) authorizers[i];
- authorizer.setAccreditableManager(accreditableManager);
- authorizer.setPolicyManager(policyManager);
+ if (_authorizers[i] instanceof PolicyAuthorizer) {
+ PolicyAuthorizer authorizer = (PolicyAuthorizer) _authorizers[i];
+ authorizer.setAccreditableManager(this.accreditableManager);
+ authorizer.setPolicyManager(this.policyManager);
}
- authorized = authorized && authorizers[i].authorize(request);
+ authorized = authorized && _authorizers[i].authorize(request);
if (getLogger().isDebugEnabled()) {
getLogger().debug(
- "Authorizer [" + authorizers[i] + "] returned [" + authorized + "]");
+ "Authorizer [" + _authorizers[i] + "] returned [" + authorized + "]");
}
i++;
@@ -190,12 +190,12 @@
getLogger().debug("AccreditableManager type: [" + accreditableManagerType + "]");
}
- accreditableManagerSelector = (ServiceSelector) manager.lookup(AccreditableManager.ROLE
+ this.accreditableManagerSelector = (ServiceSelector) this.manager.lookup(AccreditableManager.ROLE
+ "Selector");
- accreditableManager = (AccreditableManager) accreditableManagerSelector
+ this.accreditableManager = (AccreditableManager) this.accreditableManagerSelector
.select(accreditableManagerType);
- accreditableManager.addItemManagerListener(this);
- configureOrParameterize(accreditableManager, accreditableManagerConfiguration);
+ this.accreditableManager.addItemManagerListener(this);
+ configureOrParameterize(this.accreditableManager, accreditableManagerConfiguration);
}
}
@@ -211,7 +211,7 @@
ConfigurationException, ParameterException {
Configuration[] authorizerConfigurations = configuration.getChildren(AUTHORIZER_ELEMENT);
if (authorizerConfigurations.length > 0) {
- authorizerSelector = (ServiceSelector) manager.lookup(Authorizer.ROLE + "Selector");
+ this.authorizerSelector = (ServiceSelector) this.manager.lookup(Authorizer.ROLE + "Selector");
for (int i = 0; i < authorizerConfigurations.length; i++) {
String type = authorizerConfigurations[i].getAttribute(TYPE_ATTRIBUTE);
@@ -219,9 +219,9 @@
getLogger().debug("Adding authorizer [" + type + "]");
}
- Authorizer authorizer = (Authorizer) authorizerSelector.select(type);
- authorizerKeys.add(type);
- authorizers.put(type, authorizer);
+ Authorizer authorizer = (Authorizer) this.authorizerSelector.select(type);
+ this.authorizerKeys.add(type);
+ this.authorizers.put(type, authorizer);
configureOrParameterize(authorizer, authorizerConfigurations[i]);
}
}
@@ -244,20 +244,19 @@
if (getLogger().isDebugEnabled()) {
getLogger().debug("Adding policy manager type: [" + policyManagerType + "]");
}
- policyManagerSelector = (ServiceSelector) manager.lookup(PolicyManager.ROLE
+ this.policyManagerSelector = (ServiceSelector) this.manager.lookup(PolicyManager.ROLE
+ "Selector");
- policyManager = (PolicyManager) policyManagerSelector.select(policyManagerType);
- configureOrParameterize(policyManager, policyManagerConfiguration);
+ this.policyManager = (PolicyManager) this.policyManagerSelector.select(policyManagerType);
+ configureOrParameterize(this.policyManager, policyManagerConfiguration);
}
}
/**
* Sets up the authenticator.
- *
* @throws ServiceException when something went wrong.
*/
protected void setupAuthenticator() throws ServiceException {
- authenticator = (Authenticator) manager.lookup(Authenticator.ROLE);
+ this.authenticator = (Authenticator) this.manager.lookup(Authenticator.ROLE);
}
private ServiceManager manager;
@@ -265,45 +264,41 @@
/**
* Set the global component manager.
*
- * @param manager The global component manager
+ * @param _manager The global component manager
* @throws ServiceException when something went wrong.
*/
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
+ public void service(ServiceManager _manager) throws ServiceException {
+ this.manager = _manager;
}
/**
* Returns the service manager.
- *
* @return A service manager.
*/
protected ServiceManager getManager() {
- return manager;
+ return this.manager;
}
/**
* Returns the authorizers of this action.
- *
* @return An array of authorizers.
*/
public Authorizer[] getAuthorizers() {
- Authorizer[] authorizerArray = new Authorizer[authorizers.size()];
- for (int i = 0; i < authorizers.size(); i++) {
- String key = (String) authorizerKeys.get(i);
- authorizerArray[i] = (Authorizer) authorizers.get(key);
+ Authorizer[] authorizerArray = new Authorizer[this.authorizers.size()];
+ for (int i = 0; i < this.authorizers.size(); i++) {
+ String key = (String) this.authorizerKeys.get(i);
+ authorizerArray[i] = (Authorizer) this.authorizers.get(key);
}
-
return authorizerArray;
}
/**
* Returns if this action has authorizers.
- *
* @return A boolean value.
*/
protected boolean hasAuthorizers() {
- return !authorizers.isEmpty();
+ return !this.authorizers.isEmpty();
}
/**
@@ -311,31 +306,31 @@
*/
public void dispose() {
- if (accreditableManagerSelector != null) {
- if (accreditableManager != null) {
- accreditableManager.removeItemManagerListener(this);
- accreditableManagerSelector.release(accreditableManager);
+ if (this.accreditableManagerSelector != null) {
+ if (this.accreditableManager != null) {
+ this.accreditableManager.removeItemManagerListener(this);
+ this.accreditableManagerSelector.release(this.accreditableManager);
}
- getManager().release(accreditableManagerSelector);
+ getManager().release(this.accreditableManagerSelector);
}
- if (policyManagerSelector != null) {
- if (policyManager != null) {
- policyManagerSelector.release(policyManager);
+ if (this.policyManagerSelector != null) {
+ if (this.policyManager != null) {
+ this.policyManagerSelector.release(this.policyManager);
}
- getManager().release(policyManagerSelector);
+ getManager().release(this.policyManagerSelector);
}
- if (authorizerSelector != null) {
- Authorizer[] authorizers = getAuthorizers();
- for (int i = 0; i < authorizers.length; i++) {
- authorizerSelector.release(authorizers[i]);
+ if (this.authorizerSelector != null) {
+ Authorizer[] _authorizers = getAuthorizers();
+ for (int i = 0; i < _authorizers.length; i++) {
+ this.authorizerSelector.release(_authorizers[i]);
}
- getManager().release(authorizerSelector);
+ getManager().release(this.authorizerSelector);
}
- if (authenticator != null) {
- getManager().release(authenticator);
+ if (this.authenticator != null) {
+ getManager().release(this.authenticator);
}
if (getLogger().isDebugEnabled()) {
@@ -345,29 +340,26 @@
/**
* Returns the accreditable manager.
- *
* @return An accreditable manager.
*/
public AccreditableManager getAccreditableManager() {
- return accreditableManager;
+ return this.accreditableManager;
}
/**
* Returns the policy manager.
- *
* @return A policy manager.
*/
public PolicyManager getPolicyManager() {
- return policyManager;
+ return this.policyManager;
}
/**
* Returns the authenticator.
- *
* @return The authenticator.
*/
public Authenticator getAuthenticator() {
- return authenticator;
+ return this.authenticator;
}
/**
@@ -405,7 +397,7 @@
getLogger().info("Remote Address to use: [" + remoteAddress + "]");
Machine machine = new Machine(remoteAddress);
- IPRange[] ranges = accreditableManager.getIPRangeManager().getIPRanges();
+ IPRange[] ranges = this.accreditableManager.getIPRangeManager().getIPRanges();
for (int i = 0; i < ranges.length; i++) {
if (ranges[i].contains(machine)) {
machine.addIPRange(ranges[i]);
Modified: lenya/trunk/src/java/org/apache/lenya/ac/impl/DefaultPolicy.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/impl/DefaultPolicy.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/impl/DefaultPolicy.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/impl/DefaultPolicy.java Tue Feb 8 10:13:39 2005
@@ -41,20 +41,18 @@
/**
* Adds a credential to this policy.
- *
* @param credential A credential.
*/
public void addCredential(Credential credential) {
assert credential != null;
- assert !accreditableToCredential.containsKey(credential.getAccreditable());
- accreditableToCredential.put(credential.getAccreditable(), credential);
+ assert !this.accreditableToCredential.containsKey(credential.getAccreditable());
+ this.accreditableToCredential.put(credential.getAccreditable(), credential);
}
/**
* Adds a role to this policy for a certain accreditable and a certain role. If a credenital
* exists for the accreditable, the role is added to this credential. Otherwise, a new
* credential is created.
- *
* @param accreditable An accreditable.
* @param role A role.
*/
@@ -74,7 +72,6 @@
/**
* Removes a role from this policy for a certain accreditable and a certain role.
- *
* @param accreditable An accreditable.
* @param role A role.
* @throws AccessControlException if the accreditable-role pair is not contained.
@@ -88,7 +85,7 @@
"No credential for accreditable ["
+ accreditable
+ "] ["
- + accreditableToCredential.keySet().size()
+ + this.accreditableToCredential.keySet().size()
+ "]");
}
if (!credential.contains(role)) {
@@ -108,11 +105,10 @@
/**
* Returns the credentials of this policy.
- *
* @return An array of credentials.
*/
public Credential[] getCredentials() {
- Collection values = accreditableToCredential.values();
+ Collection values = this.accreditableToCredential.values();
return (Credential[]) values.toArray(new Credential[values.size()]);
}
@@ -146,7 +142,7 @@
* @return A credential.
*/
public Credential getCredential(Accreditable accreditable) {
- return (Credential) accreditableToCredential.get(accreditable);
+ return (Credential) this.accreditableToCredential.get(accreditable);
}
private boolean isSSL;
@@ -155,12 +151,11 @@
* @see org.apache.lenya.ac.Policy#isSSLProtected()
*/
public boolean isSSLProtected() throws AccessControlException {
- return isSSL;
+ return this.isSSL;
}
/**
* Sets if this policy requires SSL protection.
- *
* @param ssl A boolean value.
*/
public void setSSL(boolean ssl) {
@@ -176,25 +171,23 @@
/**
* Removes a credential.
- *
* @param credential The credential to remove.
* @throws AccessControlException If the credential does not exist.
*/
protected void removeCredential(Credential credential) throws AccessControlException {
- if (!accreditableToCredential.containsValue(credential)) {
+ if (!this.accreditableToCredential.containsValue(credential)) {
throw new AccessControlException("Credential [" + credential + "] does not exist!");
}
- accreditableToCredential.remove(credential.getAccreditable());
+ this.accreditableToCredential.remove(credential.getAccreditable());
}
/**
* Removes all roles for a certain accreditable.
- *
* @param accreditable The accreditable to remove all roles for.
* @throws AccessControlException If no credential exists for this accreditable.
*/
public void removeRoles(Accreditable accreditable) throws AccessControlException {
- if (accreditableToCredential.containsKey(accreditable)) {
+ if (this.accreditableToCredential.containsKey(accreditable)) {
Credential credential = getCredential(accreditable);
removeCredential(credential);
}
Modified: lenya/trunk/src/java/org/apache/lenya/ac/impl/ItemConfiguration.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/impl/ItemConfiguration.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/impl/ItemConfiguration.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/impl/ItemConfiguration.java Tue Feb 8 10:13:39 2005
@@ -34,6 +34,7 @@
* Ctor.
*/
public ItemConfiguration() {
+ // do nothing
}
/**
Modified: lenya/trunk/src/java/org/apache/lenya/ac/impl/PolicyAuthorizer.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/impl/PolicyAuthorizer.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/impl/PolicyAuthorizer.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/impl/PolicyAuthorizer.java Tue Feb 8 10:13:39 2005
@@ -43,7 +43,7 @@
* @return An accreditable manager.
*/
public AccreditableManager getAccreditableManager() {
- return accreditableManager;
+ return this.accreditableManager;
}
/**
@@ -51,13 +51,14 @@
* @return A policy manager.
*/
public PolicyManager getPolicyManager() {
- return policyManager;
+ return this.policyManager;
}
/**
* Creates a new policy authorizer.
*/
public PolicyAuthorizer() {
+ // do nothing
}
private PolicyManager policyManager;
@@ -68,7 +69,7 @@
*/
public void setPolicyManager(PolicyManager manager) {
assert manager != null;
- policyManager = manager;
+ this.policyManager = manager;
}
private AccreditableManager accreditableManager;
@@ -79,7 +80,7 @@
*/
public void setAccreditableManager(AccreditableManager manager) {
assert manager != null;
- accreditableManager = manager;
+ this.accreditableManager = manager;
}
/**
@@ -165,13 +166,14 @@
List roleList = (List) request.getAttribute(AbstractRole.class.getName());
if (roleList == null) {
- String message = " URI: [" + request.getRequestURI() + "]\n";
+ StringBuffer buf = new StringBuffer();
+ buf.append(" URI: [" + request.getRequestURI() + "]\n");
for (Enumeration e = request.getParameterNames(); e.hasMoreElements(); ) {
String key = (String) e.nextElement();
- message += " Parameter: [" + key + "] = [" + request.getParameter(key) + "]\n";
+ buf.append(" Parameter: [" + key + "] = [" + request.getParameter(key) + "]\n");
}
- throw new AccessControlException("Request [" + request + "] does not contain roles: \n" + message);
+ throw new AccessControlException("Request [" + request + "] does not contain roles: \n" + buf.toString());
}
Role[] roles = (Role[]) roleList.toArray(new Role[roleList.size()]);
Modified: lenya/trunk/src/java/org/apache/lenya/ac/impl/PolicyBuilder.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/impl/PolicyBuilder.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/impl/PolicyBuilder.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/impl/PolicyBuilder.java Tue Feb 8 10:13:39 2005
@@ -43,11 +43,11 @@
/**
* Ctor.
- * @param accreditableManager An accreditable manager.
+ * @param _accreditableManager An accreditable manager.
*/
- public PolicyBuilder(AccreditableManager accreditableManager) {
- assert accreditableManager != null;
- this.accreditableManager = accreditableManager;
+ public PolicyBuilder(AccreditableManager _accreditableManager) {
+ assert _accreditableManager != null;
+ this.accreditableManager = _accreditableManager;
}
/**
@@ -55,7 +55,7 @@
* @return An accreditable manager.
*/
public AccreditableManager getAccreditableManager() {
- return accreditableManager;
+ return this.accreditableManager;
}
private AccreditableManager accreditableManager;
Modified: lenya/trunk/src/java/org/apache/lenya/ac/impl/RemovedAccreditablePolicyBuilder.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/impl/RemovedAccreditablePolicyBuilder.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/impl/RemovedAccreditablePolicyBuilder.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/impl/RemovedAccreditablePolicyBuilder.java Tue Feb 8 10:13:39 2005
@@ -58,20 +58,20 @@
Accreditable accreditable;
- if (removedAccreditable instanceof User
+ if (this.removedAccreditable instanceof User
&& elementName.equals(USER_ELEMENT)
- && ((User) removedAccreditable).getId().equals(id)) {
- accreditable = removedAccreditable;
+ && ((User) this.removedAccreditable).getId().equals(id)) {
+ accreditable = this.removedAccreditable;
} else if (
- removedAccreditable instanceof Group
+ this.removedAccreditable instanceof Group
&& elementName.equals(GROUP_ELEMENT)
- && ((Group) removedAccreditable).getId().equals(id)) {
- accreditable = removedAccreditable;
+ && ((Group) this.removedAccreditable).getId().equals(id)) {
+ accreditable = this.removedAccreditable;
} else if (
- removedAccreditable instanceof IPRange
+ this.removedAccreditable instanceof IPRange
&& elementName.equals(IP_RANGE_ELEMENT)
- && ((IPRange) removedAccreditable).getId().equals(id)) {
- accreditable = removedAccreditable;
+ && ((IPRange) this.removedAccreditable).getId().equals(id)) {
+ accreditable = this.removedAccreditable;
} else {
accreditable = super.getAccreditable(elementName, id);
Modified: lenya/trunk/src/java/org/apache/lenya/ac/impl/URLPolicy.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/impl/URLPolicy.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/impl/URLPolicy.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/impl/URLPolicy.java Tue Feb 8 10:13:39 2005
@@ -38,15 +38,15 @@
/**
* Returns the resulting policy for a certain URL.
* @param controller The acccess controller.
- * @param url The URL.
+ * @param _url The URL.
* @param manager The policy manager.
*/
- public URLPolicy(AccreditableManager controller, String url, InheritingPolicyManager manager) {
- assert url != null;
- this.url = url;
+ public URLPolicy(AccreditableManager controller, String _url, InheritingPolicyManager manager) {
+ assert _url != null;
+ this.url = _url;
assert manager != null;
- policyManager = manager;
+ this.policyManager = manager;
assert controller != null;
this.accreditableManager = controller;
@@ -63,8 +63,8 @@
* @throws AccessControlException when something went wrong.
*/
protected void obtainPolicies() throws AccessControlException {
- if (policies == null) {
- policies = getPolicyManager().getPolicies(getAccreditableManager(), getUrl());
+ if (this.policies == null) {
+ this.policies = getPolicyManager().getPolicies(getAccreditableManager(), getUrl());
}
}
@@ -86,8 +86,8 @@
roles.add(visitorRole);
}
} else {
- for (int i = 0; i < policies.length; i++) {
- addRoles(policies[i], identity, roles);
+ for (int i = 0; i < this.policies.length; i++) {
+ addRoles(this.policies[i], identity, roles);
}
}
return (AbstractRole[]) roles.toArray(new AbstractRole[roles.size()]);
@@ -161,7 +161,7 @@
* @return The URL of this policy.
*/
public String getUrl() {
- return url;
+ return this.url;
}
/**
@@ -169,7 +169,7 @@
* @return A policy builder.
*/
public InheritingPolicyManager getPolicyManager() {
- return policyManager;
+ return this.policyManager;
}
/**
@@ -177,7 +177,7 @@
* @return An access controller.
*/
public AccreditableManager getAccreditableManager() {
- return accreditableManager;
+ return this.accreditableManager;
}
/**
@@ -191,8 +191,8 @@
boolean ssl = false;
int i = 0;
- while (!ssl && i < policies.length) {
- ssl = ssl || policies[i].isSSLProtected();
+ while (!ssl && i < this.policies.length) {
+ ssl = ssl || this.policies[i].isSSLProtected();
i++;
}
@@ -206,8 +206,8 @@
boolean empty = true;
int i = 0;
- while (empty && i < policies.length) {
- empty = empty && policies[i].isEmpty();
+ while (empty && i < this.policies.length) {
+ empty = empty && this.policies[i].isEmpty();
i++;
}
Modified: lenya/trunk/src/java/org/apache/lenya/ac/ldap/LDAPUser.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/ac/ldap/LDAPUser.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/ldap/LDAPUser.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/ldap/LDAPUser.java Tue Feb 8 10:13:39 2005
@@ -47,6 +47,9 @@
public class LDAPUser extends FileUser {
private static Properties defaultProperties = null;
+ /**
+ * <code>LDAP_ID</code> The LDAP id
+ */
public static final String LDAP_ID = "ldapid";
private static String LDAP_PROPERTIES_FILE = "ldap.properties";
private static String PROVIDER_URL_PROP = "provider-url";
@@ -76,6 +79,7 @@
* Creates a new LDAPUser object.
*/
public LDAPUser() {
+ // do nothing
}
/**
@@ -88,57 +92,54 @@
/**
* Create an LDAPUser
- *
* @param configurationDirectory where the user will be attached to
* @param id user id of LDAPUser
* @param email of LDAPUser
- * @param ldapId of LDAPUser
+ * @param _ldapId of LDAPUser
* @throws ConfigurationException if the properties could not be read
*/
- public LDAPUser(File configurationDirectory, String id, String email, String ldapId)
+ public LDAPUser(File configurationDirectory, String id, String email, String _ldapId)
throws ConfigurationException {
super(configurationDirectory, id, null, email, null);
- this.ldapId = ldapId;
+ this.ldapId = _ldapId;
initialize();
}
/**
* Create a new LDAPUser from a configuration
- *
* @param config the <code>Configuration</code> specifying the user details
* @throws ConfigurationException if the user could not be instantiated
*/
public void configure(Configuration config) throws ConfigurationException {
super.configure(config);
- ldapId = config.getChild(LDAP_ID).getValue();
+ this.ldapId = config.getChild(LDAP_ID).getValue();
initialize();
}
/**
* Checks if a user exists.
- *
- * @param ldapId The LDAP id.
+ * @param _ldapId The LDAP id.
* @return A boolean value indicating whether the user is found in the directory
* @throws AccessControlException when an error occurs.
*/
- public boolean existsUser(String ldapId) throws AccessControlException {
+ public boolean existsUser(String _ldapId) throws AccessControlException {
if (getLogger().isDebugEnabled())
- getLogger().debug("existsUser() checking id " + ldapId);
+ getLogger().debug("existsUser() checking id " + _ldapId);
boolean exists = false;
try {
readProperties();
- SearchResult entry = getDirectoryEntry(ldapId);
+ SearchResult entry = getDirectoryEntry(_ldapId);
- exists = (entry != null);
+ exists = (entry != null);
} catch (Exception e) {
if (getLogger().isDebugEnabled())
- getLogger().debug("existsUser() for id " + ldapId + " got exception: " + e);
+ getLogger().debug("existsUser() for id " + _ldapId + " got exception: " + e);
throw new AccessControlException("Exception during search: ", e);
}
@@ -147,57 +148,57 @@
/**
* Initializes this user.
- *
* The current (already authenticated) ldapId is queried in the directory,
* in order to retrieve additional information, such as the user name.
* In current implementation, only the user name is actually retrieved, but
* other attributes may be used in the future (such as groups ?)
- *
* TODO: should the code be changed to not throw an exception when something
* goes wrong ? After all, it's only used to get additional info for display?
* This is a design decision, I'm not sure what's best.
- *
* @throws ConfigurationException when something went wrong.
+ * FIXME DirContext is unused at this time
*/
protected void initialize() throws ConfigurationException {
DirContext context = null;
- try {
- if (getLogger().isDebugEnabled())
- getLogger().debug("initialize() getting entry ...");
-
- SearchResult entry = getDirectoryEntry(ldapId);
- StringBuffer name = new StringBuffer();
-
- if (entry != null) {
- /* users full name */
- String usrNameAttr =
- defaultProperties.getProperty(USR_NAME_ATTR_PROP, USR_NAME_ATTR_DEFAULT);
-
- if (getLogger().isDebugEnabled())
- getLogger().debug("initialize() got entry, going to look for attribute " + usrNameAttr + " in entry, which is: " + entry);
-
- Attributes attributes = entry.getAttributes();
- if (attributes != null) {
- Attribute userNames = attributes.get(usrNameAttr);
- if (userNames != null) {
- for (NamingEnumeration enum = userNames.getAll(); enum.hasMore(); enum.next()) {
- name.append((String)userNames.get());
- }
- }
- }
- }
- ldapName = name.toString();
- if (getLogger().isDebugEnabled())
- getLogger().debug("initialize() set name to " + ldapName);
- } catch (Exception e) {
- throw new ConfigurationException("Could not read properties", e);
+ try {
+ if (getLogger().isDebugEnabled())
+ getLogger().debug("initialize() getting entry ...");
+
+ SearchResult entry = getDirectoryEntry(this.ldapId);
+ StringBuffer name = new StringBuffer();
+
+ if (entry != null) {
+ /* users full name */
+ String usrNameAttr =
+ defaultProperties.getProperty(USR_NAME_ATTR_PROP, USR_NAME_ATTR_DEFAULT);
+
+ if (getLogger().isDebugEnabled())
+ getLogger().debug("initialize() got entry, going to look for attribute " + usrNameAttr + " in entry, which is: " + entry);
+
+ Attributes attributes = entry.getAttributes();
+ if (attributes != null) {
+ Attribute userNames = attributes.get(usrNameAttr);
+ if (userNames != null) {
+ for (NamingEnumeration enumeration = userNames.getAll(); enumeration.hasMore(); enumeration.next()) {
+ name.append((String)userNames.get());
+ }
+ }
+ }
+ }
+ this.ldapName = name.toString();
+ if (getLogger().isDebugEnabled())
+ getLogger().debug("initialize() set name to " + this.ldapName);
+ } catch (final NamingException e1) {
+ throw new ConfigurationException("Could not read properties", e1);
+ } catch (final IOException e1) {
+ throw new ConfigurationException("Could not read properties", e1);
} finally {
try {
if (context != null) {
close(context);
}
- } catch (NamingException e) {
+ } catch (final NamingException e) {
throw new ConfigurationException("Closing context failed: ", e);
}
}
@@ -211,7 +212,7 @@
// add ldap_id node
DefaultConfiguration child = new DefaultConfiguration(LDAP_ID);
- child.setValue(ldapId);
+ child.setValue(this.ldapId);
config.addChild(child);
return config;
@@ -219,30 +220,26 @@
/**
* Get the ldap id
- *
* @return the ldap id
*/
public String getLdapId() {
- return ldapId;
+ return this.ldapId;
}
/**
* Set the ldap id
- *
* @param string the new ldap id
*/
public void setLdapId(String string) {
- ldapId = string;
+ this.ldapId = string;
}
/**
* Authenticate a user against the directory.
- *
* The principal to be authenticated is either constructed by use of the
* configured properties, or by lookup of this ID in the directory.
* This principal then attempts to authenticate against the directory with
* the provided password.
- *
* @see org.apache.lenya.ac.User#authenticate(java.lang.String)
*/
public boolean authenticate(String password) {
@@ -271,8 +268,6 @@
getLogger().info("authenticate failed for principal " + principal + ", exception " + e);
} catch (NamingException e) {
// log this failure
- // StringWriter writer = new StringWriter();
- // e.printStackTrace(new PrintWriter(writer));
if (getLogger().isInfoEnabled()) {
getLogger().info("Bind for user " + principal + " to Ldap server failed: ", e);
}
@@ -286,14 +281,13 @@
* @see org.apache.lenya.ac.Item#getName()
*/
public String getName() {
- return ldapName;
+ return this.ldapName;
}
/**
* LDAP Users fetch their name information from the LDAP server, so we don't store it locally.
* Since we only have read access we basically can't set the name, i.e. any request to change
* the name is ignored.
- *
* @param string is ignored
*/
public void setName(String string) {
@@ -303,7 +297,6 @@
/**
* The LDAPUser doesn't store any passwords as they are handled by LDAP
- *
* @param plainTextPassword is ignored
*/
public void setPassword(String plainTextPassword) {
@@ -312,7 +305,6 @@
/**
* The LDAPUser doesn't store any passwords as they are handled by LDAP
- *
* @param encryptedPassword is ignored
*/
protected void setEncryptedPassword(String encryptedPassword) {
@@ -321,7 +313,6 @@
/**
* Connect to the LDAP server
- *
* @param principal the principal string for the LDAP connection
* @param credentials the credentials for the LDAP connection
* @param authMethod the authentication method
@@ -358,7 +349,6 @@
/**
* Close the connection to the LDAP server
- *
* @param ctx the context that was returned from the bind
* @throws NamingException if there is a problem communicating to the LDAP server
*/
@@ -368,7 +358,6 @@
/**
* Read the properties
- *
* @throws IOException if the properties cannot be found.
*/
private void readProperties() throws IOException {
@@ -397,6 +386,7 @@
* (starting Lenya 1.2.2); if it has a value, then a specific branch is wanted:
* no recursive search. If the property is present, but has no value,
* search recursively.
+ * @return Recursive search
*/
private boolean isSubtreeSearch() {
boolean recurse = false;
@@ -431,7 +421,6 @@
defaultProperties.getProperty(USR_ATTR_PROP, USR_ATTR_DEFAULT);
searchFilter = "(" + userAttribute + "=" + userId + ")";
SearchControls scope = new SearchControls();
- NamingEnumeration results;
recursiveSearch = isSubtreeSearch();
if (recursiveSearch) {
@@ -447,7 +436,7 @@
if (getLogger().isDebugEnabled())
getLogger().debug("searching object " + objectName + " filtering with " + searchFilter + ", recursive search ? " + recursiveSearch);
- results = context.search(objectName, searchFilter, scope);
+ NamingEnumeration results = context.search(objectName, searchFilter, scope);
// sanity check: if more than one entry is returned
// for a user-id, then the directory is probably flawed,
@@ -494,6 +483,9 @@
* The third case is where a specific branch of the directory is to be used;
* this is the case where usr-branch is set to a value. In this case, this branch
* is used to construct the principal.
+ * @return The principal
+ * @throws IOException
+ * @throws NamingException
*/
private String getPrincipal() throws IOException, NamingException {
@@ -527,7 +519,8 @@
/**
* Construct the principal for a user, by using the given userId along
* with the configured properties.
- *
+ * @param userId The user id
+ * @return The principal
*/
private String constructPrincipal(String userId) {
StringBuffer principal = new StringBuffer();
@@ -561,6 +554,5 @@
return principal.toString();
}
-
}
Modified: lenya/trunk/src/java/org/apache/lenya/cms/ac/DocumentPolicyManagerWrapper.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/ac/DocumentPolicyManagerWrapper.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/ac/DocumentPolicyManagerWrapper.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/ac/DocumentPolicyManagerWrapper.java Tue Feb 8 10:13:39 2005
@@ -26,6 +26,7 @@
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.parameters.ParameterException;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.ServiceSelector;
@@ -57,6 +58,7 @@
* Ctor.
*/
public DocumentPolicyManagerWrapper() {
+ // do nothing
}
private InheritingPolicyManager policyManager;
@@ -64,7 +66,6 @@
/**
* Returns the URI which is used to obtain the policy for a webapp URL.
- *
* @param webappUrl The webapp URL.
* @return A string.
* @throws AccessControlException when something went wrong.
@@ -108,7 +109,6 @@
/**
* Returns the publication for a certain URL.
- *
* @param url The webapp url.
* @return A publication.
* @throws AccessControlException when the publication could not be created.
@@ -121,7 +121,7 @@
SourceResolver resolver = null;
try {
- resolver = (SourceResolver) serviceManager.lookup(SourceResolver.ROLE);
+ resolver = (SourceResolver) this.serviceManager.lookup(SourceResolver.ROLE);
source = resolver.resolveURI("context:///");
File servletContext = SourceUtil.getFile(source);
getLogger().debug(" Webapp URL: [" + url + "]");
@@ -135,7 +135,7 @@
if (source != null) {
resolver.release(source);
}
- serviceManager.release(resolver);
+ this.serviceManager.release(resolver);
}
}
return publication;
@@ -145,11 +145,10 @@
/**
* Returns the service manager.
- *
* @return A service manager.
*/
protected ServiceManager getServiceManager() {
- return serviceManager;
+ return this.serviceManager;
}
/**
@@ -163,14 +162,14 @@
* @return Returns the policyManager.
*/
public InheritingPolicyManager getPolicyManager() {
- return policyManager;
+ return this.policyManager;
}
/**
- * @param policyManager The policyManager to set.
+ * @param _policyManager The policyManager to set.
*/
- public void setPolicyManager(InheritingPolicyManager policyManager) {
- this.policyManager = policyManager;
+ public void setPolicyManager(InheritingPolicyManager _policyManager) {
+ this.policyManager = _policyManager;
}
/**
@@ -243,28 +242,46 @@
* @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
*/
public void configure(Configuration configuration) throws ConfigurationException {
- Configuration policyManagerConfiguration = configuration.getChild(ELEMENT_POLICY_MANAGER,
- false);
+ Configuration policyManagerConfiguration = configuration.getChild(
+ this.ELEMENT_POLICY_MANAGER, false);
if (policyManagerConfiguration != null) {
- String type = policyManagerConfiguration.getAttribute(ATTRIBUTE_TYPE);
+ String type = null;
try {
- policyManagerSelector = (ServiceSelector) getServiceManager().lookup(
- PolicyManager.ROLE + "Selector");
+ type = policyManagerConfiguration
+ .getAttribute(this.ATTRIBUTE_TYPE);
- PolicyManager policyManager = (PolicyManager) policyManagerSelector.select(type);
+ this.policyManagerSelector = (ServiceSelector) getServiceManager()
+ .lookup(PolicyManager.ROLE + "Selector");
- if (!(policyManager instanceof InheritingPolicyManager)) {
- throw new AccessControlException("The " + getClass().getName()
+ PolicyManager _policyManager = (PolicyManager) this.policyManagerSelector
+ .select(type);
+
+ if (!(_policyManager instanceof InheritingPolicyManager)) {
+ throw new AccessControlException("The "
+ + getClass().getName()
+ " can only be used with an "
+ InheritingPolicyManager.class.getName() + ".");
}
- DefaultAccessController.configureOrParameterize(policyManager,
+ DefaultAccessController.configureOrParameterize(_policyManager,
policyManagerConfiguration);
- setPolicyManager((InheritingPolicyManager) policyManager);
- } catch (Exception e) {
- throw new ConfigurationException("Obtaining policy manager for type [" + type
- + "] failed: ", e);
+ setPolicyManager((InheritingPolicyManager) _policyManager);
+ } catch (final ConfigurationException e1) {
+ throw new ConfigurationException(
+ "Obtaining policy manager for type [" + type
+ + "] failed: ", e1);
+ } catch (final ServiceException e1) {
+ throw new ConfigurationException(
+ "Obtaining policy manager for type [" + type
+ + "] failed: ", e1);
+ } catch (final ParameterException e1) {
+ throw new ConfigurationException(
+ "Obtaining policy manager for type [" + type
+ + "] failed: ", e1);
+ } catch (final AccessControlException e1) {
+ throw new ConfigurationException(
+ "Obtaining policy manager for type [" + type
+ + "] failed: ", e1);
}
}
}
@@ -273,11 +290,11 @@
* @see org.apache.avalon.framework.activity.Disposable#dispose()
*/
public void dispose() {
- if (policyManagerSelector != null) {
+ if (this.policyManagerSelector != null) {
if (getPolicyManager() != null) {
- policyManagerSelector.release(getPolicyManager());
+ this.policyManagerSelector.release(getPolicyManager());
}
- getServiceManager().release(policyManagerSelector);
+ getServiceManager().release(this.policyManagerSelector);
}
if (getLogger().isDebugEnabled()) {
getLogger().debug("Disposing [" + this + "]");
Modified: lenya/trunk/src/java/org/apache/lenya/cms/ac/PublicationAccessControllerResolver.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/ac/PublicationAccessControllerResolver.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/ac/PublicationAccessControllerResolver.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/ac/PublicationAccessControllerResolver.java Tue Feb 8 10:13:39 2005
@@ -125,9 +125,8 @@
/**
* Returns the servlet context.
* @return A file.
- * @throws AccessControlException when something went wrong.
*/
- protected File getContext() throws AccessControlException {
+ protected File getContext() {
return this.context;
}
Modified: lenya/trunk/src/java/org/apache/lenya/cms/ac/SitemapPolicyManager.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/ac/SitemapPolicyManager.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/ac/SitemapPolicyManager.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/ac/SitemapPolicyManager.java Tue Feb 8 10:13:39 2005
@@ -17,11 +17,17 @@
package org.apache.lenya.cms.ac;
+import java.io.IOException;
+import java.net.MalformedURLException;
+
+import javax.xml.parsers.ParserConfigurationException;
+
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceNotFoundException;
import org.apache.excalibur.source.SourceResolver;
import org.apache.lenya.ac.AccessControlException;
import org.apache.lenya.ac.Accreditable;
@@ -31,6 +37,7 @@
import org.apache.lenya.ac.impl.PolicyBuilder;
import org.apache.lenya.xml.DocumentHelper;
import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
/**
* Policy manager based on Cocoon sitemaps.
@@ -66,8 +73,19 @@
source = resolver.resolveURI("cocoon://" + policyUrl);
Document document = DocumentHelper.readDocument(source.getInputStream());
policy = new PolicyBuilder(accreditableManager).buildPolicy(document);
-
- } catch (Exception e) {
+ } catch (SourceNotFoundException e) {
+ throw new AccessControlException(e);
+ } catch (ServiceException e) {
+ throw new AccessControlException(e);
+ } catch (MalformedURLException e) {
+ throw new AccessControlException(e);
+ } catch (IOException e) {
+ throw new AccessControlException(e);
+ } catch (ParserConfigurationException e) {
+ throw new AccessControlException(e);
+ } catch (SAXException e) {
+ throw new AccessControlException(e);
+ } catch (AccessControlException e) {
throw new AccessControlException(e);
} finally {
if (resolver != null) {
@@ -77,6 +95,7 @@
getManager().release(resolver);
}
}
+
return policy;
}
@@ -85,8 +104,8 @@
/**
* @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
*/
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
+ public void service(ServiceManager _manager) throws ServiceException {
+ this.manager = _manager;
}
/**
@@ -94,23 +113,25 @@
* @return A service manager.
*/
public ServiceManager getManager() {
- return manager;
+ return this.manager;
}
/**
* @see org.apache.lenya.ac.PolicyManager#accreditableRemoved(org.apache.lenya.ac.AccreditableManager,
* org.apache.lenya.ac.Accreditable)
*/
- public void accreditableRemoved(AccreditableManager manager, Accreditable accreditable)
+ public void accreditableRemoved(AccreditableManager _manager, Accreditable accreditable)
throws AccessControlException {
+ // do nothing
}
/**
* @see org.apache.lenya.ac.PolicyManager#accreditableAdded(org.apache.lenya.ac.AccreditableManager,
* org.apache.lenya.ac.Accreditable)
*/
- public void accreditableAdded(AccreditableManager manager, Accreditable accreditable)
+ public void accreditableAdded(AccreditableManager _manager, Accreditable accreditable)
throws AccessControlException {
+ // do nothing
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org