Author: julien(a)jboss.com
Date: 2007-03-21 15:00:50 -0400 (Wed, 21 Mar 2007)
New Revision: 6792
Added:
trunk/core/src/main/org/jboss/portlet/content/
trunk/core/src/main/org/jboss/portlet/content/ContentTypeRegistration.java
Removed:
trunk/core/src/main/org/jboss/portal/core/servlet/jsp/ContentTypeRegistration.java
Modified:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java
trunk/core-samples/src/resources/portal-samples-war/WEB-INF/web.xml
Log:
moved the content type registration to a better package, not core
Deleted:
trunk/core/src/main/org/jboss/portal/core/servlet/jsp/ContentTypeRegistration.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/servlet/jsp/ContentTypeRegistration.java 2007-03-21
18:56:43 UTC (rev 6791)
+++
trunk/core/src/main/org/jboss/portal/core/servlet/jsp/ContentTypeRegistration.java 2007-03-21
19:00:50 UTC (rev 6792)
@@ -1,87 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.servlet.jsp;
-
-import org.jboss.portal.core.impl.model.content.ContentEditorRegistry;
-import org.jboss.portal.core.model.content.ContentType;
-import org.apache.log4j.Logger;
-
-import javax.servlet.ServletContextListener;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContext;
-
-/**
- * Provide registration of a content type with a portlet instance. This listener can be
used
- * in war files to register content driven portlet.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class ContentTypeRegistration implements ServletContextListener
-{
-
- /** . */
- private static final Logger log = Logger.getLogger(ContentTypeRegistration.class);
-
- /** . */
- private ContentType contentType;
-
- public void contextInitialized(ServletContextEvent event)
- {
- ServletContext ctx = event.getServletContext();
-
- //
- String tmp = ctx.getInitParameter("org.jboss.portal.content_type");
- if (tmp == null)
- {
- log.warn("The content type of the content registration is not defined,
please define the init parameter org.jboss.portal.content_type in web.xml");
- return;
- }
- contentType = ContentType.create(tmp);
-
- //
- String portletInstance =
event.getServletContext().getInitParameter("org.jboss.portal.portlet_instance");
- if (portletInstance == null)
- {
- log.warn("The portlet instance of the content registration is not defined,
please define the init parameter org.jboss.portal.portlet_instance in web.xml");
- return;
- }
-
- //
- log.debug("About to register content type "+ contentType + " with
portlet instance " + portletInstance);
- ContentEditorRegistry registry = ContentEditorRegistry.getInstance();
- registry.registerEditor(contentType, portletInstance);
- log.debug("Registered content type "+ contentType + " with portlet
instance " + portletInstance);
- }
-
- public void contextDestroyed(ServletContextEvent event)
- {
- if (contentType != null)
- {
- log.debug("About to unregister content type "+ contentType);
- ContentEditorRegistry registry = ContentEditorRegistry.getInstance();
- registry.unregisterEditor(contentType);
- log.debug("Content type "+ contentType + " has been
unregistered");
- }
- }
-}
Copied: trunk/core/src/main/org/jboss/portlet/content/ContentTypeRegistration.java (from
rev 6780,
trunk/core/src/main/org/jboss/portal/core/servlet/jsp/ContentTypeRegistration.java)
===================================================================
--- trunk/core/src/main/org/jboss/portlet/content/ContentTypeRegistration.java
(rev 0)
+++ trunk/core/src/main/org/jboss/portlet/content/ContentTypeRegistration.java 2007-03-21
19:00:50 UTC (rev 6792)
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portlet.content;
+
+import org.jboss.portal.core.impl.model.content.ContentEditorRegistry;
+import org.jboss.portal.core.model.content.ContentType;
+import org.apache.log4j.Logger;
+
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContext;
+
+/**
+ * Provide registration of a content type with a portlet instance. This listener can be
used
+ * in war files to register content driven portlet.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ContentTypeRegistration implements ServletContextListener
+{
+
+ /** . */
+ private static final Logger log = Logger.getLogger(ContentTypeRegistration.class);
+
+ /** . */
+ private ContentType contentType;
+
+ public void contextInitialized(ServletContextEvent event)
+ {
+ ServletContext ctx = event.getServletContext();
+
+ //
+ String tmp = ctx.getInitParameter("org.jboss.portal.content_type");
+ if (tmp == null)
+ {
+ log.warn("The content type of the content registration is not defined,
please define the init parameter org.jboss.portal.content_type in web.xml");
+ return;
+ }
+ contentType = ContentType.create(tmp);
+
+ //
+ String portletInstance =
event.getServletContext().getInitParameter("org.jboss.portal.portlet_instance");
+ if (portletInstance == null)
+ {
+ log.warn("The portlet instance of the content registration is not defined,
please define the init parameter org.jboss.portal.portlet_instance in web.xml");
+ return;
+ }
+
+ //
+ log.debug("About to register content type "+ contentType + " with
portlet instance " + portletInstance);
+ ContentEditorRegistry registry = ContentEditorRegistry.getInstance();
+ registry.registerEditor(contentType, portletInstance);
+ log.debug("Registered content type "+ contentType + " with portlet
instance " + portletInstance);
+ }
+
+ public void contextDestroyed(ServletContextEvent event)
+ {
+ if (contentType != null)
+ {
+ log.debug("About to unregister content type "+ contentType);
+ ContentEditorRegistry registry = ContentEditorRegistry.getInstance();
+ registry.unregisterEditor(contentType);
+ log.debug("Content type "+ contentType + " has been
unregistered");
+ }
+ }
+}
Modified:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java 2007-03-21
18:56:43 UTC (rev 6791)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java 2007-03-21
19:00:50 UTC (rev 6792)
@@ -252,7 +252,7 @@
/**
* Avoid the WEB-INF directory and list only text files.
*/
- private FileFilter filter = new FileFilter()
+ private final FileFilter filter = new FileFilter()
{
public boolean accept(File file)
{
Modified: trunk/core-samples/src/resources/portal-samples-war/WEB-INF/web.xml
===================================================================
--- trunk/core-samples/src/resources/portal-samples-war/WEB-INF/web.xml 2007-03-21
18:56:43 UTC (rev 6791)
+++ trunk/core-samples/src/resources/portal-samples-war/WEB-INF/web.xml 2007-03-21
19:00:50 UTC (rev 6792)
@@ -38,6 +38,6 @@
<param-value>FSContentDrivenPortletInstance</param-value>
</context-param>
<listener>
-
<listener-class>org.jboss.portal.core.servlet.jsp.ContentTypeRegistration</listener-class>
+
<listener-class>org.jboss.portlet.content.ContentTypeRegistration</listener-class>
</listener>
</web-app>