You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ck...@apache.org on 2007/07/23 22:02:03 UTC
svn commit: r558849 [1/6] - in /directory/triplesec/trunk: admin-api/
admin-api/src/test/java/org/apache/directory/triplesec/admin/
admin-api/src/test/resources/ guardian-api/src/main/java/org/apache/
guardian-api/src/main/java/org/apache/directory/ gu...
Author: ckoppelt
Date: Mon Jul 23 13:01:54 2007
New Revision: 558849
URL: http://svn.apache.org/viewvc?view=rev&rev=558849
Log:
renamed packages in guardian-api, guardian-ldap, guardian-ldif, integration, main
Added:
directory/triplesec/trunk/guardian-api/src/main/java/org/apache/
directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/
directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/
directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/
directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ApplicationPolicy.java
directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ApplicationPolicyFactory.java
directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ChangeType.java
directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ConnectionDriver.java
directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/GuardianException.java
directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/NoConnectionDriverException.java
directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/Permission.java
directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/Permissions.java
directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/PolicyChangeAdapter.java
directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/PolicyChangeListener.java
directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/Profile.java
directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/Role.java
directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/Roles.java
directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/StoreConnectionException.java
directory/triplesec/trunk/guardian-api/src/test/java/org/apache/
directory/triplesec/trunk/guardian-api/src/test/java/org/apache/directory/
directory/triplesec/trunk/guardian-api/src/test/java/org/apache/directory/triplesec/
directory/triplesec/trunk/guardian-api/src/test/java/org/apache/directory/triplesec/guardian/
directory/triplesec/trunk/guardian-api/src/test/java/org/apache/directory/triplesec/guardian/AbstractEntityTest.java
directory/triplesec/trunk/guardian-api/src/test/java/org/apache/directory/triplesec/guardian/ApplicationPolicyFactoryTest.java
directory/triplesec/trunk/guardian-api/src/test/java/org/apache/directory/triplesec/guardian/ExceptionTests.java
directory/triplesec/trunk/guardian-api/src/test/java/org/apache/directory/triplesec/guardian/PermissionTest.java
directory/triplesec/trunk/guardian-api/src/test/java/org/apache/directory/triplesec/guardian/PermissionsTest.java
directory/triplesec/trunk/guardian-api/src/test/java/org/apache/directory/triplesec/guardian/ProfileTest.java
directory/triplesec/trunk/guardian-api/src/test/java/org/apache/directory/triplesec/guardian/RoleTest.java
directory/triplesec/trunk/guardian-api/src/test/java/org/apache/directory/triplesec/guardian/RolesTest.java
directory/triplesec/trunk/guardian-api/src/test/java/org/apache/directory/triplesec/guardian/mock/
directory/triplesec/trunk/guardian-api/src/test/java/org/apache/directory/triplesec/guardian/mock/MockApplicationPolicy.java
directory/triplesec/trunk/guardian-api/src/test/java/org/apache/directory/triplesec/guardian/mock/MockApplicationPolicyTest.java
directory/triplesec/trunk/guardian-api/src/test/java/org/apache/directory/triplesec/guardian/mock/MockConnectionDriver.java
directory/triplesec/trunk/guardian-ldap/src/main/java/org/apache/
directory/triplesec/trunk/guardian-ldap/src/main/java/org/apache/directory/
directory/triplesec/trunk/guardian-ldap/src/main/java/org/apache/directory/triplesec/
directory/triplesec/trunk/guardian-ldap/src/main/java/org/apache/directory/triplesec/guardian/
directory/triplesec/trunk/guardian-ldap/src/main/java/org/apache/directory/triplesec/guardian/ldap/
directory/triplesec/trunk/guardian-ldap/src/main/java/org/apache/directory/triplesec/guardian/ldap/LdapApplicationPolicy.java
directory/triplesec/trunk/guardian-ldap/src/main/java/org/apache/directory/triplesec/guardian/ldap/LdapConnectionDriver.java
directory/triplesec/trunk/guardian-ldap/src/main/java/org/apache/directory/triplesec/guardian/ldap/ProfileIdIterator.java
directory/triplesec/trunk/guardian-ldap/src/test/java/org/apache/
directory/triplesec/trunk/guardian-ldap/src/test/java/org/apache/directory/
directory/triplesec/trunk/guardian-ldap/src/test/java/org/apache/directory/triplesec/
directory/triplesec/trunk/guardian-ldap/src/test/java/org/apache/directory/triplesec/guardian/
directory/triplesec/trunk/guardian-ldap/src/test/java/org/apache/directory/triplesec/guardian/ldap/
directory/triplesec/trunk/guardian-ldap/src/test/java/org/apache/directory/triplesec/guardian/ldap/GuardianClient.java
directory/triplesec/trunk/guardian-ldap/src/test/java/org/apache/directory/triplesec/guardian/ldap/LdapApplicationPolicyIntegrationTest.java
directory/triplesec/trunk/guardian-ldap/src/test/java/org/apache/directory/triplesec/guardian/ldap/LdapConnectionDriverTest.java
directory/triplesec/trunk/guardian-ldif/src/main/java/org/apache/
directory/triplesec/trunk/guardian-ldif/src/main/java/org/apache/directory/
directory/triplesec/trunk/guardian-ldif/src/main/java/org/apache/directory/triplesec/
directory/triplesec/trunk/guardian-ldif/src/main/java/org/apache/directory/triplesec/guardian/
directory/triplesec/trunk/guardian-ldif/src/main/java/org/apache/directory/triplesec/guardian/ldif/
directory/triplesec/trunk/guardian-ldif/src/main/java/org/apache/directory/triplesec/guardian/ldif/LdifApplicationPolicy.java
directory/triplesec/trunk/guardian-ldif/src/main/java/org/apache/directory/triplesec/guardian/ldif/LdifConnectionDriver.java
directory/triplesec/trunk/guardian-ldif/src/test/java/org/apache/
directory/triplesec/trunk/guardian-ldif/src/test/java/org/apache/directory/
directory/triplesec/trunk/guardian-ldif/src/test/java/org/apache/directory/triplesec/
directory/triplesec/trunk/guardian-ldif/src/test/java/org/apache/directory/triplesec/guardian/
directory/triplesec/trunk/guardian-ldif/src/test/java/org/apache/directory/triplesec/guardian/ldif/
directory/triplesec/trunk/guardian-ldif/src/test/java/org/apache/directory/triplesec/guardian/ldif/LdapConnectionDriverTest.java
directory/triplesec/trunk/guardian-ldif/src/test/java/org/apache/directory/triplesec/guardian/ldif/LdifApplicationPolicyTest.java
directory/triplesec/trunk/integration/src/main/java/org/apache/
directory/triplesec/trunk/integration/src/main/java/org/apache/directory/
directory/triplesec/trunk/integration/src/main/java/org/apache/directory/triplesec/
directory/triplesec/trunk/integration/src/main/java/org/apache/directory/triplesec/integration/
directory/triplesec/trunk/integration/src/main/java/org/apache/directory/triplesec/integration/TriplesecIntegration.java
directory/triplesec/trunk/integration/src/test/java/org/apache/
directory/triplesec/trunk/integration/src/test/java/org/apache/directory/
directory/triplesec/trunk/integration/src/test/java/org/apache/directory/triplesec/
directory/triplesec/trunk/integration/src/test/java/org/apache/directory/triplesec/integration/
directory/triplesec/trunk/integration/src/test/java/org/apache/directory/triplesec/integration/TriplesecIntegrationITest.java
directory/triplesec/trunk/main/src/main/java/org/apache/
directory/triplesec/trunk/main/src/main/java/org/apache/directory/
directory/triplesec/trunk/main/src/main/java/org/apache/directory/triplesec/
directory/triplesec/trunk/main/src/main/java/org/apache/directory/triplesec/LoggingHotpMonitor.java
directory/triplesec/trunk/main/src/main/java/org/apache/directory/triplesec/LoggingStoreMonitor.java
directory/triplesec/trunk/main/src/main/java/org/apache/directory/triplesec/Service.java
directory/triplesec/trunk/main/src/main/java/org/apache/directory/triplesec/TriplesecInstallationLayout.java
directory/triplesec/trunk/main/src/main/java/org/apache/directory/triplesec/TriplesecUberjarMain.java
directory/triplesec/trunk/main/src/main/java/org/apache/directory/triplesec/TriplsecContextFactory.java
Removed:
directory/triplesec/trunk/guardian-api/src/main/java/org/safehaus/
directory/triplesec/trunk/guardian-api/src/test/java/org/safehaus/
directory/triplesec/trunk/guardian-ldap/src/main/java/org/safehaus/
directory/triplesec/trunk/guardian-ldap/src/test/java/org/safehaus/
directory/triplesec/trunk/guardian-ldif/src/main/java/org/safehaus/
directory/triplesec/trunk/guardian-ldif/src/test/java/org/safehaus/
directory/triplesec/trunk/integration/src/main/java/org/safehaus/
directory/triplesec/trunk/integration/src/test/java/org/safehaus/
directory/triplesec/trunk/main/src/main/java/org/safehaus/
Modified:
directory/triplesec/trunk/admin-api/pom.xml
directory/triplesec/trunk/admin-api/src/test/java/org/apache/directory/triplesec/admin/IntegrationTest.java
directory/triplesec/trunk/admin-api/src/test/resources/server.xml
directory/triplesec/trunk/guardian-ldap/pom.xml
directory/triplesec/trunk/guardian-ldap/src/test/resources/server.xml
directory/triplesec/trunk/integration/pom.xml
directory/triplesec/trunk/integration/src/test/resources/server.xml
directory/triplesec/trunk/main/conf/server.xml
directory/triplesec/trunk/swing-admin/pom.xml
directory/triplesec/trunk/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/AdminFrame.java
directory/triplesec/trunk/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ConfigurationFileManager.java
directory/triplesec/trunk/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ConnectionManager.java
directory/triplesec/trunk/swing-admin/src/test/java/org/safehaus/triplesec/admin/swing/LaunchAdminFrame.java
directory/triplesec/trunk/swing-admin/src/test/resources/server.xml
directory/triplesec/trunk/swing-demo/pom.xml
directory/triplesec/trunk/swing-demo/sample.properties
directory/triplesec/trunk/swing-demo/src/main/java/org/safehaus/triplesec/guardian/demo/DemoFrame.java
directory/triplesec/trunk/swing-demo/src/main/java/org/safehaus/triplesec/guardian/demo/LoginCommand.java
directory/triplesec/trunk/swing-demo/src/test/java/org/safehaus/triplesec/guardian/demo/LaunchDemoFrame.java
directory/triplesec/trunk/swing-demo/src/test/resources/server.xml
directory/triplesec/trunk/tools/pom.xml
directory/triplesec/trunk/utils-hauskeys/src/test/java/org/safehaus/triplesec/utils/hauskeys/HauskeysMidletBuilderTest.java
directory/triplesec/trunk/verifier/src/main/java/org/safehaus/triplesec/verifier/hotp/AccountDisabledException.java
directory/triplesec/trunk/verifier/src/main/java/org/safehaus/triplesec/verifier/hotp/AccountInactiveException.java
directory/triplesec/trunk/verifier/src/main/java/org/safehaus/triplesec/verifier/hotp/AccountLockedOutException.java
directory/triplesec/trunk/verifier/src/main/java/org/safehaus/triplesec/verifier/hotp/DefaultHotpSamVerifier.java
directory/triplesec/trunk/verifier/src/main/java/org/safehaus/triplesec/verifier/hotp/HotpException.java
directory/triplesec/trunk/verifier/src/main/java/org/safehaus/triplesec/verifier/hotp/HotpMonitor.java
directory/triplesec/trunk/verifier/src/main/java/org/safehaus/triplesec/verifier/hotp/HotpMonitorAdapter.java
directory/triplesec/trunk/verifier/src/main/java/org/safehaus/triplesec/verifier/hotp/PreauthFailedException.java
directory/triplesec/trunk/verifier/src/main/java/org/safehaus/triplesec/verifier/hotp/ResynchInProgressException.java
directory/triplesec/trunk/verifier/src/main/java/org/safehaus/triplesec/verifier/hotp/ResynchStartingException.java
directory/triplesec/trunk/verifier/src/test/java/org/safehaus/triplesec/verifier/hotp/GenerateHotp.java
directory/triplesec/trunk/verifier/src/test/java/org/safehaus/triplesec/verifier/hotp/HotpSamVerifierITest.java
directory/triplesec/trunk/webapp-activation/src/main/java/org/safehaus/triplesec/activation/ActivateAccountFilter.java
directory/triplesec/trunk/webapp-activation/src/main/java/org/safehaus/triplesec/activation/ActivationUtils.java
directory/triplesec/trunk/webapp-changelog/pom.xml
directory/triplesec/trunk/webapp-changelog/src/main/webapp/WEB-INF/faces-config.xml
directory/triplesec/trunk/webapp-changelog/src/test/java/org/safehaus/triplesec/changelogui/TriplesecChangelogWebappUnit.java
directory/triplesec/trunk/webapp-changelog/src/test/resources/server.xml
directory/triplesec/trunk/webapp-config/pom.xml
directory/triplesec/trunk/webapp-config/src/main/java/org/safehaus/triplesec/configui/util/TriplesecConfigTool.java
directory/triplesec/trunk/webapp-config/src/main/java/org/safehaus/triplesec/configui/util/TriplesecPropBuilder.java
directory/triplesec/trunk/webapp-config/src/main/java/org/safehaus/triplesec/configui/view/panels/WizardPanelFinish.java
directory/triplesec/trunk/webapp-config/src/main/webapp/WEB-INF/web.xml
directory/triplesec/trunk/webapp-config/src/test/java/org/safehaus/triplesec/configui/RunConfigUI.java
directory/triplesec/trunk/webapp-config/src/test/java/org/safehaus/triplesec/configui/util/TriplesecPropBuilderTest.java
directory/triplesec/trunk/webapp-config/src/test/resources/server.xml
directory/triplesec/trunk/webapp-demo/pom.xml
directory/triplesec/trunk/webapp-demo/src/main/java/org/safehaus/triplesec/demo/dao/mock/MockAccountDao.java
directory/triplesec/trunk/webapp-demo/src/main/java/org/safehaus/triplesec/demo/security/AuthenticatedWebSession.java
directory/triplesec/trunk/webapp-demo/src/main/java/org/safehaus/triplesec/demo/service/DefaultPolicyManager.java
directory/triplesec/trunk/webapp-demo/src/main/java/org/safehaus/triplesec/demo/service/PolicyManager.java
directory/triplesec/trunk/webapp-demo/src/main/java/org/safehaus/triplesec/demo/view/borders/PageBorder.java
directory/triplesec/trunk/webapp-demo/src/main/java/org/safehaus/triplesec/demo/view/pages/AdminPage.java
directory/triplesec/trunk/webapp-demo/src/main/java/org/safehaus/triplesec/demo/view/pages/HomePage.java
directory/triplesec/trunk/webapp-demo/src/main/java/org/safehaus/triplesec/demo/view/panels/BuyPanel.java
directory/triplesec/trunk/webapp-demo/src/main/resources/applicationContext.xml
directory/triplesec/trunk/webapp-demo/src/test/java/org/safehaus/triplesec/demo/RunDemoUI.java
directory/triplesec/trunk/webapp-demo/src/test/resources/server.xml
directory/triplesec/trunk/webapp-registration/pom.xml
directory/triplesec/trunk/webapp-registration/src/main/webapp/WEB-INF/web.xml
directory/triplesec/trunk/webapp-registration/src/test/java/org/safehaus/triplesec/registration/RunRegistrationUI.java
directory/triplesec/trunk/webapp-registration/src/test/resources/server.xml
directory/triplesec/trunk/webapp-servlet-demo/pom.xml
directory/triplesec/trunk/webapp-servlet-demo/src/main/java/org/safehaus/triplesec/demo/LoginCommand.java
directory/triplesec/trunk/webapp-servlet-demo/src/main/java/org/safehaus/triplesec/demo/LoginServlet.java
directory/triplesec/trunk/webapp-servlet-demo/src/main/webapp/WEB-INF/web.xml
directory/triplesec/trunk/webapp-servlet-demo/src/test/java/org/safehaus/triplesec/demo/RunDemoUI.java
directory/triplesec/trunk/webapp-servlet-demo/src/test/resources/server.xml
directory/triplesec/trunk/webapp-wicket-admin/pom.xml
directory/triplesec/trunk/webapp-wicket-admin/src/main/java/org/safehaus/triplesec/adminui/security/AuthenticatedWebSession.java
directory/triplesec/trunk/webapp-wicket-admin/src/main/webapp/WEB-INF/web.xml
directory/triplesec/trunk/webapp-wicket-admin/src/test/java/org/safehaus/triplesec/wicket/admin/RunWicketAdminUI.java
directory/triplesec/trunk/webapp-wicket-admin/src/test/resources/server.xml
Modified: directory/triplesec/trunk/admin-api/pom.xml
URL: http://svn.apache.org/viewvc/directory/triplesec/trunk/admin-api/pom.xml?view=diff&rev=558849&r1=558848&r2=558849
==============================================================================
--- directory/triplesec/trunk/admin-api/pom.xml (original)
+++ directory/triplesec/trunk/admin-api/pom.xml Mon Jul 23 13:01:54 2007
@@ -54,7 +54,7 @@
<configuration>
<systemProperties>
<property>
- <name>org.safehaus.triplesec.integration.resourcesDirectory</name>
+ <name>org.apache.directory.triplesec.integration.resourcesDirectory</name>
<value>${basedir}/src/test/resources</value>
</property>
</systemProperties>
@@ -76,7 +76,7 @@
<configuration>
<systemProperties>
<property>
- <name>org.safehaus.triplesec.integration.resourcesDirectory</name>
+ <name>org.apache.directory.triplesec.integration.resourcesDirectory</name>
<value>${basedir}/src/test/resources</value>
</property>
</systemProperties>
Modified: directory/triplesec/trunk/admin-api/src/test/java/org/apache/directory/triplesec/admin/IntegrationTest.java
URL: http://svn.apache.org/viewvc/directory/triplesec/trunk/admin-api/src/test/java/org/apache/directory/triplesec/admin/IntegrationTest.java?view=diff&rev=558849&r1=558848&r2=558849
==============================================================================
--- directory/triplesec/trunk/admin-api/src/test/java/org/apache/directory/triplesec/admin/IntegrationTest.java (original)
+++ directory/triplesec/trunk/admin-api/src/test/java/org/apache/directory/triplesec/admin/IntegrationTest.java Mon Jul 23 13:01:54 2007
@@ -53,7 +53,7 @@
import org.apache.directory.triplesec.admin.dao.PermissionDao;
import org.apache.directory.triplesec.admin.dao.ldap.LdapDaoFactory;
import org.apache.directory.triplesec.admin.dao.ldap.LdapPermissionDao;
-import org.safehaus.triplesec.integration.TriplesecIntegration;
+import org.apache.directory.triplesec.integration.TriplesecIntegration;
Modified: directory/triplesec/trunk/admin-api/src/test/resources/server.xml
URL: http://svn.apache.org/viewvc/directory/triplesec/trunk/admin-api/src/test/resources/server.xml?view=diff&rev=558849&r1=558848&r2=558849
==============================================================================
--- directory/triplesec/trunk/admin-api/src/test/resources/server.xml (original)
+++ directory/triplesec/trunk/admin-api/src/test/resources/server.xml Mon Jul 23 13:01:54 2007
@@ -11,8 +11,8 @@
<prop key="java.naming.security.principal">uid=admin,ou=system</prop>
<prop key="java.naming.security.credentials">secret</prop>
<prop key="java.naming.provider.url">dc=example,dc=com</prop>
- <prop key="java.naming.factory.state">org.safehaus.triplesec.store.ProfileStateFactory</prop>
- <prop key="java.naming.factory.object">org.safehaus.triplesec.store.ProfileObjectFactory</prop>
+ <prop key="java.naming.factory.state">org.apache.directory.triplesec.store.ProfileStateFactory</prop>
+ <prop key="java.naming.factory.object">org.apache.directory.triplesec.store.ProfileObjectFactory</prop>
<prop key="kdc.primary.realm">EXAMPLE.COM</prop>
<prop key="kdc.principal">krbtgt/EXAMPLE.COM@EXAMPLE.COM</prop>
@@ -37,12 +37,12 @@
<prop key="safehaus.entry.basedn">ou=Users,dc=example,dc=com</prop>
<prop key="safehaus.load.testdata">true</prop>
- <prop key="kerberos.sam.type.7">org.safehaus.triplesec.verifier.hotp.DefaultHotpSamVerifier</prop>
+ <prop key="kerberos.sam.type.7">org.apache.directory.triplesec.verifier.hotp.DefaultHotpSamVerifier</prop>
</props>
</property>
</bean>
- <bean id="configuration" class="org.safehaus.triplesec.configuration.MutableTriplesecStartupConfiguration">
+ <bean id="configuration" class="org.apache.directory.triplesec.configuration.MutableTriplesecStartupConfiguration">
<property name="workingDirectory"><value>partitions</value></property>
<property name="allowAnonymousAccess"><value>false</value></property>
<property name="accessControlEnabled"><value>true</value></property>
@@ -76,7 +76,7 @@
</property>
<property name="activationConfiguration">
- <bean class="org.safehaus.triplesec.configuration.ActivationConfiguration">
+ <bean class="org.apache.directory.triplesec.configuration.ActivationConfiguration">
<property name="enableDecoyMidlet"><value>true</value></property>
<property name="otpLength"><value>6</value></property>
<property name="midletNameAttribute"><value>midletNameAttribute</value></property>
@@ -84,7 +84,7 @@
</property>
<property name="smsConfiguration">
- <bean class="org.safehaus.triplesec.configuration.SmsConfiguration">
+ <bean class="org.apache.directory.triplesec.configuration.SmsConfiguration">
<property name="smsUsername"><value>hauskeys</value></property>
<property name="smsPassword"><value>secret</value></property>
<property name="smsAccountName"><value>demo</value></property>
@@ -93,7 +93,7 @@
</property>
<property name="smtpConfiguration">
- <bean class="org.safehaus.triplesec.configuration.SmtpConfiguration">
+ <bean class="org.apache.directory.triplesec.configuration.SmtpConfiguration">
<property name="smtpAuthenticate"><value>false</value></property>
<!-- uncomment and set above property if authentication is required by mail server
<property name="smtpUsername"><value>hauskeys</value></property>
@@ -121,7 +121,7 @@
<bean class="org.apache.directory.server.core.schema.bootstrap.JavaSchema"/>
<bean class="org.apache.directory.server.core.schema.bootstrap.Krb5kdcSchema"/>
<bean class="org.apache.directory.server.core.schema.bootstrap.SystemSchema"/>
- <bean class="org.safehaus.triplesec.store.schema.SafehausSchema"/>
+ <bean class="org.apache.directory.triplesec.store.schema.SafehausSchema"/>
</set>
</property>
@@ -203,7 +203,7 @@
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name"><value>policyProtectionService</value></property>
<property name="interceptor">
- <bean class="org.safehaus.triplesec.store.interceptor.PolicyProtectionInterceptor" />
+ <bean class="org.apache.directory.triplesec.store.interceptor.PolicyProtectionInterceptor" />
</property>
</bean>
</list>
Added: directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ApplicationPolicy.java
URL: http://svn.apache.org/viewvc/directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ApplicationPolicy.java?view=auto&rev=558849
==============================================================================
--- directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ApplicationPolicy.java (added)
+++ directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ApplicationPolicy.java Mon Jul 23 13:01:54 2007
@@ -0,0 +1,145 @@
+/*
+ * 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.directory.triplesec.guardian;
+
+
+import java.util.Iterator;
+import java.util.Set;
+
+
+
+/**
+ * The policy store for an application whose access policy is managed by Triplesec.
+ *
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ * @author Trustin Lee
+ * @author <a href="mailto:ersiner@safehaus.org">Ersin Er</a>
+ * @version $Rev: 72 $, $Date: 2005-11-07 21:37:46 -0500 (Mon, 07 Nov 2005) $
+ */
+public interface ApplicationPolicy
+{
+ /**
+ * Removes a change listener so that it does not recieve policy change
+ * notifications.
+ *
+ * @param listener the listener to remove.
+ */
+ boolean removePolicyListener( PolicyChangeListener listener ) throws GuardianException;
+
+ /**
+ * Adds a change listener so that it recieves policy change notifications.
+ *
+ * @param listener the listener to add.
+ */
+ boolean addPolicyListener( PolicyChangeListener listener ) throws GuardianException;
+
+ /**
+ * Gets the name uniquely identifying the applicaiton associated
+ * with this store.
+ *
+ * @return the name of this store
+ */
+ String getApplicationName();
+
+ /**
+ * Gets a set of {@link Role}s defined for this store.
+ *
+ * @return a set of {@link Role}s defined for this store.
+ */
+ Roles getRoles();
+
+ /**
+ * Gets a set of {@link Permission}s defined for this store.
+ *
+ * @return a set of {@link Permission}s defined for this store.
+ */
+ Permissions getPermissions();
+
+ /**
+ * Gets the names of the profiles dependent on a role. The set contains
+ * Strings of the profile name.
+ *
+ * @param role the role the dependent profiles are associated with
+ * @return the name's of profiles that depend on the supplied role
+ * @throws GuardianException if there is an error accessing the backing
+ * store or the role is not associated with this ApplicationPolicy
+ */
+ Set getDependentProfileNames( Role role ) throws GuardianException;
+
+ /**
+ * Gets the names of the profiles dependent on a permission. The set
+ * contains Strings of the profile names.
+ *
+ * @param permission the permission the dependent profiles are associated with
+ * @return the name's of profiles that depend on the supplied permission
+ * @throws GuardianException if there is an error accessing the backing
+ * store or the permission is not associated with this ApplicationPolicy
+ */
+ Set getDependentProfileNames( Permission permission ) throws GuardianException;
+
+ /**
+ * Gets the set of profiles a user has for this ApplicationPolicy.
+ *
+ * @param userName the name of the user to get the profile ids for
+ * @return a set of profile ids as Strings or the empty set if the userName is
+ * invalid or does not have profiles defined
+ * @throws GuardianException if there are errors accessing the backing store
+ */
+ Set getUserProfileIds( String userName ) throws GuardianException;
+
+ /**
+ * Gets an iterator over the set of profiles in this ApplicationPolicy.
+ *
+ * @return an iterator over profileId Strings
+ * @throws GuardianException if there are errors accessing the backing store
+ */
+ Iterator getProfileIdIterator() throws GuardianException;
+
+ /**
+ * Gets this user's authorization {@link Profile} for the application.
+ *
+ * @param profileId the name of the user to get the {@link Profile} for
+ * @return the {@link Profile} for the application or null if no profile exists for
+ * the specified <tt>profileId</tt>
+ */
+ Profile getProfile( String profileId ) throws GuardianException;
+
+ /**
+ * Gets a profile for the admin user which is in all roles and has all permissions
+ * granted.
+ *
+ * @return the admin user profile with all rights
+ */
+ Profile getAdminProfile();
+
+ /**
+ * Gets a breif description of this ApplicationPolicy.
+ *
+ * @return a breif description of this ApplicationPolicy
+ */
+ String getDescription();
+
+ /**
+ * Closes the application store.
+ *
+ * @throws GuardianException if the store cannot be properly closed.
+ */
+ void close() throws GuardianException;
+}
Added: directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ApplicationPolicyFactory.java
URL: http://svn.apache.org/viewvc/directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ApplicationPolicyFactory.java?view=auto&rev=558849
==============================================================================
--- directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ApplicationPolicyFactory.java (added)
+++ directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ApplicationPolicyFactory.java Mon Jul 23 13:01:54 2007
@@ -0,0 +1,246 @@
+/*
+ * 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.directory.triplesec.guardian;
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+
+/**
+ * Connects to {@link ApplicationPolicy} and manages
+ * {@link ConnectionDriver}s.
+ *
+ * @author <a href="mailto:trustin@safehaus.org">Trustin Lee</a>
+ *
+ * @version $Rev: 68 $, $Date: 2005-08-28 10:08:31 -0400 (Sun, 28 Aug 2005) $
+ *
+ */
+public abstract class ApplicationPolicyFactory
+{
+ /**
+ * A property key that specifies the maxinum number of retries in case of
+ * connection failure in {@link #newInstance(String, Properties)}.
+ */
+ public static final String RETRY_COUNT = ApplicationPolicyFactory.class.getName() + ".retryCount";
+
+ /**
+ * A property key that specified the delay in seconds between connection retries
+ * in {@link #newInstance(String, Properties)}.
+ */
+ public static final String RETRY_DELAY = ApplicationPolicyFactory.class.getName() + ".retryDelay";
+
+ /** a static list of registered {@link ConnectionDriver}s */
+ private static final List drivers = new ArrayList();
+
+
+ /**
+ * Registers a {@link ConnectionDriver} with this factory.
+ *
+ * @param driver the {@link ConnectionDriver} being registered
+ * @return <tt>true</tt> if and only if the driver is registered
+ */
+ public static boolean registerDriver( ConnectionDriver driver )
+ {
+ synchronized( drivers )
+ {
+ for( Iterator i = drivers.iterator(); i.hasNext(); )
+ {
+ if( driver.getClass().equals( i.next().getClass() ) )
+ {
+ return false;
+ }
+ }
+
+ drivers.add( driver );
+ }
+
+ return true;
+ }
+
+
+ /**
+ * Deregisters all {@link ConnectionDriver}s of the specified
+ * <tt>driverClass</tt> type.
+ *
+ * @param driverClass the type of {@link ConnectionDriver}s to deregister
+ * @return <tt>true</tt> if and only if any drivers are deregistered
+ */
+ public static boolean deregisterDriver( Class driverClass )
+ {
+ boolean removed = false;
+ synchronized( drivers )
+ {
+ for( Iterator i = drivers.iterator(); i.hasNext(); )
+ {
+ if( driverClass.isAssignableFrom( i.next().getClass() ) )
+ {
+ i.remove();
+ removed = true;
+ }
+ }
+ }
+
+ return removed;
+ }
+
+
+ /**
+ * Connects to the {@link ApplicationPolicy} with the specified <tt>urls</tt>
+ * and extra connection <tt>info</tt> using an appropriate {@link ConnectionDriver}.
+ * <p>
+ * URLs are separated by whitespace characters. This operation tries the specified
+ * URLs in random order to distribute server-side load.
+ *
+ * @param urls the whitespace-separated URLs of the {@link ApplicationPolicy}
+ * @param info the extra information to pass to {@link ConnectionDriver}
+ * @return the connected store
+ * @throws GuardianException if failed to connect to the store
+ */
+ public static ApplicationPolicy newInstance( String urls, Properties info ) throws GuardianException
+ {
+ List urlList = new ArrayList();
+ StringTokenizer tk = new StringTokenizer( urls );
+ while( tk.hasMoreElements() )
+ {
+ urlList.add( tk.nextToken() );
+ }
+
+ Collections.shuffle( urlList );
+
+ GuardianException ex = null;
+ for( Iterator ui = urlList.iterator(); ui.hasNext(); )
+ {
+ String url = ( String ) ui.next();
+ try
+ {
+ ex = null;
+ return newInstance0( url, info );
+ }
+ catch( GuardianException e )
+ {
+ ex = e;
+ }
+ catch( Throwable t )
+ {
+ ex = new GuardianException( "Driver exception.", t );
+ }
+ }
+
+ throw ex;
+ }
+
+ private static ApplicationPolicy newInstance0( String url, Properties info )
+ {
+ ConnectionDriver driver = null;
+
+ synchronized( drivers )
+ {
+ for( Iterator i = drivers.iterator(); i.hasNext(); )
+ {
+ ConnectionDriver d = ( ConnectionDriver ) i.next();
+ if( d.accept( url ) )
+ {
+ driver = d;
+ break;
+ }
+ }
+ }
+
+ if( driver == null )
+ {
+ throw new NoConnectionDriverException( url );
+ }
+
+ if( info == null )
+ {
+ info = new Properties();
+ }
+
+ String retryCountStr = info.getProperty( RETRY_COUNT );
+ String retryDelayStr = info.getProperty( RETRY_DELAY );
+ int retryCount;
+ int retryDelay;
+
+ // Get retryCount
+ if( retryCountStr == null )
+ {
+ retryCount = 0;
+ }
+ else
+ {
+ retryCount = Integer.parseInt( retryCountStr );
+ }
+
+ // Adjust if invalid
+ if( retryCount < 0 )
+ {
+ retryCount = 0;
+ }
+
+ // Get retryDelay
+ if( retryDelayStr == null )
+ {
+ retryDelay = 1;
+ }
+ else
+ {
+ retryDelay = Integer.parseInt( retryDelayStr );
+ }
+
+ // Adjust if invalid
+ if( retryDelay < 0 )
+ {
+ retryDelay = 0;
+ }
+
+ // Try to connect
+ for( int i = 0;; i++ )
+ {
+ try
+ {
+ return driver.newStore( url, info );
+ }
+ catch( StoreConnectionException e )
+ {
+ // Propagate exception if exceeded max retryCount.
+ if( i >= retryCount )
+ {
+ throw e;
+ }
+ else
+ {
+ // or sleep for the next try
+ try
+ {
+ Thread.sleep( retryDelay * 1000L );
+ }
+ catch( InterruptedException e1 )
+ {
+ }
+ }
+ }
+ }
+ }
+}
Added: directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ChangeType.java
URL: http://svn.apache.org/viewvc/directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ChangeType.java?view=auto&rev=558849
==============================================================================
--- directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ChangeType.java (added)
+++ directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ChangeType.java Mon Jul 23 13:01:54 2007
@@ -0,0 +1,79 @@
+/*
+ * 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.directory.triplesec.guardian;
+
+
+/**
+ * The enumerated type for changes to guardian entities.
+ *
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ * @version $Rev$, $Date$
+ */
+public class ChangeType
+{
+ /** the change type representing the addition of a guardian entity */
+ public static final ChangeType ADD = new ChangeType( "Add", 1 );
+ /** the change type representing the deletion of a guardian entity */
+ public static final ChangeType DEL = new ChangeType( "Delete", 2 );
+ /** the change type representing the modification of a guardian entity */
+ public static final ChangeType MODIFY = new ChangeType( "Modify", 4 );
+ /** the change type representing the name change of a guardian entity */
+ public static final ChangeType RENAME = new ChangeType( "Rename", 8 );
+
+ /** the name of this ChangeType enumeration value */
+ private final String name;
+ /** the value of this ChangeType enumeration value */
+ private final int value;
+
+
+ /**
+ * Create a change type enumeration.
+ *
+ * @param name the name of this ChangeType enumeration value
+ * @param value the value of this ChangeType enumeration value
+ */
+ private ChangeType( String name, int value )
+ {
+ this.name = name;
+ this.value = value;
+ }
+
+
+ /**
+ * Gets the name of this ChangeType enumeration value.
+ *
+ * @return the name of this ChangeType enumeration value
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+
+ /**
+ * Gets the primitive int value of this ChangeType enumeration value.
+ *
+ * @return the primitive int value of this ChangeType enumeration value
+ */
+ public int getValue()
+ {
+ return value;
+ }
+}
Added: directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ConnectionDriver.java
URL: http://svn.apache.org/viewvc/directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ConnectionDriver.java?view=auto&rev=558849
==============================================================================
--- directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ConnectionDriver.java (added)
+++ directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/ConnectionDriver.java Mon Jul 23 13:01:54 2007
@@ -0,0 +1,57 @@
+/*
+ * 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.directory.triplesec.guardian;
+
+
+import java.util.Properties;
+
+
+/**
+ * A driver interface that provides an extension mechanism for TripleSec
+ * Guardian API to support various connection types such as JNDI, in-memory
+ * store, and JDBC.
+ *
+ * @author Trustin Lee
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ * @version $Rev: 53 $
+ */
+public interface ConnectionDriver
+{
+ /**
+ * Implement this method to return <tt>true</tt> if and only if
+ * this driver can connect to the specified <tt>url</tt>
+ *
+ * @param url the URL to connect to
+ * @return <tt>true</tt> if and only if this driver can connect to
+ * the specified <tt>url</tt>
+ */
+ boolean accept( String url );
+
+ /**
+ * Implement this method to connect to the {@link ApplicationPolicy}
+ * with the specified <tt>url</tt> and return the connected {@link ApplicationPolicy}.
+ *
+ * @param url the URL to connect to
+ * @param info the extra information a user specified
+ * @return the connected {@link ApplicationPolicy}
+ * @throws GuardianException if failed to connect
+ */
+ ApplicationPolicy newStore( String url, Properties info ) throws GuardianException;
+}
Added: directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/GuardianException.java
URL: http://svn.apache.org/viewvc/directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/GuardianException.java?view=auto&rev=558849
==============================================================================
--- directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/GuardianException.java (added)
+++ directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/GuardianException.java Mon Jul 23 13:01:54 2007
@@ -0,0 +1,85 @@
+/*
+ * 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.directory.triplesec.guardian;
+
+
+
+/**
+ * An exception thrown by {@link ApplicationPolicy} and
+ * {@link ApplicationPolicyFactory} when connection to the store is
+ * not established or crashed.
+ *
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ * @author Trustin Lee
+ *
+ * @version $Rev: 53 $, $Date: 2005-08-21 20:58:16 -0400 (Sun, 21 Aug 2005) $
+ */
+public class GuardianException extends RuntimeException
+{
+ private static final long serialVersionUID = 4460210351439248871L;
+
+
+ // ------------------------------------------------------------------------
+ // C O N S T R U C T O R S
+ // ------------------------------------------------------------------------
+
+
+ /**
+ * Creates a simple exception with no message.
+ */
+ public GuardianException()
+ {
+ super();
+ }
+
+
+ /**
+ * Creates a an exception with a message.
+ *
+ * @param message a message String indicating the problem
+ */
+ public GuardianException( String message )
+ {
+ super( message );
+ }
+
+
+ /**
+ * Creates a nested exception wrapping another throwable.
+ *
+ * @param nested the throwable wrapped by this ExceptionTests.
+ */
+ public GuardianException( Throwable nested )
+ {
+ super( nested );
+ }
+
+
+ /**
+ * Creates a nested exception wrapping another throwable with a message.
+ *
+ * @param message a message String indicating the problem
+ * @param nested the throwable wrapped by this ExceptionTests.
+ */
+ public GuardianException( String message, Throwable nested )
+ {
+ super( message, nested );
+ }
+}
Added: directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/NoConnectionDriverException.java
URL: http://svn.apache.org/viewvc/directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/NoConnectionDriverException.java?view=auto&rev=558849
==============================================================================
--- directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/NoConnectionDriverException.java (added)
+++ directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/NoConnectionDriverException.java Mon Jul 23 13:01:54 2007
@@ -0,0 +1,76 @@
+/*
+ * 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.directory.triplesec.guardian;
+
+
+/**
+ * A {@link GuardianException} which is thrown when no appropriate
+ * {@link ConnectionDriver} for the URL a user specified is found.
+ *
+ * @author Trustin Lee
+ * @version $Rev: 52 $, $Date: 2005-08-19 23:03:36 -0400 (Fri, 19 Aug 2005) $
+ */
+public class NoConnectionDriverException extends GuardianException
+{
+ private static final long serialVersionUID = -6051735665432589525L;
+
+
+ /**
+ * Creates a new instance.
+ */
+ public NoConnectionDriverException()
+ {
+ super();
+ }
+
+
+ /**
+ * Creates a new instance.
+ *
+ * @param message a detailed description
+ */
+ public NoConnectionDriverException( String message )
+ {
+ super(message);
+ }
+
+
+ /**
+ * Creates a new instance.
+ *
+ * @param nested the root cause of this exception
+ */
+ public NoConnectionDriverException( Throwable nested )
+ {
+ super(nested);
+ }
+
+
+ /**
+ * Creates a new instance.
+ *
+ * @param message a detailed description
+ * @param nested the root cause of this exception
+ */
+ public NoConnectionDriverException( String message, Throwable nested )
+ {
+ super(message, nested);
+ }
+}
Added: directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/Permission.java
URL: http://svn.apache.org/viewvc/directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/Permission.java?view=auto&rev=558849
==============================================================================
--- directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/Permission.java (added)
+++ directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/Permission.java Mon Jul 23 13:01:54 2007
@@ -0,0 +1,179 @@
+/*
+ * 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.directory.triplesec.guardian;
+
+import java.io.Serializable;
+
+
+/**
+ * An application permission.
+ *
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ * @author Trustin Lee
+ * @version $Rev: 71 $, $Date: 2005-11-07 19:11:39 -0500 (Mon, 07 Nov 2005) $
+ */
+public class Permission implements Comparable, Cloneable, Serializable
+{
+ private static final long serialVersionUID = -522561010304299861L;
+
+ /** the name of the permission */
+ private final String permissionName;
+ /** the name of the application this permission is associated with */
+ private final String applicationName;
+ /** a short description of the permission */
+ private final String description;
+
+
+ /**
+ * Creates a new permission instance.
+ *
+ * @param applicationName the name of the application this permission is associated with
+ * @param permissionName the permissionName of the permission
+ */
+ public Permission( String applicationName, String permissionName )
+ {
+ this( applicationName, permissionName, null );
+ }
+
+
+ /**
+ * Creates a new permission instance with description.
+ *
+ * @param applicationName the name of the application this permission is associated with
+ * @param permissionName the permissionName of the permission
+ */
+ public Permission( String applicationName, String permissionName, String description )
+ {
+ if( applicationName == null )
+ {
+ throw new NullPointerException( "applicationName" );
+ }
+ if( permissionName == null )
+ {
+ throw new NullPointerException( "permissionName" );
+ }
+ if( applicationName.length() == 0 )
+ {
+ throw new IllegalArgumentException( "applicationName is empty.");
+ }
+ if( permissionName.length() == 0 )
+ {
+ throw new IllegalArgumentException( "permissionName is empty.");
+ }
+
+ this.permissionName = permissionName;
+ this.applicationName = applicationName;
+ this.description = description;
+ }
+
+
+ /**
+ * Gets the name of this permission.
+ *
+ * @return the name
+ */
+ public String getName()
+ {
+ return permissionName;
+ }
+
+
+ /**
+ * Gets the application name this permission is defined for.
+ *
+ * @return the name of the application.
+ */
+ public String getApplicationName()
+ {
+ return applicationName;
+ }
+
+
+ /**
+ * Gets the name of this permission.
+ *
+ * @return the description
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+
+ // ------------------------------------------------------------------------
+ // Object Overrides
+ // ------------------------------------------------------------------------
+
+
+ public int hashCode()
+ {
+ return applicationName.hashCode() ^ permissionName.hashCode();
+ }
+
+
+ public boolean equals( Object that )
+ {
+ if( this == that )
+ {
+ return true;
+ }
+
+ if( that instanceof Permission )
+ {
+ Permission thatP = ( Permission ) that;
+ return this.applicationName.equals( thatP.applicationName ) &&
+ this.permissionName.equals( thatP.permissionName );
+ }
+
+ return false;
+ }
+
+
+ public int compareTo( Object that )
+ {
+ Permission thatP = ( Permission ) that;
+ int ret = this.applicationName.compareTo( thatP.applicationName );
+ if( ret != 0 )
+ {
+ return ret;
+ }
+
+ return this.permissionName.compareTo( thatP.permissionName );
+ }
+
+
+ public String toString()
+ {
+ return "Permission(" + applicationName + ": " + permissionName + ')';
+ }
+
+
+ public Object clone()
+ {
+ try
+ {
+ return super.clone();
+ }
+ catch( CloneNotSupportedException e )
+ {
+ throw new InternalError();
+ }
+ }
+}
Added: directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/Permissions.java
URL: http://svn.apache.org/viewvc/directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/Permissions.java?view=auto&rev=558849
==============================================================================
--- directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/Permissions.java (added)
+++ directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/Permissions.java Mon Jul 23 13:01:54 2007
@@ -0,0 +1,340 @@
+/*
+ * 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.directory.triplesec.guardian;
+
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+
+/**
+ * Represnets an immutable set of {@link Permission}s.
+ *
+ * @author Trustin Lee
+ * @version $Rev: 52 $, $Date: 2005-08-19 23:03:36 -0400 (Fri, 19 Aug 2005) $
+ */
+public class Permissions implements Cloneable, Serializable
+{
+ private static final long serialVersionUID = 824005229641450076L;
+ /** An empty array of {@link Permission}s which is used when <tt>null</tt> is specified */
+ private static final Permission[] EMPTY_PERMISSION_ARRAY = new Permission[0];
+
+ /** the name of application this permissions belong to */
+ private final String applicationName;
+ /** <tt>Map<String permissionName, Permission permission></tt> */
+ private final Map permissions = new HashMap();
+
+
+ /**
+ * Creates a new instance.
+ *
+ * @param applicationName The name of the application this permissions belong to
+ * @param permissions The array of {@link Permission}s that will belong to this permission set
+ */
+ public Permissions( String applicationName, Permission[] permissions )
+ {
+ // Check nulls and emptiness
+ if( applicationName == null )
+ {
+ throw new NullPointerException( "applicationName" );
+ }
+ if( applicationName.length() == 0 )
+ {
+ throw new IllegalArgumentException( "applicationName is empty." );
+ }
+ if( permissions == null )
+ {
+ permissions = EMPTY_PERMISSION_ARRAY;
+ }
+
+ this.applicationName = applicationName;
+
+ // Add all permissions while checking if application names are all
+ // same with what user specified.
+ for( int i = permissions.length - 1; i >= 0; i -- )
+ {
+ Permission p = permissions[ i ];
+ if( p == null )
+ {
+ continue;
+ }
+
+ if( !applicationName.equals( p.getApplicationName() ) )
+ {
+ throw new IllegalArgumentException( "Invalid applicationName: " + p.getApplicationName() );
+ }
+
+ this.permissions.put( p.getName(), p );
+ }
+ }
+
+
+ /**
+ * Returns the name of the application this permissions belong to
+ *
+ * @return the name of the application this permissions belong to
+ */
+ public String getApplicationName()
+ {
+ return applicationName;
+ }
+
+
+ /**
+ * Returns <tt>true</tt> if and only if this set contains the specified
+ * <tt>permission</tt>.
+ *
+ * @param permission the permission to find
+ * @return <tt>true</tt> if and only if this set contains the specified
+ * <tt>permission</tt>
+ */
+ public boolean contains( Permission permission )
+ {
+ return applicationName.equals( permission.getApplicationName() ) &&
+ permissions.containsKey( permission.getName() );
+ }
+
+
+ /**
+ * Returns <tt>true</tt> if and only if this set contains the {@link Permission}
+ * with the specified <tt>permissionName</tt>.
+ *
+ * @param permissionName the name of the permission to find
+ * @return <tt>true</tt> if and only if this set contains the specified
+ * <tt>permissionName</tt>
+ */
+ public boolean contains( String permissionName )
+ {
+ return permissions.containsKey( permissionName );
+ }
+
+
+ /**
+ * Returns <tt>true</tt> if and only if this set contains all elements of
+ * the specified <tt>permissions</tt>.
+ *
+ * @param permissions another set of permissions
+ * @return <tt>true</tt> if and only if this set contains all elements of
+ * the specified <tt>permissions</tt>
+ */
+ public boolean containsAll( Permissions permissions )
+ {
+ checkApplicationName( permissions );
+ return this.permissions.keySet().containsAll( permissions.permissions.keySet() );
+ }
+
+
+ /**
+ * Returns the {@link Permission} with the specified <tt>permissionName</tt>.
+ *
+ * @param permissionName the name of the permission to find
+ * @return <tt>null</tt> if there's no permission with the specified name
+ */
+ public Permission get( String permissionName )
+ {
+ return ( Permission ) permissions.get( permissionName );
+ }
+
+
+ /**
+ * Returns <tt>true</tt> if this set is empty.
+ *
+ * @return <tt>true</tt> if this set is empty
+ */
+ public boolean isEmpty()
+ {
+ return permissions.isEmpty();
+ }
+
+
+ /**
+ * Returns the number of elements this set contains.
+ *
+ * @return the number of elements this set contains
+ */
+ public int size()
+ {
+ return permissions.size();
+ }
+
+
+ /**
+ * Returns an {@link Iterator} that iterates all {@link Permission}s this set contains.
+ *
+ * @return an {@link Iterator} that iterates all {@link Permission}s this set contains
+ */
+ public Iterator iterator()
+ {
+ return Collections.unmodifiableCollection( permissions.values() ).iterator();
+ }
+
+
+ /**
+ * Creates a new set of {@link Permission}s which contains all elements of
+ * both this set and the specified set (OR operation). This operation never
+ * modifies this set.
+ *
+ * @param permissions a set of permissions to add
+ * @return a new set
+ */
+ public Permissions addAll( Permissions permissions )
+ {
+ checkApplicationName( permissions );
+ Permissions newPermissions = ( Permissions ) clone();
+ newPermissions.permissions.putAll( permissions.permissions );
+ return newPermissions;
+ }
+
+
+ /**
+ * Creates a new set of {@link Permission}s which contains elements of
+ * this set excluding what exists in the specified set (NAND operation).
+ * This operation never modifies this set.
+ *
+ * @param permissions a set of permissions to remove
+ * @return a new set
+ */
+ public Permissions removeAll( Permissions permissions )
+ {
+ checkApplicationName( permissions );
+ Permissions newPermissions = ( Permissions ) clone();
+ newPermissions.permissions.keySet().removeAll(
+ permissions.permissions.keySet() );
+ return newPermissions;
+ }
+
+
+ /**
+ * Creates a new set of {@link Permission}s which contains elements which
+ * exists in both this set and the specified set (AND operation). This
+ * operation never modifies this set.
+ *
+ * @param permissions a set of permissions to retain.
+ * @return a new set
+ */
+ public Permissions retainAll( Permissions permissions )
+ {
+ checkApplicationName( permissions );
+ Permissions newPermissions = ( Permissions ) clone();
+ newPermissions.permissions.keySet().retainAll(
+ permissions.permissions.keySet() );
+ return newPermissions;
+ }
+
+
+ // ------------------------------------------------------------------------
+ // Object Overrides
+ // ------------------------------------------------------------------------
+
+
+ public Object clone()
+ {
+ Permission[] permissionArray = new Permission[ size() ];
+ permissionArray = ( Permission[] ) permissions.values().toArray( permissionArray );
+ return new Permissions( applicationName, permissionArray );
+ }
+
+
+ public int hashCode()
+ {
+ return applicationName.hashCode() ^ permissions.hashCode();
+ }
+
+
+ public boolean equals( Object that )
+ {
+ if( this == that )
+ {
+ return true;
+ }
+
+ if( that instanceof Permissions )
+ {
+ Permissions thatP = ( Permissions ) that;
+ // We don't compare application name because permissions already
+ // contain it.
+ return this.permissions.equals( thatP.permissions );
+ }
+
+ return false;
+ }
+
+
+ public String toString()
+ {
+ StringBuffer buf = new StringBuffer();
+ buf.append( "Permissions(" );
+ buf.append( applicationName );
+ buf.append( ": " );
+
+ // Sort permissions by name
+ Set sortedPermissions = new TreeSet( permissions.values() );
+ Iterator i = sortedPermissions.iterator();
+
+ // Add the first one
+ if( i.hasNext() )
+ {
+ Permission p = ( Permission ) i.next();
+ buf.append( p.getName() );
+
+ // Add others
+ while( i.hasNext() )
+ {
+ p = ( Permission ) i.next();
+ buf.append( ", " );
+ buf.append( p.getName() );
+ }
+ }
+ else
+ {
+ buf.append( "empty" );
+ }
+
+ buf.append( ')' );
+
+ return buf.toString();
+ }
+
+
+ // ------------------------------------------------------------------------
+ // Private Methods
+ // ------------------------------------------------------------------------
+
+
+ /**
+ * Checks if the application name of the specified <tt>permissions</tt>
+ * equals to that of this set.
+ *
+ * @param permissions the permissions to check the application name
+ * @throws IllegalArgumentException if mismatches
+ */
+ private void checkApplicationName( Permissions permissions )
+ {
+ if( !applicationName.equals( permissions.getApplicationName() ) )
+ {
+ throw new IllegalArgumentException( "Wrong application name: " + permissions.getApplicationName() );
+ }
+ }
+}
Added: directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/PolicyChangeAdapter.java
URL: http://svn.apache.org/viewvc/directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/PolicyChangeAdapter.java?view=auto&rev=558849
==============================================================================
--- directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/PolicyChangeAdapter.java (added)
+++ directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/PolicyChangeAdapter.java Mon Jul 23 13:01:54 2007
@@ -0,0 +1,61 @@
+/*
+ * 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.directory.triplesec.guardian;
+
+
+
+
+/**
+ * An do nothing convenience adapter for a PolicyChangeListener.
+ *
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ * @version $Rev$, $Date$
+ */
+public class PolicyChangeAdapter implements PolicyChangeListener
+{
+ public void roleChanged( ApplicationPolicy policy, Role role, ChangeType changeType )
+ {
+ }
+
+
+ public void roleRenamed( ApplicationPolicy policy, Role role, String oldName )
+ {
+ }
+
+
+ public void permissionChanged( ApplicationPolicy policy, Permission permission, ChangeType changeType )
+ {
+ }
+
+
+ public void permissionRenamed( ApplicationPolicy policy, Permission permission, String oldName )
+ {
+ }
+
+
+ public void profileChanged( ApplicationPolicy policy, Profile profile, ChangeType changeType )
+ {
+ }
+
+
+ public void profileRenamed( ApplicationPolicy policy, Profile profile, String oldName )
+ {
+ }
+}
Added: directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/PolicyChangeListener.java
URL: http://svn.apache.org/viewvc/directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/PolicyChangeListener.java?view=auto&rev=558849
==============================================================================
--- directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/PolicyChangeListener.java (added)
+++ directory/triplesec/trunk/guardian-api/src/main/java/org/apache/directory/triplesec/guardian/PolicyChangeListener.java Mon Jul 23 13:01:54 2007
@@ -0,0 +1,90 @@
+/*
+ * 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.directory.triplesec.guardian;
+
+
+
+
+/**
+ * A policy change listener interested in changes to an application's access
+ * policy which is managed by TripleSec.
+ *
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ * @version $Rev$, $Date$
+ */
+public interface PolicyChangeListener
+{
+ /**
+ * Notification method called when a role is added, deleted, or modified.
+ * Another overload is used to handle rename operations on objects.
+ *
+ * @param policy the application policy containing the role
+ * @param role the role that is added, deleted or modified
+ * @param changeType the type of change: add, delete or modify.
+ */
+ void roleChanged( ApplicationPolicy policy, Role role, ChangeType changeType );
+
+ /**
+ * Notification method called when a role is renamed.
+ *
+ * @param policy the application policy containing the role
+ * @param role the role that was renamed and whose getName() returns the new name
+ * @param oldName the old name of the role
+ */
+ void roleRenamed( ApplicationPolicy policy, Role role, String oldName );
+
+ /**
+ * Notification method called when a permission is added, deleted, or modified.
+ * Another overload is used to handle rename operations on objects.
+ *
+ * @param policy the application policy containing the permission
+ * @param permission the permission that was changed
+ * @param changeType the type of change: add, delete or modify.
+ */
+ void permissionChanged( ApplicationPolicy policy, Permission permission, ChangeType changeType );
+
+ /**
+ * Notification method called when a permission is renamed.
+ *
+ * @param policy the application policy containing the permission
+ * @param permission the permission that was renamed
+ * @param oldName the old name of the permission
+ */
+ void permissionRenamed( ApplicationPolicy policy, Permission permission, String oldName );
+
+ /**
+ * Notification method called when a profile is added, deleted, or modified.
+ * Another overload is used to handle rename operations on objects.
+ *
+ * @param policy the application policy containing the profile
+ * @param profile the profile that changed
+ * @param changeType the type of change: add, delete or modify.
+ */
+ void profileChanged( ApplicationPolicy policy, Profile profile, ChangeType changeType );
+
+ /**
+ * Notification method called when a policy is renamed.
+ *
+ * @param policy the application policy containing the profile
+ * @param profile the profile that was renamed
+ * @param oldName the old name of the profile
+ */
+ void profileRenamed( ApplicationPolicy policy, Profile profile, String oldName );
+}