Author: chris.laprun(a)jboss.com
Date: 2010-06-18 08:57:00 -0400 (Fri, 18 Jun 2010)
New Revision: 3382
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/info/ContainerEventInfo.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/info/ContainerInfoBuilder.java
Log:
- GTNPC-21: Properly pass aliases to ContainerEventInfo upon construction.
- Also return an immutable collection on getAliases so that it cannot be modified by
clients.
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/info/ContainerEventInfo.java
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/info/ContainerEventInfo.java 2010-06-18
09:37:58 UTC (rev 3381)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/info/ContainerEventInfo.java 2010-06-18
12:57:00 UTC (rev 3382)
@@ -1,34 +1,36 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.pc.portlet.impl.info;
+import org.gatein.common.i18n.LocalizedString;
+import org.gatein.common.util.ParameterValidation;
import org.gatein.pc.api.info.EventInfo;
-import org.gatein.common.i18n.LocalizedString;
import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.List;
-import java.util.Collection;
-import java.util.ArrayList;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -56,20 +58,22 @@
QName name,
ContainerTypeInfo type,
LocalizedString displayName,
- LocalizedString description)
+ LocalizedString description, List<QName> aliases)
{
this.name = name;
this.type = type;
this.displayName = displayName;
this.description = description;
- this.aliases = new ArrayList<QName>();
+ if (ParameterValidation.existsAndIsNotEmpty(aliases))
+ {
+ this.aliases = aliases;
+ }
+ else
+ {
+ this.aliases = new ArrayList<QName>();
+ }
}
- public void addAlias(QName alias)
- {
- aliases.add(alias);
- }
-
public LocalizedString getDisplayName()
{
return displayName;
@@ -92,6 +96,6 @@
public Collection<QName> getAliases()
{
- return aliases;
+ return Collections.unmodifiableCollection(aliases);
}
}
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/info/ContainerInfoBuilder.java
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/info/ContainerInfoBuilder.java 2010-06-18
09:37:58 UTC (rev 3381)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/info/ContainerInfoBuilder.java 2010-06-18
12:57:00 UTC (rev 3382)
@@ -1,37 +1,39 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.pc.portlet.impl.info;
-import org.gatein.common.logging.Logger;
-import org.gatein.common.logging.LoggerFactory;
-import org.gatein.pc.api.Mode;
-import org.gatein.pc.api.WindowState;
import org.gatein.common.i18n.LocaleFormat;
import org.gatein.common.i18n.LocalizedString;
import org.gatein.common.i18n.ResourceBundleManager;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import org.gatein.common.reflect.NoSuchClassException;
import org.gatein.common.util.ConversionException;
import org.gatein.pc.api.LifeCyclePhase;
+import org.gatein.pc.api.Mode;
+import org.gatein.pc.api.WindowState;
+import org.gatein.pc.api.info.MetaInfo;
+import org.gatein.pc.api.info.RuntimeOptionInfo;
import org.gatein.pc.portlet.impl.metadata.CustomPortletModeMetaData;
import org.gatein.pc.portlet.impl.metadata.CustomWindowStateMetaData;
import org.gatein.pc.portlet.impl.metadata.ListenerMetaData;
@@ -55,8 +57,6 @@
import org.gatein.pc.portlet.impl.metadata.portlet.SupportsMetaData;
import org.gatein.pc.portlet.impl.metadata.portlet.WindowStateMetaData;
import org.gatein.pc.portlet.impl.metadata.security.SecurityConstraintMetaData;
-import org.gatein.pc.api.info.MetaInfo;
-import org.gatein.pc.api.info.RuntimeOptionInfo;
import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
@@ -602,7 +602,7 @@
getDefaultStringFor(eventDefinitionMD.getDescription(), "Description of
event " + name));
//
- return new ContainerEventInfo(name, type, displayName, description);
+ return new ContainerEventInfo(name, type, displayName, description,
eventDefinitionMD.getAlias());
}
private ContainerPortletInfo build(PortletMetaData portletMD)