You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by th...@apache.org on 2006/08/21 16:11:57 UTC
svn commit: r433250 -
/lenya/sandbox/ac-restricted-1.4-src/modules-core/ac-impl/java/src/org/apache/lenya/ac/impl/URLPolicy.java
Author: thorsten
Date: Mon Aug 21 07:11:56 2006
New Revision: 433250
URL: http://svn.apache.org/viewvc?rev=433250&view=rev
Log:
White noise - formating changes.
Modified:
lenya/sandbox/ac-restricted-1.4-src/modules-core/ac-impl/java/src/org/apache/lenya/ac/impl/URLPolicy.java
Modified: lenya/sandbox/ac-restricted-1.4-src/modules-core/ac-impl/java/src/org/apache/lenya/ac/impl/URLPolicy.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/ac-restricted-1.4-src/modules-core/ac-impl/java/src/org/apache/lenya/ac/impl/URLPolicy.java?rev=433250&r1=433249&r2=433250&view=diff
==============================================================================
--- lenya/sandbox/ac-restricted-1.4-src/modules-core/ac-impl/java/src/org/apache/lenya/ac/impl/URLPolicy.java (original)
+++ lenya/sandbox/ac-restricted-1.4-src/modules-core/ac-impl/java/src/org/apache/lenya/ac/impl/URLPolicy.java Mon Aug 21 07:11:56 2006
@@ -37,18 +37,24 @@
import com.ibm.icu.util.StringTokenizer;
/**
- * A policy at a certain URL. The final policy is computed by merging the subtree policies of all
- * ancestor-or-self directories with the URL policy of the actual URL.
+ * A policy at a certain URL. The final policy is computed by merging the
+ * subtree policies of all ancestor-or-self directories with the URL policy of
+ * the actual URL.
*/
public class URLPolicy implements Policy {
/**
* Returns the resulting policy for a certain URL.
- * @param controller The acccess controller.
- * @param _url The URL.
- * @param manager The policy manager.
+ *
+ * @param controller
+ * The acccess controller.
+ * @param _url
+ * The URL.
+ * @param manager
+ * The policy manager.
*/
- public URLPolicy(AccreditableManager controller, String _url, InheritingPolicyManager manager) {
+ public URLPolicy(AccreditableManager controller, String _url,
+ InheritingPolicyManager manager) {
assert _url != null;
this.url = _url;
@@ -60,23 +66,32 @@
}
private String url;
+
private InheritingPolicyManager policyManager;
+
private AccreditableManager accreditableManager;
+
private Policy[] policies = null;
/**
- * Obtains the policies from the policy manager. This method is expensive and therefore only
- * called when needed.
- * @throws AccessControlException when something went wrong.
+ * Obtains the policies from the policy manager. This method is expensive
+ * and therefore only called when needed.
+ *
+ * @throws AccessControlException
+ * when something went wrong.
*/
protected void obtainPolicies() throws AccessControlException {
if (this.policies == null) {
- this.policies = getPolicyManager().getPolicies(getAccreditableManager(), getUrl());
+ this.policies = getPolicyManager().getPolicies(
+ getAccreditableManager(), getUrl());
}
}
static final String[] VISITOR_ROLES = { "visitor", "visit" };
- static final String[] ADMINISTRATOR_ROLES = { "administrator", "admin", "organize" };
+
+ static final String[] ADMINISTRATOR_ROLES = { "administrator", "admin",
+ "organize" };
+
static final String[] AUTHOR_ROLES = { "author", "edit" };
/**
@@ -102,11 +117,15 @@
/**
* Returns the visitor role.
- * @param manager The accreditable manager.
+ *
+ * @param manager
+ * The accreditable manager.
* @return A role.
- * @throws AccessControlException when something went wrong.
+ * @throws AccessControlException
+ * when something went wrong.
*/
- public static Role getVisitorRole(AccreditableManager manager) throws AccessControlException {
+ public static Role getVisitorRole(AccreditableManager manager)
+ throws AccessControlException {
Role visitorRole = null;
for (int i = 0; i < VISITOR_ROLES.length; i++) {
Role role = manager.getRoleManager().getRole(VISITOR_ROLES[i]);
@@ -119,15 +138,19 @@
/**
* Returns the administrator role.
- * @param manager The accreditable manager.
+ *
+ * @param manager
+ * The accreditable manager.
* @return A role.
- * @throws AccessControlException when something went wrong.
+ * @throws AccessControlException
+ * when something went wrong.
*/
public static Role getAdministratorRole(AccreditableManager manager)
throws AccessControlException {
Role administratorRole = null;
for (int i = 0; i < ADMINISTRATOR_ROLES.length; i++) {
- Role role = manager.getRoleManager().getRole(ADMINISTRATOR_ROLES[i]);
+ Role role = manager.getRoleManager()
+ .getRole(ADMINISTRATOR_ROLES[i]);
if (role != null) {
administratorRole = role;
}
@@ -137,11 +160,15 @@
/**
* Returns the author role.
- * @param manager The accreditable manager.
+ *
+ * @param manager
+ * The accreditable manager.
* @return A role.
- * @throws AccessControlException when something went wrong.
+ * @throws AccessControlException
+ * when something went wrong.
*/
- public static Role getAuthorRole(AccreditableManager manager) throws AccessControlException {
+ public static Role getAuthorRole(AccreditableManager manager)
+ throws AccessControlException {
Role administratorRole = null;
for (int i = 0; i < AUTHOR_ROLES.length; i++) {
Role role = manager.getRoleManager().getRole(AUTHOR_ROLES[i]);
@@ -154,10 +181,15 @@
/**
* Adds the roles of an identity of a policy to a role set.
- * @param policy The policy.
- * @param identity The identity.
- * @param roles The role set.
- * @throws AccessControlException when something went wrong.
+ *
+ * @param policy
+ * The policy.
+ * @param identity
+ * The identity.
+ * @param roles
+ * The role set.
+ * @throws AccessControlException
+ * when something went wrong.
*/
protected void addRoles(Policy policy, Identity identity, Set roles)
throws AccessControlException {
@@ -166,6 +198,7 @@
/**
* Returns the URL of this policy.
+ *
* @return The URL of this policy.
*/
public String getUrl() {
@@ -174,6 +207,7 @@
/**
* Returns the policy builder.
+ *
* @return A policy builder.
*/
public InheritingPolicyManager getPolicyManager() {
@@ -182,6 +216,7 @@
/**
* Returns the access controller.
+ *
* @return An access controller.
*/
public AccreditableManager getAccreditableManager() {
@@ -189,7 +224,9 @@
}
/**
- * The URL policy requires SSL protection if one of its member policies requires SSL protection.
+ * The URL policy requires SSL protection if one of its member policies
+ * requires SSL protection.
+ *
* @see org.apache.lenya.ac.Policy#isSSLProtected()
*/
public boolean isSSLProtected() throws AccessControlException {
@@ -221,36 +258,35 @@
return empty;
}
- public Credential[] getCredentials() throws AccessControlException {
- obtainPolicies();
- Credential[] credential=null;
- if (this.policies!=null){
- int credentialCount=0;
- String hit ="";
- int i = 0;
- while (i < this.policies.length) {
- Credential[] temp= this.policies[i].getCredentials();
- credentialCount=+temp.length;
- if (credentialCount>0){
- hit += ":"+i;
- }
- i++;
- }
- if (hit.length()>0){
- credential = new Credential[credentialCount];
- String[] token = hit.split(":");
- for (int j = 0; j < token.length; j++) {
- if(token[j].length()>0){
- //fixme: implement!!!
- //Credential[] temp= this.policies[j].getCredentials();
- credential= this.policies[j].getCredentials();
- }
- }
- }
- }
-
-
- return credential;
- }
+ public Credential[] getCredentials() throws AccessControlException {
+ obtainPolicies();
+ Credential[] credential = null;
+ if (this.policies != null) {
+ int credentialCount = 0;
+ String hit = "";
+ int i = 0;
+ while (i < this.policies.length) {
+ Credential[] temp = this.policies[i].getCredentials();
+ credentialCount = +temp.length;
+ if (credentialCount > 0) {
+ hit += ":" + i;
+ }
+ i++;
+ }
+ if (hit.length() > 0) {
+ credential = new Credential[credentialCount];
+ String[] token = hit.split(":");
+ for (int j = 0; j < token.length; j++) {
+ if (token[j].length() > 0) {
+ // fixme: implement!!!
+ // Credential[] temp= this.policies[j].getCredentials();
+ credential = this.policies[j].getCredentials();
+ }
+ }
+ }
+ }
+
+ return credential;
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org