Author: chris.laprun(a)jboss.com
Date: 2006-11-22 18:14:30 -0500 (Wed, 22 Nov 2006)
New Revision: 5716
Added:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/config/
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/config/RegistrationConfigurationTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfiguration.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfigurationFactory.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfigurationService.java
trunk/wsrp/src/resources/portal-wsrp-sar/conf/
trunk/wsrp/src/resources/portal-wsrp-sar/conf/config.xml
trunk/wsrp/src/resources/tests/test-registration-configuration-lib-jar/
trunk/wsrp/src/resources/tests/test-registration-configuration-lib-jar/extended.xml
trunk/wsrp/src/resources/tests/test-registration-configuration-lib-jar/minimal.xml
Modified:
trunk/wsrp/build.xml
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployer.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployerMBean.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.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-deployment-lib-jar/test-wsrp.xml
trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml
Log:
- Registration configuration is now handled via a dedicated service reading an xml
configuration file (default is portal-wsrp.sar/conf/config.xml).
- Reverted changes to deployer architecture.
- Added relevant tests.
Modified: trunk/wsrp/build.xml
===================================================================
--- trunk/wsrp/build.xml 2006-11-22 22:22:21 UTC (rev 5715)
+++ trunk/wsrp/build.xml 2006-11-22 23:14:30 UTC (rev 5716)
@@ -340,6 +340,16 @@
</jar>
</target>
+ <target name="package-registration-configuration-test"
+ description="Generates the registration configuration test
artifacts" depends="compile">
+ <jar
jarfile="${build.lib.test}/test-registration-configuration-lib.jar">
+ <fileset
dir="${build.resources.test}/test-registration-configuration-lib-jar"/>
+ <fileset dir="${build.classes}/">
+ <include name="org/jboss/portal/test/wsrp/config/**"/>
+ </fileset>
+ </jar>
+ </target>
+
<target name="package-other-test" description="Generates the test
artifacts" depends="compile">
<jar jarfile="${build.lib.test}/test-other-lib.jar">
<fileset dir="${build.classes}/">
@@ -532,6 +542,7 @@
<antcall target="agent-deploy"/>
<antcall target="producer-test"/>
<antcall target="consumer-test"/>
+ <antcall target="registration-configuration-test"/>
<antcall target="deployment-test"/>
<antcall target="other-test"/>
<antcall target="registration-test"/>
@@ -554,7 +565,7 @@
<x-test>
<test todir="${test.reports}"
name="org.jboss.portal.test.wsrp.v1.producer.ServiceDescriptionTestRunner"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.wsrp.v1.producer.MarkupTestRunner"/>
- <!--<test todir="${test.reports}"
name="org.jboss.portal.test.wsrp.v1.producer.RegistrationTestRunner"/>-->
+ <test todir="${test.reports}"
name="org.jboss.portal.test.wsrp.v1.producer.RegistrationTestRunner"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.wsrp.v1.producer.PortletManagementTestRunner"/>
</x-test>
<x-sysproperty>
@@ -630,6 +641,30 @@
</execute-tests>
</target>
+ <!-- Producer registration configuration tests -->
+ <target name="registration-configuration-test"
depends="package-registration-configuration-test">
+ <execute-tests>
+ <x-test>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.wsrp.config.RegistrationConfigurationTestCase"/>
+ </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-configuration-lib.jar"/>
+ <path refid="jboss.microcontainer.classpath"/>
+ <path refid="library.classpath"/>
+ <path refid="dependentmodule.classpath"/>
+ <path refid="ws.classpath"/>
+ </x-classpath>
+ </execute-tests>
+ </target>
+
<!-- Other WSRP tests-->
<target name="other-test" depends="package-other-test">
<execute-tests>
Added:
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-11-22
22:22:21 UTC (rev 5715)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/config/RegistrationConfigurationTestCase.java 2006-11-22
23:14:30 UTC (rev 5716)
@@ -0,0 +1,108 @@
+/******************************************************************************
+ * 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.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.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+
+import javax.xml.namespace.QName;
+import java.net.URL;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class RegistrationConfigurationTestCase extends TestCase
+{
+ private Unmarshaller unmarshaller;
+ private ObjectModelFactory factory;
+
+
+ protected void setUp() throws Exception
+ {
+ unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ factory = new RegistrationConfigurationFactory();
+ }
+
+ public void testExtendedUnmarshalling() throws Exception
+ {
+ URL wsrpXMLLocation =
Thread.currentThread().getContextClassLoader().getResource("extended.xml");
+ assertNotNull(wsrpXMLLocation);
+
+ Object o = unmarshaller.unmarshal(wsrpXMLLocation.openStream(), factory, null);
+ assertNotNull(o);
+ assertTrue(o instanceof ProducerRegistrationRequirements);
+ ProducerRegistrationRequirements requirements =
(ProducerRegistrationRequirements)o;
+ assertTrue(requirements.requiresRegistration());
+ assertTrue(requirements.fullServiceDescriptionRequiresRegistration());
+ Map properties = requirements.getRegistrationProperties();
+ assertNotNull(properties);
+ assertEquals(2, properties.size());
+
+ checkRegistrationProperty(requirements, 1);
+ checkRegistrationProperty(requirements, 2);
+ }
+
+ public void testMinimalUnmarshalling() throws Exception
+ {
+ URL wsrpXMLLocation =
Thread.currentThread().getContextClassLoader().getResource("minimal.xml");
+ assertNotNull(wsrpXMLLocation);
+ Object o = unmarshaller.unmarshal(wsrpXMLLocation.openStream(), factory, null);
+ assertNotNull(o);
+ assertTrue(o instanceof ProducerRegistrationRequirements);
+ ProducerRegistrationRequirements requirements =
(ProducerRegistrationRequirements)o;
+ assertTrue(requirements.requiresRegistration());
+ assertTrue(!requirements.fullServiceDescriptionRequiresRegistration());
+ Map properties = requirements.getRegistrationProperties();
+ assertNotNull(properties);
+ assertTrue(properties.isEmpty());
+ }
+
+ private void checkRegistrationProperty(ProducerRegistrationRequirements requirements,
int index)
+ {
+ RegistrationPropertyDescription desc =
requirements.getRegistrationPropertyWith("name" + index);
+ assertNotNull(desc);
+ assertEquals(new QName("name" + index), desc.getName());
+ assertEquals(new QName("xsd:string"), desc.getType());
+
+ LocalizedString localizedString = new LocalizedString("hint" + index,
Locale.ENGLISH);
+ localizedString.setResourceName("resource.hint" + index);
+ localizedString.setValue("hint" + index);
+ assertEquals(localizedString, desc.getHint());
+
+ localizedString = new LocalizedString("label" + index, Locale.ENGLISH);
+ localizedString.setResourceName("resource.label" + index);
+ localizedString.setValue("label" + index);
+ assertEquals(localizedString, desc.getLabel());
+ }
+}
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java 2006-11-22
22:22:21 UTC (rev 5715)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java 2006-11-22
23:14:30 UTC (rev 5716)
@@ -30,9 +30,6 @@
import org.jboss.portal.wsrp.deployment.WSRPConsumerService;
import org.jboss.portal.wsrp.deployment.WSRPDeployment;
import org.jboss.portal.wsrp.deployment.WSRPDeploymentFactory;
-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.services.PerEndpointSOAPInvokerServiceFactory;
import org.jboss.portal.wsrp.services.RemoteSOAPInvokerServiceFactory;
import org.jboss.portal.wsrp.services.ServiceFactory;
@@ -40,11 +37,8 @@
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
-import javax.xml.namespace.QName;
import java.net.URL;
import java.util.List;
-import java.util.Locale;
-import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -131,34 +125,5 @@
assertNotNull(registrationData);
assertNotNull(registrationData.getConsumerName());
assertEquals(WSRPConstants.CONSUMER_AGENT, registrationData.getConsumerAgent());
-
- ProducerRegistrationRequirements requirements =
deployment.getRegistrationRequirements();
- assertTrue(requirements.requiresRegistration());
- assertTrue(requirements.fullServiceDescriptionRequiresRegistration());
- Map properties = requirements.getRegistrationProperties();
- assertNotNull(properties);
- assertEquals(2, properties.size());
-
- checkRegistrationProperty(requirements, 1);
- checkRegistrationProperty(requirements, 2);
}
-
- private void checkRegistrationProperty(ProducerRegistrationRequirements requirements,
int index)
- {
- RegistrationPropertyDescription desc =
requirements.getRegistrationPropertyWith("name" + index);
- assertNotNull(desc);
- assertEquals(new QName("name" + index), desc.getName());
- assertEquals(new QName("xsd:string"), desc.getType());
-
- LocalizedString localizedString = new LocalizedString("hint" + index,
Locale.ENGLISH);
- localizedString.setResourceName("resource.hint" + index);
- localizedString.setValue("hint" + index);
- assertEquals(localizedString, desc.getHint());
-
- localizedString = new LocalizedString("label" + index, Locale.ENGLISH);
- localizedString.setResourceName("resource.label" + index);
- localizedString.setValue("label" + index);
- assertEquals(localizedString, desc.getLabel());
- }
-
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployer.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployer.java 2006-11-22
22:22:21 UTC (rev 5715)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployer.java 2006-11-22
23:14:30 UTC (rev 5716)
@@ -27,7 +27,6 @@
import org.jboss.deployment.SubDeployerSupport;
import org.jboss.portal.common.util.URLTools;
import org.jboss.portal.federation.FederatingPortletInvoker;
-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;
@@ -60,8 +59,6 @@
/** . */
private String defaultWSRPLocation;
- private ProducerRegistrationRequirements registrationRequirements;
-
public FederatingPortletInvoker getFederatingPortletInvoker()
{
return federatingPortletInvoker;
@@ -82,11 +79,6 @@
this.defaultWSRPLocation = defaultWSRPLocation;
}
- public ProducerRegistrationRequirements getProducerRegistrationRequirements()
- {
- return registrationRequirements;
- }
-
public void init(DeploymentInfo di) throws DeploymentException
{
super.init(di);
@@ -113,7 +105,6 @@
{
super.start(di);
WSRPDeployment deployment = (WSRPDeployment)di.metaData;
- registrationRequirements = deployment.getRegistrationRequirements();
for (Iterator i = deployment.getServices().iterator(); i.hasNext();)
{
try
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployerMBean.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployerMBean.java 2006-11-22
22:22:21 UTC (rev 5715)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployerMBean.java 2006-11-22
23:14:30 UTC (rev 5716)
@@ -24,7 +24,6 @@
import org.jboss.deployment.SubDeployerExtMBean;
import org.jboss.portal.federation.FederatingPortletInvoker;
-import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -39,6 +38,4 @@
String getDefaultWSRPLocation();
void setDefaultWSRPLocation(String defaultWSRPLocation);
-
- ProducerRegistrationRequirements getProducerRegistrationRequirements();
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2006-11-22
22:22:21 UTC (rev 5715)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2006-11-22
23:14:30 UTC (rev 5716)
@@ -22,16 +22,10 @@
******************************************************************************/
package org.jboss.portal.wsrp.deployment;
-import org.jboss.portal.common.util.LocaleInfo;
-import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.consumer.WSRPConsumerImpl;
import org.jboss.portal.wsrp.core.Property;
import org.jboss.portal.wsrp.core.RegistrationData;
-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.portal.wsrp.services.AbstractJNDIServiceFactory;
import org.jboss.portal.wsrp.services.PerEndpointSOAPInvokerServiceFactory;
import org.jboss.portal.wsrp.services.RemoteSOAPInvokerServiceFactory;
@@ -40,10 +34,8 @@
import org.jboss.xb.binding.UnmarshallingContext;
import org.xml.sax.Attributes;
-import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.List;
-import java.util.Locale;
import java.util.Properties;
/**
@@ -59,8 +51,6 @@
/** . */
private static final String WSRP_PRODUCER = "wsrp-producer";
- private static final String REGISTRATION_CONFIG =
"registration-configuration";
-
/** . */
private List properties = new ArrayList();
@@ -104,17 +94,6 @@
service.setConsumer(new WSRPConsumerImpl());
return service;
}
- else 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;
- }
else
{
return null;
@@ -327,125 +306,4 @@
deployment.getServices().add(service);
}
-
- // ***** Registration requirements *****
-
- 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);
- }
- }
-
- public void addChild(WSRPDeployment deployment, ProducerRegistrationRequirements
regReq, UnmarshallingContext nav,
- String nsURI, String localName)
- {
- if (DEBUG)
- {
- System.out.println("addchild deployment regreq " + localName);
- }
-
- deployment.setRegistrationRequirements(regReq);
- }
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2006-11-22
22:22:21 UTC (rev 5715)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2006-11-22
23:14:30 UTC (rev 5716)
@@ -74,8 +74,8 @@
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.deployment.WSRPDeployer;
import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
+import org.jboss.portal.wsrp.producer.registration.config.RegistrationConfiguration;
import
org.jboss.portal.wsrp.producer.registration.impl.ProducerRegistrationRequirementsImpl;
import org.jboss.portal.wsrp.servlet.ServletAccess;
@@ -112,8 +112,8 @@
/** Handles Portlet Management interface calls. */
private PortletManagementHandler portletManagementHandler;
- /** To access the required registration information */
- private WSRPDeployer deployer;
+ /** Registration configuration service */
+ private RegistrationConfiguration registrationConfiguration;
private static final ProducerRegistrationRequirements
DEFAULT_REGISTRATION_REQUIREMENTS =
new ProducerRegistrationRequirementsImpl(false, false, false);
@@ -154,9 +154,9 @@
public ProducerRegistrationRequirements getProducerRegistrationRequirements()
{
ProducerRegistrationRequirements registrationRequirements =
DEFAULT_REGISTRATION_REQUIREMENTS;
- if (deployer != null)
+ if (registrationConfiguration != null)
{
- registrationRequirements = deployer.getProducerRegistrationRequirements();
+ registrationRequirements =
registrationConfiguration.getRegistrationRequirements();
}
// still need to check for null, in case there wasn't no registration info in
the descriptor
@@ -263,14 +263,14 @@
return registrationState;
}
- public WSRPDeployer getDeployer()
+ public RegistrationConfiguration getRegistrationConfiguration()
{
- return deployer;
+ return registrationConfiguration;
}
- public void setDeployer(WSRPDeployer deployer)
+ public void setRegistrationConfiguration(RegistrationConfiguration
registrationConfiguration)
{
- this.deployer = deployer;
+ this.registrationConfiguration = registrationConfiguration;
}
// PortletManagement implementation
*********************************************************************************
Added:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfiguration.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfiguration.java 2006-11-22
22:22:21 UTC (rev 5715)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfiguration.java 2006-11-22
23:14:30 UTC (rev 5716)
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * 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 RegistrationConfiguration
+{
+ ProducerRegistrationRequirements getRegistrationRequirements();
+}
Added:
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-11-22
22:22:21 UTC (rev 5715)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfigurationFactory.java 2006-11-22
23:14:30 UTC (rev 5716)
@@ -0,0 +1,178 @@
+/******************************************************************************
+ * 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);
+ }
+ }
+}
Added:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfigurationService.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfigurationService.java 2006-11-22
22:22:21 UTC (rev 5715)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfigurationService.java 2006-11-22
23:14:30 UTC (rev 5716)
@@ -0,0 +1,82 @@
+/******************************************************************************
+ * 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 RegistrationConfigurationService extends AbstractJBossService implements
RegistrationConfiguration
+{
+ 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);
+ }
+}
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-11-22
22:22:21 UTC (rev 5715)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2006-11-22
23:14:30 UTC (rev 5716)
@@ -79,7 +79,7 @@
<xmbean/>
<depends optional-attribute-name="Invoker"
proxy-type="attribute">portal:service=PortletInvoker,type=WSRPProducer</depends>
- <depends optional-attribute-name="Deployer"
proxy-type="attribute">portal.wsrp:service=WSRPDeployer</depends>
+ <depends optional-attribute-name="RegistrationConfiguration"
proxy-type="attribute">portal.wsrp:service=RegistrationConfiguration</depends>
</mbean>
<!-- Configure a consumer that is the portal itself -->
@@ -96,5 +96,13 @@
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
</mbean>
+
+ <!-- Registration configuration service -->
+ <mbean
code="org.jboss.portal.wsrp.producer.registration.config.RegistrationConfigurationService"
+ name="portal.wsrp:service=RegistrationConfiguration"
xmbean-dd=""
+
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="ConfigLocation">conf/config.xml</attribute>
+ </mbean>
</server>
Added: trunk/wsrp/src/resources/portal-wsrp-sar/conf/config.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/conf/config.xml 2006-11-22 22:22:21 UTC (rev
5715)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/conf/config.xml 2006-11-22 23:14:30 UTC (rev
5716)
@@ -0,0 +1,24 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<registration-configuration
fullServiceDescriptionRequiresRegistration="true"/>
Modified: trunk/wsrp/src/resources/tests/test-deployment-lib-jar/test-wsrp.xml
===================================================================
--- trunk/wsrp/src/resources/tests/test-deployment-lib-jar/test-wsrp.xml 2006-11-22
22:22:21 UTC (rev 5715)
+++ trunk/wsrp/src/resources/tests/test-deployment-lib-jar/test-wsrp.xml 2006-11-22
23:14:30 UTC (rev 5716)
@@ -78,20 +78,4 @@
</registration-data>
</wsrp-producer>
</deployment>
- <deployment>
- <registration-configuration
fullServiceDescriptionRequiresRegistration="true">
- <registration-property-description>
- <name>name1</name>
- <type>xsd:string</type>
- <hint xml:lang="en"
resourceName="resource.hint1">hint1</hint>
- <label xml:lang="en"
resourceName="resource.label1">label1</label>
- </registration-property-description>
- <registration-property-description>
- <name>name2</name>
- <type>xsd:string</type>
- <hint xml:lang="en"
resourceName="resource.hint2">hint2</hint>
- <label xml:lang="en"
resourceName="resource.label2">label2</label>
- </registration-property-description>
- </registration-configuration>
- </deployment>
</deployments>
\ No newline at end of file
Added:
trunk/wsrp/src/resources/tests/test-registration-configuration-lib-jar/extended.xml
===================================================================
---
trunk/wsrp/src/resources/tests/test-registration-configuration-lib-jar/extended.xml 2006-11-22
22:22:21 UTC (rev 5715)
+++
trunk/wsrp/src/resources/tests/test-registration-configuration-lib-jar/extended.xml 2006-11-22
23:14:30 UTC (rev 5716)
@@ -0,0 +1,37 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<registration-configuration
fullServiceDescriptionRequiresRegistration="true">
+ <registration-property-description>
+ <name>name1</name>
+ <type>xsd:string</type>
+ <hint xml:lang="en"
resourceName="resource.hint1">hint1</hint>
+ <label xml:lang="en"
resourceName="resource.label1">label1</label>
+ </registration-property-description>
+ <registration-property-description>
+ <name>name2</name>
+ <type>xsd:string</type>
+ <hint xml:lang="en"
resourceName="resource.hint2">hint2</hint>
+ <label xml:lang="en"
resourceName="resource.label2">label2</label>
+ </registration-property-description>
+</registration-configuration>
Added: trunk/wsrp/src/resources/tests/test-registration-configuration-lib-jar/minimal.xml
===================================================================
---
trunk/wsrp/src/resources/tests/test-registration-configuration-lib-jar/minimal.xml 2006-11-22
22:22:21 UTC (rev 5715)
+++
trunk/wsrp/src/resources/tests/test-registration-configuration-lib-jar/minimal.xml 2006-11-22
23:14:30 UTC (rev 5716)
@@ -0,0 +1,24 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<registration-configuration/>
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-11-22
22:22:21 UTC (rev 5715)
+++
trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml 2006-11-22
23:14:30 UTC (rev 5716)
@@ -176,13 +176,6 @@
<attribute name="RemotableByDefault">true</attribute>
</mbean>
- <!-- Use DefaultRegistrationPolicy for registration -->
- <mbean
code="org.jboss.portal.wsrp.producer.registration.policies.DefaultRegistrationPolicy"
- name="portal.wsrp:service=RegistrationPolicy" xmbean-dd=""
-
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- </mbean>
-
<!-- Hack to get access to req/resp -->
<mbean
code="org.jboss.portal.wsrp.servlet.ServletAccessService"