taylor 2004/05/07 13:32:39
Modified: components/registry/src/java/org/apache/jetspeed/om/servlet/impl
WebApplicationDefinitionImpl.java
Added: components/registry/src/java/org/apache/jetspeed/om/servlet/impl
SecurityRoleSetImpl.java SecurityRoleImpl.java
Log:
Patch from Ate Douma to support web application security constraints
PR:
Obtained from:
Submitted by:
Reviewed by:
CVS: ----------------------------------------------------------------------
CVS: PR:
CVS: If this change addresses a PR in the problem report tracking
CVS: database, then enter the PR number(s) here.
CVS: Obtained from:
CVS: If this change has been taken from another system, such as NCSA,
CVS: then name the system in this line, otherwise delete it.
CVS: Submitted by:
CVS: If this code has been contributed to Apache by someone else; i.e.,
CVS: they sent us a patch or a new module, then include their name/email
CVS: address here. If this is your work then delete this line.
CVS: Reviewed by:
CVS: If we are doing pre-commit code reviews and someone else has
CVS: reviewed your changes, include their name(s) here.
CVS: If you have not had it reviewed then delete this line.
Revision Changes Path
1.4 +22 -1
jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/servlet/impl/WebApplicationDefinitionImpl.java
Index: WebApplicationDefinitionImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/servlet/impl/WebApplicationDefinitionImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- WebApplicationDefinitionImpl.java 24 Apr 2004 19:05:54 -0000 1.3
+++ WebApplicationDefinitionImpl.java 7 May 2004 20:32:39 -0000 1.4
@@ -40,6 +40,8 @@
import org.apache.pluto.om.common.ObjectID;
import org.apache.pluto.om.common.ParameterSet;
import org.apache.pluto.om.servlet.ServletDefinitionList;
+import org.apache.pluto.om.common.SecurityRole;
+import org.apache.pluto.om.common.SecurityRoleSet;
/**
*
@@ -58,6 +60,8 @@
private Collection descriptions = new ArrayList();
private DescriptionSetImpl descCollWrapper = new
DescriptionSetImpl(DescriptionImpl.TYPE_WEB_APP);
+ private Collection securityRoles = new ArrayList();
+ private SecurityRoleSetImpl secRolesListWrapper = new SecurityRoleSetImpl();
private String contextRoot;
private ParameterSet initParameters;
@@ -245,4 +249,21 @@
addDescription(Locale.getDefault(), desc);
}
+ /**
+ * @see org.apache.pluto.om.servlet.WebApplicationDefinition#getSecurityRoles()
+ */
+ public SecurityRoleSet getSecurityRoles()
+ {
+ secRolesListWrapper.setInnerCollection(securityRoles);
+ return secRolesListWrapper;
+ }
+
+ /**
+ * @see
org.apache.jetspeed.om.common.servlet.MutableWebApplication#addSecurityRole(org.apache.pluto.om.common.SecurityRole)
+ */
+ public void addSecurityRole(SecurityRole securityRole)
+ {
+ secRolesListWrapper.setInnerCollection(securityRoles);
+ secRolesListWrapper.add(securityRole);
+ }
}
1.1
jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/servlet/impl/SecurityRoleSetImpl.java
Index: SecurityRoleSetImpl.java
===================================================================
/*
* Copyright 2000-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.apache.jetspeed.om.servlet.impl;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import org.apache.jetspeed.om.common.servlet.MutableSecurityRoleSet;
import org.apache.pluto.om.common.SecurityRole;
import org.apache.pluto.om.common.SecurityRoleSet;
/**
*
* SecurityRoleRefSetImpl
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ate Douma </a>
* @version $Id: SecurityRoleSetImpl.java,v 1.1 2004/05/07 20:32:39 taylor Exp $
*
*/
public class SecurityRoleSetImpl implements SecurityRoleSet, MutableSecurityRoleSet,
Serializable {
protected Collection innerCollection;
public SecurityRoleSetImpl() {
innerCollection = new ArrayList();
}
public SecurityRoleSetImpl(Collection collection) {
innerCollection = collection;
}
/**
* @see org.apache.pluto.om.common.SecurityRoleSet#get(java.lang.String)
*/
public SecurityRole get(String name) {
Iterator itr = innerCollection.iterator();
while (itr.hasNext()) {
SecurityRole role = (SecurityRole) itr.next();
if (role.getRoleName().equals(name)) { return role; }
}
return null;
}
/**
* @see
org.apache.jetspeed.om.common.servlet.MutableSecurityRoleSet#add(org.apache.pluto.om.common.SecurityRole)
*/
public SecurityRole add(SecurityRole securityRole) {
innerCollection.add(securityRole);
return securityRole;
}
/**
* @see java.util.Collection#add(java.lang.Object)
*/
public boolean add(Object o) {
SecurityRole role = (SecurityRole) o;
if (innerCollection.contains(o)) {
remove(o);
}
return innerCollection.add(o);
}
/**
* @see java.util.Collection#remove(java.lang.Object)
*/
public boolean remove(Object o) {
SecurityRole role = (SecurityRole) o;
return innerCollection.remove(o);
}
/**
* @see java.util.Collection#addAll(java.util.Collection)
*/
public boolean addAll(Collection c) {
return innerCollection.addAll(c);
}
/**
* @see java.util.Collection#clear()
*/
public void clear() {
innerCollection.clear();
}
/**
* @see java.util.Collection#contains(java.lang.Object)
*/
public boolean contains(Object o) {
return innerCollection.contains(o);
}
/**
* @see java.util.Collection#containsAll(java.util.Collection)
*/
public boolean containsAll(Collection c) {
return innerCollection.containsAll(c);
}
/**
* @see java.util.Collection#isEmpty()
*/
public boolean isEmpty() {
return innerCollection.isEmpty();
}
/**
* @see java.util.Collection#iterator()
*/
public Iterator iterator() {
return innerCollection.iterator();
}
/**
* @see java.util.Collection#removeAll(java.util.Collection)
*/
public boolean removeAll(Collection c) {
return innerCollection.removeAll(c);
}
/**
* @see java.util.Collection#retainAll(java.util.Collection)
*/
public boolean retainAll(Collection c) {
return innerCollection.retainAll(c);
}
/**
* @see java.util.Collection#size()
*/
public int size() {
return innerCollection.size();
}
/**
* @see java.util.Collection#toArray()
*/
public Object[] toArray() {
return innerCollection.toArray();
}
/**
* @see java.util.Collection#toArray(java.lang.Object[])
*/
public Object[] toArray(Object[] a) {
return innerCollection.toArray(a);
}
/**
* @return collection
*/
public Collection getInnerCollection() {
return innerCollection;
}
/**
* @param collection
*/
public void setInnerCollection(Collection collection) {
innerCollection = collection;
}
}
1.1
jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/servlet/impl/SecurityRoleImpl.java
Index: SecurityRoleImpl.java
===================================================================
/*
* Copyright 2004 Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.apache.jetspeed.om.servlet.impl;
import java.io.Serializable;
import org.apache.jetspeed.om.common.servlet.MutableSecurityRole;
import org.apache.pluto.om.common.SecurityRole;
/**
* MutableSecurityRoleImpl
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ate Douma </a>
* @version $Id: SecurityRoleImpl.java,v 1.1 2004/05/07 20:32:39 taylor Exp $
*/
public class SecurityRoleImpl implements SecurityRole, MutableSecurityRole,
Serializable {
private String description;
private String roleName;
/**
* Default constructor.
*/
public SecurityRoleImpl() {
}
/**
* @see org.apache.pluto.om.common.SecurityRole#getDescription()
*/
public String getDescription() {
return description;
}
/**
* @see org.apache.pluto.om.common.SecurityRole#getRoleName()
*/
public String getRoleName() {
return roleName;
}
/**
* @see
org.apache.jetspeed.om.common.servlet.MutableSecurityRole#setDescription(java.lang.String)
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @see
org.apache.jetspeed.om.common.servlet.MutableSecurityRole#setRoleName(java.lang.String)
*/
public void setRoleName(String name) {
this.roleName = name;
}
/**
* Convert [EMAIL PROTECTED] SecurityRole}to String.
*
* @return String value of SecurityRole.
*/
public String toString() {
String securityRole = "[[roleName, " + this.roleName + "], [description, " +
this.description + "]]";
return securityRole;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]