From 9180df3f3dae4a35f63c1b103dd502c8fbbaded0 Mon Sep 17 00:00:00 2001 From: erik Date: Tue, 13 May 2008 22:24:45 +0000 Subject: [PATCH] Moving around a lot of files to work towards production components. --- .../wamblee/usermgt}/HibernateComponent.java | 2 +- .../usermgt/UserAdministrationComponent.java | 60 +++++++++++++++++++ .../UserAdministrationLightComponent.java | 54 +++++++++++++++++ .../UserGroupRepositoryComponent.java | 4 +- .../UsermgtHibernateMappingFiles.java | 2 +- .../resources/hbm/AuthorizationRule.hbm.xml | 0 .../hbm/AuthorizationService.hbm.xml | 0 .../resources/hbm/Group.hbm.xml | 0 .../resources/hbm/OperationCondition.hbm.xml | 0 .../hbm/OperationCondition.hbm.xmlxx | 0 .../hbm/PageAuthorizationRule.hbm.xml | 0 .../resources/hbm/PathCondition.hbm.xml | 0 .../hbm/PhotoAuthorizationRule.hbm.xml | 0 .../hbm/TestAuthorizationRule.hbm.xml | 0 .../{test => main}/resources/hbm/User.hbm.xml | 0 .../resources/hbm/UserCondition.hbm.xml | 0 .../{test => main}/resources/hbm/ehcache.xml | 0 .../resources/hbm/hibernate.properties | 0 .../test.org.wamblee.security.ehcache.xml | 0 ...est.org.wamblee.security.authorization.xml | 0 .../test.org.wamblee.security.database.xml | 0 ....wamblee.security.usermgt-repositories.xml | 0 .../test.org.wamblee.security.usermgt.xml | 0 .../hibernate/AuthorizationMappingFiles.java | 2 +- .../HibernateUserAdministrationTest.java | 1 - .../hibernate/HibernateUserSetTest.java | 1 - .../UserMgtRepositoryTestContainer.java | 3 +- 27 files changed, 120 insertions(+), 9 deletions(-) rename security/src/{test/java/org/wamblee/usermgt/hibernate => main/java/org/wamblee/usermgt}/HibernateComponent.java (98%) create mode 100644 security/src/main/java/org/wamblee/usermgt/UserAdministrationComponent.java create mode 100644 security/src/main/java/org/wamblee/usermgt/UserAdministrationLightComponent.java rename security/src/{test/java/org/wamblee/usermgt/hibernate => main/java/org/wamblee/usermgt}/UserGroupRepositoryComponent.java (95%) rename security/src/{test/java/org/wamblee/usermgt => main/java/org/wamblee/usermgt/hibernate}/UsermgtHibernateMappingFiles.java (96%) rename security/src/{test => main}/resources/hbm/AuthorizationRule.hbm.xml (100%) rename security/src/{test => main}/resources/hbm/AuthorizationService.hbm.xml (100%) rename security/src/{test => main}/resources/hbm/Group.hbm.xml (100%) rename security/src/{test => main}/resources/hbm/OperationCondition.hbm.xml (100%) rename security/src/{test => main}/resources/hbm/OperationCondition.hbm.xmlxx (100%) rename security/src/{test => main}/resources/hbm/PageAuthorizationRule.hbm.xml (100%) rename security/src/{test => main}/resources/hbm/PathCondition.hbm.xml (100%) rename security/src/{test => main}/resources/hbm/PhotoAuthorizationRule.hbm.xml (100%) rename security/src/{test => main}/resources/hbm/TestAuthorizationRule.hbm.xml (100%) rename security/src/{test => main}/resources/hbm/User.hbm.xml (100%) rename security/src/{test => main}/resources/hbm/UserCondition.hbm.xml (100%) rename security/src/{test => main}/resources/hbm/ehcache.xml (100%) rename security/src/{test => main}/resources/hbm/hibernate.properties (100%) rename security/src/{test => main}/resources/properties/test.org.wamblee.security.ehcache.xml (100%) rename security/src/{test => main}/resources/spring/test.org.wamblee.security.authorization.xml (100%) rename security/src/{test => main}/resources/spring/test.org.wamblee.security.database.xml (100%) rename security/src/{test => main}/resources/spring/test.org.wamblee.security.usermgt-repositories.xml (100%) rename security/src/{test => main}/resources/spring/test.org.wamblee.security.usermgt.xml (100%) diff --git a/security/src/test/java/org/wamblee/usermgt/hibernate/HibernateComponent.java b/security/src/main/java/org/wamblee/usermgt/HibernateComponent.java similarity index 98% rename from security/src/test/java/org/wamblee/usermgt/hibernate/HibernateComponent.java rename to security/src/main/java/org/wamblee/usermgt/HibernateComponent.java index bbe1aefd..3ba1f785 100644 --- a/security/src/test/java/org/wamblee/usermgt/hibernate/HibernateComponent.java +++ b/security/src/main/java/org/wamblee/usermgt/HibernateComponent.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.wamblee.usermgt.hibernate; +package org.wamblee.usermgt; import java.io.IOException; import java.util.HashMap; diff --git a/security/src/main/java/org/wamblee/usermgt/UserAdministrationComponent.java b/security/src/main/java/org/wamblee/usermgt/UserAdministrationComponent.java new file mode 100644 index 00000000..9c11c1b4 --- /dev/null +++ b/security/src/main/java/org/wamblee/usermgt/UserAdministrationComponent.java @@ -0,0 +1,60 @@ +/* + * Copyright 2008 the original author or authors. + * + * 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.wamblee.usermgt; + +import java.io.IOException; + +import javax.sql.DataSource; + +import org.hibernate.cache.EhCacheProvider; +import org.springframework.transaction.PlatformTransactionManager; +import org.wamblee.system.adapters.DefaultContainer; +import org.wamblee.system.core.Component; +import org.wamblee.system.core.DefaultProvidedInterface; +import org.wamblee.system.core.DefaultRequiredInterface; +import org.wamblee.usermgt.hibernate.UsermgtHibernateMappingFiles; + +public class UserAdministrationComponent extends DefaultContainer { + + public UserAdministrationComponent(String aName, boolean aExposeInternals) + throws IOException { + super(aName); + addComponent("mappingFiles", new UsermgtHibernateMappingFiles()); + Component hibernate = new HibernateComponent("hibernate"); + addComponent(hibernate); + + Component repository = new UserGroupRepositoryComponent( + "usersgroups"); + addComponent(repository); + + Component usermgt = new UserAdministrationLightComponent( + "usermgtlight"); + addComponent(usermgt); + + addRequiredInterface(new DefaultRequiredInterface("datasource", + DataSource.class)); + + if (aExposeInternals) { + addProvidedInterface(new DefaultProvidedInterface( + "transactionManager", PlatformTransactionManager.class)); + addProvidedInterface(new DefaultProvidedInterface("userCache", + EhCacheProvider.class)); + } + addProvidedInterface(new DefaultProvidedInterface("usermgt", + UserAdministration.class)); + + } +} diff --git a/security/src/main/java/org/wamblee/usermgt/UserAdministrationLightComponent.java b/security/src/main/java/org/wamblee/usermgt/UserAdministrationLightComponent.java new file mode 100644 index 00000000..a030dc9c --- /dev/null +++ b/security/src/main/java/org/wamblee/usermgt/UserAdministrationLightComponent.java @@ -0,0 +1,54 @@ +/* + * Copyright 2008 the original author or authors. + * + * 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.wamblee.usermgt; + +import java.util.HashMap; +import java.util.Map; + +import org.wamblee.system.core.DefaultProvidedInterface; +import org.wamblee.system.core.DefaultRequiredInterface; +import org.wamblee.system.core.ProvidedInterface; +import org.wamblee.system.core.RequiredInterface; +import org.wamblee.system.spring.SpringComponent; + +/** + * Light version of the user administration component that requires external + * datasource, and userset and group set components, as well as an external + * hibernate session factory. + * @author Erik Brakkee + * + */ +public class UserAdministrationLightComponent extends SpringComponent { + + public UserAdministrationLightComponent(String aName) { + super(aName, new String[] { "spring/test.org.wamblee.security.usermgt.xml" }, + createProvided(), createRequired() ); + } + + private static Map createRequired() { + Map required = new HashMap(); + required.put(new DefaultRequiredInterface("userSet", UserSet.class), UserSet.class.getName()); + required.put(new DefaultRequiredInterface("groupSet", GroupSet.class), GroupSet.class.getName()); + return required; + } + + private static Map createProvided() { + Map provided = new HashMap(); + provided.put("userAdministration", new DefaultProvidedInterface("org.wamblee.usermgt.UserAdministration", + UserAdministration.class)); + return provided; + } +} diff --git a/security/src/test/java/org/wamblee/usermgt/hibernate/UserGroupRepositoryComponent.java b/security/src/main/java/org/wamblee/usermgt/UserGroupRepositoryComponent.java similarity index 95% rename from security/src/test/java/org/wamblee/usermgt/hibernate/UserGroupRepositoryComponent.java rename to security/src/main/java/org/wamblee/usermgt/UserGroupRepositoryComponent.java index 31350fc9..fa547e5d 100644 --- a/security/src/test/java/org/wamblee/usermgt/hibernate/UserGroupRepositoryComponent.java +++ b/security/src/main/java/org/wamblee/usermgt/UserGroupRepositoryComponent.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.wamblee.usermgt.hibernate; +package org.wamblee.usermgt; import java.util.HashMap; import java.util.Map; @@ -28,8 +28,6 @@ import org.wamblee.system.core.DefaultRequiredInterface; import org.wamblee.system.core.ProvidedInterface; import org.wamblee.system.core.RequiredInterface; import org.wamblee.system.spring.SpringComponent; -import org.wamblee.usermgt.GroupSet; -import org.wamblee.usermgt.UserSet; public class UserGroupRepositoryComponent extends SpringComponent { diff --git a/security/src/test/java/org/wamblee/usermgt/UsermgtHibernateMappingFiles.java b/security/src/main/java/org/wamblee/usermgt/hibernate/UsermgtHibernateMappingFiles.java similarity index 96% rename from security/src/test/java/org/wamblee/usermgt/UsermgtHibernateMappingFiles.java rename to security/src/main/java/org/wamblee/usermgt/hibernate/UsermgtHibernateMappingFiles.java index 6fcdfaf4..8d523c2e 100644 --- a/security/src/test/java/org/wamblee/usermgt/UsermgtHibernateMappingFiles.java +++ b/security/src/main/java/org/wamblee/usermgt/hibernate/UsermgtHibernateMappingFiles.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.wamblee.usermgt; +package org.wamblee.usermgt.hibernate; import java.util.Collections; diff --git a/security/src/test/resources/hbm/AuthorizationRule.hbm.xml b/security/src/main/resources/hbm/AuthorizationRule.hbm.xml similarity index 100% rename from security/src/test/resources/hbm/AuthorizationRule.hbm.xml rename to security/src/main/resources/hbm/AuthorizationRule.hbm.xml diff --git a/security/src/test/resources/hbm/AuthorizationService.hbm.xml b/security/src/main/resources/hbm/AuthorizationService.hbm.xml similarity index 100% rename from security/src/test/resources/hbm/AuthorizationService.hbm.xml rename to security/src/main/resources/hbm/AuthorizationService.hbm.xml diff --git a/security/src/test/resources/hbm/Group.hbm.xml b/security/src/main/resources/hbm/Group.hbm.xml similarity index 100% rename from security/src/test/resources/hbm/Group.hbm.xml rename to security/src/main/resources/hbm/Group.hbm.xml diff --git a/security/src/test/resources/hbm/OperationCondition.hbm.xml b/security/src/main/resources/hbm/OperationCondition.hbm.xml similarity index 100% rename from security/src/test/resources/hbm/OperationCondition.hbm.xml rename to security/src/main/resources/hbm/OperationCondition.hbm.xml diff --git a/security/src/test/resources/hbm/OperationCondition.hbm.xmlxx b/security/src/main/resources/hbm/OperationCondition.hbm.xmlxx similarity index 100% rename from security/src/test/resources/hbm/OperationCondition.hbm.xmlxx rename to security/src/main/resources/hbm/OperationCondition.hbm.xmlxx diff --git a/security/src/test/resources/hbm/PageAuthorizationRule.hbm.xml b/security/src/main/resources/hbm/PageAuthorizationRule.hbm.xml similarity index 100% rename from security/src/test/resources/hbm/PageAuthorizationRule.hbm.xml rename to security/src/main/resources/hbm/PageAuthorizationRule.hbm.xml diff --git a/security/src/test/resources/hbm/PathCondition.hbm.xml b/security/src/main/resources/hbm/PathCondition.hbm.xml similarity index 100% rename from security/src/test/resources/hbm/PathCondition.hbm.xml rename to security/src/main/resources/hbm/PathCondition.hbm.xml diff --git a/security/src/test/resources/hbm/PhotoAuthorizationRule.hbm.xml b/security/src/main/resources/hbm/PhotoAuthorizationRule.hbm.xml similarity index 100% rename from security/src/test/resources/hbm/PhotoAuthorizationRule.hbm.xml rename to security/src/main/resources/hbm/PhotoAuthorizationRule.hbm.xml diff --git a/security/src/test/resources/hbm/TestAuthorizationRule.hbm.xml b/security/src/main/resources/hbm/TestAuthorizationRule.hbm.xml similarity index 100% rename from security/src/test/resources/hbm/TestAuthorizationRule.hbm.xml rename to security/src/main/resources/hbm/TestAuthorizationRule.hbm.xml diff --git a/security/src/test/resources/hbm/User.hbm.xml b/security/src/main/resources/hbm/User.hbm.xml similarity index 100% rename from security/src/test/resources/hbm/User.hbm.xml rename to security/src/main/resources/hbm/User.hbm.xml diff --git a/security/src/test/resources/hbm/UserCondition.hbm.xml b/security/src/main/resources/hbm/UserCondition.hbm.xml similarity index 100% rename from security/src/test/resources/hbm/UserCondition.hbm.xml rename to security/src/main/resources/hbm/UserCondition.hbm.xml diff --git a/security/src/test/resources/hbm/ehcache.xml b/security/src/main/resources/hbm/ehcache.xml similarity index 100% rename from security/src/test/resources/hbm/ehcache.xml rename to security/src/main/resources/hbm/ehcache.xml diff --git a/security/src/test/resources/hbm/hibernate.properties b/security/src/main/resources/hbm/hibernate.properties similarity index 100% rename from security/src/test/resources/hbm/hibernate.properties rename to security/src/main/resources/hbm/hibernate.properties diff --git a/security/src/test/resources/properties/test.org.wamblee.security.ehcache.xml b/security/src/main/resources/properties/test.org.wamblee.security.ehcache.xml similarity index 100% rename from security/src/test/resources/properties/test.org.wamblee.security.ehcache.xml rename to security/src/main/resources/properties/test.org.wamblee.security.ehcache.xml diff --git a/security/src/test/resources/spring/test.org.wamblee.security.authorization.xml b/security/src/main/resources/spring/test.org.wamblee.security.authorization.xml similarity index 100% rename from security/src/test/resources/spring/test.org.wamblee.security.authorization.xml rename to security/src/main/resources/spring/test.org.wamblee.security.authorization.xml diff --git a/security/src/test/resources/spring/test.org.wamblee.security.database.xml b/security/src/main/resources/spring/test.org.wamblee.security.database.xml similarity index 100% rename from security/src/test/resources/spring/test.org.wamblee.security.database.xml rename to security/src/main/resources/spring/test.org.wamblee.security.database.xml diff --git a/security/src/test/resources/spring/test.org.wamblee.security.usermgt-repositories.xml b/security/src/main/resources/spring/test.org.wamblee.security.usermgt-repositories.xml similarity index 100% rename from security/src/test/resources/spring/test.org.wamblee.security.usermgt-repositories.xml rename to security/src/main/resources/spring/test.org.wamblee.security.usermgt-repositories.xml diff --git a/security/src/test/resources/spring/test.org.wamblee.security.usermgt.xml b/security/src/main/resources/spring/test.org.wamblee.security.usermgt.xml similarity index 100% rename from security/src/test/resources/spring/test.org.wamblee.security.usermgt.xml rename to security/src/main/resources/spring/test.org.wamblee.security.usermgt.xml diff --git a/security/src/test/java/org/wamblee/security/authorization/hibernate/AuthorizationMappingFiles.java b/security/src/test/java/org/wamblee/security/authorization/hibernate/AuthorizationMappingFiles.java index f77f71dc..6bd87f6c 100644 --- a/security/src/test/java/org/wamblee/security/authorization/hibernate/AuthorizationMappingFiles.java +++ b/security/src/test/java/org/wamblee/security/authorization/hibernate/AuthorizationMappingFiles.java @@ -16,7 +16,7 @@ package org.wamblee.security.authorization.hibernate; -import org.wamblee.usermgt.UsermgtHibernateMappingFiles; +import org.wamblee.usermgt.hibernate.UsermgtHibernateMappingFiles; /** * Mapping files for authorization. diff --git a/security/src/test/java/org/wamblee/usermgt/hibernate/HibernateUserAdministrationTest.java b/security/src/test/java/org/wamblee/usermgt/hibernate/HibernateUserAdministrationTest.java index 1af6e774..e9aa4688 100644 --- a/security/src/test/java/org/wamblee/usermgt/hibernate/HibernateUserAdministrationTest.java +++ b/security/src/test/java/org/wamblee/usermgt/hibernate/HibernateUserAdministrationTest.java @@ -26,7 +26,6 @@ import org.wamblee.general.BeanKernel; import org.wamblee.test.spring.TestTransactionCallbackWithoutResult; import org.wamblee.usermgt.UserAdministration; import org.wamblee.usermgt.UserAdministrationImplTest; -import org.wamblee.usermgt.UsermgtHibernateMappingFiles; import org.wamblee.usermgt.UsermgtSpringConfigFiles; /** diff --git a/security/src/test/java/org/wamblee/usermgt/hibernate/HibernateUserSetTest.java b/security/src/test/java/org/wamblee/usermgt/hibernate/HibernateUserSetTest.java index 22ed9cd5..3d6f8c54 100644 --- a/security/src/test/java/org/wamblee/usermgt/hibernate/HibernateUserSetTest.java +++ b/security/src/test/java/org/wamblee/usermgt/hibernate/HibernateUserSetTest.java @@ -36,7 +36,6 @@ import org.wamblee.usermgt.InMemoryUserSetTest; import org.wamblee.usermgt.User; import org.wamblee.usermgt.UserMgtException; import org.wamblee.usermgt.UserSet; -import org.wamblee.usermgt.UsermgtHibernateMappingFiles; import org.wamblee.usermgt.UsermgtSpringConfigFiles; /** diff --git a/security/src/test/java/org/wamblee/usermgt/hibernate/UserMgtRepositoryTestContainer.java b/security/src/test/java/org/wamblee/usermgt/hibernate/UserMgtRepositoryTestContainer.java index 028e3ed5..d5031f4e 100644 --- a/security/src/test/java/org/wamblee/usermgt/hibernate/UserMgtRepositoryTestContainer.java +++ b/security/src/test/java/org/wamblee/usermgt/hibernate/UserMgtRepositoryTestContainer.java @@ -19,7 +19,8 @@ import java.io.IOException; import org.wamblee.system.adapters.DefaultContainer; import org.wamblee.system.spring.DatabaseTesterComponent; -import org.wamblee.usermgt.UsermgtHibernateMappingFiles; +import org.wamblee.usermgt.HibernateComponent; +import org.wamblee.usermgt.UserGroupRepositoryComponent; /** * -- 2.31.1