JBoss Portal SVN: r5716 - in trunk/wsrp: . src/main/org/jboss/portal/test/wsrp src/main/org/jboss/portal/test/wsrp/config src/main/org/jboss/portal/test/wsrp/deployment src/main/org/jboss/portal/wsrp/deployment src/main/org/jboss/portal/wsrp/producer src/main/org/jboss/portal/wsrp/producer/registration src/main/org/jboss/portal/wsrp/producer/registration/config src/resources/portal-wsrp-sar src/resources/portal-wsrp-sar/META-INF src/resources/portal-wsrp-sar/conf src/resources/tests src/res
by portal-commits@lists.jboss.org
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"
17 years, 5 months
JBoss Portal SVN: r5715 - trunk/core/src/main/org/jboss/portal/core/portlet/dashboard
by portal-commits@lists.jboss.org
Author: roy.russo(a)jboss.com
Date: 2006-11-22 17:22:21 -0500 (Wed, 22 Nov 2006)
New Revision: 5715
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
Log:
fixed processAction, hindered by my own stupidity
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2006-11-22 22:13:17 UTC (rev 5714)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2006-11-22 22:22:21 UTC (rev 5715)
@@ -32,6 +32,7 @@
import org.jboss.portlet.JBossPortlet;
import org.jboss.portlet.JBossRenderRequest;
import org.jboss.portlet.JBossRenderResponse;
+import org.jboss.portlet.JBossActionResponse;
import javax.portlet.PortletException;
import javax.portlet.PortletRequestDispatcher;
@@ -112,7 +113,7 @@
rd.include(req, resp);
}
- public void processAction(JBossActionRequest actionRequest, JBossRenderRequest renderRequest)
+ protected void processAction(JBossActionRequest actionRequest, JBossActionResponse actionResponse)
{
System.out.println("blah");
}
17 years, 5 months
JBoss Portal SVN: r5714 - trunk/core/src/main/org/jboss/portal/core/portlet/dashboard
by portal-commits@lists.jboss.org
Author: roy.russo(a)jboss.com
Date: 2006-11-22 17:13:17 -0500 (Wed, 22 Nov 2006)
New Revision: 5714
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
Log:
JBPORTAL-993 - added instance listing for regions
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2006-11-22 19:35:37 UTC (rev 5713)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2006-11-22 22:13:17 UTC (rev 5714)
@@ -112,7 +112,7 @@
rd.include(req, resp);
}
- protected void processAction(JBossActionRequest actionRequest, JBossRenderRequest renderRequest)
+ public void processAction(JBossActionRequest actionRequest, JBossRenderRequest renderRequest)
{
System.out.println("blah");
}
17 years, 5 months
JBoss Portal SVN: r5713 - in trunk: identity/src/main/org/jboss/portal/identity2 identity/src/main/org/jboss/portal/identity2/config identity/src/main/org/jboss/portal/identity2/config/info identity/src/main/org/jboss/portal/identity2/config/metadata identity/src/main/org/jboss/portal/identity2/config/metadata/profile identity/src/main/org/jboss/portal/identity2/info identity/src/main/org/jboss/portal/identity2/service identity/src/resources/draft test
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2006-11-22 14:35:37 -0500 (Wed, 22 Nov 2006)
New Revision: 5713
Added:
trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceController.java
trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceControllerImpl.java
trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfigurationMetaDataFactory.java
trunk/identity/src/main/org/jboss/portal/identity2/config/info/
trunk/identity/src/main/org/jboss/portal/identity2/config/info/ProfileInfoSupport.java
trunk/identity/src/main/org/jboss/portal/identity2/config/info/PropertyInfoSupport.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/IdentityConfigurationMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigOptionMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModulesMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/OptionsGroupMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/OptionsGroupOptionMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/OptionsMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/LocalizedStringMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/LocalizedValueMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/ProfileMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/ProfileMetaDataFactory.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMappingMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/info/
trunk/identity/src/main/org/jboss/portal/identity2/info/ProfileInfo.java
trunk/identity/src/main/org/jboss/portal/identity2/info/PropertyInfo.java
trunk/identity/src/main/org/jboss/portal/identity2/service/IdentityConfigurationService.java
Modified:
trunk/identity/src/resources/draft/db-profile.xml
trunk/identity/src/resources/draft/ldap-profile.xml
trunk/test/build.xml
Log:
- part of initial identity configuration impl
Added: trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceController.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceController.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceController.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,32 @@
+/*
+* 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.identity2;
+
+/**
+ *
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public interface IdentityServiceController
+{
+ public IdentityContext getIdentityContext();
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceControllerImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceControllerImpl.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceControllerImpl.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,136 @@
+/*
+* 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.identity2;
+
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.common.util.JNDI;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity2.config.SimpleIdentityConfigurationFactory;
+import org.jboss.portal.identity2.config.IdentityConfigurationMetaDataFactory;
+import org.jboss.portal.identity2.config.metadata.IdentityConfigurationMetaData;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.ObjectModelFactory;
+
+import java.net.URL;
+import java.io.InputStream;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class IdentityServiceControllerImpl extends AbstractJBossService implements IdentityServiceController
+{
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(IdentityServiceControllerImpl.class);
+
+ private String jndiName;
+
+ protected JNDI.Binding jndiBinding;
+
+ private IdentityContext identityContext;
+
+ private String configFile;
+
+ protected void startService() throws Exception
+ {
+ if (jndiName != null)
+ {
+ jndiBinding = new JNDI.Binding(jndiName, this);
+ jndiBinding.bind();
+ }
+
+ try
+ {
+ log.info("Processing portal identity configuration");
+ log.debug("config file: " + configFile);
+ URL config = Thread.currentThread().getContextClassLoader().getResource(configFile);
+ InputStream in = config.openStream();
+ // create unmarshaller
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+
+ // create an instance of ObjectModelFactory
+ ObjectModelFactory factory = new IdentityConfigurationMetaDataFactory();
+
+ // let the object model factory to create an instance of Map and populate it with data from XML
+ IdentityConfigurationMetaData meta = (IdentityConfigurationMetaData)unmarshaller.unmarshal(in, factory, null);
+
+ // close the XML stream
+ in.close();
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Cannot parse configuration file", e);
+ }
+
+
+ }
+
+
+ protected void stopService() throws Exception
+ {
+ if (jndiBinding != null)
+ {
+ jndiBinding.unbind();
+ jndiBinding = null;
+ }
+
+ }
+
+
+ public IdentityContext getIdentityContext()
+ {
+ return identityContext;
+ }
+
+
+ public String getConfigFile()
+ {
+ return configFile;
+ }
+
+ public void setConfigFile(String configFile)
+ {
+ this.configFile = configFile;
+ }
+
+
+ public String getJndiName()
+ {
+ return jndiName;
+ }
+
+ public void setJndiName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }
+
+ public JNDI.Binding getJndiBinding()
+ {
+ return jndiBinding;
+ }
+
+ public void setJndiBinding(JNDI.Binding jndiBinding)
+ {
+ this.jndiBinding = jndiBinding;
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfigurationMetaDataFactory.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfigurationMetaDataFactory.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfigurationMetaDataFactory.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,221 @@
+/*
+* 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.identity2.config;
+
+import org.jboss.xb.binding.GenericObjectModelFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.jboss.portal.identity2.config.metadata.IdentityConfigurationMetaData;
+import org.jboss.portal.identity2.config.metadata.ModulesMetaData;
+import org.jboss.portal.identity2.config.metadata.OptionsMetaData;
+import org.jboss.portal.identity2.config.metadata.ModuleMetaData;
+import org.jboss.portal.identity2.config.metadata.ModuleConfigMetaData;
+import org.jboss.portal.identity2.config.metadata.ModuleConfigOptionMetaData;
+import org.jboss.portal.identity2.config.metadata.OptionsGroupMetaData;
+import org.jboss.portal.identity2.config.metadata.OptionsGroupOptionMetaData;
+import org.xml.sax.Attributes;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class IdentityConfigurationMetaDataFactory implements GenericObjectModelFactory
+{
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(IdentityConfigurationMetaDataFactory.class);
+
+ public Object newRoot(Object object, UnmarshallingContext unmarshallingContext, String string, String string1, Attributes attributes)
+ {
+ return new IdentityConfigurationMetaData();
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext unmarshallingContext, String string, String string1)
+ {
+ return root;
+ }
+
+ public Object newChild(Object root, UnmarshallingContext nav, String nsURI, String localName, Attributes attrs)
+ {
+ if (root instanceof IdentityConfigurationMetaData)
+ {
+ if ("modules".equals(localName))
+ {
+ return new ModulesMetaData();
+ }
+ else if("options".equals(localName))
+ {
+ return new OptionsMetaData();
+ }
+ }
+ else if (root instanceof ModulesMetaData)
+ {
+ if ("module".equals(localName))
+ {
+ return new ModuleMetaData();
+ }
+ }
+ else if (root instanceof ModuleMetaData)
+ {
+ if ("config".equals(localName))
+ {
+ return new ModuleConfigMetaData();
+ }
+ }
+ else if (root instanceof ModuleConfigMetaData)
+ {
+ if ("option".equals(localName))
+ {
+ return new ModuleConfigOptionMetaData();
+ }
+ }
+ else if (root instanceof OptionsMetaData)
+ {
+ if ("option-group".equals(localName))
+ {
+ return new OptionsGroupMetaData();
+ }
+ }
+ else if (root instanceof OptionsGroupMetaData)
+ {
+ if ("option".equals(localName))
+ {
+ return new OptionsGroupOptionMetaData();
+ }
+ }
+ return null;
+ }
+
+ public void addChild(Object parent, Object child, UnmarshallingContext nav, String nsURI, String localName)
+ {
+ if (parent instanceof IdentityConfigurationMetaData)
+ {
+ IdentityConfigurationMetaData identity = (IdentityConfigurationMetaData)parent;
+ if (child instanceof ModulesMetaData)
+ {
+ identity.setModules((ModulesMetaData)child);
+ }
+ else if (child instanceof OptionsMetaData)
+ {
+ identity.setOptions((OptionsMetaData)child);
+ }
+
+ }
+ else if (parent instanceof ModulesMetaData)
+ {
+ ModulesMetaData modules = (ModulesMetaData)parent;
+ if (child instanceof ModuleMetaData)
+ {
+ modules.addModule((ModuleMetaData)child);
+ }
+ }
+ else if (parent instanceof ModuleMetaData)
+ {
+ ModuleMetaData module = (ModuleMetaData)parent;
+ if (child instanceof ModuleConfigMetaData)
+ {
+ module.setConfig((ModuleConfigMetaData)child);
+ }
+ }
+ else if (parent instanceof ModuleConfigMetaData)
+ {
+ ModuleConfigMetaData config = (ModuleConfigMetaData)parent;
+ if (child instanceof ModuleConfigOptionMetaData)
+ {
+ config.addOption((ModuleConfigOptionMetaData)child);
+ }
+ }
+ else if (parent instanceof OptionsMetaData)
+ {
+ OptionsMetaData options = (OptionsMetaData)parent;
+ if (child instanceof OptionsGroupMetaData)
+ {
+ options.addGroup((OptionsGroupMetaData)child);
+ }
+ }
+ else if (parent instanceof OptionsGroupMetaData)
+ {
+ OptionsGroupMetaData group = (OptionsGroupMetaData)parent;
+ if (child instanceof OptionsGroupOptionMetaData)
+ {
+ group.addOption((OptionsGroupOptionMetaData)child);
+ }
+ }
+ }
+
+ public void setValue(Object object, UnmarshallingContext unmarshallingContext, String nsUri, String localName, String value)
+ {
+ if (object instanceof ModuleMetaData)
+ {
+ ModuleMetaData module = (ModuleMetaData)object;
+ if ("type".equals(localName))
+ {
+ module.setType(value);
+ }
+ else if ("implementation".equals(localName))
+ {
+ module.setImplementation(value);
+ }
+ else if ("service-name".equals(localName))
+ {
+ module.setServiceName(value);
+ }
+ else if ("class".equals(localName))
+ {
+ module.setClassName(value);
+ }
+ else if ("jndi-name".equals(localName))
+ {
+ module.setJndiName(value);
+ }
+ }
+ else if (object instanceof ModuleConfigOptionMetaData)
+ {
+ ModuleConfigOptionMetaData option = (ModuleConfigOptionMetaData)object;
+ if ("name".equals(localName))
+ {
+ option.setName(value);
+ }
+ else if ("value".equals(localName))
+ {
+ option.setValue(value);
+ }
+ }
+ else if (object instanceof OptionsGroupMetaData)
+ {
+ OptionsGroupMetaData group = (OptionsGroupMetaData)object;
+ if ("group-name".equals(localName))
+ {
+ group.setName(value);
+ }
+ }
+ else if (object instanceof OptionsGroupOptionMetaData)
+ {
+ OptionsGroupOptionMetaData option = (OptionsGroupOptionMetaData)object;
+ if ("name".equals(localName))
+ {
+ option.setName(value);
+ }
+ else if ("value".equals(localName))
+ {
+ option.addValue(value);
+ }
+ }
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/config/info/ProfileInfoSupport.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/info/ProfileInfoSupport.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/info/ProfileInfoSupport.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,76 @@
+/*
+* 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.identity2.config.info;
+
+import org.jboss.portal.identity2.info.ProfileInfo;
+import org.jboss.portal.identity2.info.PropertyInfo;
+import org.jboss.portal.identity2.config.metadata.profile.ProfileMetaData;
+import org.jboss.portal.identity2.config.metadata.profile.PropertyMetaData;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class ProfileInfoSupport implements ProfileInfo
+{
+ private Map properties;
+
+
+ public ProfileInfoSupport(ProfileMetaData profile)
+ {
+ properties = new HashMap();
+ Map meta = profile.getProperties();
+ for (Iterator iterator = meta.keySet().iterator(); iterator.hasNext();)
+ {
+ String name = (String)iterator.next();
+ PropertyMetaData property = (PropertyMetaData)meta.get(name);
+ PropertyInfo pi = new PropertyInfoSupport(property);
+ properties.put(pi.getName(), pi);
+ }
+ }
+
+ public Map getPropertiesInfo()
+ {
+ if (properties != null)
+ {
+ return Collections.unmodifiableMap(properties);
+ }
+ else
+ {
+ return Collections.EMPTY_MAP;
+ }
+ }
+
+ public PropertyInfo getPropertyInfo(String name)
+ {
+ if (name != null)
+ {
+ return (PropertyInfo)properties.get(name);
+ }
+ return null;
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/config/info/PropertyInfoSupport.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/info/PropertyInfoSupport.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/info/PropertyInfoSupport.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,116 @@
+/*
+* 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.identity2.config.info;
+
+import org.jboss.portal.identity2.info.PropertyInfo;
+import org.jboss.portal.identity2.config.metadata.profile.PropertyMetaData;
+import org.jboss.portal.identity2.config.metadata.profile.LocalizedValueMetaData;
+import org.jboss.portal.common.util.LocalizedString;
+
+import java.util.Locale;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class PropertyInfoSupport implements PropertyInfo
+{
+ private String name;
+ private String type;
+ private String accessMode;
+ private String usage;
+ private LocalizedString displayName;
+ private LocalizedString description;
+ private String mappingType;
+ private String mappingValue;
+
+
+ public PropertyInfoSupport(PropertyMetaData meta)
+ {
+ name = meta.getName();
+ type = meta.getType();
+ accessMode = meta.getAccessMode();
+ usage = meta.getUsage();
+ mappingType = meta.getMapping().getType();
+ mappingValue = meta.getMapping().getValue();
+
+ Map descValues = new HashMap();
+ for (Iterator iterator = meta.getDescription().getValues().iterator(); iterator.hasNext();)
+ {
+ LocalizedValueMetaData value = (LocalizedValueMetaData)iterator.next();
+ descValues.put(value.getLocale(),value.getValue());
+ }
+ Map dispValues = new HashMap();
+ for (Iterator iterator = meta.getDisplayName().getValues().iterator(); iterator.hasNext();)
+ {
+ LocalizedValueMetaData value = (LocalizedValueMetaData)iterator.next();
+ dispValues.put(value.getLocale(),value.getValue());
+ }
+
+ description = new LocalizedString(descValues, Locale.ENGLISH);
+ displayName = new LocalizedString(dispValues, Locale.ENGLISH);
+
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public String getAccessMode()
+ {
+ return accessMode;
+ }
+
+ public String getUsage()
+ {
+ return usage;
+ }
+
+ public LocalizedString getDisplayName()
+ {
+ return displayName;
+ }
+
+ public LocalizedString getDescription()
+ {
+ return description;
+ }
+
+ public String getMappingType()
+ {
+ return mappingType;
+ }
+
+ public String getMappingValue()
+ {
+ return mappingValue;
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/IdentityConfigurationMetaData.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/IdentityConfigurationMetaData.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/IdentityConfigurationMetaData.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,61 @@
+/*
+* 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.identity2.config.metadata;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class IdentityConfigurationMetaData
+{
+ private ModulesMetaData modules;
+ private OptionsMetaData options;
+
+
+ public IdentityConfigurationMetaData()
+ {
+ }
+
+
+ public ModulesMetaData getModules()
+ {
+ return modules;
+ }
+
+ public void setModules(ModulesMetaData modules)
+ {
+ this.modules = modules;
+ }
+
+ public OptionsMetaData getOptions()
+ {
+ return options;
+ }
+
+ public void setOptions(OptionsMetaData options)
+ {
+ this.options = options;
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigMetaData.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigMetaData.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigMetaData.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,61 @@
+/*
+* 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.identity2.config.metadata;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class ModuleConfigMetaData
+{
+ private Map options;
+
+
+ public ModuleConfigMetaData()
+ {
+ options = new HashMap();
+ }
+
+
+ public Map getOptions()
+ {
+ return options;
+ }
+
+ public void setOptions(Map options)
+ {
+ this.options = options;
+ }
+
+ public void addOption(ModuleConfigOptionMetaData option)
+ {
+ options.put(option.getName(), option);
+ }
+
+ public ModuleConfigOptionMetaData getOption(String name)
+ {
+ return (ModuleConfigOptionMetaData)options.get(name);
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigOptionMetaData.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigOptionMetaData.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigOptionMetaData.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,58 @@
+/*
+* 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.identity2.config.metadata;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class ModuleConfigOptionMetaData
+{
+ private String name;
+ private String value;
+
+
+ public ModuleConfigOptionMetaData()
+ {
+ }
+
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleMetaData.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleMetaData.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleMetaData.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,102 @@
+/*
+* 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.identity2.config.metadata;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class ModuleMetaData
+{
+ private String type;
+ private String implementation;
+ private String serviceName;
+ private String className;
+ private String jndiName;
+ private ModuleConfigMetaData config;
+
+
+ public ModuleMetaData()
+ {
+ }
+
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ public String getImplementation()
+ {
+ return implementation;
+ }
+
+ public void setImplementation(String implementation)
+ {
+ this.implementation = implementation;
+ }
+
+ public String getServiceName()
+ {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName)
+ {
+ this.serviceName = serviceName;
+ }
+
+ public String getClassName()
+ {
+ return className;
+ }
+
+ public void setClassName(String className)
+ {
+ this.className = className;
+ }
+
+ public String getJndiName()
+ {
+ return jndiName;
+ }
+
+ public void setJndiName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }
+
+ public ModuleConfigMetaData getConfig()
+ {
+ return config;
+ }
+
+ public void setConfig(ModuleConfigMetaData config)
+ {
+ this.config = config;
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModulesMetaData.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModulesMetaData.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModulesMetaData.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,63 @@
+/*
+* 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.identity2.config.metadata;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class ModulesMetaData
+{
+ private Map modules;
+
+
+ public ModulesMetaData()
+ {
+ modules = new HashMap();
+ }
+
+
+ public Map getModules()
+ {
+ return modules;
+ }
+
+ public void setModules(Map modules)
+ {
+ this.modules = modules;
+ }
+
+ public void addModule(ModuleMetaData module)
+ {
+ modules.put(module.getType(), module);
+ }
+
+ public ModuleMetaData getModule(String type)
+ {
+ return (ModuleMetaData)modules.get(type);
+ }
+
+
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/OptionsGroupMetaData.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/OptionsGroupMetaData.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/OptionsGroupMetaData.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,70 @@
+/*
+* 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.identity2.config.metadata;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class OptionsGroupMetaData
+{
+ private String name;
+ private Map options;
+
+ public OptionsGroupMetaData()
+ {
+ options = new HashMap();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public Map getOptions()
+ {
+ return options;
+ }
+
+ public void setOptions(Map options)
+ {
+ this.options = options;
+ }
+
+ public void addOption(OptionsGroupOptionMetaData option)
+ {
+ options.put(option.getName(), option);
+ }
+
+ public OptionsGroupOptionMetaData getOption(String name)
+ {
+ return (OptionsGroupOptionMetaData)options.get(name);
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/OptionsGroupOptionMetaData.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/OptionsGroupOptionMetaData.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/OptionsGroupOptionMetaData.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,67 @@
+/*
+* 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.identity2.config.metadata;
+
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class OptionsGroupOptionMetaData
+{
+ private String name;
+ private Set values;
+
+
+ public OptionsGroupOptionMetaData()
+ {
+ values = new HashSet();
+ }
+
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public Set getValues()
+ {
+ return values;
+ }
+
+ public void setValues(Set values)
+ {
+ this.values = values;
+ }
+
+ public void addValue(String value)
+ {
+ values.add(value);
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/OptionsMetaData.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/OptionsMetaData.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/OptionsMetaData.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,61 @@
+/*
+* 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.identity2.config.metadata;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class OptionsMetaData
+{
+ private Map groups;
+
+
+ public OptionsMetaData()
+ {
+ groups = new HashMap();
+ }
+
+
+ public Map getGroups()
+ {
+ return groups;
+ }
+
+ public void setGroups(Map groups)
+ {
+ this.groups = groups;
+ }
+
+ public void addGroup(OptionsGroupMetaData group)
+ {
+ groups.put(group.getName(), group);
+ }
+
+ public OptionsGroupMetaData getGroup(String name)
+ {
+ return (OptionsGroupMetaData)groups.get(name);
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/LocalizedStringMetaData.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/LocalizedStringMetaData.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/LocalizedStringMetaData.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,46 @@
+/*
+* 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.identity2.config.metadata.profile;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class LocalizedStringMetaData
+{
+
+ /** . */
+ private List values;
+
+ public LocalizedStringMetaData()
+ {
+ values = new ArrayList();
+ }
+
+ public List getValues()
+ {
+ return values;
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/LocalizedValueMetaData.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/LocalizedValueMetaData.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/LocalizedValueMetaData.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,58 @@
+/*
+* 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.identity2.config.metadata.profile;
+
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class LocalizedValueMetaData
+{
+
+ /** . */
+ private Locale locale;
+
+ /** . */
+ private String value;
+
+ public Locale getLocale()
+ {
+ return locale;
+ }
+
+ public void setLocale(Locale locale)
+ {
+ this.locale = locale;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/ProfileMetaData.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/ProfileMetaData.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/ProfileMetaData.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,61 @@
+/*
+* 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.identity2.config.metadata.profile;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class ProfileMetaData
+{
+ private Map properties;
+
+
+ public ProfileMetaData()
+ {
+ properties = new HashMap();
+ }
+
+
+ public Map getProperties()
+ {
+ return properties;
+ }
+
+ public void setProperties(Map properties)
+ {
+ this.properties = properties;
+ }
+
+ public void addProperty(PropertyMetaData property)
+ {
+ properties.put(property.getName(),property);
+ }
+
+ public PropertyMetaData getProperty(String name)
+ {
+ return (PropertyMetaData)properties.get(name);
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/ProfileMetaDataFactory.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/ProfileMetaDataFactory.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/ProfileMetaDataFactory.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,158 @@
+/*
+* 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.identity2.config.metadata.profile;
+
+import org.jboss.xb.binding.GenericObjectModelFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.jboss.portal.identity2.config.IdentityConfigurationMetaDataFactory;
+import org.jboss.portal.identity2.config.metadata.IdentityConfigurationMetaData;
+import org.jboss.portal.common.util.LocaleInfo;
+import org.xml.sax.Attributes;
+
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class ProfileMetaDataFactory implements GenericObjectModelFactory
+{
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(ProfileMetaDataFactory.class);
+
+ public Object newRoot(Object object, UnmarshallingContext unmarshallingContext, String string, String string1, Attributes attributes)
+ {
+ return new ProfileMetaData();
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext unmarshallingContext, String string, String string1)
+ {
+ return root;
+ }
+
+ public Object newChild(Object root, UnmarshallingContext nav, String nsURI, String localName, Attributes attrs)
+ {
+ if (root instanceof ProfileMetaData)
+ {
+ if ("property".equals(localName))
+ {
+ return new PropertyMetaData();
+ }
+ }
+ else if (root instanceof PropertyMetaData)
+ {
+ if ("mapping".equals(localName))
+ {
+ return new PropertyMappingMetaData();
+ }
+ else if ("description".equals(localName))
+ {
+ String lang = attrs.getValue("xml:lang");
+ LocalizedValueMetaData value = new LocalizedValueMetaData();
+ if (lang != null)
+ {
+ Locale locale = LocaleInfo.decodeLocaleInfo(lang).getLocale();
+ value.setLocale(locale);
+ }
+ return value;
+ }
+ else if ("display-name".equals(localName))
+ {
+ String lang = attrs.getValue("xml:lang");
+ LocalizedValueMetaData value = new LocalizedValueMetaData();
+ if (lang != null)
+ {
+ Locale locale = LocaleInfo.decodeLocaleInfo(lang).getLocale();
+ value.setLocale(locale);
+ }
+ return value;
+ }
+ }
+ return null;
+ }
+
+ public void addChild(Object parent, Object child, UnmarshallingContext nav, String nsURI, String localName)
+ {
+ if (parent instanceof ProfileMetaData)
+ {
+ ProfileMetaData profile = (ProfileMetaData)parent;
+ if (child instanceof PropertyMetaData)
+ {
+ profile.addProperty((PropertyMetaData)child);
+ }
+ }
+ else if (parent instanceof PropertyMetaData)
+ {
+ PropertyMetaData describable = (PropertyMetaData)parent;
+ if (child instanceof LocalizedValueMetaData)
+ {
+ if ("description".equals(localName))
+ {
+ describable.getDescription().getValues().add(child);
+ }
+ else if ("dispalay-name".equals(localName))
+ {
+ describable.getDisplayName().getValues().add(child);
+ }
+ }
+ else if (child instanceof PropertyMappingMetaData)
+ {
+ describable.setMapping((PropertyMappingMetaData)child);
+ }
+ }
+ }
+
+ public void setValue(Object object, UnmarshallingContext unmarshallingContext, String nsUri, String localName, String value)
+ {
+ if (object instanceof PropertyMetaData)
+ {
+ PropertyMetaData property = (PropertyMetaData)object;
+ if ("name".equals(localName))
+ {
+ property.setName(value);
+ }
+ else if ("type".equals(localName))
+ {
+ property.setType(value);
+ }
+ else if ("access-mode".equals(localName))
+ {
+ property.setType(value);
+ }
+ else if ("usage".equals(localName))
+ {
+ property.setUsage(value);
+ }
+ }
+ else if (object instanceof PropertyMappingMetaData)
+ {
+ PropertyMappingMetaData mapping = (PropertyMappingMetaData)object;
+ if ("type".equals(localName))
+ {
+ mapping.setType(value);
+ }
+ else if ("value".equals(localName))
+ {
+ mapping.setValue(value);
+ }
+ }
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMappingMetaData.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMappingMetaData.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMappingMetaData.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,58 @@
+/*
+* 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.identity2.config.metadata.profile;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class PropertyMappingMetaData
+{
+ private String type;
+ private String value;
+
+
+ public PropertyMappingMetaData()
+ {
+ }
+
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMetaData.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMetaData.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMetaData.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,116 @@
+/*
+* 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.identity2.config.metadata.profile;
+
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class PropertyMetaData
+{
+ private String name;
+ private String type;
+ private String accessMode;
+ private String usage;
+ private LocalizedStringMetaData displayName;
+ private LocalizedStringMetaData description;
+ private PropertyMappingMetaData mapping;
+
+
+ public PropertyMetaData()
+ {
+ displayName= new LocalizedStringMetaData();
+ description = new LocalizedStringMetaData();
+ }
+
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ public String getAccessMode()
+ {
+ return accessMode;
+ }
+
+ public void setAccessMode(String accessMode)
+ {
+ this.accessMode = accessMode;
+ }
+
+ public String getUsage()
+ {
+ return usage;
+ }
+
+ public void setUsage(String usage)
+ {
+ this.usage = usage;
+ }
+
+ public LocalizedStringMetaData getDisplayName()
+ {
+ return displayName;
+ }
+
+ public void setDisplayName(LocalizedStringMetaData displayName)
+ {
+ this.displayName = displayName;
+ }
+
+ public LocalizedStringMetaData getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(LocalizedStringMetaData description)
+ {
+ this.description = description;
+ }
+
+ public PropertyMappingMetaData getMapping()
+ {
+ return mapping;
+ }
+
+ public void setMapping(PropertyMappingMetaData mapping)
+ {
+ this.mapping = mapping;
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/info/ProfileInfo.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/info/ProfileInfo.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/info/ProfileInfo.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,43 @@
+/*
+* 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.identity2.info;
+
+import java.util.Set;
+import java.util.Map;
+
+/**
+ * Class provides info about user profile
+ *
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ProfileInfo
+{
+ /**
+ * Returns a Map o PropertyInfo objects describing profile properties
+ * @return Map of PropertyInfo objects
+ */
+ public Map getPropertiesInfo();
+
+ public PropertyInfo getPropertyInfo(String name);
+
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/info/PropertyInfo.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/info/PropertyInfo.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/info/PropertyInfo.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,69 @@
+/*
+* 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.identity2.info;
+
+import org.jboss.portal.common.util.LocalizedString;
+
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public interface PropertyInfo
+{
+
+ public static final String ACCESS_MODE_READ_ONLY = "read-only";
+ public static final String ACCESS_MODE_READ_WRITE = "read-write";
+ public static final String USAGE_MANDATORY = "mandatory";
+ public static final String USAGE_OPTIONAL = "optional";
+ public static final String MAPPING_TYPE_COLUMN = "column";
+ public static final String MAPPING_TYPE_DYNAMIC = "dynamic";
+ public static final String MAPPING_TYPE_ATTRIBUTE = "attribute";
+
+
+ /*private String name;
+ private String type;
+ private String accessMode;
+ private String usage;
+ private LocalizedString displayName;
+ private LocalizedString description;
+ private PropertyMappingMetaData mapping;*/
+
+ public String getName();
+
+ public String getType();
+
+ public String getAccessMode();
+
+ public String getUsage();
+
+ public LocalizedString getDisplayName();
+
+ public LocalizedString getDescription();
+
+ public String getMappingType();
+
+ public String getMappingValue();
+
+
+
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/service/IdentityConfigurationService.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/service/IdentityConfigurationService.java 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/main/org/jboss/portal/identity2/service/IdentityConfigurationService.java 2006-11-22 19:35:37 UTC (rev 5713)
@@ -0,0 +1,325 @@
+/*
+* 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.identity2.service;
+
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.identity2.IdentityConfiguration;
+import org.jboss.portal.identity2.IdentityContext;
+import org.jboss.portal.identity2.config.SimpleIdentityConfigurationFactory;
+import org.jboss.portal.common.util.JNDI;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.ObjectModelFactory;
+
+import java.util.Map;
+import java.util.Set;
+import java.net.URL;
+import java.io.InputStream;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class IdentityConfigurationService extends AbstractJBossService implements IdentityConfiguration
+{
+
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(IdentityConfigurationService.class);
+
+ private Map data;
+
+ private String jndiName;
+
+ //private String configFile;
+
+ protected JNDI.Binding jndiBinding;
+
+ private IdentityContext identityContext;
+
+ public IdentityConfigurationService(Map optionGroups)
+ {
+ this.data = optionGroups;
+ }
+
+ protected void startService() throws Exception
+ {
+
+
+ /*try
+ {
+ log.info("Processing portal identity configuration");
+ log.debug("config file: " + configFile);
+ URL config = Thread.currentThread().getContextClassLoader().getResource(configFile);
+ InputStream in = config.openStream();
+ // create unmarshaller
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+
+ // create an instance of ObjectModelFactory
+ ObjectModelFactory factory = new SimpleIdentityConfigurationFactory();
+
+ // let the object model factory to create an instance of Map and populate it with data from XML
+ data = (Map)unmarshaller.unmarshal(in, factory, null);
+
+ // close the XML stream
+ in.close();
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Cannot parse configuration file", e);
+ }*/
+
+ //
+ if (jndiName != null)
+ {
+ jndiBinding = new JNDI.Binding(jndiName, this);
+ jndiBinding.bind();
+ }
+
+ if (identityContext == null)
+ {
+ throw new IdentityException("Cannot register module in context - missing reference");
+ }
+ else
+ {
+ identityContext.register(this, IdentityContext.IDENTITY_CONFIGURATION);
+ }
+
+
+ }
+
+
+ protected void stopService() throws Exception
+ {
+ if (jndiBinding != null)
+ {
+ jndiBinding.unbind();
+ jndiBinding = null;
+ }
+
+ if (identityContext == null)
+ {
+ log.error("Cannot unregister module in context - missing reference");
+ }
+ else
+ {
+ identityContext.unregister(IdentityContext.IDENTITY_CONFIGURATION);
+ }
+
+ }
+
+
+
+ public Set getValues(String optionGroup, String option)
+ {
+ if (optionGroup == null)
+ {
+ throw new IllegalArgumentException("null option group");
+ }
+ if (option == null)
+ {
+ throw new IllegalArgumentException("null option name");
+ }
+ if (data.containsKey(optionGroup))
+ {
+ Map group = (Map)data.get(optionGroup);
+ if (group.containsKey(option))
+ {
+ return (Set)group.get(option);
+ }
+ }
+ return null;
+ }
+
+ public String getValue(String optionGroup, String option)
+ {
+ if (optionGroup == null)
+ {
+ throw new IllegalArgumentException("null option group");
+ }
+ if (option == null)
+ {
+ throw new IllegalArgumentException("null option name");
+ }
+ if (data.containsKey(optionGroup))
+ {
+ Map group = (Map)data.get(optionGroup);
+ if (group.containsKey(option))
+ {
+ Set values = (Set)group.get(option);
+ if (values.size() > 0)
+ {
+ return (String)values.toArray()[0];
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getValue(String option)
+ {
+ if (option == null)
+ {
+ throw new IllegalArgumentException("null option name");
+ }
+ if (data.containsKey(GROUP_COMMON))
+ {
+ Map group = (Map)data.get(GROUP_COMMON);
+ if (group.containsKey(option))
+ {
+ Set values = (Set)group.get(option);
+ if (values.size() > 0)
+ {
+ return (String)values.toArray()[0];
+ }
+ }
+ }
+ return null;
+ }
+
+ public void setValues(String optionGroup, String option, Set values)
+ {
+ if (optionGroup == null)
+ {
+ throw new IllegalArgumentException("null option group");
+ }
+ if (option == null)
+ {
+ throw new IllegalArgumentException("null option name");
+ }
+ if (values == null)
+ {
+ throw new IllegalArgumentException("null values list");
+ }
+ if (data.containsKey(optionGroup))
+ {
+ ((Map)data.get(optionGroup)).put(option, values);
+ }
+ }
+
+ public void addValue(String optionGroup, String option, String value)
+ {
+ if (optionGroup == null)
+ {
+ throw new IllegalArgumentException("null option group");
+ }
+ if (option == null)
+ {
+ throw new IllegalArgumentException("null option name");
+ }
+ if (value == null)
+ {
+ throw new IllegalArgumentException("null value name");
+ }
+ if (data.containsKey(optionGroup))
+ {
+ Map group = (Map)data.get(optionGroup);
+ if (group.containsKey(option))
+ {
+ ((Set)group.get(option)).add(value);
+ }
+ }
+ }
+
+ public Map getOptions(String optionGroup)
+ {
+ if (optionGroup == null)
+ {
+ throw new IllegalArgumentException("null option group");
+ }
+ if (data.containsKey(optionGroup))
+ {
+ return (Map)data.get(optionGroup);
+ }
+ return null;
+ }
+
+ public void setOptions(String optionGroup, Map options)
+ {
+ if (optionGroup == null)
+ {
+ throw new IllegalArgumentException("null option group");
+ }
+ if (options == null)
+ {
+ throw new IllegalArgumentException("null options map");
+ }
+ data.put(optionGroup,options);
+ }
+
+ public void remoeOption(String optionGroup, String option)
+ {
+ if (optionGroup == null)
+ {
+ throw new IllegalArgumentException("null option group");
+ }
+ if (option == null)
+ {
+ throw new IllegalArgumentException("null option name");
+ }
+ if (data.containsKey(optionGroup))
+ {
+ ((Map)data.get(optionGroup)).put(option, null);
+ }
+ }
+
+
+ public void setData(Map data)
+ {
+ this.data = data;
+ }
+
+ public Map getOptionGroups()
+ {
+ return data;
+ }
+
+ public String getJndiName()
+ {
+ return jndiName;
+ }
+
+ public void setJndiName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }
+
+// public String getConfigFile()
+// {
+// return configFile;
+// }
+//
+// public void setConfigFile(String configFile)
+// {
+// this.configFile = configFile;
+// }
+
+ public IdentityContext getIdentityContext()
+ {
+ return identityContext;
+ }
+
+ public void setIdentityContext(IdentityContext identityContext)
+ {
+ this.identityContext = identityContext;
+ }
+
+}
Modified: trunk/identity/src/resources/draft/db-profile.xml
===================================================================
--- trunk/identity/src/resources/draft/db-profile.xml 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/resources/draft/db-profile.xml 2006-11-22 19:35:37 UTC (rev 5713)
@@ -24,54 +24,52 @@
<profile>
<!--Database mapping - jbp_user table column mapping-->
<property>
- <attribute-name>user.name.given</attribute-name>
+ <name>user.name.given</name>
<type>java.lang.String</type>
<access-mode>read-only</access-mode>
<usage>mandatory</usage>
<display-name xml:lang="EN">User name</display-name>
<description xml:lang="EN">The user name</description>
<mapping>
- <column>
- <column-name>jbp_givenname</column-name>
- </column>
+ <type>column</type>
+ <value>jbp_givenname</value>
</mapping>
</property>
<property>
- <attribute-name>portal.user.enabled</attribute-name>
+ <name>portal.user.enabled</name>
<type>java.lang.Boolean</type>
<access-mode>read-write</access-mode>
<usage>optional</usage>
<display-name xml:lang="EN">User enabled</display-name>
<description xml:lang="EN">User enabled status</description>
<mapping>
- <column>
- <column-name>jbp_enabled</column-name>
- </column>
+ <type>column</type>
+ <value>jbp_enabled</value>
</mapping>
</property>
<property>
- <attribute-name>user.name.nickName</attribute-name>
+ <name>user.name.nickName</name>
<type>java.lang.String</type>
<access-mode>read-write</access-mode>
<usage>optional</usage>
<display-name xml:lang="EN">Nick name</display-name>
<description xml:lang="EN">The nick name</description>
<mapping>
- <column>
- <column-name>jbp_nickname</column-name>
- </column>
+ <type>column</type>
+ <value>jbp_nickname</value>
</mapping>
</property>
<!--Dynamic database store-->
<property>
- <attribute-name>portal.user.signature</attribute-name>
+ <name>portal.user.signature</name>
<type>java.lang.String</type>
<access-mode>read-write</access-mode>
<usage>optional</usage>
<display-name xml:lang="EN">Signature</display-name>
<description xml:lang="EN">The user signature</description>
<mapping>
- <dynamic-name>portal.user.signature</dynamic-name>
+ <type>dynamic</type>
+ <value>portal.user.signature</value>
</mapping>
</property>
</profile>
\ No newline at end of file
Modified: trunk/identity/src/resources/draft/ldap-profile.xml
===================================================================
--- trunk/identity/src/resources/draft/ldap-profile.xml 2006-11-22 16:59:57 UTC (rev 5712)
+++ trunk/identity/src/resources/draft/ldap-profile.xml 2006-11-22 19:35:37 UTC (rev 5713)
@@ -24,28 +24,28 @@
<profile>
<!--LDAP-->
<property>
- <attribute-name>portal.user.realEmail</attribute-name>
+ <name>portal.user.realEmail</name>
<type>java.lang.String</type>
<access-mode>read-write</access-mode>
<usage>optional</usage>
<display-name xml:lang="EN">Real Email</display-name>
<description xml:lang="EN">The real email</description>
<mapping>
- <attribute>
- <attribute-name>mail</attribute-name>
- </attribute>
+ <type>attribute</type>
+ <value>mail</value>
</mapping>
</property>
<!--Dynamic database store-->
<property>
- <attribute-name>portal.user.signature</attribute-name>
+ <name>portal.user.signature</name>
<type>java.lang.String</type>
<access-mode>read-write</access-mode>
<usage>optional</usage>
<display-name xml:lang="EN">Signature</display-name>
<description xml:lang="EN">The user signature</description>
<mapping>
- <dynamic-name>portal.user.signature</dynamic-name>
+ <type>dynamic</type>
+ <value>portal.user.signature</value>
</mapping>
</property>
</profile>
\ No newline at end of file
Modified: trunk/test/build.xml
===================================================================
17 years, 5 months
JBoss Portal SVN: r5712 - in trunk/core/src: main/org/jboss/portal/core/portlet/dashboard resources/portal-core-war/WEB-INF/jsp/dashboard
by portal-commits@lists.jboss.org
Author: roy.russo(a)jboss.com
Date: 2006-11-22 11:59:57 -0500 (Wed, 22 Nov 2006)
New Revision: 5712
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp
Log:
JBPORTAL-993 - added instance listing for regions
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2006-11-22 15:02:09 UTC (rev 5711)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2006-11-22 16:59:57 UTC (rev 5712)
@@ -22,10 +22,12 @@
package org.jboss.portal.core.portlet.dashboard;
import org.jboss.logging.Logger;
-import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.theme.ThemeConstants;
import org.jboss.portlet.JBossActionRequest;
import org.jboss.portlet.JBossPortlet;
import org.jboss.portlet.JBossRenderRequest;
@@ -36,7 +38,6 @@
import javax.portlet.PortletSecurityException;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -50,6 +51,8 @@
private InstanceContainer instanceContainer;
+ private PortalObjectContainer portalObjectContainer;
+
public void init()
throws PortletException
{
@@ -57,19 +60,54 @@
instanceContainer = (InstanceContainer)getPortletContext().getAttribute("InstanceContainer");
+ portalObjectContainer = (PortalObjectContainer)getPortletContext().getAttribute("PortalObjectContainer");
+
if (instanceContainer == null)
{
throw new PortletException("No InstanceContainer found");
}
+ if (portalObjectContainer == null)
+ {
+ throw new PortletException("No PortalObjectContainer found");
+ }
}
protected void doView(JBossRenderRequest req, JBossRenderResponse resp)
throws PortletException, PortletSecurityException, IOException
{
- List instances = (List)instanceContainer.getInstances();
+ List available_instances = (List)instanceContainer.getInstances();
+ List left_instances = new ArrayList();
+ List center_instances = new ArrayList();
+ List right_instances = new ArrayList();
+ Page page = portalObjectContainer.getContext().getPortal("dashboard").getPage(req.getUser().getUserName());
+ for (Iterator i = page.getChildren().iterator(); i.hasNext();)
+ {
+ PortalObject object = (PortalObject)i.next();
+ if (object.getType() == PortalObject.TYPE_WINDOW)
+ {
+ Window window = (Window)object;
+ String region = object.getProperty(ThemeConstants.PORTAL_PROP_REGION);
+ if (region.equals("left"))
+ {
+ left_instances.add(window.getInstanceRef());
+ }
+ else if (region.equals("center"))
+ {
+ center_instances.add(window.getInstanceRef());
+ }
+ else if (region.equals("right"))
+ {
+ right_instances.add(window.getInstanceRef());
+ }
+ }
+ }
+
resp.setContentType("text/html");
- req.setAttribute("instances", instances);
+ req.setAttribute("available_instances", available_instances);
+ req.setAttribute("left_instances", left_instances);
+ req.setAttribute("center_instances", center_instances);
+ req.setAttribute("right_instances", right_instances);
PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/dashboard/editpage.jsp");
rd.include(req, resp);
}
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp 2006-11-22 15:02:09 UTC (rev 5711)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp 2006-11-22 16:59:57 UTC (rev 5712)
@@ -1,6 +1,5 @@
<%@ page import="org.jboss.portal.core.model.instance.Instance" %>
<%@ page import="java.util.List" %>
-<%@ page import="org.jboss.portal.portlet.Portlet" %>
<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
@@ -9,7 +8,10 @@
<portlet:defineObjects/>
<%
- List instances = (List)request.getAttribute("instances");
+ List available_instances = (List)request.getAttribute("available_instances");
+ List left_instances = (List)request.getAttribute("left_instances");
+ List center_instances = (List)request.getAttribute("center_instances");
+ List right_instances = (List)request.getAttribute("right_instances");
%>
<script type="text/javascript" language="JavaScript">
@@ -67,107 +69,122 @@
</td>
</tr>
<tr>
- <td>
- <form action="<portlet:actionURL>
+<td>
+<form action="<portlet:actionURL>
</portlet:actionURL>" name="instancesForm" method="POST" onsubmit="debug();">
- <input type="hidden" name="op"/>
- <input type="hidden" name="toRegion"/>
- <input type="hidden" name="fromRegion"/>
- <input type="hidden" name="sortRegion"/>
- <table width="100%">
- <tr>
- <td>
- <table>
- <tr>
- <td>title/layout table</td>
- </tr>
- </table>
- </td>
- <td class="portlet-section-body" valign="top"><b>Available Content</b><br/>
- <select name="available_instances" multiple="true" size="20">
- <%
- for (int i = 0; i < instances.size(); i++)
- {
- Instance instance = (Instance)instances.get(i);
- %>
- <option value="<%= instance.getId() %>"><%= instance.getId()%>
- </option>
- <%
- }
- %>
- </select>
- </td>
- <td>
- <table>
- <tr>
- <td>
- <input type="submit" class="portlet-form-button" name=">" value=">"
- onclick="assignPortlet('copy','left');"/><br/><input
- type="submit" class="portlet-form-button" name="<" value="<"
- onclick="unassignPortlet('remove','left');"/></td>
- <td class="portlet-section-body" valign="top">
- <b>Left Column</b><br/>
- <select name="instances_left" multiple="true" size="6">
- <option value="">Instance 1</option>
- <option value="">Instance 2</option>
- <option value="">Instance 3</option>
- <option value="">Instance 4</option>
- <option value="">Instance 5</option>
- </select>
- </td>
- <td>
- <input type="submit" class="portlet-form-button" name="Up" value="Up"
- onclick="sortPortlet('up','left');"/><br/><input
- type="submit" class="portlet-form-button" name="Down" value="Down"
- onclick="sortPortlet('down','left');"/>
- </td>
- </tr>
- <tr>
- <td>
- <input type="submit" class="portlet-form-button" name=">" value=">"
- onclick="sortPortlet('copy','center');"/><br/><input
- type="submit" class="portlet-form-button" name="<" value="<"
- onclick="sortPortlet('remove','center');"/></td>
- <td class="portlet-section-body" valign="top"><b>Middle Column</b><br/>
- <select name="instances_middle" multiple="true" size="6">
- <option value="">Instance 1</option>
- <option value="">Instance 2</option>
- <option value="">Instance 3</option>
- <option value="">Instance 4</option>
- <option value="">Instance 5</option>
- </select></td>
- <td>
- <input type="submit" class="portlet-form-button" name="Up" value="Up"
- onclick="sortPortlet('up','center');"/><br/><input
- type="submit" class="portlet-form-button" name="Down" value="Down"
- onclick="sortPortlet('down','center');"/></td>
- </tr>
- <tr>
- <td>
- <input type="submit" class="portlet-form-button" name=">" value=">"
- onclick="assignPortlet('copy','right');"/><br/><input
- type="submit" class="portlet-form-button" name="<" value="<"
- onclick="unassignPortlet('remove','right');"/></td>
- <td class="portlet-section-body" valign="top"><b>Right Column</b><br/>
- <select name="instances_right" multiple="true" size="6">
- <option value="">Instance 1</option>
- <option value="">Instance 2</option>
- <option value="">Instance 3</option>
- <option value="">Instance 4</option>
- <option value="">Instance 5</option>
- </select></td>
- <td>
- <input type="submit" class="portlet-form-button" name="Up" value="Up"
- onclick="sortPortlet('up','right');"/><br/><input
- type="submit" class="portlet-form-button" name="Down" value="Down"
- onclick="sortPortlet('down','right');"/></td>
- </tr>
- </table>
- </tr>
- </table>
- </form>
- </td>
+<input type="hidden" name="op"/>
+<input type="hidden" name="toRegion"/>
+<input type="hidden" name="fromRegion"/>
+<input type="hidden" name="sortRegion"/>
+<table width="100%">
+<tr>
+<td>
+ <table>
+ <tr>
+ <td>title/layout table</td>
+ </tr>
+ </table>
+</td>
+<td class="portlet-section-body" valign="top"><b>Available Content</b><br/>
+ <select name="available_instances" multiple="true" size="20">
+ <%
+ for (int i = 0; i < available_instances.size(); i++)
+ {
+ Instance instance = (Instance)available_instances.get(i);
+ %>
+ <option value="<%= instance.getId() %>"><%= instance.getId()%>
+ </option>
+ <%
+ }
+ %>
+ </select>
+</td>
+<td>
+<table>
+ <tr>
+ <td>
+ <input type="submit" class="portlet-form-button" name=">" value=">"
+ onclick="assignPortlet('copy','left');"/><br/><input
+ type="submit" class="portlet-form-button" name="<" value="<"
+ onclick="unassignPortlet('remove','left');"/></td>
+ <td class="portlet-section-body" valign="top">
+ <b>Left Column</b><br/>
+ <select name="left_instances" multiple="true" size="6">
+ <%
+ for (int i = 0; i < left_instances.size(); i++)
+ {
+ String instance = (String)left_instances.get(i);
+ %>
+ <option value="<%= instance %>"><%= instance%>
+ </option>
+ <%
+ }
+ %>
+ </select>
+ </td>
+ <td>
+ <input type="submit" class="portlet-form-button" name="Up" value="Up"
+ onclick="sortPortlet('up','left');"/><br/><input
+ type="submit" class="portlet-form-button" name="Down" value="Down"
+ onclick="sortPortlet('down','left');"/>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type="submit" class="portlet-form-button" name=">" value=">"
+ onclick="sortPortlet('copy','center');"/><br/><input
+ type="submit" class="portlet-form-button" name="<" value="<"
+ onclick="sortPortlet('remove','center');"/></td>
+ <td class="portlet-section-body" valign="top"><b>Middle Column</b><br/>
+ <select name="center_instances" multiple="true" size="6">
+ <%
+ for (int i = 0; i < right_instances.size(); i++)
+ {
+ String instance = (String)right_instances.get(i);
+ %>
+ <option value="<%= instance %>"><%= instance%>
+ </option>
+ <%
+ }
+ %>
+ </select></td>
+ <td>
+ <input type="submit" class="portlet-form-button" name="Up" value="Up"
+ onclick="sortPortlet('up','center');"/><br/><input
+ type="submit" class="portlet-form-button" name="Down" value="Down"
+ onclick="sortPortlet('down','center');"/></td>
+ </tr>
+ <tr>
+ <td>
+ <input type="submit" class="portlet-form-button" name=">" value=">"
+ onclick="assignPortlet('copy','right');"/><br/><input
+ type="submit" class="portlet-form-button" name="<" value="<"
+ onclick="unassignPortlet('remove','right');"/></td>
+ <td class="portlet-section-body" valign="top"><b>Right Column</b><br/>
+ <select name="right_instances" multiple="true" size="6">
+ <%
+ for (int i = 0; i < center_instances.size(); i++)
+ {
+ String instance = (String)center_instances.get(i);
+ %>
+ <option value="<%= instance %>"><%= instance%>
+ </option>
+ <%
+ }
+ %>
+ </select></td>
+ <td>
+ <input type="submit" class="portlet-form-button" name="Up" value="Up"
+ onclick="sortPortlet('up','right');"/><br/><input
+ type="submit" class="portlet-form-button" name="Down" value="Down"
+ onclick="sortPortlet('down','right');"/></td>
+ </tr>
+</table>
</tr>
+</table>
+</form>
+</td>
+</tr>
<tr>
<td class="portlet-section-alternate" width="100%" colspan="4" align="center">
<input type="submit" name="save" value="Save" class="portlet-form-button"/>
17 years, 5 months
JBoss Portal SVN: r5711 - trunk/core/src/main/org/jboss/portal/core/util
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-11-22 10:02:09 -0500 (Wed, 22 Nov 2006)
New Revision: 5711
Removed:
trunk/core/src/main/org/jboss/portal/core/util/RewriteHelper.java
Log:
removed unused code
Deleted: trunk/core/src/main/org/jboss/portal/core/util/RewriteHelper.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/util/RewriteHelper.java 2006-11-22 15:01:12 UTC (rev 5710)
+++ trunk/core/src/main/org/jboss/portal/core/util/RewriteHelper.java 2006-11-22 15:02:09 UTC (rev 5711)
@@ -1,103 +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.core.util;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Rewrite helper class. <p>This class features a set of methods to rewrite markup content with unique identifiers. It
- * can be used for WSRP consumer rewrite. The default implementation of all methods replaces the 'wsrp_rewrite_' token
- * with the provided prefix token.</p>
- *
- * @author <a href="mailto:mholzner@novell.com>Martin Holzner</a>
- * @version $LastChangedRevision$, $LastChangedDate$
- */
-public final class RewriteHelper
-{
-
- private static Pattern WSRP_REWRITE_TOKEN = Pattern.compile("wsrp_rewrite_");
-
- /**
- * Constant to signal in a portlet that rewrite is requested. <p>A portlet can set this flag as a response property
- * (set to "true") to signal to the theme layer that the content needs to be rewritten. If the flag is set the theme
- * layer will detect it and replace all 'wsrp_rewite_' tokens with the provided prefix</p>
- */
- public static final String REWRITE_FLAG = "WSRP_REWRITE";
-
- /**
- * Constant to set a prefix value to use during the rewrite. <p>This prefix is equivalent to the producer write
- * paradigm defined in WSRP. The portlet can set any arbitrary value to use for the rewrite, by providing this token
- * as a response property. It is up to the portlet to decide where to get the value from.</p>
- */
- public static final String NAMESPACE_PREFIX = "WSRP_NAMESPACE_PREFIX";
-
- /**
- * Constant to set the content that should be injected into the HEAD tag of the pages markup. <p>The content set in a
- * portlet response property with this flag will be injected into the HEAD tag, if the portal layout features the
- * headercontent tag.</p>
- */
- public static final String HEADER_CONTENT = "HEADER_CONTENT";
-
- /**
- * Rewrite the content. <p>Rewrite the provided content by parsing for the 'wsrp_rewrite_' token and replacing it
- * with the provided <code>prefix</code>.</p>
- *
- * @param content the content to parse and potentially rewrite
- * @param prefix the replacement string for the 'wsrp_rewrite_' token(s)
- * @return the rewritten content
- */
- public static String wsrpRewriteContent(String content, String prefix)
- {
- return rewriteContent(WSRP_REWRITE_TOKEN, content, prefix);
- }
-
- /**
- * Rewrite the content. <p>Rewrite the provided content by parsing for the provided pattern, and replacing each
- * occurence with the provided prefix.</p>
- *
- * @param pattern the compiled regular expression to parse the content for
- * @param content the content to parse and potentially rewrite
- * @param prefix the replacement string for the 'wsrp_rewrite_' token(s)
- * @return the rewritten content
- * @see java.util.regex.Pattern#compile()
- */
- public static String rewriteContent(Pattern pattern, String content, String prefix)
- {
- if (pattern == null)
- {
- throw new IllegalArgumentException("pattern cannot be null");
- }
- if (content == null)
- {
- throw new IllegalArgumentException("content cannot be null");
- }
- // We allow an empty token to rewrite , or do we ?
- if (prefix == null)
- {
- throw new IllegalArgumentException("prefix cannot be null");
- }
- Matcher match = pattern.matcher(content);
- return match.replaceAll(prefix);
- }
-}
17 years, 5 months
JBoss Portal SVN: r5710 - in trunk: build/ide/intellij/idea60/modules/core core/src/main/org/jboss/portal/core
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-11-22 10:01:12 -0500 (Wed, 22 Nov 2006)
New Revision: 5710
Removed:
trunk/core/src/main/org/jboss/portal/core/ui/
Modified:
trunk/build/ide/intellij/idea60/modules/core/core.iml
Log:
remove empty dir
Modified: trunk/build/ide/intellij/idea60/modules/core/core.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/core/core.iml 2006-11-22 14:45:08 UTC (rev 5709)
+++ trunk/build/ide/intellij/idea60/modules/core/core.iml 2006-11-22 15:01:12 UTC (rev 5710)
@@ -257,6 +257,7 @@
</library>
</orderEntry>
<orderEntry type="module" module-name="wsrp" />
+ <orderEntry type="module" module-name="api" />
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
17 years, 5 months
JBoss Portal SVN: r5709 - in trunk/core/src: main/org/jboss/portal/core/aspects/controller/node main/org/jboss/portal/core/cms main/org/jboss/portal/core/controller/classic main/org/jboss/portal/core/controller/command/mapper main/org/jboss/portal/core/controller/portlet main/org/jboss/portal/core/model/instance main/org/jboss/portal/core/model/instance/command main/org/jboss/portal/core/model/instance/command/response main/org/jboss/portal/core/model/portal main/org/jboss/portal/core/model
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-11-22 09:45:08 -0500 (Wed, 22 Nov 2006)
New Revision: 5709
Added:
trunk/core/src/main/org/jboss/portal/core/controller/portlet/InvokePortletCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceURLFactory.java
trunk/core/src/main/org/jboss/portal/core/model/instance/InvokePortletInstanceCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceActionCommand.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceCommand.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/response/
trunk/core/src/main/org/jboss/portal/core/model/instance/command/response/PortletInstanceResponse.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortletWindowResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/PortletWindowResponse.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowMarkupResponse.java
Removed:
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowActionCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/UpdateWindowMarkupResponse.java
trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorURLFactory.java
trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletActionCommand.java
trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletCommand.java
trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/ui/configurator/PortletCommandFactoryImpl.java
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java
trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectURLFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingURLFactoryService.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleURLFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/URLFactoryDelegate.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
Log:
- converted the ui configurator to a portlet instance invoker that can invoke portlet instance without page support
- improved the DelegatingURLFactory mechanism to be more flexible and avoid to base its decisions on the classname which does not let room to use command properties or any other contextual information to create the right URL for the command
- disabled ajax DnD on the configurator
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -36,8 +36,8 @@
import org.jboss.portal.core.controller.CommandRedirectionException;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerInterceptor;
-import org.jboss.portal.core.model.portal.command.InvokeWindowActionCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowActionCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.model.portal.command.WindowCommand;
import org.jboss.portal.core.event.PortalEventListenerRegistry;
import org.jboss.portal.core.model.instance.Instance;
@@ -119,7 +119,7 @@
//
if (interactionParams != null)
{
- redirection = new InvokeWindowActionCommand(
+ redirection = new InvokePortletWindowActionCommand(
nodeRef,
mode,
windowState,
@@ -139,7 +139,7 @@
//
if (navigationalParams != null)
{
- redirection = new InvokeWindowRenderCommand(
+ redirection = new InvokePortletWindowRenderCommand(
nodeRef,
mode,
windowState,
@@ -148,7 +148,7 @@
}
else if (nextEvent instanceof WindowNavigationEvent)
{
- redirection = new InvokeWindowRenderCommand(
+ redirection = new InvokePortletWindowRenderCommand(
nodeRef,
mode,
windowState);
@@ -159,7 +159,7 @@
if (event instanceof WindowActionEvent)
{
WindowActionEvent wae = (WindowActionEvent)event;
- InvokeWindowActionCommand iwac = (InvokeWindowActionCommand)cmd;
+ InvokePortletWindowActionCommand iwac = (InvokePortletWindowActionCommand)cmd;
Map params = wae.getParameters();
if (params instanceof LazyParameterMap)
{
@@ -198,9 +198,9 @@
Portlet portlet = instance.getPortlet();
if (portlet != null && portlet.isRemote() == false)
{
- if (cmd instanceof InvokeWindowActionCommand)
+ if (cmd instanceof InvokePortletWindowActionCommand)
{
- InvokeWindowActionCommand iwac = (InvokeWindowActionCommand)wc;
+ InvokePortletWindowActionCommand iwac = (InvokePortletWindowActionCommand)wc;
//
Parameters formParams = iwac.getFormParameters();
@@ -244,9 +244,9 @@
action.setParameters(params);
return action;
}
- else if (cmd instanceof InvokeWindowRenderCommand)
+ else if (cmd instanceof InvokePortletWindowRenderCommand)
{
- InvokeWindowRenderCommand iwrc = (InvokeWindowRenderCommand)wc;
+ InvokePortletWindowRenderCommand iwrc = (InvokePortletWindowRenderCommand)wc;
StateString navigationalState = iwrc.getNavigationalState();
//
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -29,7 +29,7 @@
import org.jboss.portal.server.request.URLFormat;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.model.portal.command.RenderPageCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -128,7 +128,7 @@
public String toString()
{
- InvokeWindowRenderCommand cmd = new InvokeWindowRenderCommand(handle, null, null, parameters);
+ InvokePortletWindowRenderCommand cmd = new InvokePortletWindowRenderCommand(handle, null, null, parameters);
URLContext urlContext = getURLContext();
return controllerContext.renderURL(cmd, urlContext, URLFormat.newInstance(relative, true));
}
Modified: trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -29,7 +29,7 @@
import org.jboss.portal.cms.model.Content;
import org.jboss.portal.cms.model.File;
import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.server.ServerInvocation;
@@ -119,7 +119,7 @@
parameters.setValue("path", portalRequestPath);
// Perform a render URL on the target window
- return new InvokeWindowRenderCommand(targetWindowRef, Mode.VIEW, null, parameters);
+ return new InvokePortletWindowRenderCommand(targetWindowRef, Mode.VIEW, null, parameters);
}
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectURLFactory.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectURLFactory.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -36,9 +36,6 @@
{
/** . */
- private static final String[] COMMAND_CLASS_NAMES = {StreamContentCommand.class.getName()};
-
- /** . */
private String path;
public String getPath()
@@ -51,11 +48,6 @@
this.path = path;
}
- protected String[] getCommandClassNames()
- {
- return COMMAND_CLASS_NAMES;
- }
-
public ServerURL doMapping(ServerInvocation invocation, ControllerCommand cmd)
{
if (cmd == null)
@@ -79,9 +71,8 @@
asu.setPortalRequestPath(buffer.toString());
return asu;
}
- else
- {
- throw new IllegalArgumentException("Command " + cmd.getClass().getName() + " not accepted");
- }
+
+ //
+ return null;
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -32,8 +32,9 @@
import org.jboss.portal.core.controller.InsufficientTransportGuaranteeException;
import org.jboss.portal.core.controller.ControllerSecurityException;
import org.jboss.portal.core.controller.ResourceNotFoundException;
-import org.jboss.portal.core.controller.portlet.PortletResponseHandler;
import org.jboss.portal.core.model.portal.PortalObjectResponseHandler;
+import org.jboss.portal.core.model.portal.PortletWindowResponseHandler;
+import org.jboss.portal.core.model.instance.PortletInstanceResponseHandler;
import org.jboss.portal.server.ServerException;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerURL;
@@ -55,7 +56,8 @@
{
new ClassicResponseHandler(),
new PortalObjectResponseHandler(),
- new PortletResponseHandler()
+ new PortletWindowResponseHandler(),
+ new PortletInstanceResponseHandler()
};
public void handle(ServerInvocation invocation) throws ServerException
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingURLFactoryService.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingURLFactoryService.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingURLFactoryService.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -26,9 +26,7 @@
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerURL;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
+import java.util.ArrayList;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -37,7 +35,8 @@
public class DelegatingURLFactoryService extends AbstractURLFactory implements DelegatingURLFactory
{
- private Map delegates = new HashMap();
+ /** The different delegates. */
+ private ArrayList delegates = new ArrayList();
public ServerURL doMapping(ServerInvocation invocation, ControllerCommand cmd)
{
@@ -45,25 +44,23 @@
{
throw new IllegalArgumentException("No null command accepted");
}
- URLFactory delegate = null;
+
+ //
if (delegates != null)
{
- String commandClassName = cmd.getClass().getName();
- delegate = (URLFactory)delegates.get(commandClassName);
+ for (int i = 0;i < delegates.size();i++)
+ {
+ URLFactory delegate = (URLFactory)delegates.get(i);
+ ServerURL url = delegate.doMapping(invocation, cmd);
+ if (url != null)
+ {
+ return url;
+ }
+ }
}
- if (delegate != null)
- {
- return delegate.doMapping(invocation, cmd);
- }
- else
- {
- throw new IllegalArgumentException("Command " + cmd.getClass().getName() + " not accepted");
- }
- }
- public Map getFactoryMapping()
- {
- return new HashMap(delegates);
+ //
+ return null;
}
public void register(URLFactoryDelegate factory)
@@ -74,19 +71,16 @@
}
synchronized (this)
{
- Map copy = new HashMap(delegates);
- String[] classNames = factory.getCommandClassNames();
- for (int i = 0; i < classNames.length; i++)
+ if (delegates.contains(factory))
{
- String factoryClassName = classNames[i];
- Object value = copy.get(factoryClassName);
- if (value != null && !value.equals(factory))
- {
- throw new IllegalArgumentException("Factory already registered for command " + factoryClassName);
- }
- copy.put(factoryClassName, factory);
+ log.warn("Dual registration of URL factory " + factory);
}
- delegates = copy;
+ else
+ {
+ ArrayList copy = new ArrayList(delegates);
+ copy.add(factory);
+ delegates = copy;
+ }
}
}
@@ -98,16 +92,16 @@
}
synchronized (this)
{
- Map copy = new HashMap(delegates);
- for (Iterator i = copy.entrySet().iterator(); i.hasNext();)
+ if (delegates.contains(factory))
{
- Map.Entry entry = (Map.Entry)i.next();
- if (factory.equals(entry.getValue()))
- {
- i.remove();
- }
+ log.warn("Unregistration of URL factory " + factory + " failed because it is not registered");
}
- delegates = copy;
+ else
+ {
+ ArrayList copy = new ArrayList(delegates);
+ copy.remove(factory);
+ delegates = copy;
+ }
}
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleURLFactory.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleURLFactory.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -62,9 +62,21 @@
public ServerURL doMapping(ServerInvocation invocation, ControllerCommand cmd)
{
- AbstractServerURL url = new AbstractServerURL();
- url.setPortalRequestPath(path);
- return url;
+ if (cmd == null)
+ {
+ throw new IllegalArgumentException("No null cmd accepted");
+ }
+ String className = cmd.getClass().getName();
+ for (int i = 0;i < classNames.length;i++)
+ {
+ if (className.equals(classNames[i]))
+ {
+ AbstractServerURL url = new AbstractServerURL();
+ url.setPortalRequestPath(path);
+ return url;
+ }
+ }
+ return null;
}
protected String[] getCommandClassNames()
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/URLFactoryDelegate.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/URLFactoryDelegate.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/URLFactoryDelegate.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -29,6 +29,7 @@
public abstract class URLFactoryDelegate extends AbstractURLFactory
{
+ /** . */
private DelegatingURLFactory factory;
public DelegatingURLFactory getFactory()
@@ -41,8 +42,6 @@
this.factory = factory;
}
- protected abstract String[] getCommandClassNames();
-
protected void startService() throws Exception
{
factory.register(this);
Copied: trunk/core/src/main/org/jboss/portal/core/controller/portlet/InvokePortletCommandFactory.java (from rev 5700, trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletCommandFactory.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletCommandFactory.java 2006-11-21 10:09:27 UTC (rev 5700)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/InvokePortletCommandFactory.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -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. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller.portlet;
+
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.portlet.RenderURL;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface InvokePortletCommandFactory
+{
+ ControllerCommand createInvokeActionCommand(ActionURL portletURL);
+ ControllerCommand createInvokeRenderCommand(RenderURL portletURL);
+}
Deleted: trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletCommandFactory.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletCommandFactory.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -1,37 +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.core.controller.portlet;
-
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.portlet.ActionURL;
-import org.jboss.portal.portlet.RenderURL;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface PortletCommandFactory
-{
- ControllerCommand createInvokeActionCommand(ActionURL portletURL);
- ControllerCommand createInvokeRenderCommand(RenderURL portletURL);
-}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -36,8 +36,8 @@
import org.jboss.portal.portlet.spi.RenderContext;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowActionCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowActionCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.Mode;
@@ -67,7 +67,7 @@
Portal portal)
{
PortletContextFactory cf = new PortletContextFactory(controllerContext, portal, window);
- InternalPortletCommandFactory cpc = new InternalPortletCommandFactory(window, controllerContext);
+ InternalInvokePortletCommandFactory cpc = new InternalInvokePortletCommandFactory(window, controllerContext);
return createRender(controllerContext, mode, windowState, navigationalState, cf, cpc);
}
@@ -83,7 +83,7 @@
Portal portal)
{
PortletContextFactory cf = new PortletContextFactory(controllerContext, portal, window);
- InternalPortletCommandFactory cpc = new InternalPortletCommandFactory(window, controllerContext);
+ InternalInvokePortletCommandFactory cpc = new InternalInvokePortletCommandFactory(window, controllerContext);
return createAction(controllerContext, mode, windowState, navigationalState, interactionState, form, cf, cpc);
}
@@ -95,7 +95,7 @@
StateString interactionState,
Parameters form,
PortletContextFactory cf,
- PortletCommandFactory cpc)
+ InvokePortletCommandFactory cpc)
{
HTTPStreamInfo streamInfo = controllerContext.getServerInvocation().getResponse().getStreamInfo();
@@ -132,7 +132,7 @@
WindowState windowState,
StateString navigationalState,
PortletContextFactory cf,
- PortletCommandFactory cpc)
+ InvokePortletCommandFactory cpc)
{
HTTPStreamInfo streamInfo = controllerContext.getServerInvocation().getResponse().getStreamInfo();
@@ -164,9 +164,9 @@
private static class ControllerActionContext extends AbstractActionContext
{
- private PortletCommandFactory cmdFactory;
+ private InvokePortletCommandFactory cmdFactory;
private ControllerContext controllerContext;
- public ControllerActionContext(PortletCommandFactory cmdFactory, ControllerContext controllerContext, Mode mode, WindowState windowState, StateString navigationalState, HTTPStreamInfo streamInfo, StateString interactionState, Parameters form)
+ public ControllerActionContext(InvokePortletCommandFactory cmdFactory, ControllerContext controllerContext, Mode mode, WindowState windowState, StateString navigationalState, HTTPStreamInfo streamInfo, StateString interactionState, Parameters form)
{
super(mode, windowState, navigationalState, streamInfo, interactionState, form);
@@ -196,9 +196,9 @@
private static class ControllerRenderContext extends AbstractRenderContext
{
- private PortletCommandFactory cmdFactory;
+ private InvokePortletCommandFactory cmdFactory;
private ControllerContext controllerContext;
- public ControllerRenderContext(PortletCommandFactory cmdFactory, ControllerContext controllerContext, Mode mode, WindowState windowState, StateString navigationalState, HTTPStreamInfo streamInfo)
+ public ControllerRenderContext(InvokePortletCommandFactory cmdFactory, ControllerContext controllerContext, Mode mode, WindowState windowState, StateString navigationalState, HTTPStreamInfo streamInfo)
{
super(mode, windowState, navigationalState, streamInfo);
@@ -228,7 +228,7 @@
public static String renderURL(
ControllerContext controllerContext,
- PortletCommandFactory factory,
+ InvokePortletCommandFactory factory,
PortletURL portletURL,
Boolean wantSecure,
Boolean wantAuthenticated,
@@ -262,7 +262,7 @@
return controllerContext.renderURL(cmd, info, URLFormat.newInstance(relative, true));
}
- private static class InternalPortletCommandFactory implements PortletCommandFactory
+ private static class InternalInvokePortletCommandFactory implements InvokePortletCommandFactory
{
/** . */
@@ -271,7 +271,7 @@
/** . */
ControllerContext controllerContext;
- public InternalPortletCommandFactory(Window window, ControllerContext controllerContext)
+ public InternalInvokePortletCommandFactory(Window window, ControllerContext controllerContext)
{
this.controllerContext = controllerContext;
this.window = window;
@@ -279,12 +279,12 @@
public ControllerCommand createInvokeActionCommand(ActionURL actionURL)
{
- return new InvokeWindowActionCommand(window.getId(), actionURL.getMode(), actionURL.getWindowState(), actionURL.getNavigationalState(), actionURL.getInteractionState(), null);
+ return new InvokePortletWindowActionCommand(window.getId(), actionURL.getMode(), actionURL.getWindowState(), actionURL.getNavigationalState(), actionURL.getInteractionState(), null);
}
public ControllerCommand createInvokeRenderCommand(RenderURL renderURL)
{
- return new InvokeWindowRenderCommand(window.getId(), renderURL.getMode(), renderURL.getWindowState(), renderURL.getNavigationalState());
+ return new InvokePortletWindowRenderCommand(window.getId(), renderURL.getMode(), renderURL.getWindowState(), renderURL.getNavigationalState());
}
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponse.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponse.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -30,34 +30,21 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class PortletResponse
+public abstract class PortletResponse
{
/** . */
- private String windowId;
-
- /** . */
private PortletInvocationResponse response;
- public PortletResponse(String windowId, PortletInvocationResponse response)
+ public PortletResponse(PortletInvocationResponse response)
{
- if (windowId == null)
- {
- throw new IllegalArgumentException();
- }
if (response == null)
{
throw new IllegalArgumentException();
}
- this.windowId = windowId;
this.response = response;
}
- public String getWindowId()
- {
- return windowId;
- }
-
public PortletInvocationResponse getResult()
{
return response;
Modified: trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -26,8 +26,7 @@
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.classic.AbstractResponseHandler;
import org.jboss.portal.core.controller.classic.CommandForward;
-import org.jboss.portal.core.model.portal.command.InvokeWindowRenderCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowActionCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowActionCommand;
import org.jboss.portal.core.model.portal.command.RenderPageCommand;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.server.ServerException;
@@ -51,9 +50,15 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class PortletResponseHandler extends AbstractResponseHandler
+public abstract class PortletResponseHandler extends AbstractResponseHandler
{
+ protected abstract ControllerCommand createRenderCommand(
+ Mode mode,
+ WindowState windowState,
+ StateString navState,
+ PortletResponse response);
+
public CommandForward handleResponse(ControllerContext ctx, ControllerCommand cmd, Object response) throws IOException, ServletException, ServerException
{
if (response instanceof PortletResponse)
@@ -61,18 +66,23 @@
ServerInvocation invocation = ctx.getServerInvocation();
PortletResponse pr = (PortletResponse)response;
PortletInvocationResponse pir = pr.getResult();
+
+ //
if (pir instanceof RenderResponse)
{
RenderResponse renderResult = (RenderResponse)pir;
- StateString portletNavState = renderResult.getNavigationalState();
+ StateString navState = renderResult.getNavigationalState();
WindowState windowState = renderResult.getWindowState();
Mode mode = renderResult.getMode();
- InvokeWindowRenderCommand iwrc = new InvokeWindowRenderCommand(
- pr.getWindowId(),
- mode,
- windowState,
- portletNavState);
- return new CommandForward(iwrc, null);
+ ControllerCommand renderCmd = createRenderCommand(mode, windowState, navState, pr);
+ if (renderCmd != null)
+ {
+ return new CommandForward(renderCmd, null);
+ }
+ else
+ {
+ return null;
+ }
}
else if (pir instanceof HTTPRedirectionResponse)
{
@@ -105,7 +115,7 @@
if (location == null)
{
// Redirect to the same page
- InvokeWindowActionCommand iwac = (InvokeWindowActionCommand)cmd;
+ InvokePortletWindowActionCommand iwac = (InvokePortletWindowActionCommand)cmd;
Page page = iwac.getPage();
RenderPageCommand renderCmd = new RenderPageCommand(page.getId());
boolean secure = invocation.getServerContext().getURLContext().getSecure();
Copied: trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceCommandFactory.java (from rev 5700, trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorCommandFactory.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorCommandFactory.java 2006-11-21 10:09:27 UTC (rev 5700)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceCommandFactory.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * 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.core.model.instance;
+
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
+import org.jboss.portal.core.model.instance.command.InvokePortletInstanceActionCommand;
+import org.jboss.portal.core.model.instance.command.InvokePortletInstanceRenderCommand;
+import org.jboss.portal.portlet.impl.PortletRequestDecoder;
+import org.jboss.portal.server.ServerInvocation;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class InstanceCommandFactory extends AbstractCommandFactory
+{
+
+ /** The instance id of the command to create. */
+ private String instanceId;
+
+ public String getInstanceId()
+ {
+ return instanceId;
+ }
+
+ public void setInstanceId(String instanceId)
+ {
+ this.instanceId = instanceId;
+ }
+
+ public ControllerCommand doMapping(ServerInvocation invocation, String portalContextPath, String portalRequestPath)
+ {
+ PortletRequestDecoder decoder = new PortletRequestDecoder();
+ decoder.decode(invocation.getServerContext().getQueryParameterMap(), invocation.getServerContext().getBodyParameterMap());
+ switch (decoder.getType())
+ {
+ case PortletRequestDecoder.NAV_TYPE:
+ {
+ return createPortletNavCommand(decoder);
+ }
+ case PortletRequestDecoder.RENDER_TYPE:
+ {
+ return createPortletRenderCommand(decoder);
+ }
+ case PortletRequestDecoder.ACTION_TYPE:
+ {
+ return createPortletActionCommand(decoder);
+ }
+ }
+
+ //
+ return null;
+ }
+
+ /**
+ *
+ */
+ public ControllerCommand createPortletActionCommand(PortletRequestDecoder decoder)
+ {
+ return new InvokePortletInstanceActionCommand(
+ instanceId,
+ decoder.getNavigationalstate(),
+ decoder.getInteractionState(),
+ decoder.getForm());
+ }
+
+ /**
+ *
+ */
+ protected ControllerCommand createPortletRenderCommand(PortletRequestDecoder decoder)
+ {
+ return new InvokePortletInstanceRenderCommand(instanceId, decoder.getNavigationalstate());
+ }
+
+ /**
+ *
+ */
+ protected ControllerCommand createPortletNavCommand(PortletRequestDecoder decoder)
+ {
+ return new InvokePortletInstanceRenderCommand(instanceId, decoder.getNavigationalstate());
+ }
+}
Copied: trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceURLFactory.java (from rev 5700, trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorURLFactory.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorURLFactory.java 2006-11-21 10:09:27 UTC (rev 5700)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceURLFactory.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -0,0 +1,101 @@
+/******************************************************************************
+ * 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.core.model.instance;
+
+import org.jboss.portal.core.controller.command.mapper.URLFactoryDelegate;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.model.instance.command.InvokePortletInstanceRenderCommand;
+import org.jboss.portal.core.model.instance.command.InvokePortletInstanceActionCommand;
+import org.jboss.portal.core.model.instance.command.InvokePortletInstanceCommand;
+import org.jboss.portal.server.ServerURL;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.AbstractServerURL;
+import org.jboss.portal.portlet.impl.PortletRequestEncoder;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class InstanceURLFactory extends URLFactoryDelegate
+{
+
+ /** . */
+ private String path;
+
+ /** . */
+ private String instanceId;
+
+ public String getPath()
+ {
+ return path;
+ }
+
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+
+ public String getInstanceId()
+ {
+ return instanceId;
+ }
+
+ public void setInstanceId(String instanceId)
+ {
+ this.instanceId = instanceId;
+ }
+
+ public ServerURL doMapping(ServerInvocation invocation, ControllerCommand cmd)
+ {
+ if (cmd == null)
+ {
+ throw new IllegalArgumentException("No null command accepted");
+ }
+
+ //
+ if (cmd instanceof InvokePortletInstanceCommand)
+ {
+ InvokePortletInstanceCommand iic = (InvokePortletInstanceCommand)cmd;
+ if (iic.getInstanceId().equals(instanceId))
+ {
+ ServerURL url = new AbstractServerURL();
+ url.setPortalRequestPath(path);
+ if (cmd instanceof InvokePortletInstanceRenderCommand)
+ {
+ InvokePortletInstanceRenderCommand iprc = (InvokePortletInstanceRenderCommand)cmd;
+ PortletRequestEncoder.encodeRender(url, iprc.getNavigationalState(), null, null);
+ }
+ else
+ {
+ InvokePortletInstanceActionCommand iprc = (InvokePortletInstanceActionCommand)cmd;
+ PortletRequestEncoder.encodeAction(url, iprc.getNavigationalState(), iprc.getInteractionState(), null, null);
+ }
+ return url;
+
+ }
+ }
+
+ //
+ return null;
+ }
+}
Copied: trunk/core/src/main/org/jboss/portal/core/model/instance/InvokePortletInstanceCommandFactory.java (from rev 5700, trunk/core/src/main/org/jboss/portal/core/ui/configurator/PortletCommandFactoryImpl.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ui/configurator/PortletCommandFactoryImpl.java 2006-11-21 10:09:27 UTC (rev 5700)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/InvokePortletInstanceCommandFactory.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -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.core.model.instance;
+
+import org.jboss.portal.core.controller.portlet.InvokePortletCommandFactory;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.model.instance.command.InvokePortletInstanceRenderCommand;
+import org.jboss.portal.core.model.instance.command.InvokePortletInstanceActionCommand;
+import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.portlet.RenderURL;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class InvokePortletInstanceCommandFactory implements InvokePortletCommandFactory
+{
+
+ /** . */
+ private String instanceId;
+
+ public InvokePortletInstanceCommandFactory(String instanceId)
+ {
+ this.instanceId = instanceId;
+ }
+
+ public ControllerCommand createInvokeActionCommand(ActionURL portletURL)
+ {
+ return new InvokePortletInstanceActionCommand(
+ instanceId,
+ portletURL.getNavigationalState(),
+ portletURL.getInteractionState(),
+ null);
+ }
+
+ public ControllerCommand createInvokeRenderCommand(RenderURL portletURL)
+ {
+ return new InvokePortletInstanceRenderCommand(
+ instanceId,
+ portletURL.getNavigationalState());
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -0,0 +1,52 @@
+/******************************************************************************
+ * 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.core.model.instance;
+
+import org.jboss.portal.core.controller.portlet.PortletResponseHandler;
+import org.jboss.portal.core.controller.portlet.PortletResponse;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.model.instance.command.response.PortletInstanceResponse;
+import org.jboss.portal.core.model.instance.command.InvokePortletInstanceRenderCommand;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.portlet.StateString;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletInstanceResponseHandler extends PortletResponseHandler
+{
+
+ protected ControllerCommand createRenderCommand(Mode mode, WindowState windowState, StateString navState, PortletResponse response)
+ {
+ if (response instanceof PortletInstanceResponse)
+ {
+ PortletInstanceResponse ir = (PortletInstanceResponse)response;
+ return new InvokePortletInstanceRenderCommand(ir.getInstanceId(), navState);
+ }
+
+ //
+ return null;
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceActionCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceActionCommand.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceActionCommand.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -0,0 +1,106 @@
+/******************************************************************************
+ * 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.core.model.instance.command;
+
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.portlet.PortletContextFactory;
+import org.jboss.portal.core.controller.portlet.InvokePortletCommandFactory;
+import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.model.instance.InvokePortletInstanceCommandFactory;
+import org.jboss.portal.core.model.instance.command.response.PortletInstanceResponse;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class InvokePortletInstanceActionCommand extends InvokePortletInstanceCommand
+{
+
+ /** The interaction state. */
+ private StateString interactionState;
+
+ /** The nform. */
+ private Parameters form;
+
+ public InvokePortletInstanceActionCommand(String instanceId, StateString navigationalState, StateString interactionState, Parameters form)
+ {
+ super(instanceId, navigationalState);
+
+ //
+ this.interactionState = interactionState;
+ this.form = form;
+ }
+
+ public StateString getInteractionState()
+ {
+ return interactionState;
+ }
+
+ public Parameters getForm()
+ {
+ return form;
+ }
+
+ public CommandInfo getInfo()
+ {
+ return null;
+ }
+
+ public Object execute() throws ControllerException
+ {
+ try
+ {
+ PortletContextFactory pcf1 = new PortletContextFactory(context);
+ InvokePortletCommandFactory pcf2 = new InvokePortletInstanceCommandFactory(instanceId);
+
+ //
+ ActionInvocation action = PortletInvocationFactory.createAction(
+ context,
+ Mode.VIEW,
+ WindowState.MAXIMIZED,
+ navigationalState,
+ interactionState,
+ form,
+ pcf1,
+ pcf2);
+
+ //
+ PortletInvocationResponse response = instance.invoke(action);
+
+ //
+ return new PortletInstanceResponse(instanceId, response);
+ }
+ catch (PortletInvokerException e)
+ {
+ return new ControllerException(e);
+ }
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceCommand.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceCommand.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -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.core.model.instance.command;
+
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.portlet.StateString;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class InvokePortletInstanceCommand extends ControllerCommand
+{
+
+ /** The instance id. */
+ protected String instanceId;
+
+ /** The navigational state. */
+ protected StateString navigationalState;
+
+ /** The instance displayed. */
+ protected Instance instance;
+
+ protected InvokePortletInstanceCommand(String instanceId, StateString navigationalState)
+ {
+ if (instanceId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.instanceId = instanceId;
+ this.navigationalState = navigationalState;
+
+ }
+
+ public String getInstanceId()
+ {
+ return instanceId;
+ }
+
+ protected void create() throws ControllerException
+ {
+ InstanceContainer container = context.getController().getInstanceContainer();
+
+ //
+ instance = container.getInstance(instanceId);
+ if (instance == null)
+ {
+ throw new ControllerException("Configurator portlet instance " + instanceId + " not found");
+ }
+ }
+
+ public StateString getNavigationalState()
+ {
+ return navigationalState;
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -0,0 +1,136 @@
+/******************************************************************************
+ * 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.core.model.instance.command;
+
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.portlet.PortletContextFactory;
+import org.jboss.portal.core.controller.portlet.InvokePortletCommandFactory;
+import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.model.instance.InvokePortletInstanceCommandFactory;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.invocation.response.ErrorResponse;
+import org.jboss.portal.theme.PageRendition;
+import org.jboss.portal.theme.LayoutService;
+import org.jboss.portal.theme.PortalLayout;
+import org.jboss.portal.theme.ThemeConstants;
+import org.jboss.portal.theme.navigation.PageNavigationalState;
+import org.jboss.portal.theme.page.PageService;
+import org.jboss.portal.theme.page.ModifiablePageResult;
+import org.jboss.portal.theme.page.WindowResult;
+import org.jboss.portal.theme.page.ModifiableWindowResult;
+import org.jboss.portal.theme.page.WindowContext;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+import org.jboss.portal.common.NotYetImplemented;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class InvokePortletInstanceRenderCommand extends InvokePortletInstanceCommand
+{
+
+ public InvokePortletInstanceRenderCommand(String instanceId, StateString navigationalState)
+ {
+ super(instanceId, navigationalState);
+ }
+
+ public CommandInfo getInfo()
+ {
+ return null;
+ }
+
+ public Object execute() throws ControllerException
+ {
+ try
+ {
+ PortletContextFactory pcf1 = new PortletContextFactory(context);
+ InvokePortletCommandFactory pcf2 = new InvokePortletInstanceCommandFactory(instanceId);
+ RenderInvocation render = PortletInvocationFactory.createRender(context, Mode.VIEW, WindowState.MAXIMIZED, navigationalState, pcf1, pcf2);
+ PortletInvocationResponse response = instance.invoke(render);
+
+ // For now let the controller handle non fragment response
+ String content;
+ if (response instanceof FragmentResponse)
+ {
+ content = ((FragmentResponse)response).getContent();
+ }
+ else if (response instanceof ErrorResponse)
+ {
+ content = ((ErrorResponse)response).toHTML();
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+
+ //
+ PageService ps = context.getController().getPageService();
+ LayoutService ls = ps.getLayoutService();
+ PortalLayout layout = ls.getLayout("generic", true);
+ Map pageProperties = new HashMap();
+ pageProperties.put(ThemeConstants.PORTAL_AJAX_OBJECT_DISABLED, "true");
+ Map portalProperties = new HashMap();
+ portalProperties.put("theme.renderSetId", "divRenderer");
+ portalProperties.put("theme.id", "renaissance");
+ portalProperties.put("layout.strategyId", "maximizedRegion");
+ ModifiablePageResult result = new ModifiablePageResult("BILTO", pageProperties, portalProperties);
+
+ //
+ Map windowProps = new HashMap();
+ windowProps.put(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER, "emptyRenderer");
+ windowProps.put(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER, "emptyRenderer");
+ windowProps.put(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER, "emptyRenderer");
+
+ //
+ WindowResult res = new ModifiableWindowResult("", content, Collections.EMPTY_MAP, windowProps, null, null, WindowState.NORMAL, Mode.VIEW);
+ WindowContext blah = new WindowContext("BILTO", "BILTO", "maximized", 0);
+ result.addWindowContext(blah);
+ result.addWindowResult("BILTO", res);
+
+ //
+ PageNavigationalState pns = new PageNavigationalState();
+ HashMap tmp = new HashMap();
+ tmp.put("BILTO", blah);
+ pns.initialize(tmp);
+ pns.setLayoutURI("/layouts/generic/maximized.jsp");
+ pns.setLayoutState("maximized");
+
+ //
+ return new PageRendition(layout, pns, result, ps);
+ }
+ catch (PortletInvokerException e)
+ {
+ return new ControllerException(e);
+ }
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/model/instance/command/response/PortletInstanceResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/response/PortletInstanceResponse.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/response/PortletInstanceResponse.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -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.core.model.instance.command.response;
+
+import org.jboss.portal.core.controller.portlet.PortletResponse;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletInstanceResponse extends PortletResponse
+{
+
+ /** . */
+ private String instanceId;
+
+ public PortletInstanceResponse(String instanceId, PortletInvocationResponse response)
+ {
+ super(response);
+
+ //
+ this.instanceId = instanceId;
+ }
+
+ public String getInstanceId()
+ {
+ return instanceId;
+ }
+}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -25,8 +25,8 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowActionCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowActionCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.model.portal.command.RenderPageCommand;
import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
import org.jboss.portal.portlet.impl.PortletRequestDecoder;
@@ -138,13 +138,13 @@
switch (decoder.getType())
{
case PortletRequestDecoder.NAV_TYPE:
- cmd = new InvokeWindowRenderCommand(window.getId(), mode, windowState);
+ cmd = new InvokePortletWindowRenderCommand(window.getId(), mode, windowState);
break;
case PortletRequestDecoder.ACTION_TYPE:
- cmd = new InvokeWindowActionCommand(window.getId(), mode, windowState, decoder.getNavigationalstate(), decoder.getInteractionState(), decoder.getForm());
+ cmd = new InvokePortletWindowActionCommand(window.getId(), mode, windowState, decoder.getNavigationalstate(), decoder.getInteractionState(), decoder.getForm());
break;
case PortletRequestDecoder.RENDER_TYPE:
- cmd = new InvokeWindowRenderCommand(window.getId(), mode, windowState, decoder.getNavigationalstate());
+ cmd = new InvokePortletWindowRenderCommand(window.getId(), mode, windowState, decoder.getNavigationalstate());
break;
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -27,7 +27,7 @@
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.model.portal.command.response.UpdateViewResponse;
-import org.jboss.portal.core.model.portal.command.UpdateWindowMarkupResponse;
+import org.jboss.portal.core.model.portal.command.response.UpdateWindowMarkupResponse;
import org.jboss.portal.core.model.portal.command.RenderPageCommand;
import org.jboss.portal.server.ServerException;
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -26,10 +26,11 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowActionCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowActionCommand;
import org.jboss.portal.core.model.portal.command.InvokeWindowCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.model.portal.command.RenderPageCommand;
+import org.jboss.portal.core.model.portal.command.PortalObjectCommand;
import org.jboss.portal.core.controller.command.mapper.URLFactoryDelegate;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.impl.PortletRequestEncoder;
@@ -45,14 +46,6 @@
{
/** . */
- private static final String[] COMMAND_CLASS_NAMES =
- {
- RenderPageCommand.class.getName(),
- InvokeWindowActionCommand.class.getName(),
- InvokeWindowRenderCommand.class.getName()
- };
-
- /** . */
private String path;
public String getPath()
@@ -65,11 +58,6 @@
this.path = path;
}
- protected String[] getCommandClassNames()
- {
- return PortalObjectURLFactory.COMMAND_CLASS_NAMES;
- }
-
public ServerURL doMapping(ServerInvocation invocation, ControllerCommand cmd)
{
if (cmd == null)
@@ -78,42 +66,44 @@
}
//
- if (cmd instanceof RenderPageCommand)
+ if (cmd instanceof PortalObjectCommand)
{
- RenderPageCommand rpCmd = (RenderPageCommand)cmd;
- String pageRef = rpCmd.getTargetId();
- return getBaseURL(pageRef);
- }
- else if (cmd instanceof InvokeWindowCommand)
- {
- InvokeWindowCommand iwaCmd = (InvokeWindowCommand)cmd;
-
- // The base URL
- AbstractServerURL serverURL = getBaseURL(iwaCmd.getTargetId());
-
- Mode mode = iwaCmd.getMode();
- WindowState windowState = iwaCmd.getWindowState();
-
- //
- if (iwaCmd instanceof InvokeWindowActionCommand)
+ if (cmd instanceof RenderPageCommand)
{
- StateString interactionState = ((InvokeWindowActionCommand)iwaCmd).getInteractionState();
- StateString navigationalState = ((InvokeWindowActionCommand)iwaCmd).getNavigationalState();
- PortletRequestEncoder.encodeAction(serverURL, navigationalState, interactionState, mode, windowState);
+ RenderPageCommand rpCmd = (RenderPageCommand)cmd;
+ String pageRef = rpCmd.getTargetId();
+ return getBaseURL(pageRef);
}
- else
+ else if (cmd instanceof InvokeWindowCommand)
{
- StateString navigationalState = ((InvokeWindowRenderCommand)iwaCmd).getNavigationalState();
- PortletRequestEncoder.encodeRender(serverURL, navigationalState, mode, windowState);
- }
+ InvokeWindowCommand iwaCmd = (InvokeWindowCommand)cmd;
- //
- return serverURL;
+ // The base URL
+ AbstractServerURL serverURL = getBaseURL(iwaCmd.getTargetId());
+
+ Mode mode = iwaCmd.getMode();
+ WindowState windowState = iwaCmd.getWindowState();
+
+ //
+ if (iwaCmd instanceof InvokePortletWindowActionCommand)
+ {
+ StateString interactionState = ((InvokePortletWindowActionCommand)iwaCmd).getInteractionState();
+ StateString navigationalState = ((InvokePortletWindowActionCommand)iwaCmd).getNavigationalState();
+ PortletRequestEncoder.encodeAction(serverURL, navigationalState, interactionState, mode, windowState);
+ }
+ else
+ {
+ StateString navigationalState = ((InvokePortletWindowRenderCommand)iwaCmd).getNavigationalState();
+ PortletRequestEncoder.encodeRender(serverURL, navigationalState, mode, windowState);
+ }
+
+ //
+ return serverURL;
+ }
}
- else
- {
- throw new IllegalArgumentException("Command " + cmd.getClass().getName() + " not accepted");
- }
+
+ //
+ return null;
}
private AbstractServerURL getBaseURL(String objectRef)
Added: trunk/core/src/main/org/jboss/portal/core/model/portal/PortletWindowResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortletWindowResponseHandler.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortletWindowResponseHandler.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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.core.model.portal;
+
+import org.jboss.portal.core.controller.portlet.PortletResponseHandler;
+import org.jboss.portal.core.controller.portlet.PortletResponse;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletWindowResponseHandler extends PortletResponseHandler
+{
+ protected ControllerCommand createRenderCommand(Mode mode, WindowState windowState, StateString navState, PortletResponse response)
+ {
+ if (response instanceof PortletWindowResponse)
+ {
+ PortletWindowResponse pwr = (PortletWindowResponse)response;
+ return new InvokePortletWindowRenderCommand(
+ pwr.getWindowId(),
+ mode,
+ windowState,
+ navState);
+ }
+
+ //
+ return null;
+ }
+}
Copied: trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java (from rev 5706, trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowActionCommand.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowActionCommand.java 2006-11-21 21:51:07 UTC (rev 5706)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -0,0 +1,140 @@
+/******************************************************************************
+ * 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.core.model.portal.command;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ResourceNotFoundException;
+import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
+import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
+import org.jboss.portal.portlet.NoSuchPortletException;
+import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class InvokePortletWindowActionCommand extends InvokeWindowCommand
+{
+
+ /** . */
+ private static final Logger log = Logger.getLogger(InvokePortletWindowActionCommand.class);
+
+ /** . */
+ private static final CommandInfo info = new ActionCommandInfo(false, "view", false);
+
+ /** . */
+ private StateString navigationalState;
+
+ /** . */
+ private StateString interactionState;
+
+ /** . */
+ private Parameters formParameters;
+
+ public InvokePortletWindowActionCommand(
+ String windowId,
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState,
+ StateString interactionState,
+ Parameters formParameters)
+ throws IllegalArgumentException
+ {
+ super(windowId, mode, windowState);
+ this.navigationalState = navigationalState;
+ this.interactionState = interactionState;
+ this.formParameters = formParameters;
+ }
+
+ public StateString getNavigationalState()
+ {
+ return navigationalState;
+ }
+
+ public StateString getInteractionState()
+ {
+ return interactionState;
+ }
+
+ public void setInteractionState(StateString interactionState)
+ {
+ this.interactionState = interactionState;
+ }
+
+ public Parameters getFormParameters()
+ {
+ return formParameters;
+ }
+
+ public void setFormParameters(Parameters formParameters)
+ {
+ this.formParameters = formParameters;
+ }
+
+ public CommandInfo getInfo()
+ {
+ return info;
+ }
+
+ public Object execute() throws ControllerException
+ {
+ try
+ {
+ PortletInvocation invocation = PortletInvocationFactory.createAction(
+ context,
+ mode,
+ windowState,
+ navigationalState,
+ interactionState,
+ formParameters,
+ window,
+ portal);
+
+ //
+ PortletInvocationResponse response = instance.invoke(invocation);
+
+ //
+ return new PortletWindowResponse(targetId, response);
+ }
+ catch (PortletInvokerException e)
+ {
+ if (e instanceof NoSuchPortletException)
+ {
+ throw new ResourceNotFoundException(((NoSuchPortletException)e).getPortletId());
+ }
+ else
+ {
+ throw new ControllerException(e);
+ }
+ }
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java (from rev 5706, trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowRenderCommand.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowRenderCommand.java 2006-11-21 21:51:07 UTC (rev 5706)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -0,0 +1,124 @@
+/******************************************************************************
+ * 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.core.model.portal.command;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.invocation.InvocationContext;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.core.aspects.controller.PageNavigationInterceptor;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
+import org.jboss.portal.core.model.portal.command.response.UpdateWindowMarkupResponse;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.theme.LayoutService;
+import org.jboss.portal.theme.navigation.WindowNavigationalState;
+import org.jboss.portal.theme.strategy.StrategyException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class InvokePortletWindowRenderCommand extends InvokeWindowCommand
+{
+
+ private static final CommandInfo info = new ViewCommandInfo(false, "view");
+
+ /** . */
+ protected final StateString navigationalState;
+
+ public InvokePortletWindowRenderCommand(
+ String windowRef,
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState)
+ throws IllegalArgumentException
+ {
+ super(windowRef, mode, windowState);
+ this.navigationalState = navigationalState;
+ }
+
+ public InvokePortletWindowRenderCommand(
+ String windowId,
+ Mode mode,
+ WindowState windowState)
+ throws IllegalArgumentException
+ {
+ super(windowId, mode, windowState);
+ this.navigationalState = null;
+ }
+
+ public StateString getNavigationalState()
+ {
+ return navigationalState;
+ }
+
+ public CommandInfo getInfo()
+ {
+ return info;
+ }
+
+ public Object execute() throws InvocationException
+ {
+ InvocationContext ctx = getContext();
+
+ //
+ if (navigationalState != null)
+ {
+ ctx.setAttribute(NAVIGATIONAL_STATE_SCOPE, window.getInstanceRef(), navigationalState);
+ }
+
+ // Update the window nav state
+ WindowNavigationalState windowNavState = (WindowNavigationalState)ctx.getAttribute(NAVIGATIONAL_STATE_SCOPE, window.getInstanceRef() + "_window");
+ if (windowNavState == null)
+ {
+ windowNavState = new WindowNavigationalState();
+ ctx.setAttribute(NAVIGATIONAL_STATE_SCOPE, window.getId() + "_window", windowNavState);
+ }
+ if (mode != null)
+ {
+ windowNavState.setMode(mode);
+ }
+ if (windowState != null)
+ {
+ windowNavState.setWindowState(windowState);
+ }
+
+ // Udpate the page nav state
+ try
+ {
+ ServerInvocation sinv = ((ControllerContext)getContext()).getServerInvocation();
+ LayoutService layoutService = ((ControllerContext)getContext()).getController().getPageService().getLayoutService();
+ PageNavigationInterceptor.updatePageNavigationalState(layoutService, context, sinv, portal, page, window, getMode(), getWindowState());
+ }
+ catch (StrategyException e)
+ {
+ throw new InvocationException(e);
+ }
+
+ //
+ return new UpdateWindowMarkupResponse(window.getId());
+ }
+}
\ No newline at end of file
Property changes on: trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowActionCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowActionCommand.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowActionCommand.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -1,140 +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.core.model.portal.command;
-
-import org.jboss.logging.Logger;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.controller.ResourceNotFoundException;
-import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.controller.portlet.PortletResponse;
-import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
-import org.jboss.portal.portlet.NoSuchPortletException;
-import org.jboss.portal.portlet.Parameters;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class InvokeWindowActionCommand extends InvokeWindowCommand
-{
-
- /** . */
- private static final Logger log = Logger.getLogger(InvokeWindowActionCommand.class);
-
- /** . */
- private static final CommandInfo info = new ActionCommandInfo(false, "view", false);
-
- /** . */
- private StateString navigationalState;
-
- /** . */
- private StateString interactionState;
-
- /** . */
- private Parameters formParameters;
-
- public InvokeWindowActionCommand(
- String windowId,
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- StateString interactionState,
- Parameters formParameters)
- throws IllegalArgumentException
- {
- super(windowId, mode, windowState);
- this.navigationalState = navigationalState;
- this.interactionState = interactionState;
- this.formParameters = formParameters;
- }
-
- public StateString getNavigationalState()
- {
- return navigationalState;
- }
-
- public StateString getInteractionState()
- {
- return interactionState;
- }
-
- public void setInteractionState(StateString interactionState)
- {
- this.interactionState = interactionState;
- }
-
- public Parameters getFormParameters()
- {
- return formParameters;
- }
-
- public void setFormParameters(Parameters formParameters)
- {
- this.formParameters = formParameters;
- }
-
- public CommandInfo getInfo()
- {
- return info;
- }
-
- public Object execute() throws ControllerException
- {
- try
- {
- PortletInvocation invocation = PortletInvocationFactory.createAction(
- context,
- mode,
- windowState,
- navigationalState,
- interactionState,
- formParameters,
- window,
- portal);
-
- //
- PortletInvocationResponse resp = instance.invoke(invocation);
-
- //
- return new PortletResponse(targetId, resp);
- }
- catch (PortletInvokerException e)
- {
- if (e instanceof NoSuchPortletException)
- {
- throw new ResourceNotFoundException(((NoSuchPortletException)e).getPortletId());
- }
- else
- {
- throw new ControllerException(e);
- }
- }
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowRenderCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowRenderCommand.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowRenderCommand.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -1,124 +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.core.model.portal.command;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.common.invocation.InvocationContext;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.core.aspects.controller.PageNavigationInterceptor;
-import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
-import org.jboss.portal.core.model.portal.command.UpdateWindowMarkupResponse;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.theme.LayoutService;
-import org.jboss.portal.theme.navigation.WindowNavigationalState;
-import org.jboss.portal.theme.strategy.StrategyException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class InvokeWindowRenderCommand extends InvokeWindowCommand
-{
-
- private static final CommandInfo info = new ViewCommandInfo(false, "view");
-
- /** . */
- protected final StateString navigationalState;
-
- public InvokeWindowRenderCommand(
- String windowRef,
- Mode mode,
- WindowState windowState,
- StateString navigationalState)
- throws IllegalArgumentException
- {
- super(windowRef, mode, windowState);
- this.navigationalState = navigationalState;
- }
-
- public InvokeWindowRenderCommand(
- String windowId,
- Mode mode,
- WindowState windowState)
- throws IllegalArgumentException
- {
- super(windowId, mode, windowState);
- this.navigationalState = null;
- }
-
- public StateString getNavigationalState()
- {
- return navigationalState;
- }
-
- public CommandInfo getInfo()
- {
- return info;
- }
-
- public Object execute() throws InvocationException
- {
- InvocationContext ctx = getContext();
-
- //
- if (navigationalState != null)
- {
- ctx.setAttribute(NAVIGATIONAL_STATE_SCOPE, window.getInstanceRef(), navigationalState);
- }
-
- // Update the window nav state
- WindowNavigationalState windowNavState = (WindowNavigationalState)ctx.getAttribute(NAVIGATIONAL_STATE_SCOPE, window.getInstanceRef() + "_window");
- if (windowNavState == null)
- {
- windowNavState = new WindowNavigationalState();
- ctx.setAttribute(NAVIGATIONAL_STATE_SCOPE, window.getId() + "_window", windowNavState);
- }
- if (mode != null)
- {
- windowNavState.setMode(mode);
- }
- if (windowState != null)
- {
- windowNavState.setWindowState(windowState);
- }
-
- // Udpate the page nav state
- try
- {
- ServerInvocation sinv = ((ControllerContext)getContext()).getServerInvocation();
- LayoutService layoutService = ((ControllerContext)getContext()).getController().getPageService().getLayoutService();
- PageNavigationInterceptor.updatePageNavigationalState(layoutService, context, sinv, portal, page, window, getMode(), getWindowState());
- }
- catch (StrategyException e)
- {
- throw new InvocationException(e);
- }
-
- //
- return new UpdateWindowMarkupResponse(window.getId());
- }
-}
\ No newline at end of file
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -41,7 +41,7 @@
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectPermission;
import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
import org.jboss.portal.identity.User;
import org.jboss.portal.portlet.Properties;
import org.jboss.portal.portlet.info.ModeInfo;
@@ -401,7 +401,7 @@
try
{
- RenderWindowCommand renderCmd = new RenderWindowCommand(windowRef);
+ RenderPortletWindowCommand renderCmd = new RenderPortletWindowCommand(windowRef);
//
PortletResponse portletResponse = (PortletResponse)context.execute(renderCmd);
@@ -632,7 +632,7 @@
public String createUpdateNavigationalStateURL(Window window, Mode mode, WindowState windowState)
{
- InvokeWindowRenderCommand cmd = new InvokeWindowRenderCommand(window.getId(), mode, windowState);
+ InvokePortletWindowRenderCommand cmd = new InvokePortletWindowRenderCommand(window.getId(), mode, windowState);
ControllerContext controllerContext = getControllerContext();
ServerInvocationContext serverContext = controllerContext.getServerInvocation().getServerContext();
boolean secure = serverContext.getURLContext().getSecure();
Copied: trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java (from rev 5706, trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java 2006-11-21 21:51:07 UTC (rev 5706)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -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.core.model.portal.command;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ResourceNotFoundException;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
+import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
+import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
+import org.jboss.portal.portlet.NoSuchPortletException;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.theme.navigation.WindowNavigationalState;
+
+/**
+ * Render a single window.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class RenderPortletWindowCommand extends WindowCommand
+{
+
+ /** . */
+ private static final CommandInfo info = new ViewCommandInfo(true, "view");
+
+ public RenderPortletWindowCommand(String windowRef) throws IllegalArgumentException
+ {
+ super(windowRef);
+ }
+
+ public CommandInfo getInfo()
+ {
+ return info;
+ }
+
+ public Object execute() throws ControllerException
+ {
+ StateString navigationalState = (StateString)getAttribute(NAVIGATIONAL_STATE_SCOPE, window.getInstanceRef());
+
+ //
+ WindowNavigationalState windowNavState = (WindowNavigationalState)getAttribute(NAVIGATIONAL_STATE_SCOPE, targetId + "_window");
+ if (windowNavState == null)
+ {
+ windowNavState = new WindowNavigationalState();
+ setAttribute(NAVIGATIONAL_STATE_SCOPE, window.getId() + "_window", windowNavState);
+ }
+
+ // Get the mode
+ Mode mode = windowNavState.getMode();
+
+ // Get the window state
+ WindowState windowState = windowNavState.getWindowState();
+
+ //
+ RenderInvocation invocation = PortletInvocationFactory.createRender(
+ context,
+ mode,
+ windowState,
+ navigationalState,
+ window,
+ portal);
+
+ //
+ try
+ {
+ PortletInvocationResponse resp = instance.invoke(invocation);
+
+ //
+ return new PortletWindowResponse(targetId, resp);
+ }
+ catch (PortletInvokerException e)
+ {
+ if (e instanceof NoSuchPortletException)
+ {
+ throw new ResourceNotFoundException(((NoSuchPortletException)e).getPortletId());
+ }
+ else
+ {
+ throw new ControllerException(e);
+ }
+ }
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -1,109 +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.core.model.portal.command;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.controller.ResourceNotFoundException;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
-import org.jboss.portal.core.controller.portlet.PortletResponse;
-import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
-import org.jboss.portal.portlet.NoSuchPortletException;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.theme.navigation.WindowNavigationalState;
-
-/**
- * Render a single window.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class RenderWindowCommand extends WindowCommand
-{
-
- /** . */
- private static final CommandInfo info = new ViewCommandInfo(true, "view");
-
- public RenderWindowCommand(String windowRef) throws IllegalArgumentException
- {
- super(windowRef);
- }
-
- public CommandInfo getInfo()
- {
- return info;
- }
-
- public Object execute() throws ControllerException
- {
- StateString navigationalState = (StateString)getAttribute(NAVIGATIONAL_STATE_SCOPE, window.getInstanceRef());
-
- //
- WindowNavigationalState windowNavState = (WindowNavigationalState)getAttribute(NAVIGATIONAL_STATE_SCOPE, targetId + "_window");
- if (windowNavState == null)
- {
- windowNavState = new WindowNavigationalState();
- setAttribute(NAVIGATIONAL_STATE_SCOPE, window.getId() + "_window", windowNavState);
- }
-
- // Get the mode
- Mode mode = windowNavState.getMode();
-
- // Get the window state
- WindowState windowState = windowNavState.getWindowState();
-
- //
- RenderInvocation invocation = PortletInvocationFactory.createRender(
- context,
- mode,
- windowState,
- navigationalState,
- window,
- portal);
-
- //
- try
- {
- PortletInvocationResponse resp = instance.invoke(invocation);
-
- //
- return new PortletResponse(targetId, resp);
- }
- catch (PortletInvokerException e)
- {
- if (e instanceof NoSuchPortletException)
- {
- throw new ResourceNotFoundException(((NoSuchPortletException)e).getPortletId());
- }
- else
- {
- throw new ControllerException(e);
- }
- }
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/command/UpdateWindowMarkupResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/UpdateWindowMarkupResponse.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/UpdateWindowMarkupResponse.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -1,48 +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.core.model.portal.command;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class UpdateWindowMarkupResponse
-{
-
- /** . */
- private String windowId;
-
- public UpdateWindowMarkupResponse(String windowId)
- {
- if (windowId == null)
- {
- throw new IllegalArgumentException();
- }
- this.windowId = windowId;
- }
-
- public String getWindowId()
- {
- return windowId;
- }
-}
Added: trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/PortletWindowResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/PortletWindowResponse.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/PortletWindowResponse.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * 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.core.model.portal.command.response;
+
+import org.jboss.portal.core.controller.portlet.PortletResponse;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+
+/**
+ * A portlet response related to a portal object window.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletWindowResponse extends PortletResponse
+{
+
+ /** The window id targetting the portlet. */
+ private String windowId;
+
+ public PortletWindowResponse(String windowId, PortletInvocationResponse response)
+ {
+ super(response);
+
+ //
+ if (windowId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.windowId = windowId;
+ }
+
+ public String getWindowId()
+ {
+ return windowId;
+ }
+}
Copied: trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowMarkupResponse.java (from rev 5706, trunk/core/src/main/org/jboss/portal/core/model/portal/command/UpdateWindowMarkupResponse.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/UpdateWindowMarkupResponse.java 2006-11-21 21:51:07 UTC (rev 5706)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowMarkupResponse.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * 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.core.model.portal.command.response;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class UpdateWindowMarkupResponse
+{
+
+ /** . */
+ private String windowId;
+
+ public UpdateWindowMarkupResponse(String windowId)
+ {
+ if (windowId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.windowId = windowId;
+ }
+
+ public String getWindowId()
+ {
+ return windowId;
+ }
+}
Deleted: trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorCommandFactory.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorCommandFactory.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -1,87 +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.core.ui.configurator;
-
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
-import org.jboss.portal.portlet.impl.PortletRequestDecoder;
-import org.jboss.portal.server.ServerInvocation;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class ConfiguratorCommandFactory extends AbstractCommandFactory
-{
-
- public ControllerCommand doMapping(ServerInvocation invocation, String portalContextPath, String portalRequestPath)
- {
- PortletRequestDecoder decoder = new PortletRequestDecoder();
- decoder.decode(invocation.getServerContext().getQueryParameterMap(), invocation.getServerContext().getBodyParameterMap());
- switch (decoder.getType())
- {
- case PortletRequestDecoder.NAV_TYPE:
- {
- return createPortletNavCommand(decoder);
- }
- case PortletRequestDecoder.RENDER_TYPE:
- {
- return createPortletRenderCommand(decoder);
- }
- case PortletRequestDecoder.ACTION_TYPE:
- {
- return createPortletActionCommand(decoder);
- }
- }
-
- //
- return null;
- }
-
- /**
- *
- */
- public ControllerCommand createPortletActionCommand(PortletRequestDecoder decoder)
- {
- return new InvokePortletActionCommand(
- decoder.getNavigationalstate(),
- decoder.getInteractionState(),
- decoder.getForm());
- }
-
- /**
- *
- */
- protected ControllerCommand createPortletRenderCommand(PortletRequestDecoder decoder)
- {
- return new InvokePortletRenderCommand(decoder.getNavigationalstate());
- }
-
- /**
- *
- */
- protected ControllerCommand createPortletNavCommand(PortletRequestDecoder decoder)
- {
- return new InvokePortletRenderCommand(decoder.getNavigationalstate());
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorURLFactory.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorURLFactory.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -1,76 +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.core.ui.configurator;
-
-import org.jboss.portal.core.controller.command.mapper.URLFactoryDelegate;
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.server.ServerURL;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.AbstractServerURL;
-import org.jboss.portal.portlet.impl.PortletRequestEncoder;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class ConfiguratorURLFactory extends URLFactoryDelegate
-{
-
- /** . */
- private String path;
-
- protected String[] getCommandClassNames()
- {
- return new String[]{
- InvokePortletRenderCommand.class.getName(),
- InvokePortletActionCommand.class.getName()
- };
- }
-
- public String getPath()
- {
- return path;
- }
-
- public void setPath(String path)
- {
- this.path = path;
- }
-
- public ServerURL doMapping(ServerInvocation invocation, ControllerCommand cmd)
- {
- ServerURL url = new AbstractServerURL();
- url.setPortalRequestPath(path);
- if (cmd instanceof InvokePortletRenderCommand)
- {
- InvokePortletRenderCommand iprc = (InvokePortletRenderCommand)cmd;
- PortletRequestEncoder.encodeRender(url, iprc.getNavigationalState(), null, null);
- }
- else
- {
- InvokePortletActionCommand iprc = (InvokePortletActionCommand)cmd;
- PortletRequestEncoder.encodeAction(url, iprc.getNavigationalState(), iprc.getInteractionState(), null, null);
- }
- return url;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletActionCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletActionCommand.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletActionCommand.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -1,135 +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.core.ui.configurator;
-
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.controller.portlet.PortletContextFactory;
-import org.jboss.portal.core.controller.portlet.PortletCommandFactory;
-import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.Parameters;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.invocation.ActionInvocation;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
-import org.jboss.portal.portlet.invocation.response.ErrorResponse;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.theme.page.PageService;
-import org.jboss.portal.theme.page.ModifiablePageResult;
-import org.jboss.portal.theme.page.WindowResult;
-import org.jboss.portal.theme.page.ModifiableWindowResult;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.LayoutService;
-import org.jboss.portal.theme.PortalLayout;
-import org.jboss.portal.theme.ThemeConstants;
-import org.jboss.portal.theme.PageRendition;
-import org.jboss.portal.theme.navigation.PageNavigationalState;
-import org.jboss.portal.common.NotYetImplemented;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collections;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class InvokePortletActionCommand extends InvokePortletCommand
-{
-
- /** The interaction state. */
- private StateString interactionState;
-
- /** The nform. */
- private Parameters form;
-
- public InvokePortletActionCommand(StateString navigationalState, StateString interactionState, Parameters form)
- {
- super(navigationalState);
- this.interactionState = interactionState;
- this.form = form;
- }
-
- public StateString getInteractionState()
- {
- return interactionState;
- }
-
- public Parameters getForm()
- {
- return form;
- }
-
- public CommandInfo getInfo()
- {
- return null;
- }
-
- public Object execute() throws ControllerException
- {
- try
- {
- PortletContextFactory pcf1 = new PortletContextFactory(context);
- PortletCommandFactory pcf2 = new PortletCommandFactoryImpl();
- ActionInvocation action = PortletInvocationFactory.createAction(
- context,
- Mode.VIEW,
- WindowState.MAXIMIZED,
- navigationalState,
- interactionState,
- form,
- pcf1,
- pcf2);
- PortletInvocationResponse response = instance.invoke(action);
-
- // For now let the controller handle non fragment response
- String content = "";
- if (response instanceof FragmentResponse)
- {
- content = ((FragmentResponse)response).getContent();
- }
- else if (response instanceof ErrorResponse)
- {
- content = ((ErrorResponse)response).toHTML();
- }
- else
- {
- throw new NotYetImplemented();
- }
-
-
- //
- return null;
- }
- catch (PortletInvokerException e)
- {
- return new ControllerException(e);
- }
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletCommand.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletCommand.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -1,73 +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.core.ui.configurator;
-
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.portlet.StateString;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public abstract class InvokePortletCommand extends ControllerCommand
-{
-
- /** The navigational state. */
- protected StateString navigationalState;
-
- /** The instance displayed. */
- protected Instance instance;
-
- public InvokePortletCommand(StateString navigationalState)
- {
- this.navigationalState = navigationalState;
- }
-
- protected void create() throws ControllerException
- {
- InstanceContainer container = context.getController().getInstanceContainer();
-
- String instanceId = "ConfiguratorPortletInstance";
-
- //
- if (instanceId == null)
- {
- throw new ControllerException("No portlet instance configured on the configurator");
- }
-
- //
- instance = container.getInstance(instanceId);
- if (instance == null)
- {
- throw new ControllerException("Configurator portlet instance " + instanceId + " not found");
- }
- }
-
- public StateString getNavigationalState()
- {
- return navigationalState;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletRenderCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletRenderCommand.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletRenderCommand.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -1,134 +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.core.ui.configurator;
-
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.controller.portlet.PortletContextFactory;
-import org.jboss.portal.core.controller.portlet.PortletCommandFactory;
-import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
-import org.jboss.portal.portlet.invocation.response.ErrorResponse;
-import org.jboss.portal.theme.PageRendition;
-import org.jboss.portal.theme.LayoutService;
-import org.jboss.portal.theme.PortalLayout;
-import org.jboss.portal.theme.ThemeConstants;
-import org.jboss.portal.theme.navigation.PageNavigationalState;
-import org.jboss.portal.theme.page.PageService;
-import org.jboss.portal.theme.page.ModifiablePageResult;
-import org.jboss.portal.theme.page.WindowResult;
-import org.jboss.portal.theme.page.ModifiableWindowResult;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.Mode;
-import org.jboss.portal.common.NotYetImplemented;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collections;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class InvokePortletRenderCommand extends InvokePortletCommand
-{
-
- public InvokePortletRenderCommand(StateString navigationalState)
- {
- super(navigationalState);
- }
-
- public CommandInfo getInfo()
- {
- return null;
- }
-
- public Object execute() throws ControllerException
- {
- try
- {
- PortletContextFactory pcf1 = new PortletContextFactory(context);
- PortletCommandFactory pcf2 = new PortletCommandFactoryImpl();
- RenderInvocation render = PortletInvocationFactory.createRender(context, Mode.VIEW, WindowState.MAXIMIZED, navigationalState, pcf1, pcf2);
- PortletInvocationResponse response = instance.invoke(render);
-
- // For now let the controller handle non fragment response
- String content = "";
- if (response instanceof FragmentResponse)
- {
- content = ((FragmentResponse)response).getContent();
- }
- else if (response instanceof ErrorResponse)
- {
- content = ((ErrorResponse)response).toHTML();
- }
- else
- {
- throw new NotYetImplemented();
- }
-
- //
- PageService ps = context.getController().getPageService();
- LayoutService ls = ps.getLayoutService();
- PortalLayout layout = ls.getLayout("generic", true);
- Map pageProperties = new HashMap();
- Map portalProperties = new HashMap();
- portalProperties.put("theme.renderSetId", "divRenderer");
- portalProperties.put("theme.id", "renaissance");
- portalProperties.put("layout.strategyId", "maximizedRegion");
- ModifiablePageResult result = new ModifiablePageResult("BILTO", pageProperties, portalProperties);
-
- //
- Map windowProps = new HashMap();
- windowProps.put(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER, "emptyRenderer");
- windowProps.put(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER, "emptyRenderer");
- windowProps.put(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER, "emptyRenderer");
-
- //
- WindowResult res = new ModifiableWindowResult("", content, Collections.EMPTY_MAP, windowProps, null, null, WindowState.NORMAL, Mode.VIEW);
- WindowContext blah = new WindowContext("BILTO", "BILTO", "maximized", 0);
- result.addWindowContext(blah);
- result.addWindowResult("BILTO", res);
-
- //
- PageNavigationalState pns = new PageNavigationalState();
- HashMap tmp = new HashMap();
- tmp.put("BILTO", blah);
- pns.initialize(tmp);
- pns.setLayoutURI("/layouts/generic/maximized.jsp");
- pns.setLayoutState("maximized");
-
- //
- return new PageRendition(layout, pns, result, ps);
- }
- catch (PortletInvokerException e)
- {
- return new ControllerException(e);
- }
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/ui/configurator/PortletCommandFactoryImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ui/configurator/PortletCommandFactoryImpl.java 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/ui/configurator/PortletCommandFactoryImpl.java 2006-11-22 14:45:08 UTC (rev 5709)
@@ -1,45 +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.core.ui.configurator;
-
-import org.jboss.portal.core.controller.portlet.PortletCommandFactory;
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.portlet.ActionURL;
-import org.jboss.portal.portlet.RenderURL;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class PortletCommandFactoryImpl implements PortletCommandFactory
-{
- public ControllerCommand createInvokeActionCommand(ActionURL portletURL)
- {
- return new InvokePortletActionCommand(portletURL.getNavigationalState(), portletURL.getInteractionState(), null);
- }
-
- public ControllerCommand createInvokeRenderCommand(RenderURL portletURL)
- {
- return new InvokePortletRenderCommand(portletURL.getNavigationalState());
- }
-}
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2006-11-22 03:13:47 UTC (rev 5708)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2006-11-22 14:45:08 UTC (rev 5709)
@@ -689,11 +689,12 @@
proxy-type="attribute">portal:commandFactory=Dashboard</depends>
</mbean>
<mbean
- code="org.jboss.portal.core.ui.configurator.ConfiguratorCommandFactory"
+ code="org.jboss.portal.core.model.instance.InstanceCommandFactory"
name="portal:commandFactory=Configurator"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
+ <attribute name="InstanceId">ConfiguratorPortletInstance</attribute>
</mbean>
<mbean
code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
@@ -709,6 +710,28 @@
optional-attribute-name="DelegateFactory"
proxy-type="attribute">portal:commandFactory=Configurator</depends>
</mbean>
+ <mbean
+ code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
+ name="portal:commandFactory=Delegate,path=test"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="Path">/test</attribute>
+ <depends
+ optional-attribute-name="DelegatingFactory"
+ proxy-type="attribute">portal:commandFactory=Delegating</depends>
+ <depends
+ optional-attribute-name="DelegateFactory"
+ proxy-type="attribute">portal:commandFactory=Test</depends>
+ </mbean>
+ <mbean
+ code="org.jboss.portal.core.model.instance.InstanceCommandFactory"
+ name="portal:commandFactory=Test"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="InstanceId">TestPortletInstance</attribute>
+ </mbean>
<!-- URL factories -->
<mbean
@@ -754,16 +777,29 @@
proxy-type="attribute">portal:urlFactory=Delegating</depends>
</mbean>
<mbean
- code="org.jboss.portal.core.ui.configurator.ConfiguratorURLFactory"
+ code="org.jboss.portal.core.model.instance.InstanceURLFactory"
name="portal:urlFactory=Configurator"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
+ <attribute name="InstanceId">ConfiguratorPortletInstance</attribute>
<attribute name="Path">/configure</attribute>
<depends
optional-attribute-name="Factory"
proxy-type="attribute">portal:urlFactory=Delegating</depends>
</mbean>
+ <mbean
+ code="org.jboss.portal.core.model.instance.InstanceURLFactory"
+ name="portal:urlFactory=Test"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="InstanceId">TestPortletInstance</attribute>
+ <attribute name="Path">/test</attribute>
+ <depends
+ optional-attribute-name="Factory"
+ proxy-type="attribute">portal:urlFactory=Delegating</depends>
+ </mbean>
<!-- The federating portlet invoker -->
<mbean
17 years, 5 months
JBoss Portal SVN: r5708 - in trunk/wsrp/src: main/org/jboss/portal/test/wsrp/deployment main/org/jboss/portal/wsrp/deployment main/org/jboss/portal/wsrp/producer resources/portal-wsrp-sar/META-INF resources/tests/test-wsrp-producer-sar/META-INF
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2006-11-21 22:13:47 -0500 (Tue, 21 Nov 2006)
New Revision: 5708
Modified:
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/WSRPDeployment.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.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:
- Required registration is not a service, so shouldn't be handled like one.
- Producer can now access registration info via WSRPDeployer. This is pretty crappy so need to find a better solution if possible.
- Adapted service definitions...
- Tests still don't pass
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 02:16:17 UTC (rev 5707)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java 2006-11-22 03:13:47 UTC (rev 5708)
@@ -67,7 +67,7 @@
WSRPDeployment deployment = (WSRPDeployment)o;
List services = deployment.getServices();
assertNotNull(services);
- assertEquals(5, services.size());
+ assertEquals(4, services.size());
//
Object service = services.get(0);
@@ -132,7 +132,7 @@
assertNotNull(registrationData.getConsumerName());
assertEquals(WSRPConstants.CONSUMER_AGENT, registrationData.getConsumerAgent());
- ProducerRegistrationRequirements requirements = (ProducerRegistrationRequirements)services.get(4);
+ ProducerRegistrationRequirements requirements = deployment.getRegistrationRequirements();
assertTrue(requirements.requiresRegistration());
assertTrue(requirements.fullServiceDescriptionRequiresRegistration());
Map properties = requirements.getRegistrationProperties();
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 02:16:17 UTC (rev 5707)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployer.java 2006-11-22 03:13:47 UTC (rev 5708)
@@ -27,6 +27,7 @@
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;
@@ -59,6 +60,8 @@
/** . */
private String defaultWSRPLocation;
+ private ProducerRegistrationRequirements registrationRequirements;
+
public FederatingPortletInvoker getFederatingPortletInvoker()
{
return federatingPortletInvoker;
@@ -79,6 +82,11 @@
this.defaultWSRPLocation = defaultWSRPLocation;
}
+ public ProducerRegistrationRequirements getProducerRegistrationRequirements()
+ {
+ return registrationRequirements;
+ }
+
public void init(DeploymentInfo di) throws DeploymentException
{
super.init(di);
@@ -105,6 +113,7 @@
{
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 02:16:17 UTC (rev 5707)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployerMBean.java 2006-11-22 03:13:47 UTC (rev 5708)
@@ -24,6 +24,7 @@
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>
@@ -38,4 +39,6 @@
String getDefaultWSRPLocation();
void setDefaultWSRPLocation(String defaultWSRPLocation);
+
+ ProducerRegistrationRequirements getProducerRegistrationRequirements();
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployment.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployment.java 2006-11-22 02:16:17 UTC (rev 5707)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployment.java 2006-11-22 03:13:47 UTC (rev 5708)
@@ -22,6 +22,8 @@
******************************************************************************/
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.system.ServiceMBeanSupport;
import java.util.ArrayList;
@@ -33,8 +35,8 @@
*/
public class WSRPDeployment extends ServiceMBeanSupport implements WSRPDeploymentMBean
{
-
private final List services;
+ private ProducerRegistrationRequirements registrationRequirements;
public WSRPDeployment()
{
@@ -45,4 +47,15 @@
{
return services;
}
+
+ public ProducerRegistrationRequirements getRegistrationRequirements()
+ {
+ return registrationRequirements;
+ }
+
+ public void setRegistrationRequirements(ProducerRegistrationRequirements registrationRequirements)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(registrationRequirements, "Registration requirements");
+ this.registrationRequirements = registrationRequirements;
+ }
}
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 02:16:17 UTC (rev 5707)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2006-11-22 03:13:47 UTC (rev 5708)
@@ -446,6 +446,6 @@
System.out.println("addchild deployment regreq " + localName);
}
- deployment.getServices().add(regReq);
+ deployment.setRegistrationRequirements(regReq);
}
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2006-11-22 02:16:17 UTC (rev 5707)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2006-11-22 03:13:47 UTC (rev 5708)
@@ -36,6 +36,7 @@
import org.jboss.portal.portlet.info.WindowStateInfo;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.WSRPUtils;
+import org.jboss.portal.wsrp.core.CookieProtocol;
import org.jboss.portal.wsrp.core.GetServiceDescription;
import org.jboss.portal.wsrp.core.InvalidHandleFault;
import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
@@ -44,7 +45,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.RegistrationPolicy;
+import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
import java.rmi.RemoteException;
import java.util.Collection;
@@ -132,14 +133,13 @@
private ServiceDescription refreshServiceDescription(String[] desiredLocales)
{
// todo: find out how to cache this
- RegistrationPolicy policy = producer.getRegistrationPolicy();
-// ServiceDescription serviceDescription = WSRPTypeFactory.createServiceDescription(policy.getMetaData().requiresRegistration());
-// serviceDescription.setRequiresInitCookie(CookieProtocol.none);
-// PortletDescription[] descriptions = (PortletDescription[])getOfferedPortletDescriptions(desiredLocales)
-// .toArray(new PortletDescription[]{});
-// serviceDescription.setOfferedPortlets(descriptions);
-// return serviceDescription;
- throw new FixMe();
+ ProducerRegistrationRequirements requirements = producer.getProducerRegistrationRequirements();
+ ServiceDescription serviceDescription = WSRPTypeFactory.createServiceDescription(requirements.requiresRegistration());
+ serviceDescription.setRequiresInitCookie(CookieProtocol.none);
+ PortletDescription[] descriptions = (PortletDescription[])getOfferedPortletDescriptions(desiredLocales)
+ .toArray(new PortletDescription[]{});
+ serviceDescription.setOfferedPortlets(descriptions);
+ return serviceDescription;
}
/**
@@ -151,12 +151,10 @@
{
// todo: find out how to cache this
log.debug("Using service description offered for unregistered consumers");
- RegistrationPolicy policy = producer.getRegistrationPolicy();
-// RegistrationMetaData metaData = policy.getMetaData();
-// return new ServiceDescription(true, null, null, null, null, null, CookieProtocol.none,
-// WSRPUtils.convertRegistrationPropertiesToModelDescription(metaData.getRegistrationProperties()),
-// producer.getSupportedLocales(), null, null);
- throw new FixMe();
+ ProducerRegistrationRequirements requirements = producer.getProducerRegistrationRequirements();
+ return new ServiceDescription(true, null, null, null, null, null, CookieProtocol.none,
+ WSRPUtils.convertRegistrationPropertiesToModelDescription(requirements.getRegistrationProperties()),
+ producer.getSupportedLocales(), null, null);
}
/**
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 02:16:17 UTC (rev 5707)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2006-11-22 03:13:47 UTC (rev 5708)
@@ -24,7 +24,6 @@
package org.jboss.portal.wsrp.producer;
import org.jboss.logging.Logger;
-import org.jboss.portal.common.FixMe;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.NoSuchPortletException;
import org.jboss.portal.portlet.Portlet;
@@ -75,8 +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.deployment.WSRPDeployer;
import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationPolicy;
+import org.jboss.portal.wsrp.producer.registration.impl.ProducerRegistrationRequirementsImpl;
import org.jboss.portal.wsrp.servlet.ServletAccess;
import javax.servlet.http.HttpSession;
@@ -112,9 +112,12 @@
/** Handles Portlet Management interface calls. */
private PortletManagementHandler portletManagementHandler;
- /** The RegistrationPolicy to be used by the registration handler. */
- private RegistrationPolicy registrationPolicy;
+ /** To access the required registration information */
+ private WSRPDeployer deployer;
+ private static final ProducerRegistrationRequirements DEFAULT_REGISTRATION_REQUIREMENTS =
+ new ProducerRegistrationRequirementsImpl(false, false, false);
+
/**
* The ServiceDescription that is returned to an unregistred Consumer when registration is required: no information
* is provided apart from the fact that registration is required and what information is required to sucessfully
@@ -150,8 +153,14 @@
public ProducerRegistrationRequirements getProducerRegistrationRequirements()
{
-// return registrationPolicy.getMetaData();
- throw new FixMe();
+ ProducerRegistrationRequirements registrationRequirements = DEFAULT_REGISTRATION_REQUIREMENTS;
+ if (deployer != null)
+ {
+ registrationRequirements = deployer.getProducerRegistrationRequirements();
+ }
+
+ // still need to check for null, in case there wasn't no registration info in the descriptor
+ return registrationRequirements != null ? registrationRequirements : DEFAULT_REGISTRATION_REQUIREMENTS;
}
// ServiceDescription implementation ********************************************************************************
@@ -254,15 +263,14 @@
return registrationState;
}
- public RegistrationPolicy getRegistrationPolicy()
+ public WSRPDeployer getDeployer()
{
- return registrationPolicy;
+ return deployer;
}
- public void setRegistrationPolicy(RegistrationPolicy registrationPolicy)
+ public void setDeployer(WSRPDeployer deployer)
{
- this.registrationPolicy = registrationPolicy;
- registrationHandler.setPolicy(registrationPolicy);
+ this.deployer = deployer;
}
// PortletManagement implementation *********************************************************************************
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 02:16:17 UTC (rev 5707)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2006-11-22 03:13:47 UTC (rev 5708)
@@ -77,9 +77,9 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <depends optional-attribute-name="RegistrationPolicy" proxy-type="attribute">portal.wsrp:service=RegistrationPolicy</depends>
<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>
</mbean>
<!-- Configure a consumer that is the portal itself -->
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 02:16:17 UTC (rev 5707)
+++ trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml 2006-11-22 03:13:47 UTC (rev 5708)
@@ -171,10 +171,8 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <depends
- optional-attribute-name="Invoker"
- proxy-type="attribute">portal:service=PortletInvoker,type=Stateful</depends>
- <depends optional-attribute-name="RegistrationPolicy" proxy-type="attribute">portal.wsrp:service=RegistrationPolicy</depends>
+ <depends optional-attribute-name="Invoker"
+ proxy-type="attribute">portal:service=PortletInvoker,type=Stateful</depends>
<attribute name="RemotableByDefault">true</attribute>
</mbean>
17 years, 5 months
JBoss Portal SVN: r5707 - in trunk/wsrp/src: main/org/jboss/portal/test/wsrp/deployment main/org/jboss/portal/wsrp/deployment main/org/jboss/portal/wsrp/producer/registration/api main/org/jboss/portal/wsrp/producer/registration/impl resources/tests/test-deployment-lib-jar
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2006-11-21 21:16:17 -0500 (Tue, 21 Nov 2006)
New Revision: 5707
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/LocalizedString.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/ProducerRegistrationRequirements.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationPropertyDescription.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ProducerRegistrationRequirementsImpl.java
trunk/wsrp/src/resources/tests/test-deployment-lib-jar/test-wsrp.xml
Log:
- Added support for adding required registration information to the producer.
- Updated DeploymentTestCase and test data.
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-21 21:51:07 UTC (rev 5706)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java 2006-11-22 02:16:17 UTC (rev 5707)
@@ -30,6 +30,9 @@
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;
@@ -37,8 +40,11 @@
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>
@@ -61,7 +67,7 @@
WSRPDeployment deployment = (WSRPDeployment)o;
List services = deployment.getServices();
assertNotNull(services);
- assertEquals(4, services.size());
+ assertEquals(5, services.size());
//
Object service = services.get(0);
@@ -125,6 +131,34 @@
assertNotNull(registrationData);
assertNotNull(registrationData.getConsumerName());
assertEquals(WSRPConstants.CONSUMER_AGENT, registrationData.getConsumerAgent());
+
+ ProducerRegistrationRequirements requirements = (ProducerRegistrationRequirements)services.get(4);
+ 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/WSRPDeploymentFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2006-11-21 21:51:07 UTC (rev 5706)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2006-11-22 02:16:17 UTC (rev 5707)
@@ -22,10 +22,16 @@
******************************************************************************/
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;
@@ -34,8 +40,10 @@
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;
/**
@@ -46,10 +54,13 @@
*/
public class WSRPDeploymentFactory implements ObjectModelFactory
{
+ private static final boolean DEBUG = false;
/** . */
private static final String WSRP_PRODUCER = "wsrp-producer";
+ private static final String REGISTRATION_CONFIG = "registration-configuration";
+
/** . */
private List properties = new ArrayList();
@@ -87,19 +98,36 @@
public Object newChild(WSRPDeployment deployment, UnmarshallingContext nav, String nsURI, String localName,
Attributes attrs)
{
- Object child = null;
if (WSRP_PRODUCER.equals(localName))
{
WSRPConsumerService service = new WSRPConsumerService();
service.setConsumer(new WSRPConsumerImpl());
- child = service;
+ return service;
}
- return child;
+ 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;
+ }
}
public Object newChild(WSRPConsumerService service, UnmarshallingContext nav, String nsURI, String localName,
Attributes attrs)
{
+ if (DEBUG)
+ {
+ System.out.println("newchild service " + localName);
+ }
AbstractJNDIServiceFactory serviceFactory = null;
RegistrationData registrationData = null;
@@ -134,6 +162,11 @@
public Object newChild(RegistrationData registrationData, UnmarshallingContext nav, String nsURI, String localName,
Attributes attrs)
{
+ if (DEBUG)
+ {
+ System.out.println("newChild registrationdata " + localName);
+ }
+
if ("property".equals(localName))
{
return new Property();
@@ -144,6 +177,11 @@
public void setValue(WSRPConsumerService service, UnmarshallingContext nav, String nsURI, String localName,
String value)
{
+ if (DEBUG)
+ {
+ System.out.println("setvalue service " + localName);
+ }
+
if ("producer-id".equals(localName))
{
service.setId(value);
@@ -165,6 +203,11 @@
public void setValue(PerEndpointSOAPInvokerServiceFactory serviceFactory, UnmarshallingContext nav, String nsURI,
String localName, String value)
{
+ if (DEBUG)
+ {
+ System.out.println("setvalue servicefactory " + localName);
+ }
+
if ("service-description-url".equals(localName))
{
// Resolve value that may contain properties for that one
@@ -203,6 +246,11 @@
public void setValue(RegistrationData registrationData, UnmarshallingContext nav, String nsURI, String localName,
String value)
{
+ if (DEBUG)
+ {
+ System.out.println("setvalue registrationdata " + localName);
+ }
+
if ("consumer-name".equals(localName))
{
value = StringPropertyReplacer.replaceProperties(value);
@@ -212,6 +260,11 @@
public void setValue(Property property, UnmarshallingContext nav, String nsURI, String localName, String value)
{
+ if (DEBUG)
+ {
+ System.out.println("setvalue property " + localName);
+ }
+
if ("name".equals(localName))
{
value = StringPropertyReplacer.replaceProperties(value);
@@ -232,12 +285,22 @@
public void addChild(RegistrationData registrationData, Property property, UnmarshallingContext nav, String nsURI,
String localName)
{
+ if (DEBUG)
+ {
+ System.out.println("addchild registrationdata property " + localName);
+ }
+
properties.add(property);
}
public void addChild(WSRPConsumerService service, RegistrationData registrationData, UnmarshallingContext nav,
String nsURI, String localName)
{
+ if (DEBUG)
+ {
+ System.out.println("addchild service registrationdata " + localName);
+ }
+
Property[] propertyArray = (Property[])properties.toArray(new Property[0]);
registrationData.setRegistrationProperties(propertyArray);
service.getConsumer().setRegistrationData(registrationData);
@@ -246,12 +309,143 @@
public void addChild(WSRPConsumerService service, PerEndpointSOAPInvokerServiceFactory serviceFactory,
UnmarshallingContext nav, String nsURI, String localName)
{
+ if (DEBUG)
+ {
+ System.out.println("addchild service servicefactory " + localName);
+ }
+
service.getConsumer().setServiceFactory(serviceFactory);
}
public void addChild(WSRPDeployment deployment, WSRPConsumerService service, UnmarshallingContext nav, String nsURI,
String localName)
{
+ if (DEBUG)
+ {
+ System.out.println("addchild deployment service " + localName);
+ }
+
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.getServices().add(regReq);
+ }
}
Modified: 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-11-21 21:51:07 UTC (rev 5706)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/LocalizedString.java 2006-11-22 02:16:17 UTC (rev 5707)
@@ -23,6 +23,8 @@
package org.jboss.portal.wsrp.producer.registration.api;
+import org.jboss.portal.common.util.ParameterValidation;
+
import java.util.Locale;
/**
@@ -50,6 +52,58 @@
this.locale = Locale.getDefault();
}
+ public LocalizedString()
+ {
+ }
+
+
+ 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;
@@ -57,6 +111,7 @@
public void setValue(String value)
{
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(value, "value", "LocalizedString");
this.value = value;
}
@@ -67,6 +122,7 @@
public void setLocale(Locale locale)
{
+ ParameterValidation.throwIllegalArgExceptionIfNull(locale, "locale");
this.locale = locale;
}
@@ -77,6 +133,7 @@
public void setResourceName(String resourceName)
{
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(resourceName, "resource name", "LocalizedString");
this.resourceName = resourceName;
}
}
Modified: 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-11-21 21:51:07 UTC (rev 5706)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/ProducerRegistrationRequirements.java 2006-11-22 02:16:17 UTC (rev 5707)
@@ -55,4 +55,8 @@
boolean acceptValueFor(Object value, QName propertyName);
boolean acceptValueFor(Object value, String propertyName);
+
+ RegistrationPropertyDescription getRegistrationPropertyWith(String name);
+
+ RegistrationPropertyDescription getRegistrationPropertyWith(QName name);
}
Modified: 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-11-21 21:51:07 UTC (rev 5706)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationPropertyDescription.java 2006-11-22 02:16:17 UTC (rev 5707)
@@ -54,6 +54,10 @@
this(new QName(name), type);
}
+ public RegistrationPropertyDescription()
+ {
+ }
+
public QName getName()
{
return name;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ProducerRegistrationRequirementsImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ProducerRegistrationRequirementsImpl.java 2006-11-21 21:51:07 UTC (rev 5706)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ProducerRegistrationRequirementsImpl.java 2006-11-22 02:16:17 UTC (rev 5707)
@@ -47,8 +47,13 @@
public ProducerRegistrationRequirementsImpl(boolean requiresMarshalling, boolean requiresRegistration, boolean fullServiceDescriptionRequiresRegistration)
{
+ this();
this.requiresRegistration = requiresRegistration;
this.fullServiceDescriptionRequiresRegistration = fullServiceDescriptionRequiresRegistration;
+ }
+
+ public ProducerRegistrationRequirementsImpl()
+ {
registrationProperties = new HashMap(7);
}
@@ -95,6 +100,19 @@
return acceptValueFor(value, new QName(propertyName));
}
+ 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)
{
return (RegistrationPropertyDescription)registrationProperties.get(propertyName);
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-21 21:51:07 UTC (rev 5706)
+++ trunk/wsrp/src/resources/tests/test-deployment-lib-jar/test-wsrp.xml 2006-11-22 02:16:17 UTC (rev 5707)
@@ -78,4 +78,20 @@
</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
17 years, 5 months