From portal-commits at lists.jboss.org Wed Mar 21 15:00:51 2007 Content-Type: multipart/mixed; boundary="===============8110709234709992387==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r6792 - in trunk: core/src/main/org/jboss/portlet and 3 other directories. Date: Wed, 21 Mar 2007 15:00:51 -0400 Message-ID: --===============8110709234709992387== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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.ja= va Removed: trunk/core/src/main/org/jboss/portal/core/servlet/jsp/ContentTypeRegistr= ation.java Modified: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContent= DrivenPortlet.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/ContentTypeR= egistration.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/servlet/jsp/ContentTypeRegist= ration.java 2007-03-21 18:56:43 UTC (rev 6791) +++ trunk/core/src/main/org/jboss/portal/core/servlet/jsp/ContentTypeRegist= ration.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 li= stener can be used - * in war files to register content driven portlet. - * - * @author Julien Viet - * @version $Revision: 1.1 $ - */ -public class ContentTypeRegistration implements ServletContextListener -{ - - /** . */ - private static final Logger log =3D Logger.getLogger(ContentTypeRegistr= ation.class); - - /** . */ - private ContentType contentType; - - public void contextInitialized(ServletContextEvent event) - { - ServletContext ctx =3D event.getServletContext(); - - // - String tmp =3D ctx.getInitParameter("org.jboss.portal.content_type"); - if (tmp =3D=3D null) - { - log.warn("The content type of the content registration is not def= ined, please define the init parameter org.jboss.portal.content_type in web= .xml"); - return; - } - contentType =3D ContentType.create(tmp); - - // - String portletInstance =3D event.getServletContext().getInitParamete= r("org.jboss.portal.portlet_instance"); - if (portletInstance =3D=3D null) - { - log.warn("The portlet instance of the content registration is not= defined, please define the init parameter org.jboss.portal.portlet_instanc= e in web.xml"); - return; - } - - // - log.debug("About to register content type "+ contentType + " with po= rtlet instance " + portletInstance); - ContentEditorRegistry registry =3D ContentEditorRegistry.getInstance= (); - registry.registerEditor(contentType, portletInstance); - log.debug("Registered content type "+ contentType + " with portlet i= nstance " + portletInstance); - } - - public void contextDestroyed(ServletContextEvent event) - { - if (contentType !=3D null) - { - log.debug("About to unregister content type "+ contentType); - ContentEditorRegistry registry =3D ContentEditorRegistry.getInsta= nce(); - registry.unregisterEditor(contentType); - log.debug("Content type "+ contentType + " has been unregistered"= ); - } - } -} Copied: trunk/core/src/main/org/jboss/portlet/content/ContentTypeRegistrati= on.java (from rev 6780, trunk/core/src/main/org/jboss/portal/core/servlet/j= sp/ContentTypeRegistration.java) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portlet/content/ContentTypeRegistration.j= ava (rev 0) +++ trunk/core/src/main/org/jboss/portlet/content/ContentTypeRegistration.j= ava 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 li= stener can be used + * in war files to register content driven portlet. + * + * @author Julien Viet + * @version $Revision: 1.1 $ + */ +public class ContentTypeRegistration implements ServletContextListener +{ + + /** . */ + private static final Logger log =3D Logger.getLogger(ContentTypeRegistr= ation.class); + + /** . */ + private ContentType contentType; + + public void contextInitialized(ServletContextEvent event) + { + ServletContext ctx =3D event.getServletContext(); + + // + String tmp =3D ctx.getInitParameter("org.jboss.portal.content_type"); + if (tmp =3D=3D null) + { + log.warn("The content type of the content registration is not def= ined, please define the init parameter org.jboss.portal.content_type in web= .xml"); + return; + } + contentType =3D ContentType.create(tmp); + + // + String portletInstance =3D event.getServletContext().getInitParamete= r("org.jboss.portal.portlet_instance"); + if (portletInstance =3D=3D null) + { + log.warn("The portlet instance of the content registration is not= defined, please define the init parameter org.jboss.portal.portlet_instanc= e in web.xml"); + return; + } + + // + log.debug("About to register content type "+ contentType + " with po= rtlet instance " + portletInstance); + ContentEditorRegistry registry =3D ContentEditorRegistry.getInstance= (); + registry.registerEditor(contentType, portletInstance); + log.debug("Registered content type "+ contentType + " with portlet i= nstance " + portletInstance); + } + + public void contextDestroyed(ServletContextEvent event) + { + if (contentType !=3D null) + { + log.debug("About to unregister content type "+ contentType); + ContentEditorRegistry registry =3D ContentEditorRegistry.getInsta= nce(); + registry.unregisterEditor(contentType); + log.debug("Content type "+ contentType + " has been unregistered"= ); + } + } +} Modified: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FS= ContentDrivenPortlet.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSConten= tDrivenPortlet.java 2007-03-21 18:56:43 UTC (rev 6791) +++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSConten= tDrivenPortlet.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 =3D new FileFilter() + private final FileFilter filter =3D new FileFilter() { public boolean accept(File file) { Modified: trunk/core-samples/src/resources/portal-samples-war/WEB-INF/web.x= ml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core-samples/src/resources/portal-samples-war/WEB-INF/web.xml 200= 7-03-21 18:56:43 UTC (rev 6791) +++ trunk/core-samples/src/resources/portal-samples-war/WEB-INF/web.xml 200= 7-03-21 19:00:50 UTC (rev 6792) @@ -38,6 +38,6 @@ FSContentDrivenPortletInstance - org.jboss.portal.core.servlet.jsp.ContentTypeRegistr= ation + org.jboss.portlet.content.ContentTypeRegistration --===============8110709234709992387==--