You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by vk...@apache.org on 2008/09/04 10:56:34 UTC

svn commit: r691935 - /portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java

Author: vkumar
Date: Thu Sep  4 01:56:33 2008
New Revision: 691935

URL: http://svn.apache.org/viewvc?rev=691935&view=rev
Log:
Adding baseJetspeedPrincipalManager

Added:
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java   (with props)

Added: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java?rev=691935&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java (added)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java Thu Sep  4 01:56:33 2008
@@ -0,0 +1,120 @@
+/*	
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.security.impl;
+
+import java.util.List;
+
+import org.apache.jetspeed.security.DependentPrincipalException;
+import org.apache.jetspeed.security.JetspeedCredentialManager;
+import org.apache.jetspeed.security.JetspeedPermission;
+import org.apache.jetspeed.security.JetspeedPrincipal;
+import org.apache.jetspeed.security.JetspeedPrincipalAssociationHandler;
+import org.apache.jetspeed.security.JetspeedPrincipalManager;
+import org.apache.jetspeed.security.JetspeedPrincipalType;
+import org.apache.jetspeed.security.PrincipalNotFoundException;
+import org.apache.jetspeed.security.PrincipalNotRemovableException;
+import org.apache.jetspeed.security.spi.JetspeedPrincipalAccessManager;
+import org.apache.jetspeed.security.spi.JetspeedPrincipalPermissionStorageManager;
+import org.apache.jetspeed.security.spi.JetspeedPrincipalStorageManager;
+
+/**
+ * @version $Id$
+ *
+ */
+public abstract class BaseJetspeedPrincipalManager implements JetspeedPrincipalManager {
+
+	private JetspeedPrincipalAccessManager jetspeedPrincipalAccessManager;
+	private JetspeedPrincipalAssociationHandler jetspeedPrincipalAssociationHandler;
+	private JetspeedPrincipalStorageManager jetspeedPrincipalStorageManager;
+	private JetspeedPrincipalPermissionStorageManager jetspeedPrincipalPermissionStorageManager;	
+	
+	public BaseJetspeedPrincipalManager() {
+		super();		
+	}
+
+	public BaseJetspeedPrincipalManager(JetspeedPrincipalStorageManager jetspeedPrincipalStorageManager,JetspeedPrincipalPermissionStorageManager jetspeedPrincipalPermissionStorageManager)
+	{
+		this.jetspeedPrincipalStorageManager = jetspeedPrincipalStorageManager;
+		this.jetspeedPrincipalPermissionStorageManager = jetspeedPrincipalPermissionStorageManager;
+	}
+	
+	public void addAssociationHandler(JetspeedPrincipalAssociationHandler jpah) {
+		this.jetspeedPrincipalAssociationHandler = jpah;
+	}
+	
+	public void setAccessManager(JetspeedPrincipalAccessManager pam) {
+
+		this.jetspeedPrincipalAccessManager = pam;
+	}
+
+	public List<JetspeedPrincipal> getAssociatedFrom(String principalName, String associationName) {
+		return jetspeedPrincipalAccessManager.getAssociatedFrom(principalName, getPrincipalType(), associationName);
+	}
+	public List<String> getAssociatedNamesFrom(String principalName, String associationName) {
+		return jetspeedPrincipalAccessManager.getAssociatedNamesFrom(principalName, getPrincipalType(), associationName);
+	}
+
+	public List<String> getAssociatedNamesTo(String principalName, String associationName) {
+		return jetspeedPrincipalAccessManager.getAssociatedNamesTo(principalName, getPrincipalType(), associationName);
+	}
+
+	public List<JetspeedPrincipal> getAssociatedTo(String principalName, String associationName) {
+		return jetspeedPrincipalAccessManager.getAssociatedTo(principalName, getPrincipalType(), associationName);
+	}
+
+	public JetspeedCredentialManager getCredentialManager() {
+		return null;
+	}
+
+	public JetspeedPrincipal getPrincipal(String name) {
+		return jetspeedPrincipalAccessManager.getPrincipal(name, getPrincipalType());
+	}
+
+	public List<String> getPrincipalNames(String nameFilter) {
+		return jetspeedPrincipalAccessManager.getPrincipalNames(nameFilter, getPrincipalType());
+	}
+
+	public JetspeedPrincipalType getPrincipalType() {
+		return null;
+	}
+
+	public List<JetspeedPrincipal> getPrincipals(String nameFilter) {
+		return jetspeedPrincipalAccessManager.getPrincipals(nameFilter, getPrincipalType());
+	}
+
+	public boolean principalExists(String name) {
+		return false;
+	}
+
+	public void grantPermission(JetspeedPrincipal principal, JetspeedPermission permission) {
+		jetspeedPrincipalPermissionStorageManager.grantPermission(principal, permission);		
+	}
+
+	public void revokeAll(JetspeedPrincipal principal) {
+		jetspeedPrincipalPermissionStorageManager.revokeAll(principal);
+	}
+
+	public void revokePermission(JetspeedPrincipal principal, JetspeedPermission permission) {
+		jetspeedPrincipalPermissionStorageManager.revokePermission(principal, permission);
+	}
+
+	public void removePrincipal(String name) throws PrincipalNotFoundException, PrincipalNotRemovableException, DependentPrincipalException {
+		JetspeedPrincipal principal = jetspeedPrincipalAccessManager.getPrincipal(name, getPrincipalType());		
+		if (principal == null) throw new PrincipalNotFoundException();		
+		jetspeedPrincipalStorageManager.removePrincipal (principal);	
+	}
+}

Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
------------------------------------------------------------------------------
    svn:keywords = Id



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org