Author: emuckenhuber
Date: 2007-12-14 08:51:58 -0500 (Fri, 14 Dec 2007)
New Revision: 9343
Added:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/factory/
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/factory/LocalizedStringBuilder.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/factory/PortletApplicationModelFactory.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/ListenerMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/CustomPortletModeAdapter.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/CustomWindowStateAdapter.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/DescribableMetaData.java
Removed:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/SimplePortletTestCase.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/DescribeableMetaData.java
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/AbstractMetaDataTestCase.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/CustomPortletModeTestEverythingTestCase.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/CustomWindowStateTestEverythingTestCase.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/EventTestEverythingTestCase.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/FilterTestEverythingTestCase.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/GeneralMetaDataTestCase.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/PortletTestEverythingTestCase.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/RenderParameterTestEverythingTestCase.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/SecurityConstraintTestEverythingTestCase.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/UserAttributeTestEverythingTestCase.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/ValidationErrorHandler.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/CustomPortletModeMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/CustomWindowStateMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PortletApplication10MetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PortletApplication20MetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PortletApplicationMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PortletMetaDataConstants.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PublicRenderParameterMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/UserAttributeMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/ContainerRuntimeAdapter.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/FilterMappingAdapter.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/LocalizedStringAdapter.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/UserAttributeAdapter.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/ContainerRuntimeMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/InitParamMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/LocalizedDescriptionMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/event/EventDefinitionMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/event/EventDefinitionReferenceMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/filter/FilterMappingMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/filter/FilterMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/PortletInfoMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/PortletMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/PortletPreferenceMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/PortletPreferencesMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/SecurityRoleRefMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/SupportsMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/security/PortletCollectionMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/security/SecurityConstraintMetaData.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/security/UserDataConstraintMetaData.java
Log:
- update metadata to spec rev. 30
- parsing now with annotation or objectmodelfactory
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/AbstractMetaDataTestCase.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/AbstractMetaDataTestCase.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/AbstractMetaDataTestCase.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -23,31 +23,23 @@
package org.jboss.portal.portlet.test.metadata;
import java.io.IOException;
+import java.io.InputStream;
import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import javax.xml.XMLConstants;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import javax.xml.validation.Validator;
-
+import org.jboss.portal.portlet.test.deployment.ValueTrimmingFilter;
+import org.jboss.portal.portlet.test.metadata.factory.PortletApplicationModelFactory;
import org.jboss.portal.portlet.test.metadata.impl.PortletApplication10MetaData;
import org.jboss.portal.portlet.test.metadata.impl.PortletApplication20MetaData;
import org.jboss.portal.portlet.test.metadata.impl.PortletApplicationMetaData;
+
import static org.jboss.portal.portlet.test.metadata.impl.PortletMetaDataConstants.*;
-import org.jboss.util.xml.JBossEntityResolver;
+import org.jboss.unit.api.pojo.annotations.Parameter;
import org.jboss.xb.binding.JBossXBException;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
-import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import static org.jboss.unit.api.Assert.*;
@@ -58,89 +50,94 @@
public abstract class AbstractMetaDataTestCase
{
- /** The schema resolver factory */
+ /** Test parameter for using xml binding annotation. */
+ public static final String ANNOTATION_BINDING = "annotation";
+
+ /** Test parameter for using the ObjectModelFactory. */
+ public static final String FACTORY_BINDING = "factory";
+
+ /** The schema resolver factory. */
protected static SingletonSchemaResolverFactory factory;
- /** The schema resolver */
+ /** The schema resolver. */
protected static DefaultSchemaResolver resolver;
- /** The unmarshaller */
- protected static Unmarshaller unmarshaller;
+ /** The unmarshaller. */
+ protected Unmarshaller unmarshaller = null;
- /** some Suff */
-// private static Map<String, Validator> cachedXSDs = new HashMap<String,
Validator>();
-
+ /** Annotation or ObjectModelFactory parsing. */
+ private String parser;
+
+ @Parameter(name = "parser")
+ public void setParser(String parser)
+ {
+ this.parser = parser;
+ }
+
static
{
try
{
-// cachedXSDs.put(PORTLET_JSR_286_NS, getValidator(PORTLET_JSR_286_NS));
-// cachedXSDs.put(PORTLET_JSR_168_NS, getValidator(PORTLET_JSR_168_NS));
-
factory = SingletonSchemaResolverFactory.getInstance();
resolver = (DefaultSchemaResolver) factory.getSchemaBindingResolver();
- unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- unmarshaller.setNamespaceAware(true);
- unmarshaller.setSchemaValidation(true);
- unmarshaller.setValidation(true);
- // SchemaResolver
+
+ /** SchemaResolver */
resolver.addSchemaLocation(PORTLET_JSR_168_NS,
"portlet-app_1_0.xsd");
resolver.addSchemaLocation(PORTLET_JSR_286_NS,
"portlet-app_2_0.xsd");
resolver.addClassBinding(PORTLET_JSR_286_NS,
PortletApplication20MetaData.class);
resolver.addClassBinding(PORTLET_JSR_168_NS,
PortletApplication10MetaData.class);
-
}
- catch(Exception e)
+ catch (Exception e)
{
e.printStackTrace();
}
}
- protected <T> T unmarshall(String file, String nameSpace, Class<T> clazz)
throws JBossXBException, SAXException,
- ParserConfigurationException, IOException
+ protected PortletApplicationMetaData unmarshall(String file) throws JBossXBException,
SAXException, IOException
{
+ if (ANNOTATION_BINDING.equals(parser))
+ {
+ return this.unmarshallAnnotation(file);
+ }
+ else if (FACTORY_BINDING.equals(parser))
+ {
+ return this.unmarshallWithFactory(file);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Wrong parameter for parser.");
+ }
+ }
+
+ private PortletApplicationMetaData unmarshallAnnotation(String file) throws
JBossXBException, SAXException,
+ IOException
+ {
/** validate */
-// this.validateFile(file, nameSpace);
+ unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ unmarshaller.setNamespaceAware(true);
+ unmarshaller.setSchemaValidation(true);
unmarshaller.setValidation(true);
/** unmarshal */
- return (T) unmarshaller.unmarshal(getPath(file), resolver);
+ return (PortletApplicationMetaData) unmarshaller.unmarshal(getPath(file),
resolver);
}
- protected PortletApplicationMetaData unmarshall(String file) throws JBossXBException,
SAXException,
- ParserConfigurationException, IOException
+ private PortletApplicationMetaData unmarshallWithFactory(String file) throws
JBossXBException
{
+ /** validate */
+ unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ unmarshaller.setNamespaceAware(true);
+ unmarshaller.setSchemaValidation(true);
unmarshaller.setValidation(true);
- unmarshaller.setNamespaceAware(true);
- // unmarshaller.setSchemaValidation(true);
- return (PortletApplicationMetaData) unmarshaller.unmarshal(getPath(file),
resolver);
- }
-/*
- public void validateFile(String file, String namespace) throws SAXException,
ParserConfigurationException,
- IOException
- {
- Validator validator = cachedXSDs.get(namespace);
- URL xmlFile = Thread.currentThread().getContextClassLoader().getResource(file);
- DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- Document d = db.parse(xmlFile.openStream());
- validator.validate(new DOMSource(d));
+ PortletApplicationModelFactory factory = new PortletApplicationModelFactory();
+ /** unmarshal */
+ return (PortletApplicationMetaData) unmarshaller.unmarshal(getStream(file), new
ValueTrimmingFilter(factory),
+ null);
}
- private static Validator getValidator(String namespace) throws SAXException
+ protected String getPath(String file)
{
- String xsdFile = PORTLET_JSR_168_NS.equals(namespace) ?
"portlet-app_1_0.xsd" : "portlet-app_2_0.xsd";
- URL schemaFile =
Thread.currentThread().getContextClassLoader().getResource(xsdFile);
-
- SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- Schema schema = sf.newSchema(schemaFile);
- Validator validator = schema.newValidator();
- validator.setErrorHandler(new ValidationErrorHandler());
- return validator;
- }
-*/
- public String getPath(String file)
- {
URL url = Thread.currentThread().getContextClassLoader().getResource(file);
if (url == null)
{
@@ -149,4 +146,9 @@
return url.toString();
}
+ protected InputStream getStream(String file)
+ {
+ return Thread.currentThread().getContextClassLoader().getResourceAsStream(file);
+ }
+
}
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/CustomPortletModeTestEverythingTestCase.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/CustomPortletModeTestEverythingTestCase.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/CustomPortletModeTestEverythingTestCase.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -27,7 +27,7 @@
import org.jboss.portal.portlet.test.metadata.impl.CustomPortletModeMetaData;
import org.jboss.portal.portlet.test.metadata.impl.PortletApplication10MetaData;
import org.jboss.portal.portlet.test.metadata.impl.PortletApplication20MetaData;
-import org.jboss.portal.portlet.test.metadata.impl.PortletMetaDataConstants;
+import org.jboss.portal.portlet.test.metadata.impl.PortletApplicationMetaData;
import org.jboss.unit.api.pojo.annotations.Test;
import static org.jboss.unit.api.Assert.*;
@@ -39,26 +39,28 @@
public class CustomPortletModeTestEverythingTestCase extends AbstractMetaDataTestCase
{
+
@Test
public void test01()
{
try
{
String xmlFile = "customPortletMode/portlet1.xml";
- String namespace = PortletMetaDataConstants.PORTLET_JSR_168_NS;
- PortletApplication10MetaData md = unmarshall(xmlFile, namespace,
PortletApplication10MetaData.class);
+ PortletApplicationMetaData md = unmarshall(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
assertEquals("1.0", md.getVersion());
+ assertNotNull(md.getCustomPortletModes());
- CustomPortletModeMetaData cmd1 = md.getCustomPortletMode().get(0);
+ CustomPortletModeMetaData cmd1 =
md.getCustomPortletModes().get("Custom");
assertNotNull(cmd1);
+ assertEquals("mode1", cmd1.getId());
assertEquals("Custom", cmd1.getPortletMode());
assertEquals("portletMode1",
cmd1.getDescription().getDefaultString());
assertEquals("eigener portlet modus",
cmd1.getDescription().getString(new Locale("de"), false));
- assertEquals("mode1", cmd1.getId());
- assertNotNull(md.getCustomPortletMode().get(1));
-
+ assertNotNull(md.getCustomPortletModes().get("Custom2"));
}
catch (Exception e)
{
@@ -74,35 +76,34 @@
{
String xmlFile = "customPortletMode/portlet2.xml";
- String namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS;
- PortletApplication20MetaData md = unmarshall(xmlFile, namespace,
PortletApplication20MetaData.class);
+ PortletApplicationMetaData md = unmarshall(xmlFile);
assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
assertEquals("2.0", md.getVersion());
- CustomPortletModeMetaData cmd1 = md.getCustomPortletMode().get(0);
+ CustomPortletModeMetaData cmd1 =
md.getCustomPortletModes().get("Custom");
assertNotNull(cmd1);
assertEquals("Custom", cmd1.getPortletMode());
+ assertEquals("portletMode1",
cmd1.getDescription().getDefaultString());
+ assertEquals(true, cmd1.isPortalManaged());
assertEquals("cmode1", cmd1.getId());
- assertEquals(true, cmd1.isPortalManaged());
- assertEquals("portletMode1",
cmd1.getDescription().getDefaultString());
- assertEquals("eigener portlet modus",
cmd1.getDescription().getString(new Locale("de"), false));
- assertEquals("Portlet Mode One",
cmd1.getDecorationName().getDefaultString());
- assertEquals("Eigener Portlet Modus Eins",
cmd1.getDecorationName().getString(new Locale("de"), false));
-
- CustomPortletModeMetaData cmd2 = md.getCustomPortletMode().get(1);
+
+ CustomPortletModeMetaData cmd2 =
md.getCustomPortletModes().get("Custom2");
assertNotNull(cmd2);
assertEquals("Custom2", cmd2.getPortletMode());
- assertEquals("Portlet Mode One",
cmd2.getDecorationName().getDefaultString());
assertEquals(false, cmd2.isPortalManaged());
- CustomPortletModeMetaData cmd3 = md.getCustomPortletMode().get(2);
+ CustomPortletModeMetaData cmd3 =
md.getCustomPortletModes().get("Custom3");
assertNotNull(cmd3);
assertEquals("Custom3", cmd3.getPortletMode());
- assertEquals("Portlet Mode Three",
cmd3.getDescription().getDefaultString());
+
// default value
assertEquals(true, cmd3.isPortalManaged());
+ assertEquals("eigener portlet modus",
cmd1.getDescription().getString(new Locale("de"), false));
+ assertEquals("Portlet Mode Three",
cmd3.getDescription().getDefaultString());
+
}
catch (Exception e)
{
@@ -118,9 +119,8 @@
{
String xmlFile = "customPortletMode/portlet1-fail.xml";
- String namespace = PortletMetaDataConstants.PORTLET_JSR_168_NS;
- PortletApplication10MetaData md = unmarshall(xmlFile, namespace,
PortletApplication10MetaData.class);
+ PortletApplicationMetaData md = unmarshall(xmlFile);
fail("portlet 2.0 properties are not allowed");
}
catch (Exception e)
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/CustomWindowStateTestEverythingTestCase.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/CustomWindowStateTestEverythingTestCase.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/CustomWindowStateTestEverythingTestCase.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -27,7 +27,7 @@
import org.jboss.portal.portlet.test.metadata.impl.CustomWindowStateMetaData;
import org.jboss.portal.portlet.test.metadata.impl.PortletApplication10MetaData;
import org.jboss.portal.portlet.test.metadata.impl.PortletApplication20MetaData;
-import org.jboss.portal.portlet.test.metadata.impl.PortletMetaDataConstants;
+import org.jboss.portal.portlet.test.metadata.impl.PortletApplicationMetaData;
import org.jboss.unit.api.pojo.annotations.Test;
import static org.jboss.unit.api.Assert.*;
@@ -38,7 +38,6 @@
*/
public class CustomWindowStateTestEverythingTestCase extends AbstractMetaDataTestCase
{
-
@Test
public void test01()
{
@@ -46,23 +45,22 @@
{
String xmlFile = "customWindowState/portlet1.xml";
- String namespace = PortletMetaDataConstants.PORTLET_JSR_168_NS;
- PortletApplication10MetaData md = unmarshall(xmlFile, namespace,
PortletApplication10MetaData.class);
+ PortletApplicationMetaData md = unmarshall(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
assertEquals("1.0", md.getVersion());
- CustomWindowStateMetaData cws1 = md.getCustomWindowState().get(0);
- assertEquals("foo", cws1.getId());
+ CustomWindowStateMetaData cws1 =
md.getCustomWindowStates().get("windowState1");
assertEquals("WindowState",
cws1.getDescription().getDefaultString());
assertEquals("windowState1", cws1.getWindowState());
assertEquals("Offenes Fenster", cws1.getDescription().getString(new
Locale("de"), false));
-
- CustomWindowStateMetaData cws2 = md.getCustomWindowState().get(1);
+ assertEquals("foo", cws1.getId());
+ CustomWindowStateMetaData cws2 =
md.getCustomWindowStates().get("windowState2");
assertNotNull(cws2);
- CustomWindowStateMetaData cws3 = md.getCustomWindowState().get(2);
+ CustomWindowStateMetaData cws3 =
md.getCustomWindowStates().get("windowState3");
assertEquals("drei", cws3.getId());
-
}
catch (Exception e)
{
@@ -78,23 +76,23 @@
{
String xmlFile = "customWindowState/portlet2.xml";
- String namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS;
- PortletApplication20MetaData md = unmarshall(xmlFile, namespace,
PortletApplication20MetaData.class);
+ PortletApplicationMetaData md = unmarshall(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
assertEquals("2.0", md.getVersion());
- CustomWindowStateMetaData cws1 = md.getCustomWindowState().get(0);
- assertEquals("foo", cws1.getId());
- assertEquals("windowState1", cws1.getWindowState());
+ CustomWindowStateMetaData cws1 =
md.getCustomWindowStates().get("windowState1");
assertEquals("WindowState",
cws1.getDescription().getDefaultString());
+ assertEquals("windowState1", cws1.getWindowState());
assertEquals("Offenes Fenster", cws1.getDescription().getString(new
Locale("de"), false));
-
- CustomWindowStateMetaData cws2 = md.getCustomWindowState().get(1);
+ assertEquals("foo", cws1.getId());
+
+ CustomWindowStateMetaData cws2 =
md.getCustomWindowStates().get("windowState2");
assertNotNull(cws2);
- CustomWindowStateMetaData cws3 = md.getCustomWindowState().get(2);
+ CustomWindowStateMetaData cws3 =
md.getCustomWindowStates().get("windowState3");
assertEquals("drei", cws3.getId());
-
}
catch (Exception e)
{
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/EventTestEverythingTestCase.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/EventTestEverythingTestCase.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/EventTestEverythingTestCase.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -26,10 +26,8 @@
import javax.xml.namespace.QName;
-import org.jboss.portal.portlet.test.metadata.impl.PortletApplication10MetaData;
import org.jboss.portal.portlet.test.metadata.impl.PortletApplication20MetaData;
import org.jboss.portal.portlet.test.metadata.impl.PortletApplicationMetaData;
-import org.jboss.portal.portlet.test.metadata.impl.PortletMetaDataConstants;
import org.jboss.portal.portlet.test.metadata.impl.event.EventDefinitionMetaData;
import
org.jboss.portal.portlet.test.metadata.impl.event.EventDefinitionReferenceMetaData;
import org.jboss.portal.portlet.test.metadata.impl.portlet.PortletMetaData;
@@ -51,9 +49,8 @@
{
String xmlFile = "event/portlet-event1.xml";
- String namespace = PortletMetaDataConstants.PORTLET_JSR_168_NS;
- PortletApplication10MetaData md = unmarshall(xmlFile, namespace,
PortletApplication10MetaData.class);
+ unmarshall(xmlFile);
fail();
}
catch (Exception e)
@@ -69,15 +66,14 @@
{
String xmlFile = "event/portlet-event2.xml";
- String namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS;
- PortletApplication20MetaData md = unmarshall(xmlFile, namespace,
PortletApplication20MetaData.class);
+ PortletApplicationMetaData md = unmarshall(xmlFile);
assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
assertEquals("2.0", md.getVersion());
EventDefinitionMetaData emd = md.getEvents().get(0);
QName qname = emd.getQname();
-
assertEquals("eventID", emd.getId());
assertEquals("http://example.com/testEvents",
qname.getNamespaceURI());
assertEquals("portletEvent", qname.getLocalPart());
@@ -89,7 +85,6 @@
EventDefinitionMetaData emd2 = md.getEvents().get(1);
- // TODO - choice is not checked correctly
assertNull(emd2.getQname());
assertEquals("hellouh", emd2.getName());
assertEquals("hello", emd2.getAlias().get(0).getLocalPart());
@@ -116,7 +111,6 @@
assertNotNull(ermd4);
assertEquals("hellouh", ermd4.getName());
-
}
catch (Exception e)
{
@@ -137,11 +131,8 @@
assertNotNull(md);
assertEquals("2.0", md.getVersion());
- EventDefinitionMetaData edm = md.getEvents().get(0);
+// EventDefinitionMetaData edm = md.getEvents().get(0);
- System.out.println(edm.getName());
- System.out.println(edm.getQname());
-
fail("Should fail: choice and qname defined!");
}
catch (Exception e)
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/FilterTestEverythingTestCase.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/FilterTestEverythingTestCase.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/FilterTestEverythingTestCase.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -24,9 +24,8 @@
import java.util.Locale;
-import org.jboss.portal.portlet.test.metadata.impl.PortletApplication10MetaData;
import org.jboss.portal.portlet.test.metadata.impl.PortletApplication20MetaData;
-import org.jboss.portal.portlet.test.metadata.impl.PortletMetaDataConstants;
+import org.jboss.portal.portlet.test.metadata.impl.PortletApplicationMetaData;
import org.jboss.portal.portlet.test.metadata.impl.common.InitParamMetaData;
import org.jboss.portal.portlet.test.metadata.impl.filter.FilterMetaData;
import org.jboss.unit.api.pojo.annotations.Test;
@@ -45,8 +44,7 @@
{
try
{
- PortletApplication10MetaData md =
unmarshall("filter/portlet-filter1.xml",
- PortletMetaDataConstants.PORTLET_JSR_168_NS,
PortletApplication10MetaData.class);
+ unmarshall("filter/portlet-filter1.xml");
// no filters in jsr 168
fail();
}
@@ -62,44 +60,47 @@
try
{
String xmlFile = "filter/portlet-filter2.xml";
- String namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS;
- PortletApplication20MetaData md = unmarshall(xmlFile, namespace,
PortletApplication20MetaData.class);
+ PortletApplicationMetaData md = unmarshall(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
FilterMetaData filter = md.getFilter("testFilter");
+ assertNotNull(filter);
assertEquals("org.jboss.portal.meta.NoExistingClass",
filter.getFilterClass());
assertEquals("testFilter", filter.getFilterName());
assertEquals("ACTION_PHASE", filter.getLifecycle().get(0));
assertEquals("RENDER_PHASE", filter.getLifecycle().get(1));
+
assertEquals("test", filter.getDescription().getDefaultString());
assertEquals("bla", filter.getDescription().getString(new
Locale("de"), false));
+
assertEquals("foo", filter.getDisplayName().getString(new
Locale("fr"), false));
assertEquals("foobar", filter.getDisplayName().getDefaultString());
-
+
InitParamMetaData ip = filter.getInitParams().get(0);
assertEquals("eins", ip.getId());
assertEquals("foo", ip.getName());
assertEquals("bar", ip.getValue());
assertNotNull(ip.getDescription());
-
+
InitParamMetaData ip2 = filter.getInitParams().get(1);
- assertNull(ip2.getId());
assertEquals("test", ip2.getName());
assertEquals("testing", ip2.getValue());
-
+ assertNull(ip2.getId());
+
//
FilterMetaData filter2 = md.getFilter("testFilterZwei");
assertEquals("testFilterZwei", filter2.getFilterName());
assertEquals("ACTION_PHASE", filter2.getLifecycle().get(0));
-
- // Filter mapping
-
+
+ // Filter mapping
assertTrue(md.getFilterMapping().containsKey("testFilter"));
- assertEquals("Portlet1",
md.getFilterMapping().get("testFilter").get(0));
- assertEquals("Portlet2",
md.getFilterMapping().get("testFilter").get(1));
+ assertEquals("Portlet1",
md.getFilterMapping().get("testFilter").getPortletNames().get(0));
+ assertEquals("Portlet2",
md.getFilterMapping().get("testFilter").getPortletNames().get(1));
assertTrue(md.getFilterMapping().containsKey("testFilterZwei"));
- assertEquals("Portlet2",
md.getFilterMapping().get("testFilterZwei").get(0));
+ assertEquals("Portlet2",
md.getFilterMapping().get("testFilterZwei").getPortletNames().get(0));
}
catch (Exception e)
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/GeneralMetaDataTestCase.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/GeneralMetaDataTestCase.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/GeneralMetaDataTestCase.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -23,14 +23,17 @@
package org.jboss.portal.portlet.test.metadata;
import java.net.URI;
-import java.util.List;
+import java.util.Locale;
+import org.jboss.portal.portlet.test.metadata.impl.ListenerMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.PortletApplication10MetaData;
+import org.jboss.portal.portlet.test.metadata.impl.PortletApplication20MetaData;
import org.jboss.portal.portlet.test.metadata.impl.PortletApplicationMetaData;
import org.jboss.portal.portlet.test.metadata.impl.PublicRenderParameterMetaData;
-import org.jboss.portal.portlet.test.metadata.impl.common.ContainerRuntimeMetaData;
import org.jboss.unit.api.pojo.annotations.Test;
import static org.jboss.unit.api.Assert.*;
+
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
* @version $Revision$
@@ -44,12 +47,14 @@
try
{
PortletApplicationMetaData md =
this.unmarshall("general/portlet1.xml");
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
assertEquals("1.0", md.getVersion());
}
catch (Exception e)
{
e.printStackTrace();
- fail();
+ fail("No exception expected");
}
}
@@ -59,6 +64,8 @@
try
{
PortletApplicationMetaData md =
this.unmarshall("general/portlet2.xml");
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
assertEquals("2.0", md.getVersion());
}
catch (Exception e)
@@ -75,21 +82,30 @@
{
PortletApplicationMetaData md = (PortletApplicationMetaData)
this.unmarshall("general/portlet2-jsr286.xml");
assertEquals("2.0", md.getVersion());
+ assertTrue(md instanceof PortletApplication20MetaData);
assertEquals("MyResourceBundle", md.getResourceBundle());
assertEquals(new URI("foobar"), md.getDefaultNamespace());
PublicRenderParameterMetaData prp1 = md.getPublicRenderParameters().get(0);
+
+ assertEquals("Public render parameter one",
prp1.getDescription().getDefaultString());
assertEquals("param1", prp1.getId());
- assertEquals("Public render parameter one",
prp1.getDescription().getDefaultString());
assertEquals("param1", prp1.getName());
assertEquals("Parameter1", prp1.getAlias().get(0).getLocalPart());
assertEquals("Parameter2", prp1.getAlias().get(1).getLocalPart());
assertEquals("blub", prp1.getIdentifier());
- assertEquals("foobar",
md.getContainerRuntimeOption("foo").get(0));
- assertEquals("foobar2",
md.getContainerRuntimeOption("foo").get(1));
-
+ assertEquals("foobar",
md.getContainerRuntimeOption("foo").getValues().get(0));
+ assertEquals("foobar2",
md.getContainerRuntimeOption("foo").getValues().get(1));
+
+ ListenerMetaData listener1 = md.getListeners().get(0);
+ assertNotNull(listener1);
+ assertEquals("org.jboss.portal.portlet.test.listener.MyListener",
listener1.getListenerClass());
+ assertEquals("Mein Zuhörer Eins",
listener1.getDisplayName().getString(new Locale("de"), false));
+ assertEquals("Beschreibung", listener1.getDescription().getString(new
Locale("de"), false));
+
+ assertNotNull(md.getListeners().get(1));
}
catch (Exception e)
{
@@ -97,4 +113,40 @@
fail();
}
}
+
+ @Test
+ public void test01_generated()
+ {
+ try
+ {
+ PortletApplicationMetaData md =
unmarshall("general/portlet-app_1_0.xml");
+
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
+ assertEquals("1.0", md.getVersion());
+ assertNotNull(md.getCustomPortletModes());
+
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ @Test
+ public void test02_generated()
+ {
+ try
+ {
+ PortletApplicationMetaData md = (PortletApplicationMetaData)
this.unmarshall("general/portlet-app_2_0.xml");
+ assertEquals("2.0", md.getVersion());
+ assertTrue(md instanceof PortletApplication20MetaData);
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
}
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/PortletTestEverythingTestCase.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/PortletTestEverythingTestCase.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/PortletTestEverythingTestCase.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -40,6 +40,7 @@
import org.jboss.unit.api.pojo.annotations.Test;
import static org.jboss.unit.api.Assert.*;
+
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
* @version $Revision$
@@ -53,10 +54,11 @@
try
{
String xmlFile = "portlet/portlet1.xml";
- String namespace = PortletMetaDataConstants.PORTLET_JSR_168_NS;
- PortletApplication10MetaData md = unmarshall(xmlFile, namespace,
PortletApplication10MetaData.class);
+ PortletApplicationMetaData md = unmarshall(xmlFile);
assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
+ assertEquals("1.0", md.getVersion());
Locale fr = new Locale("fr");
Locale default_locale = new Locale(PortletMetaDataConstants.DEFAULT_LOCALE);
@@ -101,12 +103,12 @@
assertEquals("VIEW", smd2.getPortletModes().get(0).getPortletMode());
assertEquals("HELP", smd2.getPortletModes().get(1).getPortletMode());
+ assertEquals("MyResourceBundle", p1.getResourceBundle());
+
List<SupportedLocaleMetaData> localeList = p1.getSupportedLocale();
assertEquals("en", localeList.get(0).getLocale());
assertEquals("fr", localeList.get(1).getLocale());
- assertEquals("MyResourceBundle", p1.getResourceBundle());
-
PortletInfoMetaData pimd = p1.getPortletInfo();
assertNotNull(pimd);
assertEquals("very long portlet title", pimd.getTitle());
@@ -115,6 +117,7 @@
PortletPreferencesMetaData ppmd = p1.getPortletPreferences();
assertNotNull(ppmd);
+
assertEquals("MyValidator", ppmd.getPreferenceValidator());
assertEquals("1",
ppmd.getPortletPreferences().get("one").getValue().get(0));
assertEquals("2",
ppmd.getPortletPreferences().get("two").getValue().get(0));
@@ -191,6 +194,7 @@
PortletMetaData p13 = md.getPortlet("Portlet13");
assertNotNull(p13);
+
}
catch (Exception e)
{
@@ -205,11 +209,11 @@
try
{
String xmlFile = "portlet/portlet2.xml";
-// String namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS;
- PortletApplicationMetaData md = unmarshall(xmlFile);
- //unmarshall(xmlFile, namespace, PortletApplication20MetaData.class);
+ PortletApplicationMetaData md = unmarshall(xmlFile);
assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+ assertEquals("2.0", md.getVersion());
Locale fr = new Locale("fr");
Locale default_locale = new Locale(PortletMetaDataConstants.DEFAULT_LOCALE);
@@ -347,7 +351,6 @@
PortletMetaData p13 = md.getPortlet("Portlet13");
assertNotNull(p13);
-
}
catch (Exception e)
{
@@ -362,11 +365,12 @@
try
{
String xmlFile = "portlet/portlet2-jsr286.xml";
- String namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS;
- PortletApplication20MetaData md = unmarshall(xmlFile, namespace,
PortletApplication20MetaData.class);
+ PortletApplicationMetaData md = unmarshall(xmlFile);
assertNotNull(md);
-
+ assertTrue(md instanceof PortletApplication20MetaData);
+ assertEquals("2.0", md.getVersion());
+
Locale fr = new Locale("fr");
Locale default_locale = new Locale(PortletMetaDataConstants.DEFAULT_LOCALE);
@@ -465,14 +469,12 @@
assertEquals("foo2", p1.getSupportedPublicRenderParameters().get(2));
assertEquals("foo2bar",
p1.getSupportedPublicRenderParameters().get(3));
- assertEquals("org.jboss.portal.test.url.generation.listener",
p1.getUrlGenerationListener().get(0));
- assertEquals("org.jboss.portal.test.url.generation.listener.foo",
p1.getUrlGenerationListener().get(1));
-
assertTrue(p1.getContainerRuntimeOptions().containsKey("option1"));
assertTrue(p1.getContainerRuntimeOptions().containsKey("option2"));
- assertEquals("value1",
p1.getContainerRuntimeOptions().get("option1").get(0));
- assertEquals("value2",
p1.getContainerRuntimeOptions().get("option1").get(1));
- assertEquals("value3",
p1.getContainerRuntimeOptions().get("option2").get(0));
+ assertEquals("value1",
p1.getContainerRuntimeOptions().get("option1").getValues().get(0));
+ assertEquals("value2",
p1.getContainerRuntimeOptions().get("option1").getValues().get(1));
+ assertEquals("value3",
p1.getContainerRuntimeOptions().get("option2").getValues().get(0));
+
}
catch (Exception e)
{
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/RenderParameterTestEverythingTestCase.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/RenderParameterTestEverythingTestCase.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/RenderParameterTestEverythingTestCase.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.test.metadata;
+import org.jboss.portal.portlet.test.metadata.impl.PortletApplication20MetaData;
import org.jboss.portal.portlet.test.metadata.impl.PortletApplicationMetaData;
import org.jboss.portal.portlet.test.metadata.impl.PublicRenderParameterMetaData;
import org.jboss.unit.api.pojo.annotations.Test;
@@ -41,26 +42,32 @@
{
String xmlFile = "renderParameter/portlet2.xml";
-// String namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS;
- PortletApplicationMetaData md = unmarshall(xmlFile); //, namespace,
PortletApplication20MetaData.class);
+ PortletApplicationMetaData md = unmarshall(xmlFile);
assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
assertEquals("2.0", md.getVersion());
PublicRenderParameterMetaData prp1 = md.getPublicRenderParameters().get(0);
+ assertNotNull(prp1);
+
assertEquals("blah", prp1.getIdentifier());
assertEquals("renderParameter1", prp1.getName());
- assertEquals("fooo", prp1.getAlias().get(0).getLocalPart());
- assertEquals("rP1", prp1.getAlias().get(1).getLocalPart());
- assertEquals("render parameter foo",
prp1.getDescription().getDefaultString());
-
+
+
PublicRenderParameterMetaData prp2 = md.getPublicRenderParameters().get(1);
assertEquals("foo", prp2.getQname().getLocalPart());
assertEquals("x", prp2.getQname().getPrefix());
assertEquals("http://someurl.com",
prp2.getQname().getNamespaceURI());
+
+ assertEquals("fooo", prp1.getAlias().get(0).getLocalPart());
+ assertEquals("rP1", prp1.getAlias().get(1).getLocalPart());
+
assertEquals("foo", prp2.getAlias().get(0).getLocalPart());
assertEquals("http://someurl.alias.com",
prp2.getAlias().get(0).getNamespaceURI());
assertEquals("s", prp2.getAlias().get(0).getPrefix());
+
+ assertEquals("render parameter foo",
prp1.getDescription().getDefaultString());
}
catch (Exception e)
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/SecurityConstraintTestEverythingTestCase.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/SecurityConstraintTestEverythingTestCase.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/SecurityConstraintTestEverythingTestCase.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -27,7 +27,6 @@
import org.jboss.portal.portlet.test.metadata.impl.PortletApplication10MetaData;
import org.jboss.portal.portlet.test.metadata.impl.PortletApplication20MetaData;
import org.jboss.portal.portlet.test.metadata.impl.PortletApplicationMetaData;
-import org.jboss.portal.portlet.test.metadata.impl.PortletMetaDataConstants;
import org.jboss.portal.portlet.test.metadata.impl.portlet.PortletMetaData;
import org.jboss.portal.portlet.test.metadata.impl.security.SecurityConstraintMetaData;
import org.jboss.portal.portlet.test.metadata.impl.security.TransportGuaranteeEnum;
@@ -48,27 +47,29 @@
{
String xmlFile = "security/portlet1.xml";
- String namespace = PortletMetaDataConstants.PORTLET_JSR_168_NS;
PortletApplicationMetaData md = unmarshall(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
assertEquals("1.0", md.getVersion());
SecurityConstraintMetaData scd1 = md.getSecurityConstraints().get(0);
assertNotNull(scd1);
-
- assertEquals("foo", scd1.getId());
assertEquals("test", scd1.getDisplayName().getDefaultString());
assertEquals("Test", scd1.getDisplayName().getString(new
Locale("de"), false));
assertEquals(TransportGuaranteeEnum.NONE,
scd1.getUserDataConstraint().getTransportQuarantee());
- assertEquals("fooConstraint",
scd1.getUserDataConstraint().getDescription().getDefaultString());
- assertEquals("FooConstraint",
scd1.getUserDataConstraint().getDescription().getString(new Locale("de"),
false));
+
assertEquals("foo", scd1.getPortletList().getPortletNames().get(0));
assertEquals("foobar",
scd1.getPortletList().getPortletNames().get(1));
-
+ assertEquals("foo", scd1.getId());
+
SecurityConstraintMetaData scd2 = md.getSecurityConstraints().get(1);
assertNotNull(scd2);
assertEquals(TransportGuaranteeEnum.INTEGRAL,
scd2.getUserDataConstraint().getTransportQuarantee());
assertEquals("foo", scd2.getPortletList().getPortletNames().get(0));
+ assertEquals("fooConstraint",
scd1.getUserDataConstraint().getDescription().getDefaultString());
+ assertEquals("FooConstraint",
scd1.getUserDataConstraint().getDescription().getString(new Locale("de"),
false));
+
try
{
scd2.getPortletList().getPortletNames().get(1);
@@ -84,7 +85,6 @@
PortletMetaData pmd2 = md.getPortlet("foobar");
assertNotNull(pmd2);
-
}
catch (Exception e)
{
@@ -137,26 +137,30 @@
{
String xmlFile = "security/portlet2.xml";
- String namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS;
- PortletApplication20MetaData md = unmarshall(xmlFile, namespace,
PortletApplication20MetaData.class);
+ PortletApplicationMetaData md = unmarshall( xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
assertEquals("2.0", md.getVersion());
SecurityConstraintMetaData scd1 = md.getSecurityConstraints().get(0);
assertNotNull(scd1);
- assertEquals("foo", scd1.getId());
assertEquals("test", scd1.getDisplayName().getDefaultString());
assertEquals("Test", scd1.getDisplayName().getString(new
Locale("de"), false));
+ assertEquals("foo", scd1.getId());
+
assertEquals(TransportGuaranteeEnum.NONE,
scd1.getUserDataConstraint().getTransportQuarantee());
- assertEquals("fooConstraint",
scd1.getUserDataConstraint().getDescription().getDefaultString());
- assertEquals("FooConstraint",
scd1.getUserDataConstraint().getDescription().getString(new Locale("de"),
false));
assertEquals("foo", scd1.getPortletList().getPortletNames().get(0));
assertEquals("foobar",
scd1.getPortletList().getPortletNames().get(1));
+
SecurityConstraintMetaData scd2 = md.getSecurityConstraints().get(1);
assertNotNull(scd2);
assertEquals(TransportGuaranteeEnum.INTEGRAL,
scd2.getUserDataConstraint().getTransportQuarantee());
assertEquals("foo", scd2.getPortletList().getPortletNames().get(0));
+ assertEquals("fooConstraint",
scd1.getUserDataConstraint().getDescription().getDefaultString());
+ assertEquals("FooConstraint",
scd1.getUserDataConstraint().getDescription().getString(new Locale("de"),
false));
+
try
{
scd2.getPortletList().getPortletNames().get(1);
@@ -166,16 +170,7 @@
{
// expected java.lang.IndexOutOfBoundsException
}
- /*
- PortletMetaData pmd1 = md.getPortlet("foo");
- assertNotNull(pmd1);
-
assertTrue(pmd1.getTransportGuarantee().containsGuarantee(TransportGuaranteeEnum.NONE));
-
assertTrue(pmd1.getTransportGuarantee().containsGuarantee(TransportGuaranteeEnum.INTEGRAL));
-
- PortletMetaData pmd2 = md.getPortlet("foobar");
- assertNotNull(pmd2);
-
assertTrue(pmd2.getTransportGuarantee().containsGuarantee(TransportGuaranteeEnum.NONE));
- */
+
}
catch (Exception e)
{
Deleted:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/SimplePortletTestCase.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/SimplePortletTestCase.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/SimplePortletTestCase.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -1,52 +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.portlet.test.metadata;
-
-import org.jboss.portal.portlet.test.metadata.impl.PortletApplication10MetaData;
-import org.jboss.portal.portlet.test.metadata.impl.PortletApplicationMetaData;
-import org.jboss.portal.portlet.test.metadata.impl.PortletMetaDataConstants;
-import org.jboss.unit.api.pojo.annotations.Test;
-
-import static org.jboss.unit.api.Assert.*;
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
- * @version $Revision$
- */
-public class SimplePortletTestCase extends AbstractMetaDataTestCase
-{
-
- @Test
- public void test02()
- {
- try
- {
- PortletApplicationMetaData md =
unmarshall("portlet/portlet1-simple.xml");
- fail();
- }
- catch (Exception e)
- {
- // OK
- }
- }
-
-}
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/UserAttributeTestEverythingTestCase.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/UserAttributeTestEverythingTestCase.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/UserAttributeTestEverythingTestCase.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -26,11 +26,12 @@
import org.jboss.portal.portlet.test.metadata.impl.PortletApplication10MetaData;
import org.jboss.portal.portlet.test.metadata.impl.PortletApplication20MetaData;
-import org.jboss.portal.portlet.test.metadata.impl.PortletMetaDataConstants;
+import org.jboss.portal.portlet.test.metadata.impl.PortletApplicationMetaData;
import org.jboss.portal.portlet.test.metadata.impl.UserAttributeMetaData;
import org.jboss.unit.api.pojo.annotations.Test;
import static org.jboss.unit.api.Assert.*;
+
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
* @version $Revision$
@@ -44,10 +45,10 @@
try
{
String xmlFile = "userAttribute/portlet1.xml";
- String namespace = PortletMetaDataConstants.PORTLET_JSR_168_NS;
- PortletApplication10MetaData md = unmarshall(xmlFile, namespace,
PortletApplication10MetaData.class);
+ PortletApplicationMetaData md = unmarshall(xmlFile);
assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
UserAttributeMetaData umb = md.getUserAttributes().get("blub");
assertNotNull(umb);
@@ -59,6 +60,7 @@
assertEquals("realFoo", umd.getId());
assertEquals("foobar", umd.getDescription().getDefaultString());
assertEquals("fuhbar", umd.getDescription().getString(new
Locale("de"), true));
+
}
catch (Exception e)
{
@@ -73,10 +75,11 @@
try
{
String xmlFile = "userAttribute/portlet2.xml";
- String namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS;
- PortletApplication20MetaData md = unmarshall(xmlFile, namespace,
PortletApplication20MetaData.class);
+ PortletApplicationMetaData md = unmarshall(xmlFile);
assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+
UserAttributeMetaData umb = md.getUserAttributes().get("blub");
assertNotNull(umb);
assertEquals("notFoo", umb.getId());
@@ -87,7 +90,6 @@
assertEquals("realFoo", umd.getId());
assertEquals("foobar", umd.getDescription().getDefaultString());
assertEquals("fuhbar", umd.getDescription().getString(new
Locale("de"), true));
-
}
catch (Exception e)
{
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/ValidationErrorHandler.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/ValidationErrorHandler.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/ValidationErrorHandler.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -25,7 +25,6 @@
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
-import static org.jboss.unit.api.Assert.*;
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
* @version $Revision$
@@ -47,7 +46,7 @@
public void warning(SAXParseException e) throws SAXException
{
- // TODO
+ // TODO - maybe logging or similar stuff
}
}
\ No newline at end of file
Added:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/factory/LocalizedStringBuilder.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/factory/LocalizedStringBuilder.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/factory/LocalizedStringBuilder.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * 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.portlet.test.metadata.factory;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.portlet.test.metadata.impl.adapter.LocalizedStringAdapter;
+import org.jboss.portal.portlet.test.metadata.impl.common.LocalizedDescriptionMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class LocalizedStringBuilder
+{
+
+ /** The object to localized meta data. */
+ private Map<Object, LocalizedMetaDataContainer> map = new
LinkedHashMap<Object, LocalizedMetaDataContainer>();
+
+ /** The logger. */
+ private static final Logger log = Logger.getLogger(LocalizedStringBuilder.class);
+
+ public void put(Object object, LocalizedDescriptionMetaData description)
+ {
+ LocalizedMetaDataContainer container = map.get(object);
+ if (container == null)
+ {
+ container = new LocalizedMetaDataContainer();
+ map.put(object, container);
+ }
+ container.addLocalizedDescription(description);
+ }
+
+ public LocalizedString getLocalizedString(Object key)
+ {
+ try
+ {
+ return this.map.get(key) != null ? this.map.get(key).getLocalizedString() :
null;
+ }
+ catch (Exception e)
+ {
+ log.error("could not generate localized string.", e);
+ return null;
+ }
+ }
+
+ private static class LocalizedMetaDataContainer
+ {
+ /** The list of localiezd meta data */
+ private List<LocalizedDescriptionMetaData> list = new
ArrayList<LocalizedDescriptionMetaData>();
+
+ public void addLocalizedDescription(LocalizedDescriptionMetaData description)
+ {
+ this.list.add(description);
+ }
+
+ public LocalizedString getLocalizedString() throws Exception
+ {
+ LocalizedStringAdapter adapter = new LocalizedStringAdapter();
+ return adapter.unmarshal(list);
+ }
+ }
+}
Added:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/factory/PortletApplicationModelFactory.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/factory/PortletApplicationModelFactory.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/factory/PortletApplicationModelFactory.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -0,0 +1,836 @@
+/******************************************************************************
+ * 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.portlet.test.metadata.factory;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.portlet.test.metadata.impl.CustomPortletModeMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.CustomWindowStateMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.ListenerMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.PortletApplication10MetaData;
+import org.jboss.portal.portlet.test.metadata.impl.PortletApplication20MetaData;
+import org.jboss.portal.portlet.test.metadata.impl.PortletApplicationMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.PublicRenderParameterMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.UserAttributeMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.common.ContainerRuntimeMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.common.DescribableMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.common.InitParamMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.common.LocalizedDescriptionMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.event.EventDefinitionMetaData;
+import
org.jboss.portal.portlet.test.metadata.impl.event.EventDefinitionReferenceMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.filter.FilterMappingMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.filter.FilterMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.portlet.PortletCacheScopeEnum;
+import org.jboss.portal.portlet.test.metadata.impl.portlet.PortletInfoMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.portlet.PortletMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.portlet.PortletModeMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.portlet.PortletPreferenceMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.portlet.PortletPreferencesMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.portlet.SecurityRoleRefMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.portlet.SupportedLocaleMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.portlet.SupportsMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.portlet.WindowStateMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.security.PortletCollectionMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.security.SecurityConstraintMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.security.TransportGuaranteeEnum;
+import org.jboss.portal.portlet.test.metadata.impl.security.UserDataConstraintMetaData;
+import org.jboss.xb.binding.GenericObjectModelFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+import static org.jboss.portal.portlet.test.metadata.impl.PortletMetaDataConstants.*;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PortletApplicationModelFactory implements GenericObjectModelFactory
+{
+
+ /** LocalizedDescriptionMetaData container for descriptions */
+ private LocalizedStringBuilder descriptions = new LocalizedStringBuilder();
+
+ /** LocalizedDescriptionMetaData container for displayNames */
+ private LocalizedStringBuilder displayNames = new LocalizedStringBuilder();
+
+ /** Guess what? The logger. */
+ private static final Logger log =
Logger.getLogger(PortletApplicationModelFactory.class);
+
+ public Object newRoot(Object root, UnmarshallingContext nav, String nsURI, String
localName, Attributes attrs)
+ {
+
+ String version = attrs.getValue("version");
+ String id = attrs.getValue("id");
+
+ // portlet-app 2.0 or 1.0
+ PortletApplicationMetaData md = PORTLET_JSR_286_NS.equals(nsURI)
+ ? new PortletApplication20MetaData()
+ : new PortletApplication10MetaData();
+
+ // Set portlet-app id
+ md.setId(id);
+ // Set portlet-app version
+ md.setVersion(version);
+ // return
+ return md;
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext ctx, String nsURI, String
name)
+ {
+ return root;
+ }
+
+ public Object newChild(Object object, UnmarshallingContext nav, String nsURI, String
localName, Attributes attrs)
+ {
+ String id = attrs.getValue("id");
+ if (object instanceof DescribableMetaData)
+ {
+
+ if ("description".equals(localName))
+ {
+ String locale = attrs.getValue("xml:lang") != null ?
attrs.getValue("xml:lang") : DEFAULT_LOCALE;
+ LocalizedDescriptionMetaData localized = new
LocalizedDescriptionMetaData(locale);
+ this.descriptions.put(object, localized);
+ return localized;
+ }
+ }
+
+ // portlet-app
+ if (object instanceof PortletApplicationMetaData)
+ {
+ if ("portlet".equals(localName))
+ {
+ return new PortletMetaData(id);
+ }
+ else if ("custom-portlet-mode".equals(localName))
+ {
+ return new CustomPortletModeMetaData(id);
+ }
+ else if ("custom-window-state".equals(localName))
+ {
+ return new CustomWindowStateMetaData(id);
+ }
+ else if ("user-attribute".equals(localName))
+ {
+ return new UserAttributeMetaData(id);
+ }
+ else if ("security-constraint".equals(localName))
+ {
+ return new SecurityConstraintMetaData(id);
+ }
+ }
+
+ // portlet-app 2.0
+ if (object instanceof PortletApplication20MetaData &&
PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ if ("public-render-parameter".equals(localName))
+ {
+ return new PublicRenderParameterMetaData(id);
+ }
+ else if ("event-definition".equals(localName))
+ {
+ return new EventDefinitionMetaData(id);
+ }
+ else if ("filter".equals(localName))
+ {
+ return new FilterMetaData();
+ }
+ else if ("filter-mapping".equals(localName))
+ {
+ return new FilterMappingMetaData();
+ }
+ else if ("listener".equals(localName))
+ {
+ return new ListenerMetaData(id);
+ }
+ else if ("container-runtime-option".equals(localName))
+ {
+ return new ContainerRuntimeMetaData();
+ }
+ }
+
+ // portlet
+ if (object instanceof PortletMetaData)
+ {
+ if ("init-param".equals(localName))
+ {
+ return new InitParamMetaData(id);
+ }
+ else if ("display-name".equals(localName))
+ {
+ String locale = attrs.getValue("xml:lang") != null ?
attrs.getValue("xml:lang") : DEFAULT_LOCALE;
+ LocalizedDescriptionMetaData localized = new
LocalizedDescriptionMetaData(locale);
+ this.displayNames.put(object, localized);
+ return localized;
+ }
+ else if ("supports".equals(localName))
+ {
+ return new SupportsMetaData(id);
+ }
+ else if ("supported-locale".equals(localName))
+ {
+ return new SupportedLocaleMetaData();
+ }
+ else if ("portlet-info".equals(localName))
+ {
+ return new PortletInfoMetaData(id);
+ }
+ else if ("portlet-preferences".equals(localName))
+ {
+ return new PortletPreferencesMetaData(id);
+ }
+ else if ("security-role-ref".equals(localName))
+ {
+ return new SecurityRoleRefMetaData(id);
+ }
+ else if ("supported-processing-event".equals(localName) &&
PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ return new EventDefinitionReferenceMetaData(id);
+ }
+ else if ("supported-publishing-event".equals(localName) &&
PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ return new EventDefinitionReferenceMetaData(id);
+ }
+ else if ("container-runtime-option".equals(localName) &&
PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ return new ContainerRuntimeMetaData();
+ }
+ }
+
+ // security-constraint
+ if (object instanceof SecurityConstraintMetaData)
+ {
+ if ("portlet-collection".equals(localName))
+ {
+ return new PortletCollectionMetaData();
+ }
+ else if ("user-data-constraint".equals(localName))
+ {
+ return new UserDataConstraintMetaData(id);
+ }
+ else if ("display-name".equals(localName))
+ {
+ String locale = attrs.getValue("xml:lang") != null ?
attrs.getValue("xml:lang") : DEFAULT_LOCALE;
+ LocalizedDescriptionMetaData localized = new
LocalizedDescriptionMetaData(locale);
+ this.displayNames.put(object, localized);
+ return localized;
+ }
+ }
+
+ // supports
+ if (object instanceof SupportsMetaData)
+ {
+ if ("portlet-mode".equals(localName))
+ {
+ return new PortletModeMetaData();
+ }
+ else if ("window-state".equals(localName) &&
PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ return new WindowStateMetaData();
+ }
+ }
+
+ // preference (in portlet-preferences)
+ if (object instanceof PortletPreferencesMetaData)
+ {
+ if ("preference".equals(localName))
+ {
+ return new PortletPreferenceMetaData(id);
+ }
+ }
+
+ // filter
+ if (object instanceof FilterMetaData)
+ {
+ if ("init-param".equals(localName))
+ {
+ return new InitParamMetaData(id);
+ }
+ else if ("display-name".equals(localName))
+ {
+ String locale = attrs.getValue("xml:lang") != null ?
attrs.getValue("xml:lang") : DEFAULT_LOCALE;
+ LocalizedDescriptionMetaData localized = new
LocalizedDescriptionMetaData(locale);
+ this.displayNames.put(object, localized);
+ return localized;
+ }
+ }
+
+ // listener
+ if (object instanceof ListenerMetaData)
+ {
+ if ("display-name".equals(localName))
+ {
+ String locale = attrs.getValue("xml:lang") != null ?
attrs.getValue("xml:lang") : DEFAULT_LOCALE;
+ LocalizedDescriptionMetaData localized = new
LocalizedDescriptionMetaData(locale);
+ this.displayNames.put(object, localized);
+ return localized;
+ }
+ }
+
+ return null;
+ }
+
+ public void addChild(Object parent, Object child, UnmarshallingContext nav, String
nsURI, String localName)
+ {
+
+ if (child instanceof DescribableMetaData)
+ {
+ DescribableMetaData md = (DescribableMetaData) child;
+ LocalizedString d = this.descriptions.getLocalizedString(md);
+ md.setDescription(d);
+ }
+
+ // portlet app
+ if (parent instanceof PortletApplicationMetaData)
+ {
+ PortletApplicationMetaData md = (PortletApplicationMetaData) parent;
+ // add portlet
+ if (child instanceof PortletMetaData)
+ {
+ PortletMetaData portlet = (PortletMetaData) child;
+ portlet.setDisplayName(this.displayNames.getLocalizedString(portlet));
+ md.addPortlet(portlet);
+ }
+ // add custom-portlet-mode
+ else if (child instanceof CustomPortletModeMetaData)
+ {
+ md.addCustomPortletMode((CustomPortletModeMetaData) child);
+ }
+ // add custom window state
+ else if (child instanceof CustomWindowStateMetaData)
+ {
+ md.addCustomWindowState((CustomWindowStateMetaData) child);
+ }
+ // add user-attribute
+ else if (child instanceof UserAttributeMetaData)
+ {
+ md.addUserAttribute((UserAttributeMetaData) child);
+ }
+ // add security-constraint
+ else if (child instanceof SecurityConstraintMetaData)
+ {
+ SecurityConstraintMetaData security = (SecurityConstraintMetaData) child;
+ // display-name
+ security.setDisplayName(this.displayNames.getLocalizedString(security));
+ md.addSecurityConstraint(security);
+ }
+ }
+
+ // portlet-app 2.0
+ if (parent instanceof PortletApplication20MetaData)
+ {
+ PortletApplication20MetaData md = (PortletApplication20MetaData) parent;
+ // add public-render-parameter
+ if (child instanceof PublicRenderParameterMetaData)
+ {
+ md.addPublicRenderParameter((PublicRenderParameterMetaData) child);
+ }
+ // add event-defintion
+ else if (child instanceof EventDefinitionMetaData)
+ {
+ md.addEventDefinition((EventDefinitionMetaData) child);
+ }
+ // add filter
+ else if (child instanceof FilterMetaData)
+ {
+ FilterMetaData filter = (FilterMetaData) child;
+ filter.setDisplayName(this.displayNames.getLocalizedString(filter));
+ md.addFilter(filter);
+ }
+ // add filter-mapping
+ else if (child instanceof FilterMappingMetaData)
+ {
+ md.addFilterMapping((FilterMappingMetaData) child);
+ }
+ // add container-runtime-option
+ else if (child instanceof ContainerRuntimeMetaData)
+ {
+ md.addContainerRuntime((ContainerRuntimeMetaData) child);
+ }
+ // add listener
+ else if (child instanceof ListenerMetaData)
+ {
+ ListenerMetaData listener = (ListenerMetaData) child;
+ listener.setDisplayName(this.displayNames.getLocalizedString(listener));
+ md.addListener(listener);
+ }
+ }
+
+ // portlet
+ if (parent instanceof PortletMetaData)
+ {
+ PortletMetaData md = (PortletMetaData) parent;
+ // init-param
+ if (child instanceof InitParamMetaData)
+ {
+ md.addInitParam((InitParamMetaData) child);
+ }
+ // supports
+ else if (child instanceof SupportsMetaData)
+ {
+ md.addSupport((SupportsMetaData) child);
+ }
+ // supported-locale
+ else if (child instanceof SupportedLocaleMetaData)
+ {
+ md.addSupportedLocale((SupportedLocaleMetaData) child);
+ }
+ // portlet-info
+ else if (child instanceof PortletInfoMetaData)
+ {
+ md.setPortletInfo((PortletInfoMetaData) child);
+ }
+ // portlet-preferences
+ else if (child instanceof PortletPreferencesMetaData)
+ {
+ md.setPortletPreferences((PortletPreferencesMetaData) child);
+ }
+ // security-role-ref
+ else if (child instanceof SecurityRoleRefMetaData)
+ {
+ md.addSecurityRoleRef((SecurityRoleRefMetaData) child);
+ }
+ // supported-events
+ else if (child instanceof EventDefinitionReferenceMetaData)
+ {
+ if ("supported-processing-event".equals(localName))
+ {
+ md.addSupportedProcessingEvent((EventDefinitionReferenceMetaData) child);
+ }
+ else if ("supported-publishing-event".equals(localName))
+ {
+ md.addSupportedPublishingEvent((EventDefinitionReferenceMetaData) child);
+ }
+ }
+ // container-runtime-option
+ else if (child instanceof ContainerRuntimeMetaData)
+ {
+ md.addContainerRuntime((ContainerRuntimeMetaData) child);
+ }
+ }
+
+ // adding user-data-constraint and portlet-name(s) to security-constraint
+ if (parent instanceof SecurityConstraintMetaData)
+ {
+ SecurityConstraintMetaData md = (SecurityConstraintMetaData) parent;
+ // add user-data-constraint
+ if (child instanceof UserDataConstraintMetaData)
+ {
+ md.setUserDataConstraint((UserDataConstraintMetaData) child);
+ }
+ // add portlet-collection
+ else if (child instanceof PortletCollectionMetaData)
+ {
+ md.setPortletList((PortletCollectionMetaData) child);
+ }
+ }
+
+ // filter
+ if (parent instanceof FilterMetaData)
+ {
+ FilterMetaData md = (FilterMetaData) parent;
+ // add init-param
+ if (child instanceof InitParamMetaData)
+ {
+ md.addInitParam((InitParamMetaData) child);
+ }
+ }
+
+ // add portlet-mode and window-state
+ if (parent instanceof SupportsMetaData)
+ {
+ SupportsMetaData md = (SupportsMetaData) parent;
+ if (child instanceof PortletModeMetaData)
+ {
+ md.addPortletMode((PortletModeMetaData) child);
+ }
+ else if (child instanceof WindowStateMetaData)
+ {
+ md.addWindowState((WindowStateMetaData) child);
+ }
+ }
+
+ // add preference
+ if (parent instanceof PortletPreferencesMetaData)
+ {
+ PortletPreferencesMetaData md = (PortletPreferencesMetaData) parent;
+ if (child instanceof PortletPreferenceMetaData)
+ {
+ md.addPortletPreference((PortletPreferenceMetaData) child);
+ }
+ }
+ }
+
+ public void setValue(Object object, UnmarshallingContext nav, String nsURI, String
localName, String value)
+ {
+
+ // JSR 286 portlet-app attributes - default-namespace and resource-bundle.
+ if (object instanceof PortletApplication20MetaData)
+ {
+ PortletApplication20MetaData md = (PortletApplication20MetaData) object;
+ if ("resource-bundle".equals(localName))
+ {
+ md.setResourceBundle(value);
+ }
+ else if ("default-namespace".equals(localName))
+ {
+ try
+ {
+ md.setDefaultNamespace(new URI(value));
+ }
+ catch (URISyntaxException e)
+ {
+ log.error("Invalid syntax for default-namespace: " + value);
+ }
+ }
+ }
+
+ // portlet
+ if (object instanceof PortletMetaData)
+ {
+ PortletMetaData md = (PortletMetaData) object;
+ if ("portlet-name".equals(localName))
+ {
+ md.setPortletName(value);
+ }
+ else if ("portlet-class".equals(localName))
+ {
+ md.setPortletClass(value);
+ }
+ else if ("cache-scope".equals(localName) &&
PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ md.setCacheScope(PortletCacheScopeEnum.valueOf(value));
+ }
+ else if ("expiration-cache".equals(localName))
+ {
+ md.setExpirationCache(Integer.valueOf(value));
+ }
+ else if ("resource-bundle".equals(localName))
+ {
+ md.setResourceBundle(value);
+ }
+ else if ("supported-public-render-parameter".equals(localName)
&& PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ md.addSupportedPublicRenderParameter(value);
+ }
+ }
+
+ if (object instanceof LocalizedDescriptionMetaData)
+ {
+ LocalizedDescriptionMetaData localized = (LocalizedDescriptionMetaData) object;
+ if ("description".equals(localName))
+ {
+ localized.setDescription(value);
+ }
+ else if ("display-name".equals(localName))
+ {
+ localized.setDescription(value);
+ }
+ }
+
+ // init-param
+ if (object instanceof InitParamMetaData)
+ {
+ InitParamMetaData md = (InitParamMetaData) object;
+ if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ else if ("value".equals(localName))
+ {
+ md.setValue(value);
+ }
+ }
+
+ // supports
+ if (object instanceof SupportsMetaData)
+ {
+ SupportsMetaData md = (SupportsMetaData) object;
+ if ("mime-type".equals(localName))
+ {
+ md.setMimeType(value);
+ }
+ }
+
+ // supports --- portlet-mode
+ if (object instanceof PortletModeMetaData)
+ {
+ PortletModeMetaData md = (PortletModeMetaData) object;
+ if ("portlet-mode".equals(localName))
+ {
+ md.setPortletMode(value);
+ }
+ }
+
+ // supports --- window-state
+ if (object instanceof WindowStateMetaData)
+ {
+ WindowStateMetaData md = (WindowStateMetaData) object;
+ if ("window-state".equals(localName))
+ {
+ md.setWindowState(value);
+ }
+ }
+
+ // supported-locale
+ if (object instanceof SupportedLocaleMetaData)
+ {
+ SupportedLocaleMetaData md = (SupportedLocaleMetaData) object;
+ if ("supported-locale".equals(localName))
+ {
+ md.setLocale(value);
+ }
+ }
+
+ // portlet-info
+ if (object instanceof PortletInfoMetaData)
+ {
+ PortletInfoMetaData md = (PortletInfoMetaData) object;
+ if ("title".equals(localName))
+ {
+ md.setTitle(value);
+ }
+ else if ("short-title".equals(localName))
+ {
+ md.setShortTitle(value);
+ }
+ else if ("keywords".equals(localName))
+ {
+ md.setKeywords(value);
+ }
+ }
+
+ // portlet-preferences
+ if (object instanceof PortletPreferencesMetaData)
+ {
+ PortletPreferencesMetaData md = (PortletPreferencesMetaData) object;
+ if ("preferences-validator".equals(localName))
+ {
+ md.setPreferenceValidator(value);
+ }
+ }
+
+ // preference
+ if (object instanceof PortletPreferenceMetaData)
+ {
+ PortletPreferenceMetaData md = (PortletPreferenceMetaData) object;
+ if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ else if ("value".equals(localName))
+ {
+ md.addValue(value);
+ }
+ else if ("read-only".equals(localName))
+ {
+ md.setReadOnly(Boolean.valueOf(value));
+ }
+ }
+
+ // security-role-ref
+ if (object instanceof SecurityRoleRefMetaData)
+ {
+ SecurityRoleRefMetaData md = (SecurityRoleRefMetaData) object;
+ if ("role-name".equals(localName))
+ {
+ md.setRoleName(value);
+ }
+ else if ("role-link".equals(localName))
+ {
+ md.setRoleLink(value);
+ }
+ }
+
+ // supported events
+ if (object instanceof EventDefinitionReferenceMetaData)
+ {
+ EventDefinitionReferenceMetaData md = (EventDefinitionReferenceMetaData)
object;
+ if ("qname".equals(localName))
+ {
+ md.setQname(nav.resolveQName(value));
+ }
+ else if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ }
+
+ // custom-portlet-mode
+ if (object instanceof CustomPortletModeMetaData)
+ {
+ CustomPortletModeMetaData mode = (CustomPortletModeMetaData) object;
+ if ("portlet-mode".equals(localName))
+ {
+ mode.setPortletMode(value);
+ }
+ else if ("portal-managed".equals(localName) &&
PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ mode.setPortalManaged(Boolean.parseBoolean(value));
+ }
+ }
+
+ // custom-window-state
+ if (object instanceof CustomWindowStateMetaData)
+ {
+ CustomWindowStateMetaData md = (CustomWindowStateMetaData) object;
+ if ("window-state".equals(localName))
+ {
+ md.setWindowState(value);
+ }
+ }
+
+ // user-attribute
+ if (object instanceof UserAttributeMetaData)
+ {
+ UserAttributeMetaData md = (UserAttributeMetaData) object;
+ if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ }
+
+ // user-data-constraint
+ if (object instanceof UserDataConstraintMetaData)
+ {
+ UserDataConstraintMetaData md = (UserDataConstraintMetaData) object;
+ if ("transport-guarantee".equals(localName))
+ {
+ md.setTransportQuarantee(TransportGuaranteeEnum.valueOf(value));
+ }
+ }
+
+ // portlet-collection in security-constraint
+ if (object instanceof PortletCollectionMetaData)
+ {
+ PortletCollectionMetaData md = (PortletCollectionMetaData) object;
+ if ("portlet-name".equals(localName))
+ {
+ md.addPortletname(value);
+ }
+ }
+
+ // filter
+ if (object instanceof FilterMetaData && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ FilterMetaData md = (FilterMetaData) object;
+ if ("filter-class".equals(localName))
+ {
+ md.setFilterClass(value);
+ }
+ else if ("filter-name".equals(localName))
+ {
+ md.setFilterName(value);
+ }
+ else if ("lifecycle".equals(localName))
+ {
+ md.addLifecycle(value);
+ }
+ }
+
+ // filter-mapping
+ if (object instanceof FilterMappingMetaData &&
PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ FilterMappingMetaData md = (FilterMappingMetaData) object;
+ if ("filter-name".equals(localName))
+ {
+ md.setName(value);
+ }
+ if ("portlet-name".equals(localName))
+ {
+ md.addPortletName(value);
+ }
+ }
+
+ // event-defintion
+ if (object instanceof EventDefinitionMetaData &&
PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ EventDefinitionMetaData md = (EventDefinitionMetaData) object;
+ if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ else if ("qname".equals(localName))
+ {
+ md.setQname(nav.resolveQName(value));
+ }
+ else if ("value-type".equals(localName))
+ {
+ md.setValueType(value);
+ }
+ else if ("alias".equals(localName))
+ {
+ md.addAlias(nav.resolveQName(value));
+ }
+ }
+
+ // public-render-parameter
+ if (object instanceof PublicRenderParameterMetaData &&
PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ PublicRenderParameterMetaData md = (PublicRenderParameterMetaData) object;
+ if ("identifier".equals(localName))
+ {
+ md.setIdentifier(value);
+ }
+ else if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ else if ("qname".equals(localName))
+ {
+ md.setQname(nav.resolveQName(value));
+ }
+ else if ("alias".equals(localName))
+ {
+ md.addAlias(nav.resolveQName(value));
+ }
+ }
+
+ // container-runtime-option
+ if (object instanceof ContainerRuntimeMetaData &&
PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ ContainerRuntimeMetaData md = (ContainerRuntimeMetaData) object;
+ if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ else if ("value".equals(localName))
+ {
+ md.addValue(value);
+ }
+ }
+
+ // listener
+ if (object instanceof ListenerMetaData &&
PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ ListenerMetaData md = (ListenerMetaData) object;
+ if ("listener-class".equals(localName))
+ {
+ md.setListenerClass(value);
+ }
+ }
+ }
+}
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/CustomPortletModeMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/CustomPortletModeMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/CustomPortletModeMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -25,18 +25,15 @@
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.jboss.portal.common.i18n.LocalizedString;
-import org.jboss.portal.portlet.test.metadata.impl.adapter.LocalizedStringAdapter;
-import org.jboss.portal.portlet.test.metadata.impl.common.DescribeableMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.common.DescribableMetaData;
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
* @version $Revision$
*/
@XmlType(name = "custom-portlet-modeType")
-public class CustomPortletModeMetaData extends DescribeableMetaData
+public class CustomPortletModeMetaData extends DescribableMetaData
{
/** The custom portlet mode id*/
@@ -48,9 +45,13 @@
/** Is portal managed */
private boolean portalManaged = true;
- /** The decoration name */
- private LocalizedString decorationName;
-
+ public CustomPortletModeMetaData() {}
+
+ public CustomPortletModeMetaData(String id)
+ {
+ this.id = id;
+ }
+
@XmlAttribute(name = "id")
public String getId()
{
@@ -83,17 +84,5 @@
{
this.portalManaged = portalManaged;
}
-
- @XmlElement(name = "decoration-name", namespace =
PortletMetaDataConstants.PORTLET_JSR_286_NS)
- @XmlJavaTypeAdapter(LocalizedStringAdapter.class)
- public LocalizedString getDecorationName()
- {
- return decorationName;
- }
-
- public void setDecorationName(LocalizedString decorationName)
- {
- this.decorationName = decorationName;
- }
-
+
}
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/CustomWindowStateMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/CustomWindowStateMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/CustomWindowStateMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -26,14 +26,14 @@
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
-import org.jboss.portal.portlet.test.metadata.impl.common.DescribeableMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.common.DescribableMetaData;
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
* @version $Revision$
*/
@XmlType(name = "custom-window-stateType")
-public class CustomWindowStateMetaData extends DescribeableMetaData
+public class CustomWindowStateMetaData extends DescribableMetaData
{
/** The window state id */
@@ -42,6 +42,13 @@
/** The window state */
private String windowState;
+ public CustomWindowStateMetaData() {}
+
+ public CustomWindowStateMetaData(String id)
+ {
+ this.id = id;
+ }
+
@XmlAttribute(name = "id")
public String getId()
{
Added:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/ListenerMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/ListenerMetaData.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/ListenerMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -0,0 +1,95 @@
+/******************************************************************************
+ * 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.portlet.test.metadata.impl;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.portlet.test.metadata.impl.adapter.LocalizedStringAdapter;
+import org.jboss.portal.portlet.test.metadata.impl.common.DescribableMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+@XmlType(name = "listenerType")
+public class ListenerMetaData extends DescribableMetaData
+{
+
+ /** The id */
+ private String id;
+
+ /** The display name */
+ private LocalizedString displayName;
+
+ /** The listener class */
+ private String listenerClass;
+
+ public ListenerMetaData() {}
+
+ public ListenerMetaData(String id)
+ {
+ this.id = id;
+ }
+
+ @XmlAttribute(name = "id")
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ @XmlElement(name = "display-name")
+ @XmlJavaTypeAdapter(LocalizedStringAdapter.class)
+ public LocalizedString getDisplayName()
+ {
+ return displayName;
+ }
+
+ public void setDisplayName(LocalizedString displayName)
+ {
+ this.displayName = displayName;
+ }
+
+ @XmlElement(name = "listener-class")
+ @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+ public String getListenerClass()
+ {
+ return listenerClass;
+ }
+
+ public void setListenerClass(String listenerClass)
+ {
+ this.listenerClass = listenerClass;
+ }
+
+}
+
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PortletApplication10MetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PortletApplication10MetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PortletApplication10MetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -23,7 +23,10 @@
package org.jboss.portal.portlet.test.metadata.impl;
import java.net.URI;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -36,12 +39,13 @@
import javax.xml.bind.annotation.XmlNs;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.jboss.portal.portlet.test.metadata.impl.adapter.ContainerRuntimeAdapter;
-import org.jboss.portal.portlet.test.metadata.impl.adapter.FilterAdapter;
-import org.jboss.portal.portlet.test.metadata.impl.adapter.FilterMappingAdapter;
+import org.jboss.portal.portlet.test.metadata.impl.adapter.CustomPortletModeAdapter;
+import org.jboss.portal.portlet.test.metadata.impl.adapter.CustomWindowStateAdapter;
import org.jboss.portal.portlet.test.metadata.impl.adapter.PortletListAdapter;
import org.jboss.portal.portlet.test.metadata.impl.adapter.UserAttributeAdapter;
+import org.jboss.portal.portlet.test.metadata.impl.common.ContainerRuntimeMetaData;
import org.jboss.portal.portlet.test.metadata.impl.event.EventDefinitionMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.filter.FilterMappingMetaData;
import org.jboss.portal.portlet.test.metadata.impl.filter.FilterMetaData;
import org.jboss.portal.portlet.test.metadata.impl.portlet.PortletMetaData;
import org.jboss.portal.portlet.test.metadata.impl.security.SecurityConstraintMetaData;
@@ -60,48 +64,27 @@
@XmlType(name = "portlet-appType")
public class PortletApplication10MetaData implements PortletApplicationMetaData
{
- /** The portlet application id */
+ /** The portlet application id. */
private String id;
- /** The portlet application version */
+ /** The portlet application version. */
private String version;
- /** A bunch of portlets */
+ /** A bunch of portlets. */
private Map<String, PortletMetaData> portlets;
- /** The user attributes */
+ /** The user attributes. */
private Map<String, UserAttributeMetaData> userAttributes;
- /** The custom portlet mode */
- private List<CustomPortletModeMetaData> customPortletMode;
+ /** The custom portlet mode. */
+ private Map<String, CustomPortletModeMetaData> customPortletModes;
- /** The custom window states */
- private List<CustomWindowStateMetaData> customWindowState;
+ /** The custom window states. */
+ private Map<String, CustomWindowStateMetaData> customWindowStates;
/** The security constraints */
private List<SecurityConstraintMetaData> securityConstraints;
- /** The resource bundle (JSR 286) */
- private String resourceBundle;
-
- /** The default namespace URI (JSR 286) */
- private URI defaultNamespace;
-
- /** The filters (JSR 286) */
- private Map<String, FilterMetaData> filters;
-
- /** The filter mapping (JSR 286) */
- private Map<String, List<String>> filterMapping;
-
- /** The events (JSR 286) */
- private List<EventDefinitionMetaData> events;
-
- /** The public render parameters */
- private List<PublicRenderParameterMetaData> publicRenderParameters;
-
- /** The container runtime options */
- private Map<String, List<String>> containerRuntimeOptions;
-
@XmlAttribute(name = "id")
public String getId()
{
@@ -145,6 +128,15 @@
{
return portlets.get(portletName);
}
+
+ public void addPortlet(PortletMetaData portlet)
+ {
+ if(this.portlets == null)
+ {
+ this.portlets = new LinkedHashMap<String, PortletMetaData>();
+ }
+ this.portlets.put(portlet.getPortletName(), portlet);
+ }
@XmlElement(name = "user-attribute")
@XmlJavaTypeAdapter(UserAttributeAdapter.class)
@@ -157,28 +149,57 @@
{
this.userAttributes = userAttributes;
}
+
+ public void addUserAttribute(UserAttributeMetaData userAttribute)
+ {
+ if( this.userAttributes == null )
+ {
+ this.userAttributes = new HashMap<String, UserAttributeMetaData>();
+ }
+ this.userAttributes.put(userAttribute.getName(), userAttribute);
+ }
@XmlElement(name = "custom-portlet-mode")
- public List<CustomPortletModeMetaData> getCustomPortletMode()
+ @XmlJavaTypeAdapter(CustomPortletModeAdapter.class)
+ public Map<String, CustomPortletModeMetaData> getCustomPortletModes()
{
- return customPortletMode;
+ return customPortletModes;
}
- public void setCustomPortletMode(List<CustomPortletModeMetaData>
customPortletMode)
+ public void setCustomPortletModes(Map<String, CustomPortletModeMetaData>
customPortletMode)
{
- this.customPortletMode = customPortletMode;
+ this.customPortletModes = customPortletMode;
}
+
+ public void addCustomPortletMode(CustomPortletModeMetaData portletMode)
+ {
+ if ( this.customPortletModes == null)
+ {
+ this.customPortletModes = new HashMap<String,
CustomPortletModeMetaData>();
+ }
+ this.customPortletModes.put(portletMode.getPortletMode(), portletMode);
+ }
@XmlElement(name = "custom-window-state")
- public List<CustomWindowStateMetaData> getCustomWindowState()
+ @XmlJavaTypeAdapter(CustomWindowStateAdapter.class)
+ public Map<String, CustomWindowStateMetaData> getCustomWindowStates()
{
- return customWindowState;
+ return customWindowStates;
}
- public void setCustomWindowState(List<CustomWindowStateMetaData>
customWindowState)
+ public void setCustomWindowStates(Map<String, CustomWindowStateMetaData>
customWindowState)
{
- this.customWindowState = customWindowState;
+ this.customWindowStates = customWindowState;
}
+
+ public void addCustomWindowState(CustomWindowStateMetaData windowState)
+ {
+ if( this.customWindowStates == null )
+ {
+ this.customWindowStates = new HashMap<String,
CustomWindowStateMetaData>();
+ }
+ this.customWindowStates.put(windowState.getWindowState(), windowState);
+ }
@XmlElement(name = "security-constraint")
public List<SecurityConstraintMetaData> getSecurityConstraints()
@@ -190,104 +211,64 @@
{
this.securityConstraints = securityConstraints;
}
-
- @XmlElement(name = "resource-bundle", namespace =
PortletMetaDataConstants.PORTLET_JSR_286_NS)
- public String getResourceBundle()
+
+ public void addSecurityConstraint(SecurityConstraintMetaData securityConstraint)
{
- return resourceBundle;
+ if(this.securityConstraints == null)
+ {
+ this.securityConstraints = new ArrayList<SecurityConstraintMetaData>();
+ }
+ this.securityConstraints.add(securityConstraint);
}
- public void setResourceBundle(String resourceBundle)
+ public String getResourceBundle()
{
- this.resourceBundle = resourceBundle;
+ return null;
}
- @XmlElement(name = "default-namespace")
- public URI getDefaultNamespace()
+ public ContainerRuntimeMetaData getContainerRuntimeOption(String option)
{
- return defaultNamespace;
+ return null;
}
- public void setDefaultNamespace(URI defaultNamespace)
+ public Set<String> getContainerRuntimeOptionSet()
{
- this.defaultNamespace = defaultNamespace;
+ return null;
}
- @XmlElement(name = "filter", namespace =
PortletMetaDataConstants.PORTLET_JSR_286_NS)
- @XmlJavaTypeAdapter(FilterAdapter.class)
- public Map<String, FilterMetaData> getFilters()
+ public URI getDefaultNamespace()
{
- return this.filters;
+ return null;
}
- public void setFilters(Map<String, FilterMetaData> filters)
+ public List<EventDefinitionMetaData> getEvents()
{
- this.filters = filters;
+ return null;
}
- public Collection<FilterMetaData> getFilterCollection()
- {
- return this.filters != null ? this.filters.values() : null;
- }
-
public FilterMetaData getFilter(String filterName)
{
- return this.filters.get(filterName);
+ return null;
}
- @XmlElement(name = "filter-mapping")
- @XmlJavaTypeAdapter(FilterMappingAdapter.class)
- public Map<String, List<String>> getFilterMapping()
+ public Collection<FilterMetaData> getFilterCollection()
{
- return filterMapping;
+ return null;
}
- public void setFilterMapping(Map<String, List<String>> filterMapping)
+ public Map<String, FilterMappingMetaData> getFilterMapping()
{
- this.filterMapping = filterMapping;
+ return null;
}
- @XmlElement(name = "event-definition", namespace =
PortletMetaDataConstants.PORTLET_JSR_286_NS)
- public List<EventDefinitionMetaData> getEvents()
+ public List<ListenerMetaData> getListeners()
{
- return events;
+ return null;
}
- public void setEvents(List<EventDefinitionMetaData> events)
- {
- this.events = events;
- }
-
- @XmlElement(name = "public-render-parameter")
public List<PublicRenderParameterMetaData> getPublicRenderParameters()
{
- return publicRenderParameters;
+ return null;
}
- public void setPublicRenderParameters(List<PublicRenderParameterMetaData>
publicRenderParameters)
- {
- this.publicRenderParameters = publicRenderParameters;
- }
-
- @XmlElement(name = "container-runtime-option")
- @XmlJavaTypeAdapter(ContainerRuntimeAdapter.class)
- public Map<String, List<String>> getContainerRuntimeOptions()
- {
- return containerRuntimeOptions;
- }
-
- public void setContainerRuntimeOptions(Map<String, List<String>>
containerRuntimeOptions)
- {
- this.containerRuntimeOptions = containerRuntimeOptions;
- }
-
- public List<String> getContainerRuntimeOption(String option)
- {
- return this.containerRuntimeOptions.get(option);
- }
-
- public Set<String> getContainerRuntimeOptionSet()
- {
- return this.containerRuntimeOptions != null ? this.containerRuntimeOptions.keySet()
: null;
- }
}
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PortletApplication20MetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PortletApplication20MetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PortletApplication20MetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -23,7 +23,10 @@
package org.jboss.portal.portlet.test.metadata.impl;
import java.net.URI;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -37,11 +40,15 @@
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.jboss.portal.portlet.test.metadata.impl.adapter.ContainerRuntimeAdapter;
+import org.jboss.portal.portlet.test.metadata.impl.adapter.CustomPortletModeAdapter;
+import org.jboss.portal.portlet.test.metadata.impl.adapter.CustomWindowStateAdapter;
import org.jboss.portal.portlet.test.metadata.impl.adapter.FilterAdapter;
import org.jboss.portal.portlet.test.metadata.impl.adapter.FilterMappingAdapter;
import org.jboss.portal.portlet.test.metadata.impl.adapter.PortletListAdapter;
import org.jboss.portal.portlet.test.metadata.impl.adapter.UserAttributeAdapter;
+import org.jboss.portal.portlet.test.metadata.impl.common.ContainerRuntimeMetaData;
import org.jboss.portal.portlet.test.metadata.impl.event.EventDefinitionMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.filter.FilterMappingMetaData;
import org.jboss.portal.portlet.test.metadata.impl.filter.FilterMetaData;
import org.jboss.portal.portlet.test.metadata.impl.portlet.PortletMetaData;
import org.jboss.portal.portlet.test.metadata.impl.security.SecurityConstraintMetaData;
@@ -73,10 +80,10 @@
private Map<String, UserAttributeMetaData> userAttributes;
/** The custom portlet mode */
- private List<CustomPortletModeMetaData> customPortletMode;
+ private Map<String, CustomPortletModeMetaData> customPortletModes;
/** The custom window states */
- private List<CustomWindowStateMetaData> customWindowState;
+ private Map<String, CustomWindowStateMetaData> customWindowStates;
/** The security constraints */
private List<SecurityConstraintMetaData> securityConstraints;
@@ -91,16 +98,19 @@
private Map<String, FilterMetaData> filters;
/** The filter mapping (JSR 286) */
- private Map<String, List<String>> filterMapping;
+ private Map<String, FilterMappingMetaData> filterMapping;
/** The events (JSR 286) */
private List<EventDefinitionMetaData> events;
/** The public render parameters */
private List<PublicRenderParameterMetaData> publicRenderParameters;
+
+ /** The url generation listener */
+ private List<ListenerMetaData> listeners;
/** The container runtime options */
- private Map<String, List<String>> containerRuntimeOptions;
+ private Map<String, ContainerRuntimeMetaData> containerRuntimeOptions;
@XmlAttribute(name = "id")
public String getId()
@@ -146,6 +156,15 @@
{
return portlets.get(portletName);
}
+
+ public void addPortlet(PortletMetaData portlet)
+ {
+ if(this.portlets == null)
+ {
+ this.portlets = new LinkedHashMap<String, PortletMetaData>();
+ }
+ this.portlets.put(portlet.getPortletName(), portlet);
+ }
@XmlElement(name = "user-attribute")
@XmlJavaTypeAdapter(UserAttributeAdapter.class)
@@ -158,28 +177,57 @@
{
this.userAttributes = userAttributes;
}
+
+ public void addUserAttribute(UserAttributeMetaData userAttribute)
+ {
+ if( this.userAttributes == null )
+ {
+ this.userAttributes = new HashMap<String, UserAttributeMetaData>();
+ }
+ this.userAttributes.put(userAttribute.getName(), userAttribute);
+ }
@XmlElement(name = "custom-portlet-mode")
- public List<CustomPortletModeMetaData> getCustomPortletMode()
+ @XmlJavaTypeAdapter(CustomPortletModeAdapter.class)
+ public Map<String, CustomPortletModeMetaData> getCustomPortletModes()
{
- return customPortletMode;
+ return customPortletModes;
}
- public void setCustomPortletMode(List<CustomPortletModeMetaData>
customPortletMode)
+ public void setCustomPortletModes(Map<String, CustomPortletModeMetaData>
customPortletMode)
{
- this.customPortletMode = customPortletMode;
+ this.customPortletModes = customPortletMode;
}
+
+ public void addCustomPortletMode(CustomPortletModeMetaData portletMode)
+ {
+ if ( this.customPortletModes == null)
+ {
+ this.customPortletModes = new HashMap<String,
CustomPortletModeMetaData>();
+ }
+ this.customPortletModes.put(portletMode.getPortletMode(), portletMode);
+ }
@XmlElement(name = "custom-window-state")
- public List<CustomWindowStateMetaData> getCustomWindowState()
+ @XmlJavaTypeAdapter(CustomWindowStateAdapter.class)
+ public Map<String, CustomWindowStateMetaData> getCustomWindowStates()
{
- return customWindowState;
+ return customWindowStates;
}
- public void setCustomWindowState(List<CustomWindowStateMetaData>
customWindowState)
+ public void setCustomWindowStates(Map<String, CustomWindowStateMetaData>
customWindowState)
{
- this.customWindowState = customWindowState;
+ this.customWindowStates = customWindowState;
}
+
+ public void addCustomWindowState(CustomWindowStateMetaData windowState)
+ {
+ if( this.customWindowStates == null )
+ {
+ this.customWindowStates = new HashMap<String,
CustomWindowStateMetaData>();
+ }
+ this.customWindowStates.put(windowState.getWindowState(), windowState);
+ }
@XmlElement(name = "security-constraint")
public List<SecurityConstraintMetaData> getSecurityConstraints()
@@ -191,6 +239,15 @@
{
this.securityConstraints = securityConstraints;
}
+
+ public void addSecurityConstraint(SecurityConstraintMetaData securityConstraint)
+ {
+ if(this.securityConstraints == null)
+ {
+ this.securityConstraints = new ArrayList<SecurityConstraintMetaData>();
+ }
+ this.securityConstraints.add(securityConstraint);
+ }
@XmlElement(name = "resource-bundle", namespace =
PortletMetaDataConstants.PORTLET_JSR_286_NS)
public String getResourceBundle()
@@ -235,19 +292,37 @@
{
return this.filters.get(filterName);
}
+
+ public void addFilter(FilterMetaData filter)
+ {
+ if ( this.filters == null)
+ {
+ this.filters = new LinkedHashMap<String, FilterMetaData>();
+ }
+ this.filters.put(filter.getFilterName(), filter);
+ }
- @XmlElement(name = "filter-mapping")
+ @XmlElement(name = "filter-mapping", namespace =
PortletMetaDataConstants.PORTLET_JSR_286_NS)
@XmlJavaTypeAdapter(FilterMappingAdapter.class)
- public Map<String, List<String>> getFilterMapping()
+ public Map<String, FilterMappingMetaData> getFilterMapping()
{
return filterMapping;
}
- public void setFilterMapping(Map<String, List<String>> filterMapping)
+ public void setFilterMapping(Map<String, FilterMappingMetaData> filterMapping)
{
this.filterMapping = filterMapping;
}
-
+
+ public void addFilterMapping(FilterMappingMetaData filterMapping)
+ {
+ if(this.filterMapping == null)
+ {
+ this.filterMapping = new HashMap<String, FilterMappingMetaData>();
+ }
+ this.filterMapping.put(filterMapping.getName(), filterMapping);
+ }
+
@XmlElement(name = "event-definition", namespace =
PortletMetaDataConstants.PORTLET_JSR_286_NS)
public List<EventDefinitionMetaData> getEvents()
{
@@ -258,8 +333,17 @@
{
this.events = events;
}
+
+ public void addEventDefinition(EventDefinitionMetaData eventDefinition)
+ {
+ if(this.events == null)
+ {
+ this.events = new ArrayList<EventDefinitionMetaData>();
+ }
+ this.events.add(eventDefinition);
+ }
- @XmlElement(name = "public-render-parameter")
+ @XmlElement(name = "public-render-parameter", namespace =
PortletMetaDataConstants.PORTLET_JSR_286_NS)
public List<PublicRenderParameterMetaData> getPublicRenderParameters()
{
return publicRenderParameters;
@@ -269,20 +353,50 @@
{
this.publicRenderParameters = publicRenderParameters;
}
+
+ public void addPublicRenderParameter(PublicRenderParameterMetaData renderParameter)
+ {
+ if( this.publicRenderParameters == null)
+ {
+ this.publicRenderParameters = new
ArrayList<PublicRenderParameterMetaData>();
+ }
+ this.publicRenderParameters.add(renderParameter);
+ }
+
+ @XmlElement(name = "listener", namespace =
PortletMetaDataConstants.PORTLET_JSR_286_NS)
+ public List<ListenerMetaData> getListeners()
+ {
+ return listeners;
+ }
+
+ public void setListeners(List<ListenerMetaData> listeners)
+ {
+ this.listeners = listeners;
+ }
+
+ public void addListener(ListenerMetaData listener)
+ {
+ if (this.listeners == null)
+ {
+ this.listeners = new ArrayList<ListenerMetaData>();
+ }
+ this.listeners.add(listener);
+ }
- @XmlElement(name = "container-runtime-option")
+ @XmlElement(name = "container-runtime-option",
+ namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS)
@XmlJavaTypeAdapter(ContainerRuntimeAdapter.class)
- public Map<String, List<String>> getContainerRuntimeOptions()
+ public Map<String, ContainerRuntimeMetaData> getContainerRuntimeOptions()
{
return containerRuntimeOptions;
}
- public void setContainerRuntimeOptions(Map<String, List<String>>
containerRuntimeOptions)
+ public void setContainerRuntimeOptions(Map<String, ContainerRuntimeMetaData>
containerRuntimeOptions)
{
this.containerRuntimeOptions = containerRuntimeOptions;
}
- public List<String> getContainerRuntimeOption(String option)
+ public ContainerRuntimeMetaData getContainerRuntimeOption(String option)
{
return this.containerRuntimeOptions.get(option);
}
@@ -291,4 +405,13 @@
{
return this.containerRuntimeOptions != null ? this.containerRuntimeOptions.keySet()
: null;
}
+
+ public void addContainerRuntime(ContainerRuntimeMetaData option)
+ {
+ if (this.containerRuntimeOptions == null)
+ {
+ this.containerRuntimeOptions = new HashMap<String,
ContainerRuntimeMetaData>();
+ }
+ this.containerRuntimeOptions.put(option.getName(), option);
+ }
}
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PortletApplicationMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PortletApplicationMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PortletApplicationMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -28,7 +28,9 @@
import java.util.Map;
import java.util.Set;
+import org.jboss.portal.portlet.test.metadata.impl.common.ContainerRuntimeMetaData;
import org.jboss.portal.portlet.test.metadata.impl.event.EventDefinitionMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.filter.FilterMappingMetaData;
import org.jboss.portal.portlet.test.metadata.impl.filter.FilterMetaData;
import org.jboss.portal.portlet.test.metadata.impl.portlet.PortletMetaData;
import org.jboss.portal.portlet.test.metadata.impl.security.SecurityConstraintMetaData;
@@ -40,21 +42,46 @@
public interface PortletApplicationMetaData
{
public String getId();
+
+ public void setId(String id);
public String getVersion();
+
+ public void setVersion(String version);
+
+ // portlet
public Collection<PortletMetaData> getPortletCollection();
public PortletMetaData getPortlet(String portletName);
+
+ public void addPortlet(PortletMetaData portlet);
+
+ // user-attribute
public Map<String, UserAttributeMetaData> getUserAttributes();
+
+ public void addUserAttribute(UserAttributeMetaData userAttribute);
- public List<CustomPortletModeMetaData> getCustomPortletMode();
+
+ // custom-portlet-mode
+ public Map<String, CustomPortletModeMetaData> getCustomPortletModes();
+
+ public void addCustomPortletMode(CustomPortletModeMetaData portletMode);
- public List<CustomWindowStateMetaData> getCustomWindowState();
+
+ // custom-window-state
+ public Map<String, CustomWindowStateMetaData> getCustomWindowStates();
+
+ public void addCustomWindowState(CustomWindowStateMetaData windowState);
+
+ // security-constraint
public List<SecurityConstraintMetaData> getSecurityConstraints();
-
+
+ public void addSecurityConstraint(SecurityConstraintMetaData securityConstraint);
+
+
public String getResourceBundle();
public URI getDefaultNamespace();
@@ -63,15 +90,15 @@
public FilterMetaData getFilter(String filterName);
- public Map<String, List<String>> getFilterMapping();
+ public Map<String, FilterMappingMetaData> getFilterMapping();
public List<EventDefinitionMetaData> getEvents();
- public void setEvents(List<EventDefinitionMetaData> events);
-
public List<PublicRenderParameterMetaData> getPublicRenderParameters();
public Set<String> getContainerRuntimeOptionSet();
- public List<String> getContainerRuntimeOption(String option);
+ public ContainerRuntimeMetaData getContainerRuntimeOption(String option);
+
+ public List<ListenerMetaData> getListeners();
}
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PortletMetaDataConstants.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PortletMetaDataConstants.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PortletMetaDataConstants.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.portlet.test.metadata.impl;
+import static javax.xml.XMLConstants.*;
+
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
* @version $Revision$
@@ -36,7 +38,7 @@
public final static String PORTLET_JSR_286_NS =
"http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd";
/** The xml namespace */
- public final static String NS_XML_NAMESPACE =
"http://www.w3.org/XML/1998/namespace";
+ public final static String NS_XML_NAMESPACE = XML_NS_URI;
/** The default locale */
public final static String DEFAULT_LOCALE = "en";
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PublicRenderParameterMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PublicRenderParameterMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/PublicRenderParameterMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.test.metadata.impl;
+import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
@@ -29,14 +30,14 @@
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
-import org.jboss.portal.portlet.test.metadata.impl.common.DescribeableMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.common.DescribableMetaData;
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
* @version $Revision$
*/
@XmlType(name = "public-render-parameterType")
-public class PublicRenderParameterMetaData extends DescribeableMetaData
+public class PublicRenderParameterMetaData extends DescribableMetaData
{
/** The public render parameter id */
@@ -54,6 +55,13 @@
/** The public render parameter alias */
private List<QName> alias;
+ public PublicRenderParameterMetaData() {}
+
+ public PublicRenderParameterMetaData(String id)
+ {
+ this.id = id;
+ }
+
@XmlAttribute(name = "id")
public String getId()
{
@@ -108,4 +116,14 @@
{
this.alias = alias;
}
+
+ public void addAlias(QName alias)
+ {
+ if(this.alias == null)
+ {
+ this.alias = new ArrayList<QName>();
+ }
+ this.alias.add(alias);
+ }
+
}
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/UserAttributeMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/UserAttributeMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/UserAttributeMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -26,14 +26,14 @@
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
-import org.jboss.portal.portlet.test.metadata.impl.common.DescribeableMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.common.DescribableMetaData;
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
* @version $Revision$
*/
@XmlType(name = "user-attributeType")
-public class UserAttributeMetaData extends DescribeableMetaData
+public class UserAttributeMetaData extends DescribableMetaData
{
/** The id */
@@ -42,6 +42,13 @@
/** The name */
private String name;
+ public UserAttributeMetaData() {}
+
+ public UserAttributeMetaData(String id)
+ {
+ this.id = id;
+ }
+
@XmlAttribute(name = "id")
public String getId()
{
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/ContainerRuntimeAdapter.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/ContainerRuntimeAdapter.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/ContainerRuntimeAdapter.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -35,22 +35,22 @@
* @version $Revision$
*/
public class ContainerRuntimeAdapter
- extends XmlAdapter<List<ContainerRuntimeMetaData>,
java.util.Map<String, List<String>>>
+ extends XmlAdapter<List<ContainerRuntimeMetaData>,
java.util.Map<String, ContainerRuntimeMetaData>>
{
@Override
- public List<ContainerRuntimeMetaData> marshal(Map<String,
List<String>> map) throws Exception
+ public List<ContainerRuntimeMetaData> marshal(Map<String,
ContainerRuntimeMetaData> map) throws Exception
{
throw new RuntimeException("Not yet implemented.");
}
@Override
- public Map<String, List<String>>
unmarshal(List<ContainerRuntimeMetaData> list) throws Exception
+ public Map<String, ContainerRuntimeMetaData>
unmarshal(List<ContainerRuntimeMetaData> list) throws Exception
{
- Map<String, List<String>> map = new HashMap<String,
List<String>>();
+ Map<String, ContainerRuntimeMetaData> map = new HashMap<String,
ContainerRuntimeMetaData>();
for (ContainerRuntimeMetaData c : list)
{
- map.put(c.getName(), c.getValues());
+ map.put(c.getName(), c);
}
return map;
}
Added:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/CustomPortletModeAdapter.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/CustomPortletModeAdapter.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/CustomPortletModeAdapter.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * 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.portlet.test.metadata.impl.adapter;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+import org.jboss.portal.portlet.test.metadata.impl.CustomPortletModeMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class CustomPortletModeAdapter extends
XmlAdapter<List<CustomPortletModeMetaData>, Map<String,
CustomPortletModeMetaData>>
+{
+
+ @Override
+ public List<CustomPortletModeMetaData> marshal(Map<String,
CustomPortletModeMetaData> map) throws Exception
+ {
+ // FIXME marshal
+ return null;
+ }
+
+ @Override
+ public Map<String, CustomPortletModeMetaData>
unmarshal(List<CustomPortletModeMetaData> list) throws Exception
+ {
+ Map<String, CustomPortletModeMetaData> map = new LinkedHashMap<String,
CustomPortletModeMetaData>();
+ for (CustomPortletModeMetaData md : list)
+ {
+ map.put(md.getPortletMode(), md);
+ }
+ return map;
+ }
+
+}
+
Added:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/CustomWindowStateAdapter.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/CustomWindowStateAdapter.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/CustomWindowStateAdapter.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * 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.portlet.test.metadata.impl.adapter;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+import org.jboss.portal.portlet.test.metadata.impl.CustomWindowStateMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class CustomWindowStateAdapter extends
XmlAdapter<List<CustomWindowStateMetaData>, Map<String,
CustomWindowStateMetaData>>
+{
+
+ @Override
+ public List<CustomWindowStateMetaData> marshal(Map<String,
CustomWindowStateMetaData> map) throws Exception
+ {
+ // FIXME marshal
+ return null;
+ }
+
+ @Override
+ public Map<String, CustomWindowStateMetaData>
unmarshal(List<CustomWindowStateMetaData> list) throws Exception
+ {
+ Map<String, CustomWindowStateMetaData> map = new LinkedHashMap<String,
CustomWindowStateMetaData>();
+ for(CustomWindowStateMetaData md : list)
+ {
+ map.put(md.getWindowState(), md);
+ }
+ return map;
+ }
+
+}
+
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/FilterMappingAdapter.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/FilterMappingAdapter.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/FilterMappingAdapter.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -35,22 +35,22 @@
* @version $Revision$
*/
public class FilterMappingAdapter
- extends XmlAdapter<List<FilterMappingMetaData>, Map<String,
List<String>>>
+ extends XmlAdapter<List<FilterMappingMetaData>, Map<String,
FilterMappingMetaData>>
{
@Override
- public List<FilterMappingMetaData> marshal(Map<String, List<String>>
arg0) throws Exception
+ public List<FilterMappingMetaData> marshal(Map<String,
FilterMappingMetaData> arg0) throws Exception
{
throw new RuntimeException("Not yet implemented.");
}
@Override
- public Map<String, List<String>>
unmarshal(List<FilterMappingMetaData> list) throws Exception
+ public Map<String, FilterMappingMetaData>
unmarshal(List<FilterMappingMetaData> list) throws Exception
{
- Map<String, List<String>> map = new HashMap<String,
List<String>>();
+ Map<String, FilterMappingMetaData> map = new HashMap<String,
FilterMappingMetaData>();
for (FilterMappingMetaData f : list)
{
- map.put(f.getName(), f.getPortletNames());
+ map.put(f.getName(), f);
}
return map;
}
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/LocalizedStringAdapter.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/LocalizedStringAdapter.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/LocalizedStringAdapter.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -29,8 +29,9 @@
import javax.xml.bind.annotation.adapters.XmlAdapter;
+import org.jboss.portal.common.i18n.LocaleFormat;
import org.jboss.portal.common.i18n.LocalizedString;
-import org.jboss.portal.portlet.test.metadata.impl.PortletMetaDataConstants;
+import static org.jboss.portal.portlet.test.metadata.impl.PortletMetaDataConstants.*;
import org.jboss.portal.portlet.test.metadata.impl.common.LocalizedDescriptionMetaData;
/**
@@ -53,9 +54,10 @@
Map<Locale, String> map = new LinkedHashMap<Locale, String>();
for (LocalizedDescriptionMetaData d : descriptionList)
{
- map.put(new Locale(d.getLang()), d.getDescription());
+ Locale locale = LocaleFormat.DEFAULT.getLocale(d.getLang());
+ map.put(locale, d.getDescription());
}
- return new LocalizedString(map, new
Locale(PortletMetaDataConstants.DEFAULT_LOCALE));
+ return new LocalizedString(map, new Locale(DEFAULT_LOCALE));
}
}
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/UserAttributeAdapter.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/UserAttributeAdapter.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/adapter/UserAttributeAdapter.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -24,6 +24,7 @@
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.xml.bind.annotation.adapters.XmlAdapter;
@@ -35,17 +36,17 @@
*/
public class UserAttributeAdapter
- extends XmlAdapter<List<UserAttributeMetaData>, HashMap<String,
UserAttributeMetaData>>
+ extends XmlAdapter<List<UserAttributeMetaData>, Map<String,
UserAttributeMetaData>>
{
@Override
- public List<UserAttributeMetaData> marshal(HashMap<String,
UserAttributeMetaData> arg0) throws Exception
+ public List<UserAttributeMetaData> marshal(Map<String,
UserAttributeMetaData> arg0) throws Exception
{
throw new RuntimeException("Not yet implemented.");
}
@Override
- public HashMap<String, UserAttributeMetaData>
unmarshal(List<UserAttributeMetaData> list) throws Exception
+ public Map<String, UserAttributeMetaData>
unmarshal(List<UserAttributeMetaData> list) throws Exception
{
HashMap<String, UserAttributeMetaData> m = new HashMap<String,
UserAttributeMetaData>();
for (UserAttributeMetaData a : list)
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/ContainerRuntimeMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/ContainerRuntimeMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/ContainerRuntimeMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.test.metadata.impl.common;
+import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
@@ -63,4 +64,12 @@
this.values = values;
}
+ public void addValue(String value)
+ {
+ if( this.values == null)
+ {
+ this.values = new ArrayList<String>();
+ }
+ this.values.add(value);
+ }
}
Copied:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/DescribableMetaData.java
(from rev 9242,
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/DescribeableMetaData.java)
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/DescribableMetaData.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/DescribableMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * 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.portlet.test.metadata.impl.common;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.portlet.test.metadata.impl.adapter.LocalizedStringAdapter;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class DescribableMetaData
+{
+
+ /** The description */
+ private LocalizedString description;
+
+ @XmlElement(name = "description")
+ @XmlJavaTypeAdapter(value=LocalizedStringAdapter.class, type=LocalizedString.class)
+ public LocalizedString getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(LocalizedString description)
+ {
+ this.description = description;
+ }
+
+}
Deleted:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/DescribeableMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/DescribeableMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/DescribeableMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -1,53 +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.portlet.test.metadata.impl.common;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import org.jboss.portal.common.i18n.LocalizedString;
-import org.jboss.portal.portlet.test.metadata.impl.adapter.LocalizedStringAdapter;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
- * @version $Revision$
- */
-public abstract class DescribeableMetaData
-{
-
- /** The description */
- private LocalizedString description;
-
- @XmlElement(name = "description")
- @XmlJavaTypeAdapter(LocalizedStringAdapter.class)
- public LocalizedString getDescription()
- {
- return description;
- }
-
- public void setDescription(LocalizedString description)
- {
- this.description = description;
- }
-
-}
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/InitParamMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/InitParamMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/InitParamMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -33,7 +33,7 @@
* @version $Revision$
*/
@XmlType(name = "init-paramType")
-public class InitParamMetaData extends DescribeableMetaData
+public class InitParamMetaData extends DescribableMetaData
{
/** The init param id */
@@ -44,6 +44,13 @@
/** The init param value */
private String value;
+
+ public InitParamMetaData() {}
+
+ public InitParamMetaData(String id)
+ {
+ this.id = id;
+ }
@XmlAttribute
public String getId()
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/LocalizedDescriptionMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/LocalizedDescriptionMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/common/LocalizedDescriptionMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -42,6 +42,13 @@
/** The description */
private String description;
+
+ public LocalizedDescriptionMetaData() {}
+
+ public LocalizedDescriptionMetaData(String lang)
+ {
+ this.lang = lang;
+ }
@XmlAttribute(name = "lang",
namespace = PortletMetaDataConstants.NS_XML_NAMESPACE)
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/event/EventDefinitionMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/event/EventDefinitionMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/event/EventDefinitionMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -22,24 +22,24 @@
******************************************************************************/
package org.jboss.portal.portlet.test.metadata.impl.event;
+import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.namespace.QName;
-import org.jboss.portal.portlet.test.metadata.impl.common.DescribeableMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.common.DescribableMetaData;
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
* @version $Revision$
*/
@XmlType(name = "event-definitionType")
-public class EventDefinitionMetaData extends DescribeableMetaData
+public class EventDefinitionMetaData extends DescribableMetaData
{
/** The event definition id */
private String id;
@@ -55,6 +55,13 @@
/** The alias */
private List<QName> alias;
+
+ public EventDefinitionMetaData() {}
+
+ public EventDefinitionMetaData(String id)
+ {
+ this.id = id;
+ }
@XmlAttribute(name = "id")
public String getId()
@@ -111,5 +118,13 @@
{
this.alias = alias;
}
-
+
+ public void addAlias(QName alias)
+ {
+ if (this.alias == null)
+ {
+ this.alias = new ArrayList<QName>();
+ }
+ this.alias.add(alias);
+ }
}
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/event/EventDefinitionReferenceMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/event/EventDefinitionReferenceMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/event/EventDefinitionReferenceMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -24,7 +24,6 @@
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
@@ -44,6 +43,13 @@
/** The name */
private String name;
+
+ public EventDefinitionReferenceMetaData() {}
+
+ public EventDefinitionReferenceMetaData(String id)
+ {
+ this.id = id;
+ }
@XmlAttribute(name = "id")
public String getId()
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/filter/FilterMappingMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/filter/FilterMappingMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/filter/FilterMappingMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.test.metadata.impl.filter;
+import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
@@ -63,5 +64,14 @@
{
this.portletNames = portletNames;
}
+
+ public void addPortletName(String portletName)
+ {
+ if( this.portletNames == null)
+ {
+ this.portletNames = new ArrayList<String>();
+ }
+ this.portletNames.add(portletName);
+ }
}
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/filter/FilterMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/filter/FilterMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/filter/FilterMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.test.metadata.impl.filter;
+import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
@@ -32,7 +33,7 @@
import org.jboss.portal.common.i18n.LocalizedString;
import org.jboss.portal.portlet.test.metadata.impl.PortletMetaDataConstants;
import org.jboss.portal.portlet.test.metadata.impl.adapter.LocalizedStringAdapter;
-import org.jboss.portal.portlet.test.metadata.impl.common.DescribeableMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.common.DescribableMetaData;
import org.jboss.portal.portlet.test.metadata.impl.common.InitParamMetaData;
/**
@@ -42,7 +43,7 @@
@XmlType(name = "filterType", namespace =
PortletMetaDataConstants.PORTLET_JSR_286_NS,
propOrder = {"description", "displayName",
"filterName", "filterClass", "lifecycle",
"initParams"})
-public class FilterMetaData extends DescribeableMetaData
+public class FilterMetaData extends DescribableMetaData
{
/** The filter name */
private String filterName;
@@ -95,6 +96,15 @@
{
this.lifecycle = lifecycle;
}
+
+ public void addLifecycle(String lifecycle)
+ {
+ if( this.lifecycle == null)
+ {
+ this.lifecycle = new ArrayList<String>();
+ }
+ this.lifecycle.add(lifecycle);
+ }
@XmlElement(name = "display-name")
@XmlJavaTypeAdapter(LocalizedStringAdapter.class)
@@ -118,5 +128,14 @@
{
this.initParams = initParams;
}
+
+ public void addInitParam(InitParamMetaData initParam)
+ {
+ if(this.initParams == null)
+ {
+ this.initParams = new ArrayList<InitParamMetaData>();
+ }
+ this.initParams.add(initParam);
+ }
}
\ No newline at end of file
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/PortletInfoMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/PortletInfoMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/PortletInfoMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -22,13 +22,11 @@
******************************************************************************/
package org.jboss.portal.portlet.test.metadata.impl.portlet;
-import java.util.List;
-
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
* @version $Revision$
@@ -48,6 +46,13 @@
/* The portlet keywords*/
private String keywords;
+
+ public PortletInfoMetaData() {}
+
+ public PortletInfoMetaData(String id)
+ {
+ this.id = id;
+ }
@XmlAttribute(name = "id")
public String getId()
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/PortletMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/PortletMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/PortletMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -22,8 +22,9 @@
******************************************************************************/
package org.jboss.portal.portlet.test.metadata.impl.portlet;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
import javax.xml.bind.annotation.XmlAttribute;
@@ -36,7 +37,8 @@
import org.jboss.portal.portlet.test.metadata.impl.PortletMetaDataConstants;
import org.jboss.portal.portlet.test.metadata.impl.adapter.ContainerRuntimeAdapter;
import org.jboss.portal.portlet.test.metadata.impl.adapter.LocalizedStringAdapter;
-import org.jboss.portal.portlet.test.metadata.impl.common.DescribeableMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.common.ContainerRuntimeMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.common.DescribableMetaData;
import org.jboss.portal.portlet.test.metadata.impl.common.InitParamMetaData;
import
org.jboss.portal.portlet.test.metadata.impl.event.EventDefinitionReferenceMetaData;
@@ -48,8 +50,8 @@
propOrder = {"id", "description", "portletName",
"displayName", "portletClass", "initParams",
"expirationCache", "cacheScope",
"supports", "supportedLocale", "resourceBundle",
"portletInfo", "portletPreferences", "securityRoleRef",
"supportedProcessingEvent", "supportedPublishingEvent",
"supportedPublicRenderParameters",
- "urlGenerationListener", "containerRuntimeOptions"})
-public class PortletMetaData extends DescribeableMetaData
+ "containerRuntimeOptions"})
+public class PortletMetaData extends DescribableMetaData
{
/** The portlet id */
@@ -100,12 +102,16 @@
/** The portlet supported public render parameters */
private List<String> supportedPublicRenderParameters;
- /** The url generation listener */
- private List<String> urlGenerationListener;
-
/** The portlet container runtime options */
- private Map<String, List<String>> containerRuntimeOptions;
+ private Map<String, ContainerRuntimeMetaData> containerRuntimeOptions;
+ public PortletMetaData() {}
+
+ public PortletMetaData(String id)
+ {
+ this.id = id;
+ }
+
@XmlAttribute(name = "id")
public String getId()
{
@@ -165,6 +171,15 @@
{
this.initParams = initParams;
}
+
+ public void addInitParam(InitParamMetaData initParam)
+ {
+ if (this.initParams == null)
+ {
+ this.initParams = new ArrayList<InitParamMetaData>();
+ }
+ this.initParams.add(initParam);
+ }
@XmlElement(name = "expiration-cache")
public int getExpirationCache()
@@ -200,6 +215,15 @@
{
this.supports = supports;
}
+
+ public void addSupport(SupportsMetaData support)
+ {
+ if (this.supports == null)
+ {
+ this.supports = new ArrayList<SupportsMetaData>();
+ }
+ this.supports.add(support);
+ }
@XmlElement(name = "supported-locale")
// @XmlJavaTypeAdapter(SupportedLocaleAdapter.class)
@@ -212,6 +236,15 @@
{
this.supportedLocale = supportedLocale;
}
+
+ public void addSupportedLocale(SupportedLocaleMetaData supportedLocale)
+ {
+ if(this.supportedLocale == null)
+ {
+ this.supportedLocale = new ArrayList<SupportedLocaleMetaData>();
+ }
+ this.supportedLocale.add(supportedLocale);
+ }
@XmlElement(name = "resource-bundle")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@@ -257,6 +290,15 @@
{
this.securityRoleRef = securityRoleRef;
}
+
+ public void addSecurityRoleRef(SecurityRoleRefMetaData securityRoleRef)
+ {
+ if (this.securityRoleRef == null)
+ {
+ this.securityRoleRef = new ArrayList<SecurityRoleRefMetaData>();
+ }
+ this.securityRoleRef.add(securityRoleRef);
+ }
@XmlElement(name = "supported-processing-event",
namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS)
@@ -269,6 +311,15 @@
{
this.supportedProcessingEvent = supportedProcessingEvent;
}
+
+ public void addSupportedProcessingEvent(EventDefinitionReferenceMetaData eventRef)
+ {
+ if (this.supportedProcessingEvent == null)
+ {
+ this.supportedProcessingEvent = new
ArrayList<EventDefinitionReferenceMetaData>();
+ }
+ this.supportedProcessingEvent.add(eventRef);
+ }
@XmlElement(name = "supported-publishing-event",
namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS)
@@ -281,6 +332,15 @@
{
this.supportedPublishingEvent = supportedPublishingEvent;
}
+
+ public void addSupportedPublishingEvent(EventDefinitionReferenceMetaData eventRef)
+ {
+ if(this.supportedPublishingEvent == null)
+ {
+ this.supportedPublishingEvent = new
ArrayList<EventDefinitionReferenceMetaData>();
+ }
+ this.supportedPublishingEvent.add(eventRef);
+ }
@XmlElement(name = "supported-public-render-parameter",
namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS)
@@ -293,30 +353,35 @@
{
this.supportedPublicRenderParameters = supportedPublicRenderParameters;
}
-
- @XmlElement(name = "url-generation-listener",
- namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS)
-// @XmlJavaTypeAdapter(CollapsedStringListAdapter.class)
- public List<String> getUrlGenerationListener()
+
+ public void addSupportedPublicRenderParameter(String parameter)
{
- return urlGenerationListener;
+ if (this.supportedPublicRenderParameters == null)
+ {
+ this.supportedPublicRenderParameters = new ArrayList<String>();
+ }
+ this.supportedPublicRenderParameters.add(parameter);
}
- public void setUrlGenerationListener(List<String> urlGenerationListener)
- {
- this.urlGenerationListener = urlGenerationListener;
- }
-
@XmlElement(name = "container-runtime-option",
namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS)
@XmlJavaTypeAdapter(ContainerRuntimeAdapter.class)
- public Map<String, List<String>> getContainerRuntimeOptions()
+ public Map<String, ContainerRuntimeMetaData> getContainerRuntimeOptions()
{
return containerRuntimeOptions;
}
- public void setContainerRuntimeOptions(Map<String, List<String>>
containerRuntimeOptions)
+ public void setContainerRuntimeOptions(Map<String, ContainerRuntimeMetaData>
containerRuntimeOptions)
{
this.containerRuntimeOptions = containerRuntimeOptions;
}
+
+ public void addContainerRuntime(ContainerRuntimeMetaData containerRuntimeOption)
+ {
+ if ( this.containerRuntimeOptions == null)
+ {
+ this.containerRuntimeOptions = new HashMap<String,
ContainerRuntimeMetaData>();
+ }
+ this.containerRuntimeOptions.put(containerRuntimeOption.getName(),
containerRuntimeOption);
+ }
}
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/PortletPreferenceMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/PortletPreferenceMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/PortletPreferenceMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.test.metadata.impl.portlet;
+import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
@@ -47,6 +48,13 @@
/** Is read only */
private boolean readOnly;
+
+ public PortletPreferenceMetaData() {}
+
+ public PortletPreferenceMetaData(String id)
+ {
+ this.id = id;
+ }
@XmlAttribute(name = "id")
public String getId()
@@ -80,6 +88,15 @@
{
this.value = value;
}
+
+ public void addValue(String value)
+ {
+ if (this.value == null)
+ {
+ this.value = new ArrayList<String>();
+ }
+ this.value.add(value);
+ }
@XmlElement(name = "read-only")
public boolean isReadOnly()
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/PortletPreferencesMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/PortletPreferencesMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/PortletPreferencesMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.test.metadata.impl.portlet;
+import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAttribute;
@@ -49,6 +50,13 @@
/** The portlet preference validator */
private String preferenceValidator;
+ public PortletPreferencesMetaData() {}
+
+ public PortletPreferencesMetaData(String id)
+ {
+ this.id = id;
+ }
+
@XmlAttribute(name = "id")
public String getId()
{
@@ -71,6 +79,15 @@
{
this.portletPreferences = portletPreferences;
}
+
+ public void addPortletPreference(PortletPreferenceMetaData preference)
+ {
+ if(this.portletPreferences == null)
+ {
+ this.portletPreferences = new HashMap<String,
PortletPreferenceMetaData>();
+ }
+ this.portletPreferences.put(preference.getName(), preference);
+ }
@XmlElement(name = "preferences-validator")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/SecurityRoleRefMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/SecurityRoleRefMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/SecurityRoleRefMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -26,7 +26,7 @@
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
-import org.jboss.portal.portlet.test.metadata.impl.common.DescribeableMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.common.DescribableMetaData;
/**
@@ -35,7 +35,7 @@
*/
@XmlType(name = "security-role-refType")
-public class SecurityRoleRefMetaData extends DescribeableMetaData
+public class SecurityRoleRefMetaData extends DescribableMetaData
{
/** The security role ref id */
@@ -47,6 +47,13 @@
/** The role link */
private String roleLink;
+ public SecurityRoleRefMetaData() {}
+
+ public SecurityRoleRefMetaData(String id)
+ {
+ this.id = id;
+ }
+
@XmlAttribute(name = "id")
public String getId()
{
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/SupportsMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/SupportsMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/portlet/SupportsMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.portlet.test.metadata.impl.portlet;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
@@ -50,6 +52,13 @@
/** The window states */
private List<WindowStateMetaData> windowStates;
+
+ public SupportsMetaData() {}
+
+ public SupportsMetaData(String id)
+ {
+ this.id = id;
+ }
@XmlAttribute(name = "id")
public String getId()
@@ -76,19 +85,28 @@
@XmlElement(name = "portlet-mode")
public List<PortletModeMetaData> getPortletModes()
{
- return portletModes;
+ return this.portletModes;
}
public void setPortletModes(List<PortletModeMetaData> portletModes)
{
this.portletModes = portletModes;
}
+
+ public void addPortletMode(PortletModeMetaData portletMode)
+ {
+ if (this.portletModes == null)
+ {
+ this.portletModes = new ArrayList<PortletModeMetaData>();
+ }
+ this.portletModes.add(portletMode);
+ }
@XmlElement(name = "window-state",
namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS)
public List<WindowStateMetaData> getWindowStates()
{
- return windowStates;
+ return this.windowStates;
}
public void setWindowStates(List<WindowStateMetaData> windowStates)
@@ -96,4 +114,12 @@
this.windowStates = windowStates;
}
+ public void addWindowState(WindowStateMetaData windowState)
+ {
+ if (this.windowStates == null)
+ {
+ this.windowStates = new ArrayList<WindowStateMetaData>();
+ }
+ this.windowStates.add(windowState);
+ }
}
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/security/PortletCollectionMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/security/PortletCollectionMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/security/PortletCollectionMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.test.metadata.impl.security;
+import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
@@ -47,4 +48,13 @@
{
this.portletNames = portletNames;
}
+
+ public void addPortletname(String portletName)
+ {
+ if( this.portletNames == null )
+ {
+ this.portletNames = new ArrayList<String>();
+ }
+ this.portletNames.add(portletName);
+ }
}
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/security/SecurityConstraintMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/security/SecurityConstraintMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/security/SecurityConstraintMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.test.metadata.impl.security;
-import java.util.List;
-
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@@ -51,6 +49,13 @@
/** The user data constraints */
private UserDataConstraintMetaData userDataConstraint;
+
+ public SecurityConstraintMetaData() {}
+
+ public SecurityConstraintMetaData(String id)
+ {
+ this.id = id;
+ }
@XmlAttribute(name = "id")
public String getId()
@@ -76,7 +81,6 @@
}
@XmlElement(name = "portlet-collection")
-// @XmlJavaTypeAdapter(PortletCollectionAdapter.class)
public PortletCollectionMetaData getPortletList()
{
return portletList;
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/security/UserDataConstraintMetaData.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/security/UserDataConstraintMetaData.java 2007-12-13
23:18:58 UTC (rev 9342)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/metadata/impl/security/UserDataConstraintMetaData.java 2007-12-14
13:51:58 UTC (rev 9343)
@@ -26,14 +26,14 @@
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
-import org.jboss.portal.portlet.test.metadata.impl.common.DescribeableMetaData;
+import org.jboss.portal.portlet.test.metadata.impl.common.DescribableMetaData;
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
* @version $Revision$
*/
@XmlType(name = "user-data-constraint")
-public class UserDataConstraintMetaData extends DescribeableMetaData
+public class UserDataConstraintMetaData extends DescribableMetaData
{
/** The user data constraint id */
@@ -41,6 +41,13 @@
/** The user transport quarantee */
private TransportGuaranteeEnum transportQuarantee;
+
+ public UserDataConstraintMetaData() {}
+
+ public UserDataConstraintMetaData(String id)
+ {
+ this.id = id;
+ }
@XmlAttribute(name = "id")
public String getId()