Author: chris.laprun(a)jboss.com
Date: 2006-12-14 19:11:16 -0500 (Thu, 14 Dec 2006)
New Revision: 5865
Added:
trunk/build/ide/intellij/idea60/modules/registration/
trunk/build/ide/intellij/idea60/modules/registration/registration.iml
trunk/registration/
trunk/registration/build.bat
trunk/registration/build.sh
trunk/registration/build.xml
trunk/registration/src/
trunk/registration/src/main/
trunk/registration/src/main/org/
trunk/registration/src/main/org/jboss/
trunk/registration/src/main/org/jboss/portal/
trunk/registration/src/main/org/jboss/portal/registration/
trunk/registration/src/main/org/jboss/portal/registration/Consumer.java
trunk/registration/src/main/org/jboss/portal/registration/ConsumerCapabilities.java
trunk/registration/src/main/org/jboss/portal/registration/ConsumerGroup.java
trunk/registration/src/main/org/jboss/portal/registration/DuplicateRegistrationException.java
trunk/registration/src/main/org/jboss/portal/registration/InvalidConsumerDataException.java
trunk/registration/src/main/org/jboss/portal/registration/NoSuchRegistrationException.java
trunk/registration/src/main/org/jboss/portal/registration/Registration.java
trunk/registration/src/main/org/jboss/portal/registration/RegistrationException.java
trunk/registration/src/main/org/jboss/portal/registration/RegistrationFailedException.java
trunk/registration/src/main/org/jboss/portal/registration/RegistrationLocal.java
trunk/registration/src/main/org/jboss/portal/registration/RegistrationManager.java
trunk/registration/src/main/org/jboss/portal/registration/RegistrationPersistenceManager.java
trunk/registration/src/main/org/jboss/portal/registration/RegistrationPolicy.java
trunk/registration/src/main/org/jboss/portal/registration/RegistrationPropertyChangeListener.java
trunk/registration/src/main/org/jboss/portal/registration/RegistrationStatus.java
trunk/registration/src/main/org/jboss/portal/registration/RegistrationUtils.java
trunk/registration/src/main/org/jboss/portal/registration/impl/
trunk/registration/src/main/org/jboss/portal/registration/impl/ConsumerCapabilitiesImpl.java
trunk/registration/src/main/org/jboss/portal/registration/impl/ConsumerGroupImpl.java
trunk/registration/src/main/org/jboss/portal/registration/impl/ConsumerImpl.java
trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationImpl.java
trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationManagerImpl.java
trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationPersistenceManagerImpl.java
trunk/registration/src/main/org/jboss/portal/registration/policies/
trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPolicy.java
trunk/registration/src/main/org/jboss/portal/test/
trunk/registration/src/main/org/jboss/portal/test/registration/
trunk/registration/src/main/org/jboss/portal/test/registration/AbstractRegistrationPersistenceManagerTestCase.java
trunk/registration/src/main/org/jboss/portal/test/registration/ConsumerGroupTestCase.java
trunk/registration/src/main/org/jboss/portal/test/registration/ConsumerTestCase.java
trunk/registration/src/main/org/jboss/portal/test/registration/RegistrationManagerTestCase.java
trunk/registration/src/main/org/jboss/portal/test/registration/RegistrationPersistenceManagerTestCase.java
trunk/registration/src/main/org/jboss/portal/test/registration/RegistrationTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/LocalizedString.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfiguration.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationService.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerRegistrationRequirements.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/RegistrationConfigurationFactory.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/RegistrationPropertyDescription.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java
Removed:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/AbstractRegistrationPersistenceManagerTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerGroupTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationPersistenceManagerTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfiguration.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationService.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/RegistrationConfigurationFactory.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/
Modified:
trunk/build/build.xml
trunk/build/ide/intellij/idea60/modules/bridge/bridge.iml
trunk/build/ide/intellij/idea60/modules/cms/cms.iml
trunk/build/ide/intellij/idea60/modules/core/core.iml
trunk/build/ide/intellij/idea60/modules/identity/identity.iml
trunk/build/ide/intellij/idea60/modules/management/management.iml
trunk/build/ide/intellij/idea60/modules/test/test.iml
trunk/build/ide/intellij/idea60/modules/wsrp/wsrp.iml
trunk/core/build.xml
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumer.java
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumerGroup.java
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateStore.java
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/RegistrationStatusUserType.java
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/StateManagementPolicyImpl.java
trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
trunk/core/src/main/org/jboss/portal/test/core/state/RegistrationPersistenceManagerTestCase.java
trunk/tools/etc/buildfragments/modules.ent
trunk/wsrp/build.xml
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/config/RegistrationConfigurationTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ServiceDescriptionTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPProducer.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployment.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml
Log:
- Extracted registration to a proper module.
- Updated associated classes.
- Moved Producer configuration to a config package instead of being under registration.
- Updated build scripts and modules definition.
- Updated IDEA 6 modules.
Modified: trunk/build/build.xml
===================================================================
--- trunk/build/build.xml 2006-12-15 00:06:23 UTC (rev 5864)
+++ trunk/build/build.xml 2006-12-15 00:11:16 UTC (rev 5865)
@@ -60,10 +60,10 @@
<!--+==============================+-->
<property name="version.major" value="2"/>
- <property name="version.minor" value="4"/>
+ <property name="version.minor" value="6"/>
<property name="version.revision" value="0"/>
<property name="version.tag" value="A"/>
- <property name="version.name" value="Devil"/>
+ <property name="version.name" value="Ninja"/>
<!-- This must be set to the CVS tag for any release -->
<property name="version.cvstag" value="HEAD"/>
@@ -128,12 +128,13 @@
<module name="samples"/>
<module name="core"/>
<module name="wsrp"/>
-
- <!-- Module groups -->
+ <module name="registration"/>
+ <!-- Module groups -->
+
<group name="portal">
<include
- modules="common, test, api, faces, jems, server, security, identity,
format, portlet, federation, theme, cms, bridge, samples, wsrp, core"/>
+ modules="common, test, api, faces, jems, server, security, identity,
format, portlet, federation, theme, cms, bridge, samples, registration, wsrp,
core"/>
</group>
<group name="cms">
@@ -269,7 +270,8 @@
description="Deploy."
depends="main">
<require file="${jboss.home}/server/${portal.deploy.dir}"/>
- <copy file="../core/output/lib/jboss-portal.sar"
todir="${jboss.home}/server/${portal.deploy.dir}"
overwrite="true"/>
+ <copy file="../core/output/lib/jboss-portal.sar"
todir="${jboss.home}/server/${portal.deploy.dir}"
+ overwrite="true"/>
</target>
<target name="undeploy"
@@ -344,6 +346,9 @@
<packageset dir="../wsrp/src/generated">
<exclude name="org/jboss/portal/test/**"/>
</packageset>
+ <packageset dir="../registration/src/main">
+ <exclude name="org/jboss/portal/test/**"/>
+ </packageset>
</javadoc>
</target>
Modified: trunk/build/ide/intellij/idea60/modules/bridge/bridge.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/bridge/bridge.iml 2006-12-15 00:06:23 UTC (rev
5864)
+++ trunk/build/ide/intellij/idea60/modules/bridge/bridge.iml 2006-12-15 00:11:16 UTC (rev
5865)
@@ -50,6 +50,7 @@
</library>
</orderEntry>
<orderEntry type="module" module-name="jems" />
+ <orderEntry type="module" module-name="api" />
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/build/ide/intellij/idea60/modules/cms/cms.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/cms/cms.iml 2006-12-15 00:06:23 UTC (rev
5864)
+++ trunk/build/ide/intellij/idea60/modules/cms/cms.iml 2006-12-15 00:11:16 UTC (rev
5865)
@@ -168,6 +168,7 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module" module-name="identity" />
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/build/ide/intellij/idea60/modules/core/core.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/core/core.iml 2006-12-15 00:06:23 UTC (rev
5864)
+++ trunk/build/ide/intellij/idea60/modules/core/core.iml 2006-12-15 00:11:16 UTC (rev
5865)
@@ -256,7 +256,6 @@
<SOURCES />
</library>
</orderEntry>
- <orderEntry type="module" module-name="wsrp" />
<orderEntry type="module" module-name="api" />
<orderEntry type="module-library">
<library>
@@ -267,6 +266,7 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module" module-name="registration" />
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/build/ide/intellij/idea60/modules/identity/identity.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/identity/identity.iml 2006-12-15 00:06:23 UTC
(rev 5864)
+++ trunk/build/ide/intellij/idea60/modules/identity/identity.iml 2006-12-15 00:11:16 UTC
(rev 5865)
@@ -85,7 +85,51 @@
</library>
</orderEntry>
<orderEntry type="module" module-name="jems" />
- <orderEntry type="library" name="apacheds"
level="project" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/sun-opends/lib/OpenDS.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/jbossxb/lib/jboss-xml-binding.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-dependency.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-container.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-microcontainer.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/build/ide/intellij/idea60/modules/management/management.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/management/management.iml 2006-12-15 00:06:23
UTC (rev 5864)
+++ trunk/build/ide/intellij/idea60/modules/management/management.iml 2006-12-15 00:11:16
UTC (rev 5865)
@@ -38,6 +38,10 @@
</orderEntry>
<orderEntryProperties />
</component>
+ <component name="VcsManagerConfiguration">
+ <option name="ACTIVE_VCS_NAME" value="svn" />
+ <option name="USE_PROJECT_VCS" value="false" />
+ </component>
<component name="copyright">
<Base>
<setting name="state" value="1" />
Added: trunk/build/ide/intellij/idea60/modules/registration/registration.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/registration/registration.iml 2006-12-15
00:06:23 UTC (rev 5864)
+++ trunk/build/ide/intellij/idea60/modules/registration/registration.iml 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,231 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module version="4" relativePaths="true"
type="JAVA_MODULE">
+ <component name="ModuleRootManager" />
+ <component name="NewModuleRootManager"
inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../../../../../../registration">
+ <sourceFolder
url="file://$MODULE_DIR$/../../../../../../registration/src/main"
isTestSource="false" />
+ <sourceFolder
url="file://$MODULE_DIR$/../../../../../../registration/src/main/org/jboss/portal/test"
isTestSource="true" />
+ <excludeFolder
url="file://$MODULE_DIR$/../../../../../../registration/output" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="common" />
+ <orderEntry type="module" module-name="jems" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jbossas/core-libs/lib/jboss-common.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jbossas/core-libs/lib/jboss-system.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jbossas/core-libs/lib/jboss-jmx.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/junit/lib/junit.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntryProperties />
+ </component>
+ <component name="VcsManagerConfiguration">
+ <option name="ACTIVE_VCS_NAME" value="svn" />
+ <option name="USE_PROJECT_VCS" value="false" />
+ </component>
+ <component name="copyright">
+ <Base>
+ <setting name="state" value="1" />
+ </Base>
+ <LanguageOptions name="$TEMPLATE$">
+ <option name="templateOptions">
+ <value>
+ <option name="block" value="true" />
+ <option name="separateBefore" value="true" />
+ <option name="separateAfter" value="true" />
+ <option name="prefixLines" value="true" />
+ <option name="lenBefore" value="80" />
+ <option name="lenAfter" value="80" />
+ <option name="box" value="true" />
+ <option name="filler" value=" " />
+ </value>
+ </option>
+ <option name="notice" value="JBoss, a division of Red
Hat Copyright &#36;today.year, Red Hat Middleware, LLC, and individual
contributors as indicated by the @authors tag. See the copyright.txt in
the distribution for a full listing of individual
contributors. This is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version. This software is
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details. You
should have received a copy of the GNU Lesser General Public License along with
this software; if not, write to the Free Software Foundation, Inc., 51 Fr!
anklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
http://www.fsf.org." />
+ <option name="keyword" value="Copyright" />
+ <option name="fileTypeOverride" value="4" />
+ <option name="relativeBefore" value="true" />
+ <option name="addBlankAfter" value="true" />
+ <option name="fileLocation" value="1" />
+ <option name="useAlternate" value="false" />
+ </LanguageOptions>
+ <LanguageOptions name="CSS">
+ <option name="templateOptions">
+ <value>
+ <option name="block" value="true" />
+ <option name="separateBefore" value="false" />
+ <option name="separateAfter" value="false" />
+ <option name="prefixLines" value="true" />
+ <option name="lenBefore" value="80" />
+ <option name="lenAfter" value="80" />
+ <option name="box" value="false" />
+ <option name="filler" value=" " />
+ </value>
+ </option>
+ <option name="notice" value="Copyright (c)
&#36;today.year, Your Corporation. All Rights Reserved." />
+ <option name="keyword" value="Copyright" />
+ <option name="fileTypeOverride" value="1" />
+ <option name="relativeBefore" value="true" />
+ <option name="addBlankAfter" value="true" />
+ <option name="fileLocation" value="1" />
+ <option name="useAlternate" value="false" />
+ </LanguageOptions>
+ <LanguageOptions name="HTML">
+ <option name="templateOptions">
+ <value>
+ <option name="block" value="true" />
+ <option name="separateBefore" value="false" />
+ <option name="separateAfter" value="false" />
+ <option name="prefixLines" value="true" />
+ <option name="lenBefore" value="80" />
+ <option name="lenAfter" value="80" />
+ <option name="box" value="false" />
+ <option name="filler" value=" " />
+ </value>
+ </option>
+ <option name="notice" value="Copyright (c)
&#36;today.year, Your Corporation. All Rights Reserved." />
+ <option name="keyword" value="Copyright" />
+ <option name="fileTypeOverride" value="1" />
+ <option name="relativeBefore" value="true" />
+ <option name="addBlankAfter" value="true" />
+ <option name="fileLocation" value="1" />
+ <option name="useAlternate" value="false" />
+ </LanguageOptions>
+ <LanguageOptions name="JAVA">
+ <option name="templateOptions">
+ <value>
+ <option name="block" value="true" />
+ <option name="separateBefore" value="false" />
+ <option name="separateAfter" value="false" />
+ <option name="prefixLines" value="true" />
+ <option name="lenBefore" value="80" />
+ <option name="lenAfter" value="80" />
+ <option name="box" value="false" />
+ <option name="filler" value=" " />
+ </value>
+ </option>
+ <option name="notice" value="Copyright (c)
&#36;today.year, Your Corporation. All Rights Reserved." />
+ <option name="keyword" value="Copyright" />
+ <option name="fileTypeOverride" value="2" />
+ <option name="relativeBefore" value="true" />
+ <option name="addBlankAfter" value="true" />
+ <option name="fileLocation" value="1" />
+ <option name="useAlternate" value="false" />
+ </LanguageOptions>
+ <LanguageOptions name="JSP">
+ <option name="templateOptions">
+ <value>
+ <option name="block" value="true" />
+ <option name="separateBefore" value="false" />
+ <option name="separateAfter" value="false" />
+ <option name="prefixLines" value="true" />
+ <option name="lenBefore" value="80" />
+ <option name="lenAfter" value="80" />
+ <option name="box" value="false" />
+ <option name="filler" value=" " />
+ </value>
+ </option>
+ <option name="notice" value="Copyright (c)
&#36;today.year, Your Corporation. All Rights Reserved." />
+ <option name="keyword" value="Copyright" />
+ <option name="fileTypeOverride" value="1" />
+ <option name="relativeBefore" value="true" />
+ <option name="addBlankAfter" value="true" />
+ <option name="fileLocation" value="1" />
+ <option name="useAlternate" value="false" />
+ </LanguageOptions>
+ <LanguageOptions name="JavaScript">
+ <option name="templateOptions">
+ <value>
+ <option name="block" value="true" />
+ <option name="separateBefore" value="false" />
+ <option name="separateAfter" value="false" />
+ <option name="prefixLines" value="true" />
+ <option name="lenBefore" value="80" />
+ <option name="lenAfter" value="80" />
+ <option name="box" value="false" />
+ <option name="filler" value=" " />
+ </value>
+ </option>
+ <option name="notice" value="Copyright (c)
&#36;today.year, Your Corporation. All Rights Reserved." />
+ <option name="keyword" value="Copyright" />
+ <option name="fileTypeOverride" value="1" />
+ <option name="relativeBefore" value="true" />
+ <option name="addBlankAfter" value="true" />
+ <option name="fileLocation" value="1" />
+ <option name="useAlternate" value="false" />
+ </LanguageOptions>
+ <LanguageOptions name="Properties">
+ <option name="templateOptions">
+ <value>
+ <option name="block" value="true" />
+ <option name="separateBefore" value="false" />
+ <option name="separateAfter" value="false" />
+ <option name="prefixLines" value="true" />
+ <option name="lenBefore" value="80" />
+ <option name="lenAfter" value="80" />
+ <option name="box" value="false" />
+ <option name="filler" value=" " />
+ </value>
+ </option>
+ <option name="notice" value="Copyright (c)
&#36;today.year, Your Corporation. All Rights Reserved." />
+ <option name="keyword" value="Copyright" />
+ <option name="fileTypeOverride" value="1" />
+ <option name="relativeBefore" value="true" />
+ <option name="addBlankAfter" value="true" />
+ <option name="fileLocation" value="1" />
+ <option name="useAlternate" value="false" />
+ </LanguageOptions>
+ <LanguageOptions name="XML">
+ <option name="templateOptions">
+ <value>
+ <option name="block" value="true" />
+ <option name="separateBefore" value="false" />
+ <option name="separateAfter" value="false" />
+ <option name="prefixLines" value="true" />
+ <option name="lenBefore" value="80" />
+ <option name="lenAfter" value="80" />
+ <option name="box" value="false" />
+ <option name="filler" value=" " />
+ </value>
+ </option>
+ <option name="notice" value="Copyright (c)
&#36;today.year, Your Corporation. All Rights Reserved." />
+ <option name="keyword" value="Copyright" />
+ <option name="fileTypeOverride" value="2" />
+ <option name="relativeBefore" value="true" />
+ <option name="addBlankAfter" value="true" />
+ <option name="fileLocation" value="1" />
+ <option name="useAlternate" value="false" />
+ </LanguageOptions>
+ </component>
+</module>
+
Modified: trunk/build/ide/intellij/idea60/modules/test/test.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/test/test.iml 2006-12-15 00:06:23 UTC (rev
5864)
+++ trunk/build/ide/intellij/idea60/modules/test/test.iml 2006-12-15 00:11:16 UTC (rev
5865)
@@ -281,7 +281,15 @@
<SOURCES />
</library>
</orderEntry>
- <orderEntry type="library" name="apacheds"
level="project" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/sun-opends/lib/OpenDS.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/build/ide/intellij/idea60/modules/wsrp/wsrp.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/wsrp/wsrp.iml 2006-12-15 00:06:23 UTC (rev
5864)
+++ trunk/build/ide/intellij/idea60/modules/wsrp/wsrp.iml 2006-12-15 00:11:16 UTC (rev
5865)
@@ -149,15 +149,6 @@
<orderEntry type="module-library">
<library>
<CLASSES>
- <root
url="jar://$MODULE_DIR$/../../../../../../../intuit/spc-foundations-nonPortableJava-2.0.0.0.jar!/"
/>
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
<root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-httpclient/lib/commons-httpclient.jar!/"
/>
</CLASSES>
<JAVADOC />
@@ -165,6 +156,7 @@
</library>
</orderEntry>
<orderEntry type="module" module-name="jems" />
+ <orderEntry type="module" module-name="registration" />
<orderEntryProperties />
<javadoc-paths>
<root
url="http://java.sun.com/j2ee/1.4/docs/api/" />
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2006-12-15 00:06:23 UTC (rev 5864)
+++ trunk/core/build.xml 2006-12-15 00:11:16 UTC (rev 5865)
@@ -123,7 +123,7 @@
<path refid="jboss.portal-faces.classpath"/>
<path refid="jboss.portal-cms.classpath"/>
<path refid="jboss.portal-server.classpath"/>
- <path refid="jboss.portal-wsrp.classpath"/>
+ <path refid="jboss.portal-registration.classpath"/>
<path refid="jboss.portal-portlet.classpath"/>
<path refid="jboss.portal-jems.classpath"/>
<path refid="jboss.portal-federation.classpath"/>
@@ -353,7 +353,7 @@
<fileset dir="${jboss.portal-security.root}/lib"
includes="portal-security-lib.jar"/>
<fileset dir="${jboss.portal-samples.root}/lib"
includes="portal-samples-lib.jar"/>
<fileset dir="${jboss.portal-identity.root}/lib"
includes="portal-identity-lib.jar"/>
- <fileset dir="${jboss.portal-wsrp.root}/lib"
includes="portal-wsrp-lib.jar"/>
+ <fileset dir="${jboss.portal-registration.root}/lib"
includes="portal-registration-lib.jar"/>
<fileset dir="${ehcache.ehcache.lib}"
includes="ehcache.jar"/>
<fileset dir="${apache.collections.lib}"
includes="commons-collections.jar"/>
<fileset dir="${facelets.facelets.lib}"
includes="jsf-facelets.jar"/>
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumer.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumer.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumer.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -22,17 +22,17 @@
******************************************************************************/
package org.jboss.portal.core.impl.portlet.state;
-import org.jboss.portal.wsrp.producer.registration.api.Consumer;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
-import org.jboss.portal.wsrp.producer.registration.api.ConsumerCapabilities;
-import org.jboss.portal.wsrp.producer.registration.api.DuplicateRegistrationException;
+import org.jboss.portal.registration.Consumer;
+import org.jboss.portal.registration.ConsumerCapabilities;
+import org.jboss.portal.registration.ConsumerGroup;
+import org.jboss.portal.registration.DuplicateRegistrationException;
+import org.jboss.portal.registration.RegistrationException;
+import org.jboss.portal.registration.RegistrationStatus;
import java.util.Collection;
import java.util.Collections;
-import java.util.Set;
import java.util.HashSet;
+import java.util.Set;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -71,9 +71,7 @@
this.persistentAgent = null;
}
- /**
- * Hibernate constructor.
- */
+ /** Hibernate constructor. */
PersistentConsumer()
{
this.key = null;
@@ -196,7 +194,7 @@
public void setCapabilities(ConsumerCapabilities capabilities)
{
-
+
}
public void setGroup(ConsumerGroup group) throws RegistrationException,
DuplicateRegistrationException
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumerGroup.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumerGroup.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumerGroup.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -22,17 +22,17 @@
******************************************************************************/
package org.jboss.portal.core.impl.portlet.state;
-import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.Consumer;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
-import org.jboss.portal.jems.hibernate.ContextObject;
import org.hibernate.Session;
+import org.jboss.portal.jems.hibernate.ContextObject;
+import org.jboss.portal.registration.Consumer;
+import org.jboss.portal.registration.ConsumerGroup;
+import org.jboss.portal.registration.RegistrationException;
+import org.jboss.portal.registration.RegistrationStatus;
import java.util.Collection;
-import java.util.Map;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -64,9 +64,7 @@
this.context = context;
}
- /**
- * Hibernate constructor.
- */
+ /** Hibernate constructor. */
PersistentConsumerGroup()
{
this.key = null;
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -22,15 +22,15 @@
******************************************************************************/
package org.jboss.portal.core.impl.portlet.state;
-import org.jboss.portal.wsrp.producer.registration.api.Registration;
-import org.jboss.portal.wsrp.producer.registration.api.Consumer;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
-import org.jboss.portal.common.util.TypedMap;
import org.jboss.portal.common.NotYetImplemented;
+import org.jboss.portal.common.util.TypedMap;
+import org.jboss.portal.registration.Consumer;
+import org.jboss.portal.registration.Registration;
+import org.jboss.portal.registration.RegistrationStatus;
import javax.xml.namespace.QName;
-import java.util.Map;
import java.util.Collections;
+import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -54,9 +54,7 @@
private Properties properties;
- /**
- * Hibernate constructor.
- */
+ /** Hibernate constructor. */
PersistentRegistration()
{
this.key = null;
@@ -235,9 +233,7 @@
// ***********
- /**
- * Implement registration properties semantics, mostly validation and equality.
- */
+ /** Implement registration properties semantics, mostly validation and equality. */
public class Properties extends TypedMap
{
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateStore.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateStore.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateStore.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -34,19 +34,19 @@
import org.jboss.portal.portlet.state.SimplePropertyMap;
import org.jboss.portal.portlet.state.producer.ProducerPersistenceManager;
import org.jboss.portal.portlet.state.producer.ProducerStateContext;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationPersistenceManager;
-import org.jboss.portal.wsrp.producer.registration.api.Consumer;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
-import org.jboss.portal.wsrp.producer.registration.api.Registration;
-import org.jboss.portal.wsrp.producer.registration.api.NoSuchRegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
-import org.jboss.portal.wsrp.producer.registration.api.DuplicateRegistrationException;
+import org.jboss.portal.registration.Consumer;
+import org.jboss.portal.registration.ConsumerGroup;
+import org.jboss.portal.registration.DuplicateRegistrationException;
+import org.jboss.portal.registration.NoSuchRegistrationException;
+import org.jboss.portal.registration.Registration;
+import org.jboss.portal.registration.RegistrationException;
+import org.jboss.portal.registration.RegistrationPersistenceManager;
+import org.jboss.portal.registration.RegistrationStatus;
import javax.naming.InitialContext;
+import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
-import java.util.Collection;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/RegistrationStatusUserType.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/RegistrationStatusUserType.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/RegistrationStatusUserType.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -22,15 +22,15 @@
******************************************************************************/
package org.jboss.portal.core.impl.portlet.state;
+import org.hibernate.Hibernate;
+import org.hibernate.HibernateException;
import org.hibernate.usertype.UserType;
-import org.hibernate.HibernateException;
-import org.hibernate.Hibernate;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
+import org.jboss.portal.registration.RegistrationStatus;
+import java.io.Serializable;
+import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-import java.sql.PreparedStatement;
-import java.io.Serializable;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/StateManagementPolicyImpl.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/StateManagementPolicyImpl.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/StateManagementPolicyImpl.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -22,14 +22,14 @@
******************************************************************************/
package org.jboss.portal.core.impl.portlet.state;
+import org.jboss.portal.portlet.aspects.portlet.LocalInterceptor;
import org.jboss.portal.portlet.state.StateManagementPolicy;
-import org.jboss.portal.portlet.aspects.portlet.LocalInterceptor;
-import org.jboss.portal.wsrp.producer.registration.RegistrationLocal;
-import org.jboss.portal.wsrp.producer.registration.api.Registration;
+import org.jboss.portal.registration.Registration;
+import org.jboss.portal.registration.RegistrationLocal;
/**
- * An implementation that rely on thread local context to make up its decision. State is
locally persisted
- * only for the local portal or for wsrp invocations in the context of a registration.
+ * An implementation that rely on thread local context to make up its decision. State is
locally persisted only for the
+ * local portal or for wsrp invocations in the context of a registration.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
Modified: trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java 2006-12-15
00:06:23 UTC (rev 5864)
+++ trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -29,21 +29,20 @@
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
+import org.hibernate.Session;
import org.jboss.portal.Mode;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
import org.jboss.portal.common.junit.TransactionAssert;
import org.jboss.portal.common.test.TestParametrization;
import org.jboss.portal.common.test.junit.JUnitAdapter;
import org.jboss.portal.common.test.junit.POJOJUnitTest;
import org.jboss.portal.common.value.StringValue;
+import org.jboss.portal.core.impl.portlet.state.PersistentConsumer;
+import org.jboss.portal.core.impl.portlet.state.PersistentRegistration;
import org.jboss.portal.core.impl.portlet.state.PersistentStateStore;
import org.jboss.portal.core.impl.portlet.state.ProducerPortletInvoker;
-import org.jboss.portal.core.impl.portlet.state.PersistentRegistration;
-import org.jboss.portal.core.impl.portlet.state.PersistentConsumer;
import org.jboss.portal.portlet.NoSuchPortletException;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletContext;
-import org.jboss.portal.portlet.support.info.PreferencesInfoSupport;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -55,22 +54,23 @@
import org.jboss.portal.portlet.state.SimplePropertyMap;
import org.jboss.portal.portlet.state.producer.ProducerState;
import org.jboss.portal.portlet.state.producer.ProducerStateContext;
+import org.jboss.portal.portlet.support.info.PreferencesInfoSupport;
import org.jboss.portal.portlet.test.ActionContextImpl;
import org.jboss.portal.portlet.test.InstanceContextImpl;
import org.jboss.portal.portlet.test.UserContextImpl;
import org.jboss.portal.portlet.test.ValueMapAssert;
import org.jboss.portal.portlet.test.support.PortletInvokerSupport;
import org.jboss.portal.portlet.test.support.PortletSupport;
+import org.jboss.portal.registration.RegistrationStatus;
import org.jboss.portal.test.framework.TestRuntimeContext;
import org.jboss.portal.test.framework.embedded.DataSourceSupport;
import org.jboss.portal.test.framework.embedded.HibernateSupport;
-import org.hibernate.Session;
import javax.xml.namespace.QName;
import java.net.URL;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
-import java.util.HashMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Modified:
trunk/core/src/main/org/jboss/portal/test/core/state/RegistrationPersistenceManagerTestCase.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/test/core/state/RegistrationPersistenceManagerTestCase.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/core/src/main/org/jboss/portal/test/core/state/RegistrationPersistenceManagerTestCase.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -25,19 +25,19 @@
import junit.framework.TestSuite;
import org.apache.log4j.Appender;
import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
-import org.apache.log4j.Logger;
-import org.apache.log4j.Level;
+import org.jboss.portal.common.junit.TransactionAssert;
import org.jboss.portal.common.test.TestParametrization;
import org.jboss.portal.common.test.junit.JUnitAdapter;
import org.jboss.portal.common.test.junit.POJOJUnitTest;
-import org.jboss.portal.common.junit.TransactionAssert;
+import org.jboss.portal.core.impl.portlet.state.PersistentStateStore;
+import org.jboss.portal.registration.RegistrationPersistenceManager;
+import org.jboss.portal.test.framework.TestRuntimeContext;
import org.jboss.portal.test.framework.embedded.DataSourceSupport;
import org.jboss.portal.test.framework.embedded.HibernateSupport;
-import org.jboss.portal.test.framework.TestRuntimeContext;
-import
org.jboss.portal.test.wsrp.registration.AbstractRegistrationPersistenceManagerTestCase;
-import org.jboss.portal.core.impl.portlet.state.PersistentStateStore;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationPersistenceManager;
+import
org.jboss.portal.test.registration.AbstractRegistrationPersistenceManagerTestCase;
import java.net.URL;
Added: trunk/registration/build.bat
===================================================================
--- trunk/registration/build.bat 2006-12-15 00:06:23 UTC (rev 5864)
+++ trunk/registration/build.bat 2006-12-15 00:11:16 UTC (rev 5865)
@@ -0,0 +1,54 @@
+@echo off
+rem
+rem Invokes a script of the same name in the 'tools' module.
+rem
+rem The 'tools' module is expected to be a peer directory of the directory
+rem in which this script lives.
+rem
+rem @author Jason Dillon <jason(a)planet57.com>
+rem
+
+rem $Id: build.bat 2 2005-01-14 23:01:32Z vietj $
+
+setlocal
+
+set PROGNAME=%~nx0
+set DIRNAME=%~dp0
+
+rem Legacy shell support
+if x%PROGNAME%==x set PROGNAME=build.bat
+if x%DIRNAME%==x set DIRNAME=.\
+
+set MODULE_ROOT=%DIRNAME%
+if x%TOOLS_ROOT%==x set TOOLS_ROOT=%DIRNAME%..\tools
+set TARGET=%TOOLS_ROOT%\bin\build.bat
+set ARGS=%*
+
+rem Start'er up yo
+goto main
+
+:debug
+if not x%DEBUG%==x echo %PROGNAME%: %*
+goto :EOF
+
+:main
+call :debug PROGNAME=%PROGNAME%
+call :debug DIRNAME=%DIRNAME%
+call :debug TOOLS_ROOT=%TOOLS_ROOT%
+call :debug TARGET=%TARGET%
+
+if exist %TARGET% call :call-script & goto :EOF
+rem else fail, we can not go on
+
+echo %PROGNAME%: *ERROR* The target executable does not exist:
+echo %PROGNAME%:
+echo %PROGNAME%: %TARGET%
+echo %PROGNAME%:
+echo %PROGNAME%: Please make sure you have checked out the 'tools' module
+echo %PROGNAME%: and make sure it is up to date.
+goto :EOF
+
+:call-script
+call :debug Executing %TARGET% %ARGS%
+call %TARGET% %ARGS%
+goto :EOF
Property changes on: trunk/registration/build.bat
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/registration/build.sh
===================================================================
--- trunk/registration/build.sh 2006-12-15 00:06:23 UTC (rev 5864)
+++ trunk/registration/build.sh 2006-12-15 00:11:16 UTC (rev 5865)
@@ -0,0 +1,49 @@
+#!/bin/sh
+##
+## Invokes a script of the same name in the 'tools' module.
+##
+## The 'tools' module is expected to be a peer directory of the directory
+## in which this script lives.
+##
+## @author Jason Dillon <jason(a)planet57.com>
+##
+
+# $Id: build.sh 2 2005-01-14 23:01:32Z vietj $
+
+PROGNAME=`basename $0`
+DIRNAME=`dirname $0`
+
+# Buss it yo
+main() {
+ if [ "x$TOOLS_ROOT" = "x" ]; then
+ TOOLS_ROOT=`cd $DIRNAME/../tools && pwd`
+ fi
+
+ MODULE_ROOT=`cd $DIRNAME; pwd`
+ export TOOLS_ROOT MODULE_ROOT DEBUG TRACE
+
+ # Where is the target script?
+ target="$TOOLS_ROOT/bin/$PROGNAME"
+ if [ ! -f "$target" ]; then
+ echo "${PROGNAME}: *ERROR* The target executable does not exist:"
+ echo "${PROGNAME}:"
+ echo "${PROGNAME}: $target"
+ echo "${PROGNAME}:"
+ echo "${PROGNAME}: Please make sure you have checked out the 'tools'
module"
+ echo "${PROGNAME}: and make sure it is up to date."
+ exit 2
+ fi
+
+ # Get busy yo!
+ if [ "x$DEBUG" != "x" ]; then
+ echo "${PROGNAME}: Executing: /bin/sh $target $@"
+ fi
+ if [ "x$TRACE" = "x" ]; then
+ exec /bin/sh $target "$@"
+ else
+ exec /bin/sh -x $target "$@"
+ fi
+}
+
+# Lets get ready to rumble!
+main "$@"
Property changes on: trunk/registration/build.sh
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:eol-style
+ native
Added: trunk/registration/build.xml
===================================================================
--- trunk/registration/build.xml 2006-12-15 00:06:23 UTC (rev 5864)
+++ trunk/registration/build.xml 2006-12-15 00:11:16 UTC (rev 5865)
@@ -0,0 +1,232 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE project [
+ <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
+ <!ENTITY buildmagic SYSTEM
"../tools/etc/buildfragments/buildmagic.ent">
+ <!ENTITY tools SYSTEM "../tools/etc/buildfragments/tools.ent">
+ <!ENTITY modules SYSTEM "../tools/etc/buildfragments/modules.ent">
+ <!ENTITY defaults SYSTEM
"../tools/etc/buildfragments/defaults.ent">
+ <!ENTITY targets SYSTEM "../tools/etc/buildfragments/targets.ent">
+ ]>
+
+<!-- $Id: build.xml 5441 2006-10-13 13:25:44 -0400 (Fri, 13 Oct 2006)
chris.laprun(a)jboss.com $ -->
+
+<!--+======================================================================+-->
+<!--| JBoss Portal (The OpenSource Portal) Build File |-->
+<!--| |-->
+<!--| Distributable under LGPL license. |-->
+<!--| See terms of license at
http://www.gnu.org. |-->
+<!--| |-->
+<!--| This file has been designed to work with the 'tools' module and
|-->
+<!--| Buildmagic extentions. |-->
+<!--+======================================================================+-->
+
+<project default="main" name="JBoss Portal Registration">
+
+ <!--+====================================================================+-->
+ <!--| Setup |-->
+ <!--| |-->
+ <!--| Include the common build elements. |-->
+ <!--| |-->
+ <!--| This defines several different targets, properties and paths. |-->
+ <!--| It also sets up the basic extention tasks amoung other things. |-->
+ <!--+====================================================================+-->
+
+ &buildmagic;
+
+ &modules;
+ &defaults;
+ &tools;
+ &targets;
+
+ <!-- ================================================================== -->
+ <!-- Initialization -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Initialize the build system. Must depend on '_buildmagic:init'.
+ | Other targets should depend on 'init' or things will mysteriously fail.
+ -->
+
+ <target name="init" unless="init.disable"
depends="_buildmagic:init">
+ </target>
+
+ <!--+====================================================================+-->
+ <!--| Configuration |-->
+ <!--| |-->
+ <!--| This target is invoked by the Buildmagic initialization logic |-->
+ <!--| and should contain module specific configuration elements. |-->
+ <!--+====================================================================+-->
+
+ <target name="configure" unless="configure.disable">
+
+ <!-- Configure some properties -->
+ <property name="jboss-junit-configuration" value=""/>
+ <property name="junit.formatter.usefile" value="true"/>
+
+ <!-- Configure thirdparty libraries -->
+ &libraries;
+ <path id="library.classpath">
+ <path refid="junit.junit.classpath"/>
+ <path refid="oswego.concurrent.classpath"/>
+ <path refid="jbossas/core.libs.classpath"/>
+ </path>
+
+ <!-- Configure modules -->
+ <call target="configure-modules"/>
+ <path id="dependentmodule.classpath">
+ <path refid="jboss.portal-common.classpath"/>
+ <path refid="jboss.portal-jems.classpath"/>
+ </path>
+
+ <!--+=======================================+-->
+ <!--| Override any default properties here. |-->
+ <!--+=======================================+-->
+
+ <!-- Configure defaults & build tools -->
+ <call target="configure-defaults"/>
+ <call target="configure-tools"/>
+
+ <property name="log.dir" value="${module.output}/logs"/>
+ <property name="reports.dir"
value="${module.output}/reports"/>
+ <property name="test.reports"
value="${module.output}/tests"/>
+ <property name="build.lib.test"
value="${build.lib}/tests"/>
+ </target>
+
+ <!--+====================================================================+-->
+ <!--| Compile |-->
+ <!--| |-->
+ <!--| This target should depend on other compile-* targets for each |-->
+ <!--| different type of compile that needs to be performed, short of |-->
+ <!--| documentation compiles. |-->
+ <!--+====================================================================+-->
+
+ <target name="compile"
+ description="Compile all source files."
+ depends="_default:compile-classes,
+ _default:compile-etc,
+ _default:compile-resources">
+ <!-- Add module specific elements here. -->
+ </target>
+
+ <!--+====================================================================+-->
+ <!--| Generate Output |-->
+ <!--| |-->
+ <!--| Generates the target output for this module. Target output is |-->
+ <!--| the output which is ment to be released or used by external |-->
+ <!--| modules. |-->
+ <!--+====================================================================+-->
+
+ <target name="output"
+ description="Generate all target output."
+ depends="compile">
+
+ <mkdir dir="${build.lib}"/>
+
+ <jar jarfile="${build.lib}/portal-registration-lib.jar">
+ <fileset dir="${build.classes}"
includes="org/jboss/portal/registration/**"/>
+ </jar>
+
+ <jar jarfile="${build.lib}/portal-registration-test-lib.jar">
+ <fileset dir="${build.classes}"
includes="org/jboss/portal/test/registration/**"/>
+ </jar>
+
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Cleaning -->
+ <!-- ================================================================== -->
+
+ <!-- Clean up all build output -->
+ <target name="clean" depends="_default:clean">
+ <!-- Add module specific elements here. -->
+ </target>
+
+ <!--+====================================================================+-->
+ <!--| Documents |-->
+ <!--| |-->
+ <!--| Generate all documentation for this module. |-->
+ <!--+====================================================================+-->
+
+ <target name="docs" depends="_default:docs">
+ <!-- Add module specific elements here. -->
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Misc. -->
+ <!-- ================================================================== -->
+
+ <target name="main" depends="most"/>
+ <target name="all" depends="_default:all"/>
+ <target name="most" depends="_default:most"/>
+ <target name="help" depends="_default:help"/>
+
+ <!-- Registration tests -->
+ <target name="registration-test" depends="output">
+ <execute-tests>
+ <x-test>
+ <test todir="${test.reports}"
+
name="org.jboss.portal.test.registration.RegistrationPersistenceManagerTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.registration.ConsumerTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.registration.ConsumerGroupTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.registration.RegistrationManagerTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.registration.RegistrationTestCase"/>
+ </x-test>
+ <x-sysproperty>
+ <!--<jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xnoagent"/>
+ <jvmarg value="-Djava.compiler=NONE"/>
+ <jvmarg
value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787"/>-->
+ <sysproperty key="test.root"
value="${build.lib}/tests"/>
+ </x-sysproperty>
+ <x-classpath>
+ <fileset dir="${build.lib}"
includes="portal-registration-lib.jar"/>
+ <fileset dir="${build.lib.test}"
includes="portal-registration-test-lib.jar"/>
+ <path refid="library.classpath"/>
+ <path refid="dependentmodule.classpath"/>
+ </x-classpath>
+ </execute-tests>
+ </target>
+
+ <target name="reports">
+ <junitreport todir="${reports.dir}">
+ <fileset dir="${test.reports}">
+ <include name="TEST-*.xml"/>
+ </fileset>
+ <report format="frames" todir="${reports.dir}"/>
+ </junitreport>
+ </target>
+
+ <target name="clean-test">
+ <!-- remove generated test xml files -->
+ <delete dir="${reports.dir}"/>
+ <delete file="tests.log"/>
+ <delete file="output.log"/>
+ </target>
+
+ <target name="tests" depends="clean-test">
+ <antcall target="registration-test"/>
+ </target>
+</project>
Property changes on: trunk/registration/build.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/registration/src/main/org/jboss/portal/registration/Consumer.java
===================================================================
--- trunk/registration/src/main/org/jboss/portal/registration/Consumer.java 2006-12-15
00:06:23 UTC (rev 5864)
+++ trunk/registration/src/main/org/jboss/portal/registration/Consumer.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,93 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.registration;
+
+import java.util.Collection;
+
+/**
+ * An entity that groups several registrations under the same scope, for exemple a
Consumer entity could be related to
+ * several registrations for the same consumer with different capabilities.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision:5641 $
+ * @since 2.6
+ */
+public interface Consumer
+{
+
+ /**
+ * Return the consumer name.
+ *
+ * @return the consumer name
+ */
+ String getName();
+
+ /**
+ * Return the registration status of the consumer entity.
+ *
+ * @return the registration stats.
+ */
+ RegistrationStatus getStatus();
+
+ /**
+ * Set the registration status of the consumer entity.
+ *
+ * @param status the registration status
+ */
+ void setStatus(RegistrationStatus status);
+
+ /**
+ * Return all the registrations for the specified consumer.
+ *
+ * @return the consumer registrations
+ * @throws RegistrationException
+ */
+ Collection getRegistrations() throws RegistrationException;
+
+ /**
+ * Returns the group that this consumer belongs to.
+ *
+ * @return the consumer group
+ */
+ ConsumerGroup getGroup();
+
+ /**
+ * Retrieves this Consumer's identity, which uniquely identifies the Consumer
since the name cannot be relied on. It
+ * is up to the {@link RegistrationPolicy} to determine what the Consumer's
identity is. Note also that this is
+ * different from the Consumer's database identifier.
+ *
+ * @return this Consumer's identity.
+ */
+ String getId();
+
+ ConsumerCapabilities getCapabilities();
+
+ void setCapabilities(ConsumerCapabilities capabilities);
+
+ void setGroup(ConsumerGroup group) throws RegistrationException,
DuplicateRegistrationException;
+
+ String getConsumerAgent();
+
+ void setConsumerAgent(String consumerAgent) throws IllegalArgumentException,
IllegalStateException;
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/Consumer.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/registration/ConsumerCapabilities.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/ConsumerCapabilities.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/ConsumerCapabilities.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,54 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.registration;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public interface ConsumerCapabilities
+{
+ boolean supportsGetMethod();
+
+ List getSupportedModes();
+
+ List getSupportedWindowStates();
+
+ List getSupportedUserScopes();
+
+ List getSupportedUserProfileData();
+
+ void setSupportsGetMethod(boolean supportsGetMethod);
+
+ void setSupportedModes(List supportedModes);
+
+ void setSupportedWindowStates(List supportedWindowStates);
+
+ void setSupportedUserScopes(List supportedUserScopes);
+
+ void setSupportedUserProfileData(List supportedUserProfileData);
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/ConsumerCapabilities.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: trunk/registration/src/main/org/jboss/portal/registration/ConsumerGroup.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/ConsumerGroup.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/ConsumerGroup.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.registration;
+
+import java.util.Collection;
+
+/**
+ * A business entity that is related to several consumers.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public interface ConsumerGroup
+{
+
+ /**
+ * Return this ConsumerGroup's name (i.e. the name of the the business entity
aggregating the associated consumers)
+ *
+ * @return the ConsumerGroup's name
+ */
+ String getName();
+
+ /**
+ * Return a collection of associated consumers.
+ *
+ * @return the consumer collection
+ * @throws RegistrationException
+ */
+ Collection getConsumers() throws RegistrationException;
+
+ /**
+ * Return the member Consumer associated with the given identifier
+ *
+ * @param consumerId
+ * @return the Consumer associated with the identity or <code>null</code>
if no such Consumer is part of this
+ * ConsumerGroup
+ * @throws IllegalArgumentException if the consumer identity is null
+ * @throws RegistrationException
+ */
+ Consumer getConsumer(String consumerId) throws IllegalArgumentException,
RegistrationException;
+
+ void addConsumer(Consumer consumer) throws RegistrationException;
+
+ void removeConsumer(Consumer consumer) throws RegistrationException;
+
+ boolean contains(Consumer consumer);
+
+ boolean isEmpty();
+
+ RegistrationStatus getStatus();
+
+ void setStatus(RegistrationStatus status);
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/ConsumerGroup.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/registration/DuplicateRegistrationException.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/DuplicateRegistrationException.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/DuplicateRegistrationException.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.registration;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision:5641 $
+ */
+public class DuplicateRegistrationException extends RegistrationException
+{
+ public DuplicateRegistrationException()
+ {
+ }
+
+ public DuplicateRegistrationException(String message)
+ {
+ super(message);
+ }
+
+ public DuplicateRegistrationException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public DuplicateRegistrationException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/DuplicateRegistrationException.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/registration/InvalidConsumerDataException.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/InvalidConsumerDataException.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/InvalidConsumerDataException.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,33 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.registration;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class InvalidConsumerDataException extends RegistrationException
+{
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/InvalidConsumerDataException.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/registration/NoSuchRegistrationException.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/NoSuchRegistrationException.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/NoSuchRegistrationException.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,49 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.registration;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision:5641 $
+ */
+public class NoSuchRegistrationException extends RegistrationException
+{
+ public NoSuchRegistrationException()
+ {
+ }
+
+ public NoSuchRegistrationException(String message)
+ {
+ super(message);
+ }
+
+ public NoSuchRegistrationException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public NoSuchRegistrationException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/NoSuchRegistrationException.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: trunk/registration/src/main/org/jboss/portal/registration/Registration.java
===================================================================
--- trunk/registration/src/main/org/jboss/portal/registration/Registration.java 2006-12-15
00:06:23 UTC (rev 5864)
+++ trunk/registration/src/main/org/jboss/portal/registration/Registration.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,109 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.registration;
+
+import javax.xml.namespace.QName;
+import java.util.Map;
+
+/**
+ * A class representing an association between a consumer and a producer.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public interface Registration
+{
+ /**
+ * Retrieves the internal identifier for this Registration. This will correspond to
the database key for this
+ * Registration. This identifier can be used by {@link RegistrationPolicy} to create a
handle for this Registration.
+ *
+ * @return this Registration's internal identifier.
+ */
+ String getId();
+
+ /**
+ * Sets the handle for this Registration.
+ *
+ * @param handle
+ */
+ void setRegistrationHandle(String handle);
+
+ /**
+ * Retrieves the handle associated with this Registration
+ *
+ * @return the registration handle
+ */
+ String getRegistrationHandle();
+
+ /**
+ * Return the consumer owning this registration.
+ *
+ * @return the owning consumer
+ */
+ Consumer getConsumer();
+
+ /**
+ * Retrieve the properties associated with this Registration.
+ *
+ * @return a Map containing the associated properties
+ */
+ Map getProperties();
+
+ void setPropertyValueFor(QName propertyName, Object value) throws
IllegalArgumentException;
+
+ void setPropertyValueFor(String propertyName, Object value);
+
+ boolean hasEqualProperties(Registration registration);
+
+ boolean hasEqualProperties(Map properties);
+
+ /**
+ * Return the status of this specific registration.
+ *
+ * @return the status
+ */
+ RegistrationStatus getStatus();
+
+ /**
+ * Update the registration status
+ *
+ * @param status the new status
+ */
+ void setStatus(RegistrationStatus status);
+
+ /** Clears any state (cloned portlet information, session, etc) associated with this
Registration */
+ void clearAssociatedState();
+
+ void updateProperties(Map registrationProperties);
+
+ void removeProperty(QName propertyName);
+
+ void removeProperty(String propertyName);
+
+ Object getPropertyValueFor(QName propertyName);
+
+ Object getPropertyValueFor(String propertyName);
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/Registration.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/registration/RegistrationException.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/RegistrationException.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/RegistrationException.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,49 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.registration;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision:5641 $
+ */
+public class RegistrationException extends Exception
+{
+ public RegistrationException()
+ {
+ }
+
+ public RegistrationException(String message)
+ {
+ super(message);
+ }
+
+ public RegistrationException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public RegistrationException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/RegistrationException.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/registration/RegistrationFailedException.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/RegistrationFailedException.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/RegistrationFailedException.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.registration;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision:5641 $
+ */
+public class RegistrationFailedException
+{
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/RegistrationFailedException.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: trunk/registration/src/main/org/jboss/portal/registration/RegistrationLocal.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/RegistrationLocal.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/RegistrationLocal.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.registration;
+
+
+/**
+ * Hold registration provided by the consumer for the duration of the invocation.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class RegistrationLocal
+{
+
+ /** The thread local to keep track of the registration associated with the current
thread of execution. */
+ private static final ThreadLocal registrationLocal = new ThreadLocal();
+
+ public static void setRegistration(Registration registration)
+ {
+ registrationLocal.set(registration);
+ }
+
+ public static Registration getRegistration()
+ {
+ return (Registration)registrationLocal.get();
+ }
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/RegistrationLocal.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: trunk/registration/src/main/org/jboss/portal/registration/RegistrationManager.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/RegistrationManager.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/RegistrationManager.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,79 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.registration;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public interface RegistrationManager extends RegistrationPropertyChangeListener
+{
+ RegistrationPolicy getPolicy();
+
+ void setPolicy(RegistrationPolicy policy);
+
+ RegistrationPersistenceManager getPersistenceManager();
+
+ void setPersistenceManager(RegistrationPersistenceManager persistenceManager);
+
+ Registration addRegistrationTo(String consumerName, Map registrationProperties,
boolean createConsumerIfNeeded)
+ throws RegistrationException;
+
+ Consumer createConsumer(String name) throws RegistrationException,
InvalidConsumerDataException;
+
+ Consumer addConsumerToGroupNamed(String consumerName, String groupName, boolean
createGroupIfNeeded,
+ boolean createConsumerIfNeeded) throws
RegistrationException;
+
+ ConsumerGroup createConsumerGroup(String groupName) throws RegistrationException;
+
+ void removeConsumer(String identity) throws RegistrationException,
NoSuchRegistrationException;
+
+ void removeConsumer(Consumer consumer) throws RegistrationException,
NoSuchRegistrationException;
+
+ Consumer getConsumerByIdentity(String identity) throws RegistrationException;
+
+ Consumer getConsumerFor(String registrationHandle) throws RegistrationException;
+
+ Registration getRegistration(String registrationHandle) throws RegistrationException;
+
+ void removeRegistration(String registrationHandle) throws RegistrationException,
NoSuchRegistrationException;
+
+ void removeRegistration(Registration registration) throws RegistrationException,
NoSuchRegistrationException;
+
+ ConsumerGroup getConsumerGroup(String groupName) throws RegistrationException;
+
+ Collection getConsumerGroups() throws RegistrationException;
+
+ void removeConsumerGroup(ConsumerGroup group) throws RegistrationException;
+
+ void removeConsumerGroup(String name) throws RegistrationException;
+
+ Collection getConsumers() throws RegistrationException;
+
+ void clear() throws RegistrationException;
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/RegistrationManager.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/registration/RegistrationPersistenceManager.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/RegistrationPersistenceManager.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/RegistrationPersistenceManager.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.registration;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public interface RegistrationPersistenceManager
+{
+ /**
+ * Creates a Consumer with the specified identity and name (which might be the same,
depending on the policy)
+ *
+ * @param consumerId
+ * @param consumerName
+ */
+ Consumer createConsumer(String consumerId, String consumerName) throws
RegistrationException;
+
+ /**
+ * Retrieves the ConsumerGroup identified by the specified name.
+ *
+ * @param name the name of the group to be retrieved
+ * @return the ConsumerGroup identified by the specified name
+ * @throws RegistrationException
+ */
+ ConsumerGroup getConsumerGroup(String name) throws RegistrationException;
+
+ /**
+ * Creates a new ConsumerGroup with the associated name.
+ *
+ * @param name the name of the ConsumerGroup to be created
+ * @return a new ConsumerGroup with the associated name
+ * @throws RegistrationException
+ */
+ ConsumerGroup createConsumerGroup(String name) throws RegistrationException;
+
+ void removeConsumerGroup(String name) throws RegistrationException;
+
+ void removeConsumer(String consumerId) throws RegistrationException;
+
+ void removeRegistration(String registrationId) throws RegistrationException;
+
+ /**
+ * Return an existing consumer from its id.
+ *
+ * @param consumerId the consumer id
+ * @return the consumer or null if it does not exist
+ * @throws IllegalArgumentException if the consumer id argument is null
+ * @throws RegistrationException
+ */
+ Consumer getConsumerById(String consumerId) throws IllegalArgumentException,
RegistrationException;
+
+ Registration addRegistrationFor(String consumerId, Map registrationProperties) throws
RegistrationException;
+
+ Collection getConsumerGroups();
+
+ Registration getRegistration(String registrationId);
+
+ Consumer addConsumerToGroupNamed(String consumerId, String groupName) throws
RegistrationException;
+
+ Collection getConsumers();
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/RegistrationPersistenceManager.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: trunk/registration/src/main/org/jboss/portal/registration/RegistrationPolicy.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/RegistrationPolicy.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/RegistrationPolicy.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.registration;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public interface RegistrationPolicy
+{
+ void validateRegistrationDataFor(Map registrationProperties, String consumerIdentity)
+ throws IllegalArgumentException, RegistrationException,
DuplicateRegistrationException;
+
+ String createRegistrationHandleFor(String registrationId);
+
+ String getGroupNameFor(String consumerName);
+
+ /**
+ * Obtain a consumer id in function of the consumer name and registration properties.
+ *
+ * @param consumerName the consumer name
+ * @param registrationProperties the provided registration properties
+ * @return the consumer id
+ * @throws IllegalArgumentException
+ * @throws InvalidConsumerDataException
+ */
+ String getConsumerIdFrom(String consumerName, Map registrationProperties)
+ throws IllegalArgumentException, InvalidConsumerDataException;
+
+ void validateConsumerName(String consumerName)
+ throws IllegalArgumentException, RegistrationException;
+
+ void validateConsumerGroupName(String groupName) throws IllegalArgumentException,
RegistrationException;
+
+ RegistrationManager getManager();
+
+ void setManager(RegistrationManager manager);
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/RegistrationPolicy.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/registration/RegistrationPropertyChangeListener.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/RegistrationPropertyChangeListener.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/RegistrationPropertyChangeListener.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.registration;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public interface RegistrationPropertyChangeListener
+{
+ void propertiesHaveChanged();
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/RegistrationPropertyChangeListener.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: trunk/registration/src/main/org/jboss/portal/registration/RegistrationStatus.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/RegistrationStatus.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/RegistrationStatus.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.registration;
+
+import java.io.Serializable;
+
+/**
+ * Type safe enumeration that describes the status of a registration.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision:5641 $
+ */
+public class RegistrationStatus implements Serializable
+{
+ /** The registration is valid. */
+ public static final RegistrationStatus VALID = new RegistrationStatus();
+
+ /** The registration is waiting for validation. */
+ public static final RegistrationStatus PENDING = new RegistrationStatus();
+
+ /** The registration is not valid. */
+ public static final RegistrationStatus INVALID = new RegistrationStatus();
+
+ private RegistrationStatus()
+ {
+ }
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/RegistrationStatus.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: trunk/registration/src/main/org/jboss/portal/registration/RegistrationUtils.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/RegistrationUtils.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/RegistrationUtils.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.registration;
+
+import org.jboss.portal.common.util.ParameterValidation;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class RegistrationUtils
+{
+ /**
+ * @param consumerAgent
+ * @throws IllegalArgumentException
+ * @since 2.6
+ */
+ public static void validateConsumerAgent(String consumerAgent) throws
IllegalArgumentException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerAgent,
"consumer agent", null);
+ char periodChar = '.';
+ int period = consumerAgent.indexOf(periodChar);
+ if (period != -1)
+ {
+ consumerAgent = consumerAgent.substring(period);
+ period = consumerAgent.indexOf(periodChar);
+
+ if (period != -1)
+ {
+ return;
+ }
+ }
+ throw new IllegalArgumentException("'" + consumerAgent + "'
is not a valid Consumer Agent.");
+ }
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/RegistrationUtils.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/registration/impl/ConsumerCapabilitiesImpl.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/impl/ConsumerCapabilitiesImpl.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/impl/ConsumerCapabilitiesImpl.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,92 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.registration.impl;
+
+import org.jboss.portal.registration.ConsumerCapabilities;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class ConsumerCapabilitiesImpl implements ConsumerCapabilities
+{
+ private boolean supportsGetMethod;
+ private List supportedModes;
+ private List supportedWindowStates;
+ private List supportedUserScopes;
+ private List supportedUserProfileData;
+
+ public boolean supportsGetMethod()
+ {
+ return supportsGetMethod;
+ }
+
+ public List getSupportedModes()
+ {
+ return supportedModes;
+ }
+
+ public List getSupportedWindowStates()
+ {
+ return supportedWindowStates;
+ }
+
+ public List getSupportedUserScopes()
+ {
+ return supportedUserScopes;
+ }
+
+ public List getSupportedUserProfileData()
+ {
+ return supportedUserProfileData;
+ }
+
+ public void setSupportsGetMethod(boolean supportsGetMethod)
+ {
+ this.supportsGetMethod = supportsGetMethod;
+ }
+
+ public void setSupportedModes(List supportedModes)
+ {
+ this.supportedModes = supportedModes;
+ }
+
+ public void setSupportedWindowStates(List supportedWindowStates)
+ {
+ this.supportedWindowStates = supportedWindowStates;
+ }
+
+ public void setSupportedUserScopes(List supportedUserScopes)
+ {
+ this.supportedUserScopes = supportedUserScopes;
+ }
+
+ public void setSupportedUserProfileData(List supportedUserProfileData)
+ {
+ this.supportedUserProfileData = supportedUserProfileData;
+ }
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/impl/ConsumerCapabilitiesImpl.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/registration/impl/ConsumerGroupImpl.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/impl/ConsumerGroupImpl.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/impl/ConsumerGroupImpl.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,154 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.registration.impl;
+
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.registration.Consumer;
+import org.jboss.portal.registration.ConsumerGroup;
+import org.jboss.portal.registration.NoSuchRegistrationException;
+import org.jboss.portal.registration.RegistrationException;
+import org.jboss.portal.registration.RegistrationStatus;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision:5672 $
+ */
+public class ConsumerGroupImpl implements ConsumerGroup
+{
+
+ private String name;
+ private Map consumers;
+ private RegistrationStatus status;
+
+
+ private ConsumerGroupImpl()
+ {
+ init();
+ }
+
+ ConsumerGroupImpl(String name)
+ {
+ this.name = name;
+ init();
+ }
+
+ private void init()
+ {
+ this.consumers = new HashMap();
+ status = RegistrationStatus.PENDING;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ ConsumerGroupImpl that = (ConsumerGroupImpl)o;
+
+ return name.equals(that.name);
+ }
+
+ public int hashCode()
+ {
+ return name.hashCode();
+ }
+
+ public RegistrationStatus getStatus()
+ {
+ return status;
+ }
+
+ public void setStatus(RegistrationStatus status)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(status,
"RegistrationStatus");
+ this.status = status;
+ }
+
+ public Collection getConsumers() throws RegistrationException
+ {
+ return Collections.unmodifiableCollection(consumers.values());
+ }
+
+ public Consumer getConsumer(String consumerId) throws IllegalArgumentException,
RegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerId,
"Consumer name", null);
+ return (Consumer)consumers.get(consumerId);
+ }
+
+ public boolean isEmpty()
+ {
+ return consumers.isEmpty();
+ }
+
+ public void addConsumer(Consumer consumer) throws RegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(consumer,
"Consumer");
+ String identity = consumer.getId();
+ if (consumers.containsKey(identity))
+ {
+ throw new IllegalArgumentException("ConsumerGroup named '" + name
+ + "' already contains a Consumer named '" +
consumer.getName() + "' (identity: '" + identity + "')");
+ }
+
+ consumers.put(identity, consumer);
+ consumer.setGroup(this);
+ }
+
+ public void removeConsumer(Consumer consumer) throws RegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(consumer,
"Consumer");
+
+ if (consumers.remove(consumer.getId()) == null)
+ {
+ throw new NoSuchRegistrationException("ConsumerGroup named '" +
name
+ + "' does not contain a Consumer named '" +
consumer.getName() + "' (identity: '" + consumer.getId()
+ + "')");
+ }
+
+ consumer.setGroup(null);
+ }
+
+ public boolean contains(Consumer consumer)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(consumer,
"Consumer");
+
+ return consumers.containsKey(consumer.getId());
+ }
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/impl/ConsumerGroupImpl.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: trunk/registration/src/main/org/jboss/portal/registration/impl/ConsumerImpl.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/impl/ConsumerImpl.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/impl/ConsumerImpl.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,200 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.registration.impl;
+
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.registration.Consumer;
+import org.jboss.portal.registration.ConsumerCapabilities;
+import org.jboss.portal.registration.ConsumerGroup;
+import org.jboss.portal.registration.Registration;
+import org.jboss.portal.registration.RegistrationException;
+import org.jboss.portal.registration.RegistrationStatus;
+import org.jboss.portal.registration.RegistrationUtils;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class ConsumerImpl implements Consumer
+{
+
+ private String name;
+ private String identity;
+ private String consumerAgent;
+ private Set registrations;
+ private RegistrationStatus status;
+ private ConsumerGroup group;
+ private ConsumerCapabilities capabilities;
+
+
+ private ConsumerImpl()
+ {
+ init();
+ }
+
+ ConsumerImpl(String identity, String name)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "name",
"Consumer");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name,
"identity", "Consumer");
+
+ this.name = name;
+ this.identity = identity;
+ init();
+ }
+
+ private void init()
+ {
+ registrations = new HashSet(7);
+ status = RegistrationStatus.PENDING;
+ capabilities = new ConsumerCapabilitiesImpl();
+ }
+
+
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ ConsumerImpl consumer = (ConsumerImpl)o;
+
+ return identity.equals(consumer.identity);
+ }
+
+ public int hashCode()
+ {
+ return identity.hashCode();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getId()
+ {
+ return identity;
+ }
+
+
+ public String getConsumerAgent()
+ {
+ return consumerAgent;
+ }
+
+ public void setConsumerAgent(String consumerAgent) throws IllegalArgumentException,
IllegalStateException
+ {
+ if (consumerAgent != null && !consumerAgent.equals(this.consumerAgent))
+ {
+ RegistrationUtils.validateConsumerAgent(consumerAgent);
+ this.consumerAgent = consumerAgent;
+ }
+ }
+
+ public ConsumerCapabilities getCapabilities()
+ {
+ return capabilities;
+ }
+
+ public void setCapabilities(ConsumerCapabilities capabilities)
+ {
+ this.capabilities = capabilities;
+ }
+
+ public RegistrationStatus getStatus()
+ {
+ return status;
+ }
+
+ public void setStatus(RegistrationStatus status)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(status,
"RegistrationStatus");
+ this.status = status;
+ }
+
+ public Collection getRegistrations() throws RegistrationException
+ {
+ return Collections.unmodifiableSet(registrations);
+ }
+
+ public ConsumerGroup getGroup()
+ {
+ return group;
+ }
+
+ void addRegistration(Registration registration)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(registration,
"Registration");
+
+ registrations.add(registration);
+ }
+
+ void removeRegistration(Registration registration) throws RegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(registration,
"Registration");
+
+ registrations.remove(registration);
+
+ // status should become pending if there are no registrations
+ if (registrations.isEmpty())
+ {
+ setStatus(RegistrationStatus.PENDING);
+ }
+ }
+
+ public void setGroup(ConsumerGroup group) throws RegistrationException
+ {
+ if (this.group != null)
+ {
+ // if we're trying to set the same group, just return
+ if (this.group.equals(group))
+ {
+ return;
+ }
+
+ if (this.group.contains(this))
+ {
+ this.group.removeConsumer(this);
+ }
+ }
+
+ this.group = group;
+
+ if (group != null && !this.group.contains(this))
+ {
+ group.addConsumer(this);
+ }
+ }
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/impl/ConsumerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationImpl.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationImpl.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationImpl.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,194 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.registration.impl;
+
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.registration.Consumer;
+import org.jboss.portal.registration.Registration;
+import org.jboss.portal.registration.RegistrationStatus;
+
+import javax.xml.namespace.QName;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class RegistrationImpl implements Registration
+{
+
+ private final String id;
+ private ConsumerImpl consumer;
+ private RegistrationStatus status;
+ private Map properties;
+ private String registrationHandle;
+
+
+ public RegistrationImpl(String id, ConsumerImpl consumer, RegistrationStatus status,
Map properties)
+ {
+ this.id = id;
+ this.consumer = consumer;
+ this.status = status;
+ this.properties = new HashMap(properties);
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setRegistrationHandle(String handle)
+ {
+ this.registrationHandle = handle;
+ }
+
+ public String getRegistrationHandle()
+ {
+ return registrationHandle;
+ }
+
+ public Consumer getConsumer()
+ {
+ return consumer;
+ }
+
+ public Map getProperties()
+ {
+ return Collections.unmodifiableMap(properties);
+ }
+
+ public void setPropertyValueFor(QName propertyName, Object value)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property
name");
+ ParameterValidation.throwIllegalArgExceptionIfNull(value, "Property
value");
+
+ // avoid modifying the properties if new value is the same as old one
+ Object oldValue = properties.get(propertyName);
+ if (!value.equals(oldValue))
+ {
+ properties.put(propertyName, value);
+ }
+ }
+
+ public void setPropertyValueFor(String propertyName, Object value)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property
name");
+ setPropertyValueFor(new QName(propertyName), value);
+ }
+
+ public Object getPropertyValueFor(QName propertyName)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property
name");
+ return properties.get(propertyName);
+ }
+
+ public Object getPropertyValueFor(String propertyName)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property
name");
+ return getPropertyValueFor(new QName(propertyName));
+ }
+
+
+ public void removeProperty(QName propertyName)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property
name");
+ properties.remove(propertyName);
+ }
+
+ public void removeProperty(String propertyName)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property
name");
+ removeProperty(new QName(propertyName));
+ }
+
+ public boolean hasEqualProperties(Registration registration)
+ {
+ if (registration == null)
+ {
+ return false;
+ }
+
+ Map other = registration.getProperties();
+ return hasEqualProperties(other);
+ }
+
+ public boolean hasEqualProperties(Map registrationProperties)
+ {
+ if (registrationProperties == null)
+ {
+ return false;
+ }
+
+ if (properties.size() != registrationProperties.size())
+ {
+ return false;
+ }
+
+ // check properties
+ for (Iterator props = properties.entrySet().iterator(); props.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)props.next();
+
+ // we should have a 1-1 match between name/value pair
+ QName name = (QName)entry.getKey();
+ if (!entry.getValue().equals(registrationProperties.get(name)))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public void setRegistrationPropertyValueFor(String propertyName, Object value)
+ {
+ setPropertyValueFor(new QName(propertyName), value);
+ }
+
+ public RegistrationStatus getStatus()
+ {
+ return status;
+ }
+
+ public void setStatus(RegistrationStatus status)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(status,
"RegistrationStatus");
+ this.status = status;
+ }
+
+ public void clearAssociatedState()
+ {
+ //todo: implement
+ }
+
+ public void updateProperties(Map registrationProperties)
+ {
+ properties = new HashMap(registrationProperties);
+ }
+
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationImpl.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationManagerImpl.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationManagerImpl.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationManagerImpl.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,359 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.registration.impl;
+
+import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
+import org.jboss.logging.Logger;
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.registration.Consumer;
+import org.jboss.portal.registration.ConsumerGroup;
+import org.jboss.portal.registration.InvalidConsumerDataException;
+import org.jboss.portal.registration.NoSuchRegistrationException;
+import org.jboss.portal.registration.Registration;
+import org.jboss.portal.registration.RegistrationException;
+import org.jboss.portal.registration.RegistrationManager;
+import org.jboss.portal.registration.RegistrationPersistenceManager;
+import org.jboss.portal.registration.RegistrationPolicy;
+import org.jboss.portal.registration.RegistrationStatus;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class RegistrationManagerImpl extends AbstractJBossService implements
RegistrationManager
+{
+ private static final Logger log = Logger.getLogger(RegistrationManager.class);
+
+ private RegistrationPolicy policy;
+ private RegistrationPersistenceManager persistenceManager;
+ private Map registrations;
+
+
+ public RegistrationManagerImpl()
+ {
+ registrations = new ConcurrentHashMap();
+ }
+
+ public RegistrationPolicy getPolicy()
+ {
+ return policy;
+ }
+
+ public void setPolicy(RegistrationPolicy policy)
+ {
+ this.policy = policy;
+ }
+
+ public RegistrationPersistenceManager getPersistenceManager()
+ {
+ return persistenceManager;
+ }
+
+ public void setPersistenceManager(RegistrationPersistenceManager persistenceManager)
+ {
+ this.persistenceManager = persistenceManager;
+ }
+
+
+ protected void startService() throws Exception
+ {
+ super.startService();
+ policy.setManager(this);
+ }
+
+
+ protected void stopService() throws Exception
+ {
+ policy.setManager(null);
+ super.stopService();
+ }
+
+ public Registration addRegistrationTo(String consumerName, Map registrationProperties,
boolean createConsumerIfNeeded)
+ throws RegistrationException
+ {
+ // the policy determines the identity of the consumer based on the given
information (note that this might be obsoleted by using WS-Security)
+ String identity = policy.getConsumerIdFrom(consumerName, registrationProperties);
+
+ // validate the registration information
+ policy.validateRegistrationDataFor(registrationProperties, identity);
+
+ Consumer consumer = getOrCreateConsumer(identity, createConsumerIfNeeded,
consumerName);
+
+ // create the actual registration
+ Registration registration = persistenceManager.addRegistrationFor(identity,
registrationProperties);
+
+ // let the policy decide what the handle should be
+ String handle = policy.createRegistrationHandleFor(registration.getId());
+ registration.setRegistrationHandle(handle);
+
+ // associate the handle to the consumer for easy retrieval
+ registrations.put(handle, registration);
+
+ return registration;
+ }
+
+ public Consumer createConsumer(String name) throws RegistrationException,
InvalidConsumerDataException
+ {
+ // check with policy if we allow the consumer
+ policy.validateConsumerName(name);
+
+ String identity = policy.getConsumerIdFrom(name, Collections.EMPTY_MAP);
+
+ Consumer consumer = persistenceManager.createConsumer(identity, name);
+
+ // deal with group if needed
+ // let the policy decide if there should be a group associated with the Consumer
and if yes, with which id
+ String groupName = policy.getGroupNameFor(name);
+ if (groupName != null)
+ {
+ addConsumerToGroupNamed(name, groupName, true, false);
+ }
+
+ return consumer;
+ }
+
+ public Consumer addConsumerToGroupNamed(String consumerName, String groupName, boolean
createGroupIfNeeded, boolean createConsumerIfNeeded) throws RegistrationException
+ {
+ // check with the policy if we allow the group name in case we need to create it
+ if (createGroupIfNeeded)
+ {
+ policy.validateConsumerGroupName(groupName);
+ }
+
+ // check with policy if we allow the consumer name in case we need to create it
+ if (createConsumerIfNeeded)
+ {
+ policy.validateConsumerName(consumerName);
+ }
+
+ ConsumerGroup group = getConsumerGroup(groupName);
+ boolean justCreatedGroup = false;
+ if (group == null)
+ {
+ if (createGroupIfNeeded)
+ {
+ createConsumerGroup(groupName);
+ justCreatedGroup = true;
+ }
+ else
+ {
+ throw new NoSuchRegistrationException("There is no existing
ConsumerGroup named '" + groupName + "'.");
+ }
+ }
+
+ String identity = policy.getConsumerIdFrom(consumerName, Collections.EMPTY_MAP);
+ try
+ {
+ getOrCreateConsumer(identity, createConsumerIfNeeded, consumerName);
+ }
+ catch (NoSuchRegistrationException e)
+ {
+ if (justCreatedGroup)
+ {
+ removeConsumerGroup(groupName);
+ }
+ }
+
+ return persistenceManager.addConsumerToGroupNamed(identity, groupName);
+ }
+
+ public ConsumerGroup createConsumerGroup(String groupName) throws
RegistrationException
+ {
+ // check with the policy if we allow the group
+ policy.validateConsumerGroupName(groupName);
+
+ return persistenceManager.createConsumerGroup(groupName);
+ }
+
+ public void removeConsumer(String identity) throws RegistrationException,
NoSuchRegistrationException
+ {
+ Consumer consumer = getOrCreateConsumer(identity, false, null);
+
+ ConsumerGroup group = consumer.getGroup();
+ if (group != null)
+ {
+ group.removeConsumer(consumer);
+ }
+
+ // cascade delete the registrations
+ for (Iterator i = new ArrayList(consumer.getRegistrations()).iterator();
i.hasNext();)
+ {
+ removeRegistration((Registration)i.next());
+ }
+
+ // let the registry do the actual deletion
+ persistenceManager.removeConsumer(identity);
+ }
+
+ public void removeConsumer(Consumer consumer) throws RegistrationException,
NoSuchRegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(consumer,
"Consumer");
+
+ removeConsumer(consumer.getId());
+ }
+
+ public Consumer getConsumerByIdentity(String identity) throws RegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(identity,
"identity", null);
+ return persistenceManager.getConsumerById(identity);
+ }
+
+ public Consumer getConsumerFor(String registrationHandle) throws
RegistrationException
+ {
+ return (Consumer)getConsumerOrRegistration(registrationHandle, true);
+ }
+
+ public Registration getRegistration(String registrationHandle) throws
RegistrationException
+ {
+ return (Registration)getConsumerOrRegistration(registrationHandle, false);
+ }
+
+ public void removeRegistration(String registrationHandle) throws
RegistrationException, NoSuchRegistrationException
+ {
+ Registration registration = getRegistration(registrationHandle);
+ if (registration == null)
+ {
+ throw new NoSuchRegistrationException("There is no Registration with handle
'" + registrationHandle + "'");
+ }
+ removeRegistration(registration);
+ }
+
+ public void removeRegistration(Registration registration) throws
RegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(registration,
"Registration");
+
+ registration.setStatus(RegistrationStatus.INVALID); // just in case...
+ registration.clearAssociatedState();
+
+ persistenceManager.removeRegistration(registration.getId());
+ registrations.remove(registration.getRegistrationHandle());
+ }
+
+ public ConsumerGroup getConsumerGroup(String groupName) throws RegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(groupName,
"ConsumerGroup name", null);
+ return persistenceManager.getConsumerGroup(groupName);
+ }
+
+ private Consumer getOrCreateConsumer(String identity, boolean createConsumerIfNeeded,
String consumerName)
+ throws RegistrationException
+ {
+ Consumer consumer = getConsumerByIdentity(identity);
+ if (consumer == null)
+ {
+ if (createConsumerIfNeeded)
+ {
+ consumer = createConsumer(consumerName);
+ }
+ else
+ {
+ throw new NoSuchRegistrationException("There is no Consumer named
'" + consumerName + "'.");
+ }
+ }
+ return consumer;
+ }
+
+ private Object getConsumerOrRegistration(String registrationHandle, boolean
getConsumer)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(registrationHandle,
"registration handle", null);
+ // this particular implementations uses a map though it could delegate to the
registry and make a DB query to retrieve the info
+ Registration registration = (Registration)registrations.get(registrationHandle);
+
+ if (registration == null)
+ {
+ return null;
+ }
+ else
+ {
+ return getConsumer ? (Object)registration.getConsumer() : registration;
+ }
+ }
+
+ public Collection getConsumerGroups()
+ {
+ return persistenceManager.getConsumerGroups();
+ }
+
+ public void removeConsumerGroup(ConsumerGroup group) throws RegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(group,
"ConsumerGroup");
+
+ for (Iterator consumers = group.getConsumers().iterator(); consumers.hasNext();)
+ {
+ removeConsumer((Consumer)consumers.next());
+ }
+
+ persistenceManager.removeConsumerGroup(group.getName());
+ }
+
+ public void removeConsumerGroup(String name) throws RegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(name, "ConsumerGroup
name");
+ removeConsumerGroup(getConsumerGroup(name));
+ }
+
+ public Collection getConsumers()
+ {
+ return persistenceManager.getConsumers();
+ }
+
+ public void clear() throws RegistrationException
+ {
+ Collection tmpColl = new ArrayList(getConsumers());
+ for (Iterator consumers = tmpColl.iterator(); consumers.hasNext();)
+ {
+ removeConsumer((Consumer)consumers.next());
+ }
+
+ tmpColl = new ArrayList(getConsumerGroups());
+ for (Iterator groups = tmpColl.iterator(); groups.hasNext();)
+ {
+ removeConsumerGroup((ConsumerGroup)groups.next());
+ }
+ }
+
+ /**
+ * We listen to registration property changes on the producer configuration so that we
can invalidate the current
+ * registrations. Consumers will need to call modifyRegistration since properties have
changed...
+ */
+ public void propertiesHaveChanged()
+ {
+ log.debug("Registration properties have changed, existing registrations will
be invalidated...");
+ for (Iterator regs = registrations.values().iterator(); regs.hasNext();)
+ {
+ Registration reg = (Registration)regs.next();
+ reg.setStatus(RegistrationStatus.INVALID);
+ reg.clearAssociatedState(); //todo: or should we wait until current operations
are done?
+ }
+ }
+
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationManagerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationPersistenceManagerImpl.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationPersistenceManagerImpl.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationPersistenceManagerImpl.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,189 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.registration.impl;
+
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.registration.Consumer;
+import org.jboss.portal.registration.ConsumerGroup;
+import org.jboss.portal.registration.DuplicateRegistrationException;
+import org.jboss.portal.registration.NoSuchRegistrationException;
+import org.jboss.portal.registration.Registration;
+import org.jboss.portal.registration.RegistrationException;
+import org.jboss.portal.registration.RegistrationPersistenceManager;
+import org.jboss.portal.registration.RegistrationStatus;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class RegistrationPersistenceManagerImpl extends AbstractJBossService implements
RegistrationPersistenceManager
+{
+ private long lastRegistrationId;
+ private Map consumers = new HashMap();
+ private Map groups = new HashMap();
+ private Map registrations = new HashMap();
+
+ public Consumer createConsumer(String consumerId, String consumerName) throws
RegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerId,
"Consumer identity", null);
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerName,
"Consumer name", null);
+
+ ConsumerImpl consumer = new ConsumerImpl(consumerId, consumerName);
+ consumer.setStatus(RegistrationStatus.PENDING);
+ consumers.put(consumerId, consumer);
+
+ return consumer;
+ }
+
+ public ConsumerGroup getConsumerGroup(String name) throws RegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "ConsumerGroup
name", null);
+
+ return (ConsumerGroup)groups.get(name);
+ }
+
+ public ConsumerGroup createConsumerGroup(String name) throws RegistrationException
+ {
+ ConsumerGroup group = getConsumerGroup(name);
+ if (group != null)
+ {
+ throw new DuplicateRegistrationException("A ConsumerGroup named '"
+ name + "' has already been registered.");
+ }
+ else
+ {
+ group = new ConsumerGroupImpl(name);
+ groups.put(name, group);
+ return group;
+ }
+ }
+
+ public void removeConsumerGroup(String name) throws RegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "ConsumerGroup
name", null);
+ if (groups.remove(name) == null)
+ {
+ throw new NoSuchRegistrationException("There is no ConsumerGroup named
'" + name + "'.");
+ }
+ }
+
+ public void removeConsumer(String consumerId) throws RegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerId,
"Consumer identity", null);
+ if (consumers.remove(consumerId) == null)
+ {
+ throw new RegistrationException("There is no Consumer with identity
'" + consumerId + "'.");
+ }
+ }
+
+ public void removeRegistration(String registrationId) throws RegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(registrationId,
"Registration identity", null);
+
+ RegistrationImpl registration =
(RegistrationImpl)registrations.get(registrationId);
+ if (registration == null)
+ {
+ throw new NoSuchRegistrationException("There is no Registration with id
'" + registrationId + "'");
+ }
+
+ ConsumerImpl consumer = (ConsumerImpl)registration.getConsumer();
+ consumer.removeRegistration(registration);
+ registrations.remove(registrationId);
+ }
+
+ public Consumer getConsumerById(String consumerId) throws RegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerId,
"Consumer identity", null);
+
+ return (Consumer)consumers.get(consumerId);
+ }
+
+ public Registration addRegistrationFor(String consumerId, Map registrationProperties)
throws RegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerId,
"Consumer identity", null);
+ ParameterValidation.throwIllegalArgExceptionIfNull(registrationProperties,
"Registration properties");
+
+ ConsumerImpl consumer = (ConsumerImpl)getConsumerById(consumerId);
+ if (consumer == null)
+ {
+ throw new NoSuchRegistrationException("There is no Consumer with identity
'" + consumerId
+ + "' to add a Registration to...");
+ }
+
+ RegistrationImpl registration = new RegistrationImpl("" +
lastRegistrationId++, consumer,
+ RegistrationStatus.PENDING, registrationProperties);
+ consumer.addRegistration(registration);
+
+ registrations.put(registration.getId(), registration);
+
+ return registration;
+ }
+
+ public Consumer addConsumerToGroupNamed(String consumerId, String groupName) throws
RegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerId,
"Consumer identity", null);
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(groupName,
"ConsumerGroup name", null);
+
+ ConsumerGroupImpl group = (ConsumerGroupImpl)getConsumerGroup(groupName);
+ if (group == null)
+ {
+ throw new NoSuchRegistrationException("There is no ConsumerGroup named
'" + groupName
+ + "' to add a Consumer to...");
+ }
+
+ ConsumerImpl consumer = (ConsumerImpl)getConsumerById(consumerId);
+ if (consumer == null)
+ {
+ throw new NoSuchRegistrationException("There is no Consumer with identity
'" + consumerId
+ + "' to add to ConsumerGroup named '" + groupName +
"'. Did you create it?");
+ }
+
+ group.addConsumer(consumer);
+
+ return consumer;
+ }
+
+ public Collection getConsumers()
+ {
+ return Collections.unmodifiableCollection(consumers.values());
+ }
+
+ public Collection getConsumerGroups()
+ {
+ return Collections.unmodifiableCollection(groups.values());
+ }
+
+ public Registration getRegistration(String registrationId)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(registrationId,
"Registration id", null);
+
+ return (Registration)registrations.get(registrationId);
+ }
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationPersistenceManagerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPolicy.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPolicy.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPolicy.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,132 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.registration.policies;
+
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.registration.Consumer;
+import org.jboss.portal.registration.DuplicateRegistrationException;
+import org.jboss.portal.registration.InvalidConsumerDataException;
+import org.jboss.portal.registration.Registration;
+import org.jboss.portal.registration.RegistrationException;
+import org.jboss.portal.registration.RegistrationManager;
+import org.jboss.portal.registration.RegistrationPolicy;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * Provides a default implementation of RegistrationPolicy.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class DefaultRegistrationPolicy extends AbstractJBossService implements
RegistrationPolicy
+{
+ private RegistrationManager manager;
+
+
+ public RegistrationManager getManager()
+ {
+ return manager;
+ }
+
+ public void setManager(RegistrationManager manager)
+ {
+ this.manager = manager;
+ }
+
+ /**
+ * @throws DuplicateRegistrationException if a Consumer with the same identity has
already registered with the same
+ * registration properties.
+ */
+ public void validateRegistrationDataFor(Map registrationProperties, String
consumerIdentity)
+ throws IllegalArgumentException, RegistrationException,
DuplicateRegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(registrationProperties,
"Registration properties");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerIdentity,
"Consumer identity", null);
+
+ Consumer consumer = manager.getConsumerByIdentity(consumerIdentity);
+ if (consumer != null)
+ {
+ // allow the new registration only if the registration properties are different
that existing registrations
+ // for this consumer...
+ for (Iterator iterator = consumer.getRegistrations().iterator();
iterator.hasNext();)
+ {
+ Registration registration = (Registration)iterator.next();
+ if (registration.hasEqualProperties(registrationProperties))
+ {
+ throw new DuplicateRegistrationException("Consumer named '"
+ consumer.getName()
+ + "' has already been registered with the same set of
registration properties. Registration rejected!");
+ }
+ }
+ }
+ else
+ {
+ // check that values are consistent with ProducerRegistrationRequirement
+ // todo: implement
+ }
+ }
+
+ /** Simply returns the given registration id. */
+ public String createRegistrationHandleFor(String registrationId)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(registrationId,
"Registration id", null);
+ return registrationId;
+ }
+
+ /** Doesn't support automatic ConsumerGroups so always return
<code>null</code>. */
+ public String getGroupNameFor(String consumerName)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerName,
"Consumer name", null);
+ return null;
+ }
+
+ /** Simply returns the given consumer name, trusted (!) to be unique. */
+ public String getConsumerIdFrom(String consumerName, Map registrationProperties)
throws IllegalArgumentException, InvalidConsumerDataException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerName,
"Consumer name", null);
+ return consumerName;
+ }
+
+ /** Rejects registration if a Consumer with the specified name already exists. */
+ public void validateConsumerName(String consumerName) throws IllegalArgumentException,
RegistrationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerName,
"Consumer name", null);
+
+ Consumer consumer = manager.getConsumerByIdentity(getConsumerIdFrom(consumerName,
Collections.EMPTY_MAP));
+ if (consumer != null)
+ {
+ throw new DuplicateRegistrationException("A Consumer named '" +
consumerName + "' has already been registered.");
+ }
+ }
+
+ /** Rejects name if a ConsumerGroup with the specified name already exists. */
+ public void validateConsumerGroupName(String groupName) throws
IllegalArgumentException, RegistrationException
+ {
+ // this is already the behavior in the RegistrationPersistenceManager so no need to
do anything
+ }
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPolicy.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/test/registration/AbstractRegistrationPersistenceManagerTestCase.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/test/registration/AbstractRegistrationPersistenceManagerTestCase.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/test/registration/AbstractRegistrationPersistenceManagerTestCase.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,400 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.registration;
+
+import junit.framework.TestCase;
+import org.jboss.portal.registration.Consumer;
+import org.jboss.portal.registration.ConsumerGroup;
+import org.jboss.portal.registration.DuplicateRegistrationException;
+import org.jboss.portal.registration.NoSuchRegistrationException;
+import org.jboss.portal.registration.Registration;
+import org.jboss.portal.registration.RegistrationPersistenceManager;
+
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public abstract class AbstractRegistrationPersistenceManagerTestCase extends TestCase
+{
+
+ /** . */
+ private Map registrationProperties;
+
+ public abstract RegistrationPersistenceManager getManager();
+
+ public void startInteraction()
+ {
+ }
+
+ public void stopInteraction()
+ {
+ }
+
+ public void setUp() throws Exception
+ {
+ registrationProperties = new HashMap();
+ registrationProperties.put(new QName("prop1"), "value1");
+ registrationProperties.put(new QName("prop2"), "value2");
+ }
+
+ protected void tearDown() throws Exception
+ {
+ registrationProperties = null;
+ }
+
+ public void testGetGroupThrowsIAE() throws Exception
+ {
+ startInteraction();
+ try
+ {
+ getManager().getConsumerGroup(null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testAddGroup() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ assertNotNull(group);
+ assertEquals("Foo", group.getName());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(group.getConsumers()));
+ stopInteraction();
+
+ // Test by retrieving the same consumer
+ startInteraction();
+ group = getManager().getConsumerGroup("Foo");
+ assertNotNull(group);
+ assertEquals("Foo", group.getName());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(group.getConsumers()));
+ stopInteraction();
+
+ // Test by retrieving the consumer list
+ startInteraction();
+ Collection groups = getManager().getConsumerGroups();
+ assertNotNull(groups);
+ assertEquals(1, groups.size());
+ group = (ConsumerGroup)groups.iterator().next();
+ assertNotNull(group);
+ assertEquals("Foo", group.getName());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(group.getConsumers()));
+ stopInteraction();
+ }
+
+ public void testAddDuplicateGroup() throws Exception
+ {
+ startInteraction();
+ getManager().createConsumerGroup("Foo");
+ try
+ {
+ getManager().createConsumerGroup("Foo");
+ fail();
+ }
+ catch (DuplicateRegistrationException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testAddGroupThrowsIAE() throws Exception
+ {
+ startInteraction();
+ try
+ {
+ getManager().createConsumerGroup(null);
+ }
+ catch (IllegalArgumentException expected)
+ {
+ assertEquals(Collections.EMPTY_SET, new
HashSet(getManager().getConsumerGroups()));
+ }
+ stopInteraction();
+ }
+
+ public void testRemoveGroup() throws Exception
+ {
+ startInteraction();
+ getManager().createConsumerGroup("Foo");
+ stopInteraction();
+
+ startInteraction();
+ getManager().removeConsumerGroup("Foo");
+ assertNull(getManager().getConsumerGroup("Foo"));
+ assertEquals(Collections.EMPTY_SET, new
HashSet(getManager().getConsumerGroups()));
+ stopInteraction();
+ }
+
+ public void testRemoveGroupThrowsIAE() throws Exception
+ {
+ startInteraction();
+ try
+ {
+ getManager().removeConsumerGroup(null);
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testRemoveNonExistingGroup() throws Exception
+ {
+ startInteraction();
+ try
+ {
+ getManager().removeConsumerGroup("Foo");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testGetConsumerThrowsIAE() throws Exception
+ {
+ startInteraction();
+ try
+ {
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ group.getConsumer(null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testAddConsumer() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ stopInteraction();
+
+ startInteraction();
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+ assertNotNull(consumer);
+ assertEquals("Bar", consumer.getName());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(consumer.getRegistrations()));
+ assertEquals("Foo", consumer.getGroup().getName());
+ stopInteraction();
+
+ // Test by retrieving the same consumer
+ startInteraction();
+ consumer = group.getConsumer("Bar");
+ assertNotNull(consumer);
+ assertEquals("Bar", consumer.getName());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(consumer.getRegistrations()));
+ assertEquals("Foo", consumer.getGroup().getName());
+ stopInteraction();
+
+ // Test by retrieving the consumer list
+ startInteraction();
+ Collection consumers = group.getConsumers();
+ assertNotNull(consumers);
+ assertEquals(1, consumers.size());
+ consumer = (Consumer)consumers.iterator().next();
+ assertNotNull(consumer);
+ assertEquals("Bar", consumer.getName());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(consumer.getRegistrations()));
+ assertEquals("Foo", consumer.getGroup().getName());
+ stopInteraction();
+ }
+
+ public void testAddDuplicateConsumer() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+ stopInteraction();
+
+ startInteraction();
+ try
+ {
+ group.addConsumer(consumer);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testAddConsumerThrowsIAE() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ try
+ {
+ group.addConsumer(null);
+ }
+ catch (IllegalArgumentException expected)
+ {
+ assertEquals(Collections.EMPTY_SET, new HashSet(group.getConsumers()));
+ }
+ stopInteraction();
+ }
+
+ public void testRemoveConsumer() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+ group.removeConsumer(consumer);
+ assertNull(group.getConsumer("Bar"));
+ assertEquals(Collections.EMPTY_SET, new HashSet(group.getConsumers()));
+ stopInteraction();
+ }
+
+ public void testRemoveConsumerThrowsIAE() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ try
+ {
+ group.removeConsumer(null);
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testAddRegistration() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+ stopInteraction();
+
+ startInteraction();
+ consumer = getManager().getConsumerById("Bar");
+ Registration reg1 = getManager().addRegistrationFor("Bar",
registrationProperties);
+ assertNotNull(reg1);
+ String regId = reg1.getId();
+ assertNotNull(regId);
+ assertEquals(consumer, reg1.getConsumer());
+ Map expectedProps = new HashMap();
+ expectedProps.put(new QName("prop1"), "value1");
+ expectedProps.put(new QName("prop2"), "value2");
+ assertEquals(expectedProps, reg1.getProperties());
+ stopInteraction();
+
+ // Retrieve it from the list of consumer registrations
+ startInteraction();
+ consumer = getManager().getConsumerById("Bar");
+ Collection registrations = consumer.getRegistrations();
+ assertNotNull(registrations);
+ assertEquals(1, registrations.size());
+ Registration reg3 = (Registration)registrations.iterator().next();
+ assertEquals(regId, reg3.getId());
+ assertEquals(consumer, reg3.getConsumer());
+ assertEquals(expectedProps, reg3.getProperties());
+ stopInteraction();
+
+ // Retrieve the same registration from the registry
+ startInteraction();
+ Registration reg2 = getManager().getRegistration(regId);
+ consumer = getManager().getConsumerById("Bar");
+ assertNotNull(reg2);
+ assertEquals(regId, reg2.getId());
+ assertEquals(consumer, reg2.getConsumer());
+ assertEquals(expectedProps, reg2.getProperties());
+ stopInteraction();
+ }
+
+ public void testAddRegistrationThrowsIAE() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+
+ try
+ {
+ getManager().addRegistrationFor(consumer.getId(), null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testRemoveRegistrationThrowsIAE() throws Exception
+ {
+ startInteraction();
+ try
+ {
+ getManager().removeRegistration(null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testRemoveRegistration() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+ Registration reg = getManager().addRegistrationFor("Bar",
registrationProperties);
+ String regId = reg.getId();
+ getManager().removeRegistration(regId);
+ stopInteraction();
+
+ // remove registration is the only method on RegistrationPersistenceManager that
needs to "cascade"
+ // this is needed because there is no remove method on Consumer, hence the manager
needs to remove the
+ // registration from its consumer since it's the only class that has access to
the specific consumer impl
+ startInteraction();
+ consumer = getManager().getConsumerById("Bar");
+ Collection registrations = consumer.getRegistrations();
+ assertNotNull(registrations);
+ assertEquals(0, registrations.size());
+ stopInteraction();
+
+ //
+ startInteraction();
+ assertEquals(null, getManager().getRegistration(regId));
+ stopInteraction();
+ }
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/test/registration/AbstractRegistrationPersistenceManagerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/test/registration/ConsumerGroupTestCase.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/test/registration/ConsumerGroupTestCase.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/test/registration/ConsumerGroupTestCase.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,120 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.test.registration;
+
+import junit.framework.TestCase;
+import org.jboss.portal.registration.Consumer;
+import org.jboss.portal.registration.ConsumerGroup;
+import org.jboss.portal.registration.RegistrationException;
+import org.jboss.portal.registration.RegistrationManager;
+import org.jboss.portal.registration.RegistrationPolicy;
+import org.jboss.portal.registration.RegistrationStatus;
+import org.jboss.portal.registration.impl.RegistrationManagerImpl;
+import org.jboss.portal.registration.impl.RegistrationPersistenceManagerImpl;
+import org.jboss.portal.registration.policies.DefaultRegistrationPolicy;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class ConsumerGroupTestCase extends TestCase
+{
+ private RegistrationManager manager;
+ private ConsumerGroup group;
+ private static final String NAME = "name";
+
+
+ protected void setUp() throws Exception
+ {
+ manager = new RegistrationManagerImpl();
+ RegistrationPolicy policy = new DefaultRegistrationPolicy();
+ manager.setPolicy(policy);
+ manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
+ policy.setManager(manager);
+ group = manager.createConsumerGroup(NAME);
+ }
+
+ public void testGetName()
+ {
+ assertEquals(NAME, group.getName());
+ }
+
+ public void testConsumersManagement() throws RegistrationException
+ {
+ assertTrue(group.isEmpty());
+ assertEquals(0, group.getConsumers().size());
+
+ Consumer c1 = manager.createConsumer("c1");
+ group.addConsumer(c1);
+ assertTrue(!group.isEmpty());
+ assertEquals(1, group.getConsumers().size());
+ assertTrue(group.contains(c1));
+ assertEquals(group, c1.getGroup());
+ assertEquals(c1, group.getConsumer(c1.getId()));
+
+ Consumer c2 = manager.createConsumer("c2");
+ group.addConsumer(c2);
+ assertEquals(2, group.getConsumers().size());
+ assertTrue(group.contains(c2));
+ assertEquals(group, c2.getGroup());
+
+ group.removeConsumer(c1);
+ assertEquals(1, group.getConsumers().size());
+ assertTrue(!group.contains(c1));
+ assertTrue(group.contains(c2));
+ assertEquals(null, c1.getGroup());
+ }
+
+ public void testAddNullConsumer() throws RegistrationException
+ {
+ try
+ {
+ group.addConsumer(null);
+ fail("Shouldn't be possible to add null consumer");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ }
+
+ public void testStatus()
+ {
+ assertEquals(RegistrationStatus.PENDING, group.getStatus());
+ group.setStatus(RegistrationStatus.VALID);
+ assertEquals(RegistrationStatus.VALID, group.getStatus());
+ }
+
+ public void testIllegalStatus()
+ {
+ try
+ {
+ group.setStatus(null);
+ fail("Shouldn't be possible to set the status to null");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ }
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/test/registration/ConsumerGroupTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/test/registration/ConsumerTestCase.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/test/registration/ConsumerTestCase.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/test/registration/ConsumerTestCase.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,99 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.test.registration;
+
+import junit.framework.TestCase;
+import org.jboss.portal.registration.Consumer;
+import org.jboss.portal.registration.ConsumerGroup;
+import org.jboss.portal.registration.RegistrationManager;
+import org.jboss.portal.registration.RegistrationPolicy;
+import org.jboss.portal.registration.RegistrationStatus;
+import org.jboss.portal.registration.impl.RegistrationManagerImpl;
+import org.jboss.portal.registration.impl.RegistrationPersistenceManagerImpl;
+import org.jboss.portal.registration.policies.DefaultRegistrationPolicy;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class ConsumerTestCase extends TestCase
+{
+ private Consumer consumer;
+ private RegistrationManager manager;
+
+ protected void setUp() throws Exception
+ {
+ manager = new RegistrationManagerImpl();
+ RegistrationPolicy policy = new DefaultRegistrationPolicy();
+ manager.setPolicy(policy);
+ manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
+ policy.setManager(manager);
+ consumer = manager.createConsumer("name");
+ }
+
+ public void testGetName()
+ {
+ assertEquals("name", consumer.getName());
+ }
+
+ public void testStatus()
+ {
+ assertEquals(RegistrationStatus.PENDING, consumer.getStatus());
+
+ consumer.setStatus(RegistrationStatus.VALID);
+ assertEquals(RegistrationStatus.VALID, consumer.getStatus());
+ }
+
+ public void testIllegalStatus()
+ {
+ try
+ {
+ consumer.setStatus(null);
+ fail("Was expecting an IllegalArgumentException to be thrown on
setStatus(null)");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ }
+
+ public void testSetGroup() throws Exception
+ {
+ ConsumerGroup group = manager.createConsumerGroup("group");
+ assertTrue(!group.getConsumers().contains(consumer));
+
+ consumer.setGroup(group);
+ assertEquals(group, consumer.getGroup());
+ assertTrue(group.getConsumers().contains(consumer));
+
+ consumer.setGroup(null);
+ assertNull(consumer.getGroup());
+ assertTrue(!group.getConsumers().contains(consumer));
+ }
+
+ public void testGetIdentity() throws Exception
+ {
+ assertNotNull(consumer.getId());
+ }
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/test/registration/ConsumerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/test/registration/RegistrationManagerTestCase.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/test/registration/RegistrationManagerTestCase.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/test/registration/RegistrationManagerTestCase.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,431 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.test.registration;
+
+import junit.framework.TestCase;
+import org.jboss.portal.registration.Consumer;
+import org.jboss.portal.registration.ConsumerGroup;
+import org.jboss.portal.registration.DuplicateRegistrationException;
+import org.jboss.portal.registration.NoSuchRegistrationException;
+import org.jboss.portal.registration.Registration;
+import org.jboss.portal.registration.RegistrationException;
+import org.jboss.portal.registration.RegistrationManager;
+import org.jboss.portal.registration.RegistrationPolicy;
+import org.jboss.portal.registration.RegistrationStatus;
+import org.jboss.portal.registration.impl.RegistrationManagerImpl;
+import org.jboss.portal.registration.impl.RegistrationPersistenceManagerImpl;
+import org.jboss.portal.registration.policies.DefaultRegistrationPolicy;
+
+import javax.xml.namespace.QName;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class RegistrationManagerTestCase extends TestCase
+{
+
+ private RegistrationManager manager;
+ private Map registrationProperties;
+
+ protected void setUp() throws Exception
+ {
+ manager = new RegistrationManagerImpl();
+ // todo: policy will need access to registration configuration information to
validate properties
+ RegistrationPolicy policy = new DefaultRegistrationPolicy();
+ manager.setPolicy(policy);
+ manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
+ policy.setManager(manager);
+
+ //todo: registration properties setup will need to be updated when property
validation is implemented
+ registrationProperties = new HashMap();
+ registrationProperties.put(new QName("prop1"), "value1");
+ registrationProperties.put(new QName("prop2"), "value2");
+ }
+
+ public void testPolicy()
+ {
+ RegistrationPolicy policy = manager.getPolicy();
+ assertNotNull(policy);
+ assertEquals(manager, policy.getManager());
+ }
+
+ public void testAddRegistrationTo() throws Exception
+ {
+ Registration registration = manager.addRegistrationTo("consumerName",
registrationProperties, true);
+ assertNotNull(registration);
+ assertNotNull(registration.getId());
+
+ Consumer consumer = manager.getConsumerByIdentity("consumerName");
+ assertNotNull(consumer); // default policy: name == identity
+ assertEquals(consumer, registration.getConsumer());
+
+ String registrationHandle = registration.getRegistrationHandle();
+ assertNotNull(registrationHandle);
+ assertEquals(consumer, manager.getConsumerFor(registrationHandle));
+ }
+
+ public void testAddRegistrationToInexistentConsumer() throws RegistrationException
+ {
+ try
+ {
+ manager.addRegistrationTo("consumerName", registrationProperties,
false);
+ fail("Should have failed: consumer does not exist");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+
+ assertNull(manager.getConsumerByIdentity("consumerName")); // default
policy: name == identity
+ }
+
+ public void testGetConsumerForNullRegistrationHandle() throws Exception
+ {
+ try
+ {
+ manager.getConsumerFor(null);
+ fail("Should have failed: cannot find a consumer for a null registration
handle");
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ }
+
+ public void testCreateConsumer() throws Exception
+ {
+ String name = "consumerName";
+ Consumer consumer = manager.createConsumer(name);
+ assertNotNull(consumer);
+ assertEquals(name, consumer.getName());
+ assertNotNull(consumer.getId());
+ assertNull(consumer.getGroup());
+
+ Collection consumers = manager.getConsumers();
+ assertEquals(1, consumers.size());
+ assertTrue(consumers.contains(consumer));
+ assertEquals(consumer, manager.getConsumerByIdentity(name)); // default policy:
name == identity
+
+ try
+ {
+ consumers.add(consumer);
+ fail("Shouldn't be possible to directly modify consumer
collection");
+ }
+ catch (UnsupportedOperationException expected)
+ {
+ }
+ }
+
+ public void testCreateConsumerWithGroupFromPolicy() throws RegistrationException
+ {
+ // use a different policy: now specifies that when creating a consumer, it should
be added to a group with the same name
+ DefaultRegistrationPolicy policy = new DefaultRegistrationPolicy()
+ {
+ public String getGroupNameFor(String consumerName)
+ {
+ return "group_" + consumerName;
+ }
+ };
+ manager.setPolicy(policy);
+ policy.setManager(manager);
+
+ String name = "name";
+ Consumer consumer = manager.createConsumer(name);
+ assertNotNull(consumer);
+
+ ConsumerGroup group = manager.getConsumerGroup("group_" + name);
+ assertNotNull(group);
+ assertEquals(group, consumer.getGroup());
+ assertTrue(group.getConsumers().contains(consumer));
+ }
+
+ public void testCreateDuplicateConsumer() throws RegistrationException
+ {
+ String name = "name";
+ assertNotNull(manager.createConsumer(name));
+
+ try
+ {
+ manager.createConsumer(name);
+ fail("Should have failed when trying to create a consumer with an existing
name");
+ }
+ catch (DuplicateRegistrationException expected)
+ {
+ }
+ }
+
+ public void testAddAutomaticallyCreatedConsumerToInexistentGroup() throws
RegistrationException
+ {
+ try
+ {
+ manager.addConsumerToGroupNamed("foo", "bar", false, true);
+ fail("Shouldn't be possible to add a consumer to an inexistent group
without first creating it");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+
+ assertNull(manager.getConsumerByIdentity("foo"));
+ assertNull(manager.getConsumerGroup("bar"));
+ }
+
+ public void testAddInexistentConsumerToAutomaticallyCreatedGroup() throws
RegistrationException
+ {
+ try
+ {
+ manager.addConsumerToGroupNamed("foo", "bar", true, false);
+ fail("Shouldn't be possible to add an inexistent consumer to a group
without first creating it");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+
+ assertNull(manager.getConsumerByIdentity("foo"));
+ assertNull(manager.getConsumerGroup("bar"));
+ }
+
+ public void testAddInexistentConsumerToGroup() throws RegistrationException
+ {
+ manager.createConsumerGroup("bar");
+ try
+ {
+ manager.addConsumerToGroupNamed("foo", "bar", false,
false);
+ fail("Shouldn't be possible to add an inexistent consumer to a group
without first creating it");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+
+ assertNull(manager.getConsumerByIdentity("foo"));
+ assertNotNull(manager.getConsumerGroup("bar"));
+ }
+
+ public void testAddInexistentConsumerToInexistentGroup() throws RegistrationException
+ {
+ try
+ {
+ manager.addConsumerToGroupNamed("foo", "bar", false,
false);
+ fail("Shouldn't be possible to add a consumer to an inexistent group
without first creating it");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+
+ assertNull(manager.getConsumerByIdentity("foo"));
+ assertNull(manager.getConsumerGroup("bar"));
+ }
+
+ public void testAddConsumerToGroup() throws Exception
+ {
+ String groupName = "group";
+ String consumerName = "consumer";
+ Consumer consumer = manager.addConsumerToGroupNamed(consumerName, groupName, true,
true);
+
+ Consumer consumer1 = manager.getConsumerByIdentity(consumerName);
+ assertNotNull(consumer1);
+ assertEquals(consumer1, consumer); // default policy: identity == name
+
+ ConsumerGroup group = manager.getConsumerGroup(groupName);
+ assertNotNull(group);
+ assertEquals(group, consumer.getGroup());
+ }
+
+ public void testCreateConsumerGroup() throws Exception
+ {
+ String groupName = "name";
+ ConsumerGroup group = manager.createConsumerGroup(groupName);
+ assertNotNull(group);
+ assertEquals(groupName, group.getName());
+
+ Collection groups = manager.getConsumerGroups();
+ assertEquals(1, groups.size());
+ assertTrue(groups.contains(group));
+ assertEquals(group, manager.getConsumerGroup(groupName));
+
+ try
+ {
+ groups.add(group);
+ fail("Shouldn't be possible to directly modify group
collection");
+ }
+ catch (UnsupportedOperationException expected)
+ {
+ }
+ }
+
+ public void testRemoveConsumerGroup() throws RegistrationException
+ {
+ String groupName = "name";
+ ConsumerGroup group = manager.createConsumerGroup(groupName);
+ manager.removeConsumerGroup(group);
+ assertNull(manager.getConsumerGroup(groupName));
+
+ manager.createConsumerGroup(groupName);
+ manager.removeConsumerGroup(groupName);
+ assertNull(manager.getConsumerGroup(groupName));
+ }
+
+ public void testCascadeRemovalOnConsumerGroupRemoval() throws Exception
+ {
+ String groupName = "group";
+ String consumerName = "consumer";
+ Consumer consumer = manager.addConsumerToGroupNamed(consumerName, groupName, true,
true);
+ String consumerIdentity = consumer.getId();
+
+ Registration reg = manager.addRegistrationTo(consumerName, registrationProperties,
false);
+ String handle = reg.getRegistrationHandle();
+
+ ConsumerGroup group = manager.getConsumerGroup(groupName);
+
+ manager.removeConsumerGroup(group);
+ assertNull(manager.getConsumerByIdentity(consumerIdentity));
+ assertNull(manager.getRegistration(handle));
+ }
+
+ public void testCascadeRemovalOnConsumerRemoval() throws Exception
+ {
+ String consumerName = "consumer";
+ Consumer consumer = manager.createConsumer(consumerName);
+ String consumerIdentity = consumer.getId();
+
+ Registration reg = manager.addRegistrationTo(consumerName, registrationProperties,
false);
+ String handle = reg.getRegistrationHandle();
+
+ manager.removeConsumer(consumer);
+ assertNull(manager.getConsumerByIdentity(consumerIdentity));
+ assertNull(manager.getRegistration(handle));
+ }
+
+ public void testRemoveSingleRegistration() throws Exception
+ {
+ String consumerName = "consumer";
+ Consumer consumer = manager.createConsumer(consumerName);
+
+ Registration reg = manager.addRegistrationTo(consumerName, registrationProperties,
false);
+ String handle = reg.getRegistrationHandle();
+
+ assertTrue(consumer.getRegistrations().contains(reg));
+
+ // set the consumer status to valid
+ consumer.setStatus(RegistrationStatus.VALID);
+
+ manager.removeRegistration(handle);
+ assertTrue(!consumer.getRegistrations().contains(reg));
+ assertNull(manager.getRegistration(handle));
+
+ // since the consumer doesn't have any registration anymore, its status should
become pending
+ assertEquals(RegistrationStatus.PENDING, consumer.getStatus());
+
+ // shouldn't be possible anymore to retrieve the consumer from the registration
handle
+ assertNull(manager.getConsumerFor(handle));
+ }
+
+ public void testRemoveRegistrationOnConsumerWithOtherRegistrations() throws Exception
+ {
+ String consumerName = "consumer";
+ Consumer consumer = manager.createConsumer(consumerName);
+
+ Registration reg = manager.addRegistrationTo(consumerName, registrationProperties,
false);
+ String handle = reg.getRegistrationHandle();
+
+ // todo: this won't work anymore when properties validation is implemented
+ registrationProperties.put(new QName("prop3"), "value3");
+ Registration r2 = manager.addRegistrationTo(consumerName, registrationProperties,
false);
+
+ RegistrationStatus status = consumer.getStatus();
+
+ manager.removeRegistration(handle);
+
+ // consumer status shouldn't have changed
+ assertEquals(status, consumer.getStatus());
+
+ // should still be able to retrieve consumer from r2 handle
+ assertEquals(consumer, manager.getConsumerFor(r2.getRegistrationHandle()));
+
+ // ... but not from handle
+ assertNull(manager.getConsumerFor(handle));
+ }
+
+ public void testAddRegistrationWithInvalidRegistrationProperties() throws Exception
+ {
+ // todo: implement
+ }
+
+ public void testRemoveInexistentRegistration() throws RegistrationException
+ {
+ try
+ {
+ manager.removeRegistration((Registration)null);
+ fail("Should be possible to remove a null registration");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ try
+ {
+ manager.removeRegistration((String)null);
+ fail("Should be possible to remove a registration with a null
handle");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ try
+ {
+ manager.removeRegistration("");
+ fail("Should be possible to remove a registration with an empty
handle");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ try
+ {
+ manager.removeRegistration("doesn't exist");
+ fail("Should be possible to remove a registration with an invalid
handle");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+ }
+
+ public void testClear() throws Exception
+ {
+ manager.createConsumer("c1");
+ manager.createConsumer("c2");
+ manager.addConsumerToGroupNamed("c1g1", "g1", true, true);
+ manager.createConsumerGroup("g2");
+ Registration r1 = manager.addRegistrationTo("c1", registrationProperties,
false);
+ Registration r2 = manager.addRegistrationTo("c3", registrationProperties,
true);
+
+ manager.clear();
+ assertTrue(manager.getConsumerGroups().isEmpty());
+ assertTrue(manager.getConsumers().isEmpty());
+ assertNull(manager.getRegistration(r1.getRegistrationHandle()));
+ assertNull(manager.getRegistration(r2.getRegistrationHandle()));
+ }
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/test/registration/RegistrationManagerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/test/registration/RegistrationPersistenceManagerTestCase.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/test/registration/RegistrationPersistenceManagerTestCase.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/test/registration/RegistrationPersistenceManagerTestCase.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.test.registration;
+
+import org.jboss.portal.registration.RegistrationPersistenceManager;
+import org.jboss.portal.registration.impl.RegistrationPersistenceManagerImpl;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class RegistrationPersistenceManagerTestCase extends
AbstractRegistrationPersistenceManagerTestCase
+{
+
+ /** . */
+ private RegistrationPersistenceManager manager;
+
+ public void setUp() throws Exception
+ {
+ manager = new RegistrationPersistenceManagerImpl();
+
+ //
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+
+ //
+ this.manager = null;
+ }
+
+ public RegistrationPersistenceManager getManager()
+ {
+ return manager;
+ }
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/test/registration/RegistrationPersistenceManagerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/registration/src/main/org/jboss/portal/test/registration/RegistrationTestCase.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/test/registration/RegistrationTestCase.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/registration/src/main/org/jboss/portal/test/registration/RegistrationTestCase.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,160 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.test.registration;
+
+import junit.framework.TestCase;
+import org.jboss.portal.registration.DuplicateRegistrationException;
+import org.jboss.portal.registration.Registration;
+import org.jboss.portal.registration.RegistrationException;
+import org.jboss.portal.registration.RegistrationManager;
+import org.jboss.portal.registration.RegistrationPolicy;
+import org.jboss.portal.registration.impl.RegistrationManagerImpl;
+import org.jboss.portal.registration.impl.RegistrationPersistenceManagerImpl;
+import org.jboss.portal.registration.policies.DefaultRegistrationPolicy;
+
+import javax.xml.namespace.QName;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class RegistrationTestCase extends TestCase
+{
+ private Registration registration;
+ private Map registrationProperties;
+
+ protected void setUp() throws Exception
+ {
+ RegistrationManager manager = new RegistrationManagerImpl();
+ RegistrationPolicy policy = new DefaultRegistrationPolicy()
+ {
+ public void validateRegistrationDataFor(Map registrationProperties, String
consumerIdentity) throws IllegalArgumentException, RegistrationException,
DuplicateRegistrationException
+ {
+ // accept any registration data here
+ }
+ };
+ manager.setPolicy(policy);
+ manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
+ policy.setManager(manager);
+
+ registrationProperties = new HashMap();
+ registrationProperties.put(new QName("prop1"), "value1");
+ registrationProperties.put(new QName("prop2"), "value2");
+
+ registration = manager.addRegistrationTo("name", registrationProperties,
true);
+ }
+
+ public void testGetPropertiesIsUnmodifiable()
+ {
+ Map properties = registration.getProperties();
+
+ try
+ {
+ properties.remove("foo");
+ fail("Properties shouldn't be directly modifiable");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testPropertiesAreClonedNotLive()
+ {
+ QName prop = new QName("prop3");
+ registrationProperties.put(prop, "value3");
+
+ assertNull(registration.getProperties().get(prop));
+ }
+
+ public void testSetNullPropertyValueThrowsIAE()
+ {
+ try
+ {
+ registration.setPropertyValueFor("foo", null);
+ fail("Shouldn't accept null values for properties");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testSetNullPropertyNameThrowsIAE()
+ {
+ try
+ {
+ registration.setPropertyValueFor((QName)null, null);
+ fail("Shouldn't accept null names for properties");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testProperties()
+ {
+ QName name = new QName("prop1");
+ assertEquals("value1", registration.getProperties().get(name));
+ assertEquals("value2", registration.getProperties().get(new
QName("prop2")));
+
+ String newValue = "new value";
+ registration.setPropertyValueFor("prop1", newValue);
+ assertEquals(newValue, registration.getProperties().get(name));
+
+ registration.removeProperty(name);
+ assertNull(registration.getPropertyValueFor(name));
+ }
+
+ public void testUpdateProperties()
+ {
+ registrationProperties.remove(new QName("prop1"));
+
+ registration.updateProperties(registrationProperties);
+ assertNull(registration.getPropertyValueFor("prop1"));
+
+ QName name = new QName("prop3");
+ String value = "value3";
+ registrationProperties.put(name, value);
+ registration.updateProperties(registrationProperties);
+ assertEquals(value, registration.getPropertyValueFor(name));
+ }
+
+ public void testHasEqualProperties()
+ {
+ assertTrue(registration.hasEqualProperties(registration));
+
+ assertTrue(registration.hasEqualProperties(registrationProperties));
+
+ registrationProperties.put(new QName("prop3"), "value3");
+ assertTrue(!registration.hasEqualProperties(registrationProperties));
+ }
+
+ public void testClearAssociatedState()
+ {
+ //todo: implement
+ }
+
+}
Property changes on:
trunk/registration/src/main/org/jboss/portal/test/registration/RegistrationTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/tools/etc/buildfragments/modules.ent
===================================================================
--- trunk/tools/etc/buildfragments/modules.ent 2006-12-15 00:06:23 UTC (rev 5864)
+++ trunk/tools/etc/buildfragments/modules.ent 2006-12-15 00:11:16 UTC (rev 5865)
@@ -106,6 +106,14 @@
<pathelement
path="${jboss.portal-wsrp.lib}/portal-wsrp-test-lib.jar"/>
</path>
+ <!-- registration -->
+ <property name="jboss.portal-registration.root"
value="${project.root}/registration/output"/>
+ <property name="jboss.portal-registration.lib"
value="${jboss.portal-registration.root}/lib"/>
+ <path id="jboss.portal-registration.classpath">
+ <pathelement
path="${jboss.portal-registration.lib}/portal-registration-lib.jar"/>
+ <pathelement
path="${jboss.portal-registration.lib}/portal-registration-test-lib.jar"/>
+ </path>
+
<!-- security -->
<property name="jboss.portal-security.root"
value="${project.root}/security/output"/>
<property name="jboss.portal-security.lib"
value="${jboss.portal-security.root}/lib"/>
Modified: trunk/wsrp/build.xml
===================================================================
--- trunk/wsrp/build.xml 2006-12-15 00:06:23 UTC (rev 5864)
+++ trunk/wsrp/build.xml 2006-12-15 00:11:16 UTC (rev 5865)
@@ -132,6 +132,7 @@
<path refid="jboss.portal-common.classpath"/>
<path refid="jboss.portal-jems.classpath"/>
<path refid="jboss.portal-server.classpath"/>
+ <path refid="jboss.portal-registration.classpath"/>
<path refid="jboss.portlet-api.classpath"/>
<path refid="jboss.portal-portlet.classpath"/>
<path refid="jboss.portal-federation.classpath"/>
@@ -362,16 +363,8 @@
<include
name="org/jboss/portal/test/wsrp/handler/*.class"/>
</fileset>
</jar>
- </target>
+ </target>
- <target name="package-registration-test" description="Generates the
registration test artifacts" depends="compile">
- <jar jarfile="${build.lib.test}/test-registration-lib.jar">
- <fileset dir="${build.classes}/">
- <include
name="org/jboss/portal/test/wsrp/registration/*.class"/>
- </fileset>
- </jar>
- </target>
-
<target name="package-consumer-test" description="Generates the
consumer test artifacts"
depends="compile">
<jar jarfile="${build.lib.test}/test-wsrp-consumer-client.jar">
@@ -415,6 +408,7 @@
<fileset dir="${jboss.portal-portlet.root}/lib"
includes="portal-portlet-lib.jar,
portal-portlet-test-lib.jar"/>
<fileset dir="${jboss.portal-federation.root}/lib"
includes="portal-federation-lib.jar"/>
+ <fileset dir="${jboss.portal-registration.root}/lib"
includes="portal-registration-lib.jar"/>
<fileset dir="${jboss.portal-test.lib}"
includes="portal-test-lib.jar"/>
<fileset dir="${jboss.portal-server.lib}"
includes="portal-server-test-framework-lib.jar"/>
</copy>
@@ -470,6 +464,7 @@
<fileset dir="${jboss.portlet-api.root}/lib"
includes="portal-api-lib.jar"/>
<fileset dir="${jboss.portal-portlet.root}/lib"
includes="portal-portlet-lib.jar"/>
<fileset dir="${jboss.portal-federation.root}/lib"
includes="portal-federation-lib.jar"/>
+ <fileset dir="${jboss.portal-registration.root}/lib"
includes="portal-registration-lib.jar"/>
<fileset dir="${jboss.portal-test.lib}"
includes="portal-test-lib.jar"/>
<fileset dir="${junit.junit.lib}"
includes="junit.jar"/>
<fileset dir="${build.lib.test}"
includes="test-wsrp-producer.jar"/>
@@ -528,7 +523,7 @@
<!-- Packages all the test related artifacts. Note that compilation should have
been already executed -->
<target name="package-tests" depends="package-consumer-test,
package-deployment-test, package-other-test,
- package-producer-test, package-registration-configuration-test,
package-registration-test"
+ package-producer-test, package-registration-configuration-test"
description="Packages all the test-related artifacts. Does NOT compile
classes so this should be done before
calling this task."/>
@@ -550,7 +545,6 @@
<antcall target="consumer-test"/>
<antcall target="deployment-test"/>
<antcall target="other-test"/>
- <antcall target="registration-test"/>
<antcall target="registration-configuration-test"/>
<antcall target="agent-undeploy"/>
<server:stop name="default"/>
@@ -562,7 +556,6 @@
<antcall target="consumer-test"/>
<antcall target="deployment-test"/>
<antcall target="other-test"/>
- <antcall target="registration-test"/>
<antcall target="registration-configuration-test"/>
</target>
@@ -698,35 +691,6 @@
</execute-tests>
</target>
- <!-- Registration tests -->
- <target name="registration-test"
depends="package-registration-test">
- <execute-tests>
- <x-test>
- <test todir="${test.reports}"
-
name="org.jboss.portal.test.wsrp.registration.RegistrationPersistenceManagerTestCase"/>
- <test todir="${test.reports}"
name="org.jboss.portal.test.wsrp.registration.ConsumerTestCase"/>
- <test todir="${test.reports}"
name="org.jboss.portal.test.wsrp.registration.ConsumerGroupTestCase"/>
- <test todir="${test.reports}"
name="org.jboss.portal.test.wsrp.registration.RegistrationManagerTestCase"/>
- <test todir="${test.reports}"
name="org.jboss.portal.test.wsrp.registration.RegistrationTestCase"/>
- </x-test>
- <x-sysproperty>
- <!--<jvmarg value="-Xdebug"/>
- <jvmarg value="-Xnoagent"/>
- <jvmarg value="-Djava.compiler=NONE"/>
- <jvmarg
value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787"/>-->
- <sysproperty key="test.root"
value="${build.lib}/tests"/>
- </x-sysproperty>
- <x-classpath>
- <fileset dir="${build.lib}"
includes="portal-wsrp-lib.jar"/>
- <fileset dir="${build.lib.test}"
includes="test-registration-lib.jar"/>
- <path refid="jboss.microcontainer.classpath"/>
- <path refid="library.classpath"/>
- <path refid="dependentmodule.classpath"/>
- <path refid="ws.classpath"/>
- </x-classpath>
- </execute-tests>
- </target>
-
<target name="reports">
<junitreport todir="${reports.dir}">
<fileset dir="${test.reports}">
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/config/RegistrationConfigurationTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/config/RegistrationConfigurationTestCase.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/config/RegistrationConfigurationTestCase.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -24,10 +24,10 @@
package org.jboss.portal.test.wsrp.config;
import junit.framework.TestCase;
-import org.jboss.portal.wsrp.producer.registration.api.LocalizedString;
-import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationPropertyDescription;
-import
org.jboss.portal.wsrp.producer.registration.config.RegistrationConfigurationFactory;
+import org.jboss.portal.wsrp.producer.config.LocalizedString;
+import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
+import org.jboss.portal.wsrp.producer.config.RegistrationConfigurationFactory;
+import org.jboss.portal.wsrp.producer.config.RegistrationPropertyDescription;
import org.jboss.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -24,6 +24,7 @@
package org.jboss.portal.test.wsrp.framework;
import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.registration.RegistrationManager;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicServiceDescriptionBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.EmptyMarkupBehavior;
@@ -70,8 +71,7 @@
import org.jboss.portal.wsrp.core.UnsupportedMimeTypeFault;
import org.jboss.portal.wsrp.core.UnsupportedModeFault;
import org.jboss.portal.wsrp.core.UnsupportedWindowStateFault;
-import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationManager;
+import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
Deleted:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/AbstractRegistrationPersistenceManagerTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/AbstractRegistrationPersistenceManagerTestCase.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/AbstractRegistrationPersistenceManagerTestCase.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -1,400 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.wsrp.registration;
-
-import junit.framework.TestCase;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationPersistenceManager;
-import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
-import org.jboss.portal.wsrp.producer.registration.api.DuplicateRegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.NoSuchRegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.Consumer;
-import org.jboss.portal.wsrp.producer.registration.api.Registration;
-
-import javax.xml.namespace.QName;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collections;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision: 5787 $
- * @since 2.6
- */
-public abstract class AbstractRegistrationPersistenceManagerTestCase extends TestCase
-{
-
- /** . */
- private Map registrationProperties;
-
- public abstract RegistrationPersistenceManager getManager();
-
- public void startInteraction()
- {
- }
-
- public void stopInteraction()
- {
- }
-
- public void setUp() throws Exception
- {
- registrationProperties = new HashMap();
- registrationProperties.put(new QName("prop1"), "value1");
- registrationProperties.put(new QName("prop2"), "value2");
- }
-
- protected void tearDown() throws Exception
- {
- registrationProperties = null;
- }
-
- public void testGetGroupThrowsIAE() throws Exception
- {
- startInteraction();
- try
- {
- getManager().getConsumerGroup(null);
- fail();
- }
- catch (IllegalArgumentException expected)
- {
- }
- stopInteraction();
- }
-
- public void testAddGroup() throws Exception
- {
- startInteraction();
- ConsumerGroup group = getManager().createConsumerGroup("Foo");
- assertNotNull(group);
- assertEquals("Foo", group.getName());
- assertEquals(Collections.EMPTY_LIST, new ArrayList(group.getConsumers()));
- stopInteraction();
-
- // Test by retrieving the same consumer
- startInteraction();
- group = getManager().getConsumerGroup("Foo");
- assertNotNull(group);
- assertEquals("Foo", group.getName());
- assertEquals(Collections.EMPTY_LIST, new ArrayList(group.getConsumers()));
- stopInteraction();
-
- // Test by retrieving the consumer list
- startInteraction();
- Collection groups = getManager().getConsumerGroups();
- assertNotNull(groups);
- assertEquals(1, groups.size());
- group = (ConsumerGroup)groups.iterator().next();
- assertNotNull(group);
- assertEquals("Foo", group.getName());
- assertEquals(Collections.EMPTY_LIST, new ArrayList(group.getConsumers()));
- stopInteraction();
- }
-
- public void testAddDuplicateGroup() throws Exception
- {
- startInteraction();
- getManager().createConsumerGroup("Foo");
- try
- {
- getManager().createConsumerGroup("Foo");
- fail();
- }
- catch (DuplicateRegistrationException expected)
- {
- }
- stopInteraction();
- }
-
- public void testAddGroupThrowsIAE() throws Exception
- {
- startInteraction();
- try
- {
- getManager().createConsumerGroup(null);
- }
- catch (IllegalArgumentException expected)
- {
- assertEquals(Collections.EMPTY_SET, new
HashSet(getManager().getConsumerGroups()));
- }
- stopInteraction();
- }
-
- public void testRemoveGroup() throws Exception
- {
- startInteraction();
- getManager().createConsumerGroup("Foo");
- stopInteraction();
-
- startInteraction();
- getManager().removeConsumerGroup("Foo");
- assertNull(getManager().getConsumerGroup("Foo"));
- assertEquals(Collections.EMPTY_SET, new
HashSet(getManager().getConsumerGroups()));
- stopInteraction();
- }
-
- public void testRemoveGroupThrowsIAE() throws Exception
- {
- startInteraction();
- try
- {
- getManager().removeConsumerGroup(null);
- }
- catch (IllegalArgumentException expected)
- {
- }
- stopInteraction();
- }
-
- public void testRemoveNonExistingGroup() throws Exception
- {
- startInteraction();
- try
- {
- getManager().removeConsumerGroup("Foo");
- }
- catch (NoSuchRegistrationException expected)
- {
- }
- stopInteraction();
- }
-
- public void testGetConsumerThrowsIAE() throws Exception
- {
- startInteraction();
- try
- {
- ConsumerGroup group = getManager().createConsumerGroup("Foo");
- group.getConsumer(null);
- fail();
- }
- catch (IllegalArgumentException expected)
- {
- }
- stopInteraction();
- }
-
- public void testAddConsumer() throws Exception
- {
- startInteraction();
- ConsumerGroup group = getManager().createConsumerGroup("Foo");
- stopInteraction();
-
- startInteraction();
- Consumer consumer = getManager().createConsumer("Bar", "Bar");
- group.addConsumer(consumer);
- assertNotNull(consumer);
- assertEquals("Bar", consumer.getName());
- assertEquals(Collections.EMPTY_LIST, new ArrayList(consumer.getRegistrations()));
- assertEquals("Foo", consumer.getGroup().getName());
- stopInteraction();
-
- // Test by retrieving the same consumer
- startInteraction();
- consumer = group.getConsumer("Bar");
- assertNotNull(consumer);
- assertEquals("Bar", consumer.getName());
- assertEquals(Collections.EMPTY_LIST, new ArrayList(consumer.getRegistrations()));
- assertEquals("Foo", consumer.getGroup().getName());
- stopInteraction();
-
- // Test by retrieving the consumer list
- startInteraction();
- Collection consumers = group.getConsumers();
- assertNotNull(consumers);
- assertEquals(1, consumers.size());
- consumer = (Consumer)consumers.iterator().next();
- assertNotNull(consumer);
- assertEquals("Bar", consumer.getName());
- assertEquals(Collections.EMPTY_LIST, new ArrayList(consumer.getRegistrations()));
- assertEquals("Foo", consumer.getGroup().getName());
- stopInteraction();
- }
-
- public void testAddDuplicateConsumer() throws Exception
- {
- startInteraction();
- ConsumerGroup group = getManager().createConsumerGroup("Foo");
- Consumer consumer = getManager().createConsumer("Bar", "Bar");
- group.addConsumer(consumer);
- stopInteraction();
-
- startInteraction();
- try
- {
- group.addConsumer(consumer);
- fail();
- }
- catch (IllegalArgumentException expected)
- {
- }
- stopInteraction();
- }
-
- public void testAddConsumerThrowsIAE() throws Exception
- {
- startInteraction();
- ConsumerGroup group = getManager().createConsumerGroup("Foo");
- try
- {
- group.addConsumer(null);
- }
- catch (IllegalArgumentException expected)
- {
- assertEquals(Collections.EMPTY_SET, new HashSet(group.getConsumers()));
- }
- stopInteraction();
- }
-
- public void testRemoveConsumer() throws Exception
- {
- startInteraction();
- ConsumerGroup group = getManager().createConsumerGroup("Foo");
- Consumer consumer = getManager().createConsumer("Bar", "Bar");
- group.addConsumer(consumer);
- group.removeConsumer(consumer);
- assertNull(group.getConsumer("Bar"));
- assertEquals(Collections.EMPTY_SET, new HashSet(group.getConsumers()));
- stopInteraction();
- }
-
- public void testRemoveConsumerThrowsIAE() throws Exception
- {
- startInteraction();
- ConsumerGroup group = getManager().createConsumerGroup("Foo");
- try
- {
- group.removeConsumer(null);
- }
- catch (IllegalArgumentException expected)
- {
- }
- stopInteraction();
- }
-
- public void testAddRegistration() throws Exception
- {
- startInteraction();
- ConsumerGroup group = getManager().createConsumerGroup("Foo");
- Consumer consumer = getManager().createConsumer("Bar", "Bar");
- group.addConsumer(consumer);
- stopInteraction();
-
- startInteraction();
- consumer = getManager().getConsumerById("Bar");
- Registration reg1 = getManager().addRegistrationFor("Bar",
registrationProperties);
- assertNotNull(reg1);
- String regId = reg1.getId();
- assertNotNull(regId);
- assertEquals(consumer, reg1.getConsumer());
- Map expectedProps = new HashMap();
- expectedProps.put(new QName("prop1"), "value1");
- expectedProps.put(new QName("prop2"), "value2");
- assertEquals(expectedProps, reg1.getProperties());
- stopInteraction();
-
- // Retrieve it from the list of consumer registrations
- startInteraction();
- consumer = getManager().getConsumerById("Bar");
- Collection registrations = consumer.getRegistrations();
- assertNotNull(registrations);
- assertEquals(1, registrations.size());
- Registration reg3 = (Registration)registrations.iterator().next();
- assertEquals(regId, reg3.getId());
- assertEquals(consumer, reg3.getConsumer());
- assertEquals(expectedProps, reg3.getProperties());
- stopInteraction();
-
- // Retrieve the same registration from the registry
- startInteraction();
- Registration reg2 = getManager().getRegistration(regId);
- consumer = getManager().getConsumerById("Bar");
- assertNotNull(reg2);
- assertEquals(regId, reg2.getId());
- assertEquals(consumer, reg2.getConsumer());
- assertEquals(expectedProps, reg2.getProperties());
- stopInteraction();
- }
-
- public void testAddRegistrationThrowsIAE() throws Exception
- {
- startInteraction();
- ConsumerGroup group = getManager().createConsumerGroup("Foo");
- Consumer consumer = getManager().createConsumer("Bar", "Bar");
- group.addConsumer(consumer);
-
- try
- {
- getManager().addRegistrationFor(consumer.getId(), null);
- fail();
- }
- catch (IllegalArgumentException expected)
- {
- }
- stopInteraction();
- }
-
- public void testRemoveRegistrationThrowsIAE() throws Exception
- {
- startInteraction();
- try
- {
- getManager().removeRegistration(null);
- fail();
- }
- catch (IllegalArgumentException expected)
- {
- }
- stopInteraction();
- }
-
- public void testRemoveRegistration() throws Exception
- {
- startInteraction();
- ConsumerGroup group = getManager().createConsumerGroup("Foo");
- Consumer consumer = getManager().createConsumer("Bar", "Bar");
- group.addConsumer(consumer);
- Registration reg = getManager().addRegistrationFor("Bar",
registrationProperties);
- String regId = reg.getId();
- getManager().removeRegistration(regId);
- stopInteraction();
-
- // remove registration is the only method on RegistrationPersistenceManager that
needs to "cascade"
- // this is needed because there is no remove method on Consumer, hence the manager
needs to remove the
- // registration from its consumer since it's the only class that has access to
the specific consumer impl
- startInteraction();
- consumer = getManager().getConsumerById("Bar");
- Collection registrations = consumer.getRegistrations();
- assertNotNull(registrations);
- assertEquals(0, registrations.size());
- stopInteraction();
-
- //
- startInteraction();
- assertEquals(null, getManager().getRegistration(regId));
- stopInteraction();
- }
-}
Deleted:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerGroupTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerGroupTestCase.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerGroupTestCase.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -1,120 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-
-package org.jboss.portal.test.wsrp.registration;
-
-import junit.framework.TestCase;
-import org.jboss.portal.wsrp.producer.registration.api.Consumer;
-import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationManager;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationPolicy;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
-import org.jboss.portal.wsrp.producer.registration.impl.RegistrationManagerImpl;
-import
org.jboss.portal.wsrp.producer.registration.impl.RegistrationPersistenceManagerImpl;
-import org.jboss.portal.wsrp.producer.registration.policies.DefaultRegistrationPolicy;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision$
- * @since 2.6
- */
-public class ConsumerGroupTestCase extends TestCase
-{
- private RegistrationManager manager;
- private ConsumerGroup group;
- private static final String NAME = "name";
-
-
- protected void setUp() throws Exception
- {
- manager = new RegistrationManagerImpl();
- RegistrationPolicy policy = new DefaultRegistrationPolicy();
- manager.setPolicy(policy);
- manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
- policy.setManager(manager);
- group = manager.createConsumerGroup(NAME);
- }
-
- public void testGetName()
- {
- assertEquals(NAME, group.getName());
- }
-
- public void testConsumersManagement() throws RegistrationException
- {
- assertTrue(group.isEmpty());
- assertEquals(0, group.getConsumers().size());
-
- Consumer c1 = manager.createConsumer("c1");
- group.addConsumer(c1);
- assertTrue(!group.isEmpty());
- assertEquals(1, group.getConsumers().size());
- assertTrue(group.contains(c1));
- assertEquals(group, c1.getGroup());
- assertEquals(c1, group.getConsumer(c1.getId()));
-
- Consumer c2 = manager.createConsumer("c2");
- group.addConsumer(c2);
- assertEquals(2, group.getConsumers().size());
- assertTrue(group.contains(c2));
- assertEquals(group, c2.getGroup());
-
- group.removeConsumer(c1);
- assertEquals(1, group.getConsumers().size());
- assertTrue(!group.contains(c1));
- assertTrue(group.contains(c2));
- assertEquals(null, c1.getGroup());
- }
-
- public void testAddNullConsumer() throws RegistrationException
- {
- try
- {
- group.addConsumer(null);
- fail("Shouldn't be possible to add null consumer");
- }
- catch (IllegalArgumentException expected)
- {
- }
- }
-
- public void testStatus()
- {
- assertEquals(RegistrationStatus.PENDING, group.getStatus());
- group.setStatus(RegistrationStatus.VALID);
- assertEquals(RegistrationStatus.VALID, group.getStatus());
- }
-
- public void testIllegalStatus()
- {
- try
- {
- group.setStatus(null);
- fail("Shouldn't be possible to set the status to null");
- }
- catch (IllegalArgumentException expected)
- {
- }
- }
-}
Deleted:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerTestCase.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerTestCase.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -1,99 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-
-package org.jboss.portal.test.wsrp.registration;
-
-import junit.framework.TestCase;
-import org.jboss.portal.wsrp.producer.registration.api.Consumer;
-import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationManager;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationPolicy;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
-import org.jboss.portal.wsrp.producer.registration.impl.RegistrationManagerImpl;
-import
org.jboss.portal.wsrp.producer.registration.impl.RegistrationPersistenceManagerImpl;
-import org.jboss.portal.wsrp.producer.registration.policies.DefaultRegistrationPolicy;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision$
- * @since 2.6
- */
-public class ConsumerTestCase extends TestCase
-{
- private Consumer consumer;
- private RegistrationManager manager;
-
- protected void setUp() throws Exception
- {
- manager = new RegistrationManagerImpl();
- RegistrationPolicy policy = new DefaultRegistrationPolicy();
- manager.setPolicy(policy);
- manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
- policy.setManager(manager);
- consumer = manager.createConsumer("name");
- }
-
- public void testGetName()
- {
- assertEquals("name", consumer.getName());
- }
-
- public void testStatus()
- {
- assertEquals(RegistrationStatus.PENDING, consumer.getStatus());
-
- consumer.setStatus(RegistrationStatus.VALID);
- assertEquals(RegistrationStatus.VALID, consumer.getStatus());
- }
-
- public void testIllegalStatus()
- {
- try
- {
- consumer.setStatus(null);
- fail("Was expecting an IllegalArgumentException to be thrown on
setStatus(null)");
- }
- catch (IllegalArgumentException expected)
- {
- }
- }
-
- public void testSetGroup() throws Exception
- {
- ConsumerGroup group = manager.createConsumerGroup("group");
- assertTrue(!group.getConsumers().contains(consumer));
-
- consumer.setGroup(group);
- assertEquals(group, consumer.getGroup());
- assertTrue(group.getConsumers().contains(consumer));
-
- consumer.setGroup(null);
- assertNull(consumer.getGroup());
- assertTrue(!group.getConsumers().contains(consumer));
- }
-
- public void testGetIdentity() throws Exception
- {
- assertNotNull(consumer.getId());
- }
-}
Deleted:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -1,431 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-
-package org.jboss.portal.test.wsrp.registration;
-
-import junit.framework.TestCase;
-import org.jboss.portal.wsrp.producer.registration.api.Consumer;
-import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
-import org.jboss.portal.wsrp.producer.registration.api.DuplicateRegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.NoSuchRegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.Registration;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationManager;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationPolicy;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
-import org.jboss.portal.wsrp.producer.registration.impl.RegistrationManagerImpl;
-import
org.jboss.portal.wsrp.producer.registration.impl.RegistrationPersistenceManagerImpl;
-import org.jboss.portal.wsrp.producer.registration.policies.DefaultRegistrationPolicy;
-
-import javax.xml.namespace.QName;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision$
- * @since 2.6
- */
-public class RegistrationManagerTestCase extends TestCase
-{
-
- private RegistrationManager manager;
- private Map registrationProperties;
-
- protected void setUp() throws Exception
- {
- manager = new RegistrationManagerImpl();
- // todo: policy will need access to registration configuration information to
validate properties
- RegistrationPolicy policy = new DefaultRegistrationPolicy();
- manager.setPolicy(policy);
- manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
- policy.setManager(manager);
-
- //todo: registration properties setup will need to be updated when property
validation is implemented
- registrationProperties = new HashMap();
- registrationProperties.put(new QName("prop1"), "value1");
- registrationProperties.put(new QName("prop2"), "value2");
- }
-
- public void testPolicy()
- {
- RegistrationPolicy policy = manager.getPolicy();
- assertNotNull(policy);
- assertEquals(manager, policy.getManager());
- }
-
- public void testAddRegistrationTo() throws Exception
- {
- Registration registration = manager.addRegistrationTo("consumerName",
registrationProperties, true);
- assertNotNull(registration);
- assertNotNull(registration.getId());
-
- Consumer consumer = manager.getConsumerByIdentity("consumerName");
- assertNotNull(consumer); // default policy: name == identity
- assertEquals(consumer, registration.getConsumer());
-
- String registrationHandle = registration.getRegistrationHandle();
- assertNotNull(registrationHandle);
- assertEquals(consumer, manager.getConsumerFor(registrationHandle));
- }
-
- public void testAddRegistrationToInexistentConsumer() throws RegistrationException
- {
- try
- {
- manager.addRegistrationTo("consumerName", registrationProperties,
false);
- fail("Should have failed: consumer does not exist");
- }
- catch (NoSuchRegistrationException expected)
- {
- }
-
- assertNull(manager.getConsumerByIdentity("consumerName")); // default
policy: name == identity
- }
-
- public void testGetConsumerForNullRegistrationHandle() throws Exception
- {
- try
- {
- manager.getConsumerFor(null);
- fail("Should have failed: cannot find a consumer for a null registration
handle");
- }
- catch (IllegalArgumentException e)
- {
- }
- }
-
- public void testCreateConsumer() throws Exception
- {
- String name = "consumerName";
- Consumer consumer = manager.createConsumer(name);
- assertNotNull(consumer);
- assertEquals(name, consumer.getName());
- assertNotNull(consumer.getId());
- assertNull(consumer.getGroup());
-
- Collection consumers = manager.getConsumers();
- assertEquals(1, consumers.size());
- assertTrue(consumers.contains(consumer));
- assertEquals(consumer, manager.getConsumerByIdentity(name)); // default policy:
name == identity
-
- try
- {
- consumers.add(consumer);
- fail("Shouldn't be possible to directly modify consumer
collection");
- }
- catch (UnsupportedOperationException expected)
- {
- }
- }
-
- public void testCreateConsumerWithGroupFromPolicy() throws RegistrationException
- {
- // use a different policy: now specifies that when creating a consumer, it should
be added to a group with the same name
- DefaultRegistrationPolicy policy = new DefaultRegistrationPolicy()
- {
- public String getGroupNameFor(String consumerName)
- {
- return "group_" + consumerName;
- }
- };
- manager.setPolicy(policy);
- policy.setManager(manager);
-
- String name = "name";
- Consumer consumer = manager.createConsumer(name);
- assertNotNull(consumer);
-
- ConsumerGroup group = manager.getConsumerGroup("group_" + name);
- assertNotNull(group);
- assertEquals(group, consumer.getGroup());
- assertTrue(group.getConsumers().contains(consumer));
- }
-
- public void testCreateDuplicateConsumer() throws RegistrationException
- {
- String name = "name";
- assertNotNull(manager.createConsumer(name));
-
- try
- {
- manager.createConsumer(name);
- fail("Should have failed when trying to create a consumer with an existing
name");
- }
- catch (DuplicateRegistrationException expected)
- {
- }
- }
-
- public void testAddAutomaticallyCreatedConsumerToInexistentGroup() throws
RegistrationException
- {
- try
- {
- manager.addConsumerToGroupNamed("foo", "bar", false, true);
- fail("Shouldn't be possible to add a consumer to an inexistent group
without first creating it");
- }
- catch (NoSuchRegistrationException expected)
- {
- }
-
- assertNull(manager.getConsumerByIdentity("foo"));
- assertNull(manager.getConsumerGroup("bar"));
- }
-
- public void testAddInexistentConsumerToAutomaticallyCreatedGroup() throws
RegistrationException
- {
- try
- {
- manager.addConsumerToGroupNamed("foo", "bar", true, false);
- fail("Shouldn't be possible to add an inexistent consumer to a group
without first creating it");
- }
- catch (NoSuchRegistrationException expected)
- {
- }
-
- assertNull(manager.getConsumerByIdentity("foo"));
- assertNull(manager.getConsumerGroup("bar"));
- }
-
- public void testAddInexistentConsumerToGroup() throws RegistrationException
- {
- manager.createConsumerGroup("bar");
- try
- {
- manager.addConsumerToGroupNamed("foo", "bar", false,
false);
- fail("Shouldn't be possible to add an inexistent consumer to a group
without first creating it");
- }
- catch (NoSuchRegistrationException expected)
- {
- }
-
- assertNull(manager.getConsumerByIdentity("foo"));
- assertNotNull(manager.getConsumerGroup("bar"));
- }
-
- public void testAddInexistentConsumerToInexistentGroup() throws RegistrationException
- {
- try
- {
- manager.addConsumerToGroupNamed("foo", "bar", false,
false);
- fail("Shouldn't be possible to add a consumer to an inexistent group
without first creating it");
- }
- catch (NoSuchRegistrationException expected)
- {
- }
-
- assertNull(manager.getConsumerByIdentity("foo"));
- assertNull(manager.getConsumerGroup("bar"));
- }
-
- public void testAddConsumerToGroup() throws Exception
- {
- String groupName = "group";
- String consumerName = "consumer";
- Consumer consumer = manager.addConsumerToGroupNamed(consumerName, groupName, true,
true);
-
- Consumer consumer1 = manager.getConsumerByIdentity(consumerName);
- assertNotNull(consumer1);
- assertEquals(consumer1, consumer); // default policy: identity == name
-
- ConsumerGroup group = manager.getConsumerGroup(groupName);
- assertNotNull(group);
- assertEquals(group, consumer.getGroup());
- }
-
- public void testCreateConsumerGroup() throws Exception
- {
- String groupName = "name";
- ConsumerGroup group = manager.createConsumerGroup(groupName);
- assertNotNull(group);
- assertEquals(groupName, group.getName());
-
- Collection groups = manager.getConsumerGroups();
- assertEquals(1, groups.size());
- assertTrue(groups.contains(group));
- assertEquals(group, manager.getConsumerGroup(groupName));
-
- try
- {
- groups.add(group);
- fail("Shouldn't be possible to directly modify group
collection");
- }
- catch (UnsupportedOperationException expected)
- {
- }
- }
-
- public void testRemoveConsumerGroup() throws RegistrationException
- {
- String groupName = "name";
- ConsumerGroup group = manager.createConsumerGroup(groupName);
- manager.removeConsumerGroup(group);
- assertNull(manager.getConsumerGroup(groupName));
-
- manager.createConsumerGroup(groupName);
- manager.removeConsumerGroup(groupName);
- assertNull(manager.getConsumerGroup(groupName));
- }
-
- public void testCascadeRemovalOnConsumerGroupRemoval() throws Exception
- {
- String groupName = "group";
- String consumerName = "consumer";
- Consumer consumer = manager.addConsumerToGroupNamed(consumerName, groupName, true,
true);
- String consumerIdentity = consumer.getId();
-
- Registration reg = manager.addRegistrationTo(consumerName, registrationProperties,
false);
- String handle = reg.getRegistrationHandle();
-
- ConsumerGroup group = manager.getConsumerGroup(groupName);
-
- manager.removeConsumerGroup(group);
- assertNull(manager.getConsumerByIdentity(consumerIdentity));
- assertNull(manager.getRegistration(handle));
- }
-
- public void testCascadeRemovalOnConsumerRemoval() throws Exception
- {
- String consumerName = "consumer";
- Consumer consumer = manager.createConsumer(consumerName);
- String consumerIdentity = consumer.getId();
-
- Registration reg = manager.addRegistrationTo(consumerName, registrationProperties,
false);
- String handle = reg.getRegistrationHandle();
-
- manager.removeConsumer(consumer);
- assertNull(manager.getConsumerByIdentity(consumerIdentity));
- assertNull(manager.getRegistration(handle));
- }
-
- public void testRemoveSingleRegistration() throws Exception
- {
- String consumerName = "consumer";
- Consumer consumer = manager.createConsumer(consumerName);
-
- Registration reg = manager.addRegistrationTo(consumerName, registrationProperties,
false);
- String handle = reg.getRegistrationHandle();
-
- assertTrue(consumer.getRegistrations().contains(reg));
-
- // set the consumer status to valid
- consumer.setStatus(RegistrationStatus.VALID);
-
- manager.removeRegistration(handle);
- assertTrue(!consumer.getRegistrations().contains(reg));
- assertNull(manager.getRegistration(handle));
-
- // since the consumer doesn't have any registration anymore, its status should
become pending
- assertEquals(RegistrationStatus.PENDING, consumer.getStatus());
-
- // shouldn't be possible anymore to retrieve the consumer from the registration
handle
- assertNull(manager.getConsumerFor(handle));
- }
-
- public void testRemoveRegistrationOnConsumerWithOtherRegistrations() throws Exception
- {
- String consumerName = "consumer";
- Consumer consumer = manager.createConsumer(consumerName);
-
- Registration reg = manager.addRegistrationTo(consumerName, registrationProperties,
false);
- String handle = reg.getRegistrationHandle();
-
- // todo: this won't work anymore when properties validation is implemented
- registrationProperties.put(new QName("prop3"), "value3");
- Registration r2 = manager.addRegistrationTo(consumerName, registrationProperties,
false);
-
- RegistrationStatus status = consumer.getStatus();
-
- manager.removeRegistration(handle);
-
- // consumer status shouldn't have changed
- assertEquals(status, consumer.getStatus());
-
- // should still be able to retrieve consumer from r2 handle
- assertEquals(consumer, manager.getConsumerFor(r2.getRegistrationHandle()));
-
- // ... but not from handle
- assertNull(manager.getConsumerFor(handle));
- }
-
- public void testAddRegistrationWithInvalidRegistrationProperties() throws Exception
- {
- // todo: implement
- }
-
- public void testRemoveInexistentRegistration() throws RegistrationException
- {
- try
- {
- manager.removeRegistration((Registration)null);
- fail("Should be possible to remove a null registration");
- }
- catch (IllegalArgumentException expected)
- {
- }
-
- try
- {
- manager.removeRegistration((String)null);
- fail("Should be possible to remove a registration with a null
handle");
- }
- catch (IllegalArgumentException expected)
- {
- }
-
- try
- {
- manager.removeRegistration("");
- fail("Should be possible to remove a registration with an empty
handle");
- }
- catch (IllegalArgumentException expected)
- {
- }
-
- try
- {
- manager.removeRegistration("doesn't exist");
- fail("Should be possible to remove a registration with an invalid
handle");
- }
- catch (NoSuchRegistrationException expected)
- {
- }
- }
-
- public void testClear() throws Exception
- {
- manager.createConsumer("c1");
- manager.createConsumer("c2");
- manager.addConsumerToGroupNamed("c1g1", "g1", true, true);
- manager.createConsumerGroup("g2");
- Registration r1 = manager.addRegistrationTo("c1", registrationProperties,
false);
- Registration r2 = manager.addRegistrationTo("c3", registrationProperties,
true);
-
- manager.clear();
- assertTrue(manager.getConsumerGroups().isEmpty());
- assertTrue(manager.getConsumers().isEmpty());
- assertNull(manager.getRegistration(r1.getRegistrationHandle()));
- assertNull(manager.getRegistration(r2.getRegistrationHandle()));
- }
-}
Deleted:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationPersistenceManagerTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationPersistenceManagerTestCase.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationPersistenceManagerTestCase.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -1,60 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-
-package org.jboss.portal.test.wsrp.registration;
-
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationPersistenceManager;
-import
org.jboss.portal.wsrp.producer.registration.impl.RegistrationPersistenceManagerImpl;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision$
- * @since 2.6
- */
-public class RegistrationPersistenceManagerTestCase extends
AbstractRegistrationPersistenceManagerTestCase
-{
-
- /** . */
- private RegistrationPersistenceManager manager;
-
- public void setUp() throws Exception
- {
- manager = new RegistrationPersistenceManagerImpl();
-
- //
- super.setUp();
- }
-
- protected void tearDown() throws Exception
- {
- super.tearDown();
-
- //
- this.manager = null;
- }
-
- public RegistrationPersistenceManager getManager()
- {
- return manager;
- }
-}
Deleted:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationTestCase.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationTestCase.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -1,160 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-
-package org.jboss.portal.test.wsrp.registration;
-
-import junit.framework.TestCase;
-import org.jboss.portal.wsrp.producer.registration.api.DuplicateRegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.Registration;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationManager;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationPolicy;
-import org.jboss.portal.wsrp.producer.registration.impl.RegistrationManagerImpl;
-import
org.jboss.portal.wsrp.producer.registration.impl.RegistrationPersistenceManagerImpl;
-import org.jboss.portal.wsrp.producer.registration.policies.DefaultRegistrationPolicy;
-
-import javax.xml.namespace.QName;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision$
- * @since 2.6
- */
-public class RegistrationTestCase extends TestCase
-{
- private Registration registration;
- private Map registrationProperties;
-
- protected void setUp() throws Exception
- {
- RegistrationManager manager = new RegistrationManagerImpl();
- RegistrationPolicy policy = new DefaultRegistrationPolicy()
- {
- public void validateRegistrationDataFor(Map registrationProperties, String
consumerIdentity) throws IllegalArgumentException, RegistrationException,
DuplicateRegistrationException
- {
- // accept any registration data here
- }
- };
- manager.setPolicy(policy);
- manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
- policy.setManager(manager);
-
- registrationProperties = new HashMap();
- registrationProperties.put(new QName("prop1"), "value1");
- registrationProperties.put(new QName("prop2"), "value2");
-
- registration = manager.addRegistrationTo("name", registrationProperties,
true);
- }
-
- public void testGetPropertiesIsUnmodifiable()
- {
- Map properties = registration.getProperties();
-
- try
- {
- properties.remove("foo");
- fail("Properties shouldn't be directly modifiable");
- }
- catch (Exception expected)
- {
- }
- }
-
- public void testPropertiesAreClonedNotLive()
- {
- QName prop = new QName("prop3");
- registrationProperties.put(prop, "value3");
-
- assertNull(registration.getProperties().get(prop));
- }
-
- public void testSetNullPropertyValueThrowsIAE()
- {
- try
- {
- registration.setPropertyValueFor("foo", null);
- fail("Shouldn't accept null values for properties");
- }
- catch (Exception expected)
- {
- }
- }
-
- public void testSetNullPropertyNameThrowsIAE()
- {
- try
- {
- registration.setPropertyValueFor((QName)null, null);
- fail("Shouldn't accept null names for properties");
- }
- catch (Exception expected)
- {
- }
- }
-
- public void testProperties()
- {
- QName name = new QName("prop1");
- assertEquals("value1", registration.getProperties().get(name));
- assertEquals("value2", registration.getProperties().get(new
QName("prop2")));
-
- String newValue = "new value";
- registration.setPropertyValueFor("prop1", newValue);
- assertEquals(newValue, registration.getProperties().get(name));
-
- registration.removeProperty(name);
- assertNull(registration.getPropertyValueFor(name));
- }
-
- public void testUpdateProperties()
- {
- registrationProperties.remove(new QName("prop1"));
-
- registration.updateProperties(registrationProperties);
- assertNull(registration.getPropertyValueFor("prop1"));
-
- QName name = new QName("prop3");
- String value = "value3";
- registrationProperties.put(name, value);
- registration.updateProperties(registrationProperties);
- assertEquals(value, registration.getPropertyValueFor(name));
- }
-
- public void testHasEqualProperties()
- {
- assertTrue(registration.hasEqualProperties(registration));
-
- assertTrue(registration.hasEqualProperties(registrationProperties));
-
- registrationProperties.put(new QName("prop3"), "value3");
- assertTrue(!registration.hasEqualProperties(registrationProperties));
- }
-
- public void testClearAssociatedState()
- {
- //todo: implement
- }
-
-}
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -35,7 +35,7 @@
import org.jboss.portal.wsrp.core.PropertyDescription;
import org.jboss.portal.wsrp.core.RegistrationContext;
import org.jboss.portal.wsrp.core.RegistrationData;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationPropertyDescription;
+import org.jboss.portal.wsrp.producer.config.RegistrationPropertyDescription;
import javax.xml.namespace.QName;
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ServiceDescriptionTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ServiceDescriptionTestCase.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ServiceDescriptionTestCase.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -35,7 +35,7 @@
import org.jboss.portal.wsrp.core.ModelDescription;
import org.jboss.portal.wsrp.core.PropertyDescription;
import org.jboss.portal.wsrp.core.ServiceDescription;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationPropertyDescription;
+import org.jboss.portal.wsrp.producer.config.RegistrationPropertyDescription;
/**
* Tests WSRP Service Description
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -40,7 +40,7 @@
import org.jboss.portal.wsrp.core.WSRP_v1_PortletManagement_PortType;
import org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType;
import org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationPropertyDescription;
+import org.jboss.portal.wsrp.producer.config.RegistrationPropertyDescription;
import javax.xml.namespace.QName;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPProducer.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPProducer.java 2006-12-15 00:06:23 UTC
(rev 5864)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPProducer.java 2006-12-15 00:11:16 UTC
(rev 5865)
@@ -23,13 +23,13 @@
package org.jboss.portal.wsrp;
+import org.jboss.portal.registration.RegistrationManager;
import org.jboss.portal.wsrp.core.CookieProtocol;
import org.jboss.portal.wsrp.core.WSRP_v1_Markup_PortType;
import org.jboss.portal.wsrp.core.WSRP_v1_PortletManagement_PortType;
import org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType;
import org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType;
-import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationManager;
+import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java 2006-12-15 00:06:23 UTC (rev
5864)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java 2006-12-15 00:11:16 UTC (rev
5865)
@@ -38,8 +38,8 @@
import org.jboss.portal.wsrp.core.OperationFailedFault;
import org.jboss.portal.wsrp.core.PropertyDescription;
import org.jboss.portal.wsrp.core.StateChange;
-import org.jboss.portal.wsrp.producer.registration.api.LocalizedString;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationPropertyDescription;
+import org.jboss.portal.wsrp.producer.config.LocalizedString;
+import org.jboss.portal.wsrp.producer.config.RegistrationPropertyDescription;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
@@ -346,29 +346,6 @@
}
/**
- * @param consumerAgent
- * @throws IllegalArgumentException
- * @since 2.6
- */
- public static void validateConsumerAgent(String consumerAgent) throws
IllegalArgumentException
- {
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerAgent,
"consumer agent", null);
- char periodChar = '.';
- int period = consumerAgent.indexOf(periodChar);
- if (period != -1)
- {
- consumerAgent = consumerAgent.substring(period);
- period = consumerAgent.indexOf(periodChar);
-
- if (period != -1)
- {
- return;
- }
- }
- throw new IllegalArgumentException("'" + consumerAgent + "'
is not a valid Consumer Agent.");
- }
-
- /**
* Creates a WSRP LocalizedString based on the best (according to the specified
desired locales) value of the given
* LocalizedString.
*
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployment.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployment.java 2006-12-15
00:06:23 UTC (rev 5864)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployment.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -23,7 +23,7 @@
package org.jboss.portal.wsrp.deployment;
import org.jboss.portal.common.util.ParameterValidation;
-import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
+import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
import org.jboss.system.ServiceMBeanSupport;
import java.util.ArrayList;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java 2006-12-15
00:06:23 UTC (rev 5864)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -25,6 +25,13 @@
import org.jboss.logging.Logger;
import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.registration.Consumer;
+import org.jboss.portal.registration.ConsumerCapabilities;
+import org.jboss.portal.registration.NoSuchRegistrationException;
+import org.jboss.portal.registration.Registration;
+import org.jboss.portal.registration.RegistrationException;
+import org.jboss.portal.registration.RegistrationStatus;
+import org.jboss.portal.registration.RegistrationUtils;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
@@ -37,12 +44,6 @@
import org.jboss.portal.wsrp.core.RegistrationState;
import org.jboss.portal.wsrp.core.ReturnAny;
import org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType;
-import org.jboss.portal.wsrp.producer.registration.api.Consumer;
-import org.jboss.portal.wsrp.producer.registration.api.ConsumerCapabilities;
-import org.jboss.portal.wsrp.producer.registration.api.NoSuchRegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.Registration;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
import javax.xml.namespace.QName;
import java.rmi.RemoteException;
@@ -83,7 +84,7 @@
log.debug("Attempting to register consumer named '" + consumerName
+ "', agent '" + consumerAgent + "'.");
// check that the consumer agent is valid before trying to register
- WSRPUtils.validateConsumerAgent(consumerAgent);
+ RegistrationUtils.validateConsumerAgent(consumerAgent);
registration = producer.getRegistrationManager().addRegistrationTo(consumerName,
createRegistrationProperties(registrationData), true);
updateRegistrationInformation(registration, registrationData);
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -43,7 +43,7 @@
import org.jboss.portal.wsrp.core.PortletDescription;
import org.jboss.portal.wsrp.core.ServiceDescription;
import org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType;
-import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
+import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
import java.rmi.RemoteException;
import java.util.Collection;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2006-12-15
00:06:23 UTC (rev 5864)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -30,6 +30,7 @@
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.registration.RegistrationManager;
import org.jboss.portal.wsrp.ResponseDebugFactory;
import org.jboss.portal.wsrp.WSRPProducer;
import org.jboss.portal.wsrp.WSRPUtils;
@@ -73,10 +74,9 @@
import org.jboss.portal.wsrp.core.UnsupportedMimeTypeFault;
import org.jboss.portal.wsrp.core.UnsupportedModeFault;
import org.jboss.portal.wsrp.core.UnsupportedWindowStateFault;
-import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationManager;
-import org.jboss.portal.wsrp.producer.registration.config.ProducerConfiguration;
-import
org.jboss.portal.wsrp.producer.registration.impl.ProducerRegistrationRequirementsImpl;
+import org.jboss.portal.wsrp.producer.config.ProducerConfiguration;
+import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
+import org.jboss.portal.wsrp.producer.config.impl.ProducerRegistrationRequirementsImpl;
import org.jboss.portal.wsrp.servlet.ServletAccess;
import javax.servlet.http.HttpSession;
Copied: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config (from rev 5856,
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config)
Copied: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/LocalizedString.java
(from rev 5856,
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/LocalizedString.java)
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/LocalizedString.java 2006-12-14
14:51:47 UTC (rev 5856)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/LocalizedString.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,146 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.wsrp.producer.config;
+
+import org.jboss.portal.common.util.ParameterValidation;
+
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class LocalizedString
+{
+ private String value;
+ private Locale locale;
+ private String resourceName;
+
+
+ public LocalizedString(String value, Locale locale)
+ {
+ this.value = value;
+ this.locale = locale;
+ }
+
+
+ public LocalizedString(String value)
+ {
+ this.value = value;
+ this.locale = Locale.getDefault();
+ }
+
+ public LocalizedString()
+ {
+ }
+
+ public LocalizedString(LocalizedString other)
+ {
+ this.value = other.value;
+ this.locale = other.locale;
+ this.resourceName = other.resourceName;
+ }
+
+
+ public String toString()
+ {
+ return "LocalizedString{" +
+ "value='" + value + '\'' +
+ ", locale=" + locale +
+ ", resourceName='" + resourceName + '\'' +
+ '}';
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ LocalizedString that = (LocalizedString)o;
+
+ if (!locale.equals(that.locale))
+ {
+ return false;
+ }
+ if (resourceName != null ? !resourceName.equals(that.resourceName) :
that.resourceName != null)
+ {
+ return false;
+ }
+ if (value != null ? !value.equals(that.value) : that.value != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result;
+ result = (value != null ? value.hashCode() : 0);
+ result = 31 * result + locale.hashCode();
+ result = 31 * result + (resourceName != null ? resourceName.hashCode() : 0);
+ return result;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(value, "value",
"LocalizedString");
+ this.value = value;
+ }
+
+ public Locale getLocale()
+ {
+ return locale;
+ }
+
+ public void setLocale(Locale locale)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(locale, "locale");
+ this.locale = locale;
+ }
+
+ public String getResourceName()
+ {
+ return resourceName;
+ }
+
+ public void setResourceName(String resourceName)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(resourceName,
"resource name", "LocalizedString");
+ this.resourceName = resourceName;
+ }
+}
Property changes on:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/LocalizedString.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Deleted:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfiguration.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/ProducerConfiguration.java 2006-12-14
14:51:47 UTC (rev 5856)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfiguration.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -1,36 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-
-package org.jboss.portal.wsrp.producer.registration.config;
-
-import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision$
- * @since 2.6
- */
-public interface ProducerConfiguration
-{
- ProducerRegistrationRequirements getRegistrationRequirements();
-}
Copied:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfiguration.java (from
rev 5861,
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/ProducerConfiguration.java)
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/ProducerConfiguration.java 2006-12-14
22:14:30 UTC (rev 5861)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfiguration.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.wsrp.producer.config;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public interface ProducerConfiguration
+{
+ ProducerRegistrationRequirements getRegistrationRequirements();
+}
Deleted:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationService.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/ProducerConfigurationService.java 2006-12-14
14:51:47 UTC (rev 5856)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationService.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -1,82 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-
-package org.jboss.portal.wsrp.producer.registration.config;
-
-import org.jboss.portal.common.util.URLTools;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-
-import java.net.URL;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision$
- * @since 2.6
- */
-public class ProducerConfigurationService extends AbstractJBossService implements
ProducerConfiguration
-{
- private ProducerRegistrationRequirements requirements;
- private String configLocation;
-
- public ProducerRegistrationRequirements getRegistrationRequirements()
- {
- return requirements;
- }
-
- public String getConfigLocation()
- {
- return configLocation;
- }
-
- public void setConfigLocation(String configLocation)
- {
- this.configLocation = configLocation;
- }
-
-
- protected void createService() throws Exception
- {
- // Setup URLs
- if (configLocation == null)
- {
- throw new Exception("The config location is null");
- }
- URL configURL =
Thread.currentThread().getContextClassLoader().getResource(configLocation);
- if (configURL == null)
- {
- throw new Exception("The config " + configLocation + " does not
exist");
- }
- if (!URLTools.exists(configURL))
- {
- throw new Exception("The config " + configURL + " does not
exist");
- }
-
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- ObjectModelFactory factory = new RegistrationConfigurationFactory();
- requirements =
(ProducerRegistrationRequirements)unmarshaller.unmarshal(configURL.openStream(), factory,
null);
- }
-}
Copied:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationService.java
(from rev 5861,
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/ProducerConfigurationService.java)
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/ProducerConfigurationService.java 2006-12-14
22:14:30 UTC (rev 5861)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationService.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.wsrp.producer.config;
+
+import org.jboss.portal.common.util.URLTools;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+
+import java.net.URL;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class ProducerConfigurationService extends AbstractJBossService implements
ProducerConfiguration
+{
+ private ProducerRegistrationRequirements requirements;
+ private String configLocation;
+
+ public ProducerRegistrationRequirements getRegistrationRequirements()
+ {
+ return requirements;
+ }
+
+ public String getConfigLocation()
+ {
+ return configLocation;
+ }
+
+ public void setConfigLocation(String configLocation)
+ {
+ this.configLocation = configLocation;
+ }
+
+
+ protected void createService() throws Exception
+ {
+ // Setup URLs
+ if (configLocation == null)
+ {
+ throw new Exception("The config location is null");
+ }
+ URL configURL =
Thread.currentThread().getContextClassLoader().getResource(configLocation);
+ if (configURL == null)
+ {
+ throw new Exception("The config " + configLocation + " does not
exist");
+ }
+ if (!URLTools.exists(configURL))
+ {
+ throw new Exception("The config " + configURL + " does not
exist");
+ }
+
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ ObjectModelFactory factory = new RegistrationConfigurationFactory();
+ requirements =
(ProducerRegistrationRequirements)unmarshaller.unmarshal(configURL.openStream(), factory,
null);
+ }
+}
Copied:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerRegistrationRequirements.java
(from rev 5856,
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/ProducerRegistrationRequirements.java)
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/ProducerRegistrationRequirements.java 2006-12-14
14:51:47 UTC (rev 5856)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerRegistrationRequirements.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,72 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.wsrp.producer.config;
+
+import org.jboss.portal.registration.RegistrationPropertyChangeListener;
+
+import javax.xml.namespace.QName;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public interface ProducerRegistrationRequirements
+{
+ boolean requiresRegistration();
+
+ void setRequiresRegistration(boolean requiresRegistration);
+
+ boolean fullServiceDescriptionRequiresRegistration();
+
+ void setFullServiceDescriptionRequiresRegistration(boolean
fullServiceDescriptionRequiresRegistration);
+
+ Map getRegistrationProperties();
+
+ void addRegistrationProperty(RegistrationPropertyDescription propertyDescription);
+
+ void removeRegistrationProperty(String propertyName);
+
+ void removeRegistrationProperty(QName propertyName);
+
+ void clearRegistrationProperties();
+
+ boolean acceptValueFor(QName propertyName, Object value);
+
+ boolean acceptValueFor(String propertyName, Object value);
+
+ RegistrationPropertyDescription getRegistrationPropertyWith(String name);
+
+ RegistrationPropertyDescription getRegistrationPropertyWith(QName name);
+
+ void notifyRegistrationPropertyChangeListeners();
+
+ void addRegistrationPropertyChangeListeners(RegistrationPropertyChangeListener
listener);
+
+ void clearRegistrationPropertyChangeListeners();
+
+ void removeRegistrationPropertyChangeListener(RegistrationPropertyChangeListener
listener);
+
+}
Property changes on:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerRegistrationRequirements.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Deleted:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/RegistrationConfigurationFactory.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfigurationFactory.java 2006-12-14
14:51:47 UTC (rev 5856)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/RegistrationConfigurationFactory.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -1,178 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-
-package org.jboss.portal.wsrp.producer.registration.config;
-
-import org.jboss.portal.common.util.LocaleInfo;
-import org.jboss.portal.common.util.ParameterValidation;
-import org.jboss.portal.wsrp.producer.registration.api.LocalizedString;
-import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationPropertyDescription;
-import
org.jboss.portal.wsrp.producer.registration.impl.ProducerRegistrationRequirementsImpl;
-import org.jboss.util.StringPropertyReplacer;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
-
-import javax.xml.namespace.QName;
-import java.util.Locale;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision$
- * @since 2.6
- */
-public class RegistrationConfigurationFactory implements ObjectModelFactory
-{
- private static final String REGISTRATION_CONFIG =
"registration-configuration";
- private static final boolean DEBUG = false;
-
- public Object newRoot(Object root, UnmarshallingContext nav, String nsURI, String
localName, Attributes attrs)
- {
- if (REGISTRATION_CONFIG.equals(localName))
- {
- ProducerRegistrationRequirements registrationRequirements = new
ProducerRegistrationRequirementsImpl();
- registrationRequirements.setRequiresRegistration(true);
- String descRequiresRegistration =
attrs.getValue("fullServiceDescriptionRequiresRegistration");
- if ("true".equals(descRequiresRegistration))
- {
-
registrationRequirements.setFullServiceDescriptionRequiresRegistration(true);
- }
- return registrationRequirements;
- }
- throw new IllegalArgumentException("The processed file doesn't seem to
have the proper format");
- }
-
- public Object completeRoot(Object root, UnmarshallingContext nav, String nsURI, String
localName)
- {
- return root;
- }
-
- public Object newChild(ProducerRegistrationRequirementsImpl regReq,
UnmarshallingContext nav, String nsURI,
- String localName, Attributes attrs)
- {
- if (DEBUG)
- {
- System.out.println("newChild regReq " + localName);
- }
-
- if ("registration-property-description".equals(localName))
- {
- return new RegistrationPropertyDescription();
- }
- else
- {
- return null;
- }
- }
-
- public void setValue(RegistrationPropertyDescription desc, UnmarshallingContext nav,
String nsURI,
- String localName, String value)
- {
- if (DEBUG)
- {
- System.out.println("setvalue desc " + localName);
- }
-
- if ("name".equals(localName))
- {
- value = StringPropertyReplacer.replaceProperties(value);
- desc.setName(new QName(value));
- }
- else if ("type".equals(localName))
- {
- value = StringPropertyReplacer.replaceProperties(value);
- desc.setType(new QName(value));
- }
- }
-
- public Object newChild(RegistrationPropertyDescription desc, UnmarshallingContext nav,
String nsURI, String localName,
- Attributes attrs)
- {
- if (DEBUG)
- {
- System.out.println("newchild desc " + localName);
- }
-
- if ("hint".equals(localName) || "label".equals(localName))
- {
- String lang = attrs.getValue("xml:lang");
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(lang,
"xml:lang", localName);
- Locale locale = LocaleInfo.decodeLocaleInfo(lang).getLocale();
-
- String resourceName = attrs.getValue("resourceName");
-
- LocalizedString string = new LocalizedString();
- string.setLocale(locale);
-
- if (resourceName != null && resourceName.length() > 0)
- {
- string.setResourceName(resourceName);
- }
-
- return string;
- }
-
- return null;
- }
-
- public void setValue(LocalizedString string, UnmarshallingContext nav, String nsURI,
String localName, String value)
- {
- if (DEBUG)
- {
- System.out.println("setvalue string " + localName);
- }
-
- value = StringPropertyReplacer.replaceProperties(value);
- string.setValue(value);
- }
-
- public void addChild(ProducerRegistrationRequirementsImpl regReq,
RegistrationPropertyDescription desc,
- UnmarshallingContext nav, String nsURI, String localName)
- {
- if (DEBUG)
- {
- System.out.println("addchild regreq desc " + localName);
- }
-
- regReq.addRegistrationProperty(desc);
- }
-
- public void addChild(RegistrationPropertyDescription desc, LocalizedString string,
UnmarshallingContext nav,
- String nsURI, String localName)
- {
- if (DEBUG)
- {
- System.out.println("addchild desc string " + localName);
- }
-
- if ("hint".equals(localName))
- {
- desc.setHint(string);
- }
- else if ("label".equals(localName))
- {
- desc.setLabel(string);
- }
- }
-}
Copied:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/RegistrationConfigurationFactory.java
(from rev 5861,
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfigurationFactory.java)
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfigurationFactory.java 2006-12-14
22:14:30 UTC (rev 5861)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/RegistrationConfigurationFactory.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,175 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.wsrp.producer.config;
+
+import org.jboss.portal.common.util.LocaleInfo;
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.wsrp.producer.config.impl.ProducerRegistrationRequirementsImpl;
+import org.jboss.util.StringPropertyReplacer;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+import javax.xml.namespace.QName;
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class RegistrationConfigurationFactory implements ObjectModelFactory
+{
+ private static final String REGISTRATION_CONFIG =
"registration-configuration";
+ private static final boolean DEBUG = false;
+
+ public Object newRoot(Object root, UnmarshallingContext nav, String nsURI, String
localName, Attributes attrs)
+ {
+ if (REGISTRATION_CONFIG.equals(localName))
+ {
+ ProducerRegistrationRequirements registrationRequirements = new
ProducerRegistrationRequirementsImpl();
+ registrationRequirements.setRequiresRegistration(true);
+ String descRequiresRegistration =
attrs.getValue("fullServiceDescriptionRequiresRegistration");
+ if ("true".equals(descRequiresRegistration))
+ {
+
registrationRequirements.setFullServiceDescriptionRequiresRegistration(true);
+ }
+ return registrationRequirements;
+ }
+ throw new IllegalArgumentException("The processed file doesn't seem to
have the proper format");
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext nav, String nsURI, String
localName)
+ {
+ return root;
+ }
+
+ public Object newChild(ProducerRegistrationRequirementsImpl regReq,
UnmarshallingContext nav, String nsURI,
+ String localName, Attributes attrs)
+ {
+ if (DEBUG)
+ {
+ System.out.println("newChild regReq " + localName);
+ }
+
+ if ("registration-property-description".equals(localName))
+ {
+ return new RegistrationPropertyDescription();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public void setValue(RegistrationPropertyDescription desc, UnmarshallingContext nav,
String nsURI,
+ String localName, String value)
+ {
+ if (DEBUG)
+ {
+ System.out.println("setvalue desc " + localName);
+ }
+
+ if ("name".equals(localName))
+ {
+ value = StringPropertyReplacer.replaceProperties(value);
+ desc.setName(new QName(value));
+ }
+ else if ("type".equals(localName))
+ {
+ value = StringPropertyReplacer.replaceProperties(value);
+ desc.setType(new QName(value));
+ }
+ }
+
+ public Object newChild(RegistrationPropertyDescription desc, UnmarshallingContext nav,
String nsURI, String localName,
+ Attributes attrs)
+ {
+ if (DEBUG)
+ {
+ System.out.println("newchild desc " + localName);
+ }
+
+ if ("hint".equals(localName) || "label".equals(localName))
+ {
+ String lang = attrs.getValue("xml:lang");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(lang,
"xml:lang", localName);
+ Locale locale = LocaleInfo.decodeLocaleInfo(lang).getLocale();
+
+ String resourceName = attrs.getValue("resourceName");
+
+ LocalizedString string = new LocalizedString();
+ string.setLocale(locale);
+
+ if (resourceName != null && resourceName.length() > 0)
+ {
+ string.setResourceName(resourceName);
+ }
+
+ return string;
+ }
+
+ return null;
+ }
+
+ public void setValue(LocalizedString string, UnmarshallingContext nav, String nsURI,
String localName, String value)
+ {
+ if (DEBUG)
+ {
+ System.out.println("setvalue string " + localName);
+ }
+
+ value = StringPropertyReplacer.replaceProperties(value);
+ string.setValue(value);
+ }
+
+ public void addChild(ProducerRegistrationRequirementsImpl regReq,
RegistrationPropertyDescription desc,
+ UnmarshallingContext nav, String nsURI, String localName)
+ {
+ if (DEBUG)
+ {
+ System.out.println("addchild regreq desc " + localName);
+ }
+
+ regReq.addRegistrationProperty(desc);
+ }
+
+ public void addChild(RegistrationPropertyDescription desc, LocalizedString string,
UnmarshallingContext nav,
+ String nsURI, String localName)
+ {
+ if (DEBUG)
+ {
+ System.out.println("addchild desc string " + localName);
+ }
+
+ if ("hint".equals(localName))
+ {
+ desc.setHint(string);
+ }
+ else if ("label".equals(localName))
+ {
+ desc.setLabel(string);
+ }
+ }
+}
Copied:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/RegistrationPropertyDescription.java
(from rev 5856,
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationPropertyDescription.java)
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationPropertyDescription.java 2006-12-14
14:51:47 UTC (rev 5856)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/RegistrationPropertyDescription.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,198 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.wsrp.producer.config;
+
+import javax.xml.namespace.QName;
+import java.net.URI;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class RegistrationPropertyDescription implements Cloneable
+{
+ private QName name;
+ private QName type;
+ private URI schemaLocation;
+ private LocalizedString description;
+ private LocalizedString hint;
+ private LocalizedString label;
+ private String[] usages;
+ private QName[] aliases;
+ private transient ProducerRegistrationRequirements parent;
+
+
+ public RegistrationPropertyDescription(QName name, QName type)
+ {
+ this.name = name;
+ this.type = type;
+ }
+
+ public RegistrationPropertyDescription(String name, QName type)
+ {
+ this(new QName(name), type);
+ }
+
+ public RegistrationPropertyDescription()
+ {
+ }
+
+ public RegistrationPropertyDescription(RegistrationPropertyDescription other)
+ {
+ setName(new QName(other.name.toString()));
+ setType(new QName(other.type.toString()));
+
+ aliases = new QName[other.aliases.length];
+ System.arraycopy(other.aliases, 0, aliases, 0, other.aliases.length);
+
+ setDescription(new LocalizedString(other.description));
+ setHint(new LocalizedString(other.hint));
+ setLabel(new LocalizedString(other.label));
+ setSchemaLocation(other.schemaLocation);
+
+ usages = new String[other.usages.length];
+ System.arraycopy(other.usages, 0, usages, 0, other.usages.length);
+
+ parent = other.parent;
+ }
+
+ public QName getName()
+ {
+ return name;
+ }
+
+ public void setName(QName name)
+ {
+ this.name = name;
+ notifyParentOfChangeIfNeeded();
+ }
+
+ public QName getType()
+ {
+ return type;
+ }
+
+ public void setType(QName type)
+ {
+ this.type = type;
+ notifyParentOfChangeIfNeeded();
+ }
+
+ public URI getSchemaLocation()
+ {
+ return schemaLocation;
+ }
+
+ public void setSchemaLocation(URI schemaLocation)
+ {
+ this.schemaLocation = schemaLocation;
+ notifyParentOfChangeIfNeeded();
+ }
+
+ public LocalizedString getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(LocalizedString description)
+ {
+ this.description = description;
+ notifyParentOfChangeIfNeeded();
+ }
+
+ public void setDefaultDescription(String value)
+ {
+ setDescription(new LocalizedString(value));
+ }
+
+ public LocalizedString getHint()
+ {
+ return hint;
+ }
+
+ public void setHint(LocalizedString hint)
+ {
+ this.hint = hint;
+ notifyParentOfChangeIfNeeded();
+ }
+
+ public void setDefaultHint(String value)
+ {
+ setHint(new LocalizedString(value));
+ }
+
+ public LocalizedString getLabel()
+ {
+ return label;
+ }
+
+ public void setLabel(LocalizedString label)
+ {
+ this.label = label;
+ notifyParentOfChangeIfNeeded();
+ }
+
+ public void setDefaultLabel(String value)
+ {
+ setLabel(new LocalizedString(value));
+ }
+
+ public String[] getUsages()
+ {
+ return usages;
+ }
+
+ public void setUsages(String[] usages)
+ {
+ this.usages = new String[usages.length];
+ System.arraycopy(usages, 0, this.usages, 0, usages.length);
+ notifyParentOfChangeIfNeeded();
+ }
+
+ public QName[] getAliases()
+ {
+ return aliases;
+ }
+
+ public void setAliases(QName[] aliases)
+ {
+ this.aliases = new QName[aliases.length];
+ System.arraycopy(aliases, 0, this.aliases, 0, aliases.length);
+ notifyParentOfChangeIfNeeded();
+ }
+
+ public void setParent(ProducerRegistrationRequirements requirements)
+ {
+ this.parent = requirements;
+ }
+
+ private void notifyParentOfChangeIfNeeded()
+ {
+ if (parent != null)
+ {
+ parent.notifyRegistrationPropertyChangeListeners();
+ }
+ }
+}
Property changes on:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/RegistrationPropertyDescription.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/impl/ProducerRegistrationRequirementsImpl.java 2006-12-14
14:51:47 UTC (rev 5856)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java 2006-12-15
00:11:16 UTC (rev 5865)
@@ -0,0 +1,177 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.wsrp.producer.config.impl;
+
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.registration.RegistrationPropertyChangeListener;
+import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
+import org.jboss.portal.wsrp.producer.config.RegistrationPropertyDescription;
+
+import javax.xml.namespace.QName;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 5730 $
+ * @since 2.6
+ */
+public class ProducerRegistrationRequirementsImpl implements
ProducerRegistrationRequirements
+{
+ private boolean requiresRegistration;
+ private boolean fullServiceDescriptionRequiresRegistration;
+ private transient Set listeners = new HashSet(3);
+
+ /** property name (QName) -> PropertyDescription */
+ private Map registrationProperties;
+
+ public ProducerRegistrationRequirementsImpl(boolean requiresMarshalling, boolean
requiresRegistration, boolean fullServiceDescriptionRequiresRegistration)
+ {
+ this();
+ this.requiresRegistration = requiresRegistration;
+ this.fullServiceDescriptionRequiresRegistration =
fullServiceDescriptionRequiresRegistration;
+ }
+
+ public ProducerRegistrationRequirementsImpl()
+ {
+ registrationProperties = new HashMap(7);
+ }
+
+ public boolean requiresRegistration()
+ {
+ return requiresRegistration;
+ }
+
+ public void setRequiresRegistration(boolean requiresRegistration)
+ {
+ this.requiresRegistration = requiresRegistration;
+ }
+
+ public boolean fullServiceDescriptionRequiresRegistration()
+ {
+ return fullServiceDescriptionRequiresRegistration;
+ }
+
+ public void setFullServiceDescriptionRequiresRegistration(boolean
fullServiceDescriptionRequiresRegistration)
+ {
+ this.fullServiceDescriptionRequiresRegistration =
fullServiceDescriptionRequiresRegistration;
+ }
+
+ public Map getRegistrationProperties()
+ {
+ return Collections.unmodifiableMap(registrationProperties);
+ }
+
+ public void addRegistrationProperty(RegistrationPropertyDescription
propertyDescription)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(propertyDescription,
"PropertyDescription");
+ QName name = propertyDescription.getName();
+ ParameterValidation.throwIllegalArgExceptionIfNull(name, "Property
name");
+
+ registrationProperties.put(name, propertyDescription);
+ propertyDescription.setParent(this);
+ notifyRegistrationPropertyChangeListeners();
+ }
+
+ public boolean acceptValueFor(QName propertyName, Object value)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property
name");
+
+ QName type = getPropertyDescription(propertyName).getType();
+ // todo: decide if type is actually compatible with value...
+ return true;
+ }
+
+ public boolean acceptValueFor(String propertyName, Object value)
+ {
+ return acceptValueFor(new QName(propertyName), value);
+ }
+
+ public RegistrationPropertyDescription getRegistrationPropertyWith(String name)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "Property
name", null);
+ return getRegistrationPropertyWith(new QName(name));
+ }
+
+
+ public RegistrationPropertyDescription getRegistrationPropertyWith(QName name)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(name, "Property
name");
+ return (RegistrationPropertyDescription)registrationProperties.get(name);
+ }
+
+ private RegistrationPropertyDescription getPropertyDescription(QName propertyName)
+ {
+ // copy to ensure immutability
+ return new
RegistrationPropertyDescription((RegistrationPropertyDescription)registrationProperties.get(propertyName));
+ }
+
+ public void removeRegistrationProperty(QName propertyName)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property
name");
+ registrationProperties.remove(propertyName);
+ notifyRegistrationPropertyChangeListeners();
+ }
+
+ public void clearRegistrationProperties()
+ {
+ registrationProperties.clear();
+ notifyRegistrationPropertyChangeListeners();
+ }
+
+ public void removeRegistrationProperty(String propertyName)
+ {
+ removeRegistrationProperty(new QName(propertyName));
+ }
+
+ public void notifyRegistrationPropertyChangeListeners()
+ {
+ for (Iterator iterator = listeners.iterator(); iterator.hasNext();)
+ {
+ RegistrationPropertyChangeListener listener =
(RegistrationPropertyChangeListener)iterator.next();
+ listener.propertiesHaveChanged();
+ }
+ }
+
+ public void clearRegistrationPropertyChangeListeners()
+ {
+ listeners.clear();
+ }
+
+ public void addRegistrationPropertyChangeListeners(RegistrationPropertyChangeListener
listener)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(listener,
"RegistrationPropertyChangeListener");
+ listeners.add(listener);
+ }
+
+ public void
removeRegistrationPropertyChangeListener(RegistrationPropertyChangeListener listener)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(listener,
"RegistrationPropertyChangeListener");
+ listeners.remove(listener);
+ }
+}
Modified: trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2006-12-15
00:06:23 UTC (rev 5864)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2006-12-15
00:11:16 UTC (rev 5865)
@@ -84,7 +84,7 @@
</mbean>
<!-- Registration manager -->
- <mbean
code="org.jboss.portal.wsrp.producer.registration.impl.RegistrationManagerImpl"
+ <mbean code="org.jboss.portal.registration.impl.RegistrationManagerImpl"
name="portal.wsrp:service=RegistrationManager"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
@@ -93,21 +93,21 @@
</mbean>
<!-- Registration policy -->
- <mbean
code="org.jboss.portal.wsrp.producer.registration.policies.DefaultRegistrationPolicy"
+ <mbean
code="org.jboss.portal.registration.policies.DefaultRegistrationPolicy"
name="portal.wsrp:service=RegistrationPolicy" xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
</mbean>
<!-- Persistence manager for registrations -->
- <mbean
code="org.jboss.portal.wsrp.producer.registration.impl.RegistrationPersistenceManagerImpl"
+ <mbean
code="org.jboss.portal.registration.impl.RegistrationPersistenceManagerImpl"
name="portal.wsrp:service=PersistenceManager" xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
</mbean>
<!-- Registration configuration service -->
- <mbean
code="org.jboss.portal.wsrp.producer.registration.config.ProducerConfigurationService"
+ <mbean
code="org.jboss.portal.wsrp.producer.config.ProducerConfigurationService"
name="portal.wsrp:service=ProducerConfiguration"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
Modified:
trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml
===================================================================
---
trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml 2006-12-15
00:06:23 UTC (rev 5864)
+++
trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml 2006-12-15
00:11:16 UTC (rev 5865)
@@ -178,7 +178,7 @@
</mbean>
<!-- Registration manager -->
- <mbean
code="org.jboss.portal.wsrp.producer.registration.impl.RegistrationManagerImpl"
+ <mbean code="org.jboss.portal.registration.impl.RegistrationManagerImpl"
name="portal.wsrp:service=RegistrationManager"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
@@ -187,14 +187,14 @@
</mbean>
<!-- Use DefaultRegistrationPolicy for registration -->
- <mbean
code="org.jboss.portal.wsrp.producer.registration.policies.DefaultRegistrationPolicy"
+ <mbean
code="org.jboss.portal.registration.policies.DefaultRegistrationPolicy"
name="portal.wsrp:service=RegistrationPolicy" xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
</mbean>
<!-- Persistence manager for registrations -->
- <mbean
code="org.jboss.portal.wsrp.producer.registration.impl.RegistrationPersistenceManagerImpl"
+ <mbean
code="org.jboss.portal.registration.impl.RegistrationPersistenceManagerImpl"
name="portal.wsrp:service=PersistenceManager" xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>