Author: julien(a)jboss.com
Date: 2007-02-13 19:01:21 -0500 (Tue, 13 Feb 2007)
New Revision: 6259
Added:
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContent.java
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentEditor.java
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentHandler.java
Removed:
trunk/core-cms/src/main/org/jboss/portal/core/cms/editor/CMSContentEditor.java
trunk/core/src/main/org/jboss/portal/core/impl/model/content/cms/
Modified:
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentRenderer.java
trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
Log:
moved cms content handler to the core-cms integration package
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-02-13
23:59:09 UTC (rev 6258)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-02-14
00:01:21 UTC (rev 6259)
@@ -561,17 +561,6 @@
proxy-type="attribute">portal:container=Instance</depends>
<attribute name="ContentType">portlet</attribute>
</mbean>
- <mbean
- code="org.jboss.portal.core.impl.model.content.cms.CMSContentHandler"
- name="portal:service=ContentHandler,type=cms"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <depends
- optional-attribute-name="Registry"
-
proxy-type="attribute">portal:container=PortalObject</depends>
- <attribute name="ContentType">cms</attribute>
- </mbean>
<!-- Customization manager -->
<mbean
Added: trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContent.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContent.java
(rev 0)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContent.java 2007-02-14
00:01:21 UTC (rev 6259)
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * 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.cms.content;
+
+import org.jboss.portal.core.model.content.Content;
+import org.jboss.portal.core.model.content.spi.ContentState;
+import org.jboss.portal.common.util.LocalizedString;
+
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CMSContent implements Content
+{
+
+ /** . */
+ private final ContentState state;
+
+ public CMSContent(ContentState state)
+ {
+ this.state = state;
+ }
+
+ public LocalizedString getDisplayName()
+ {
+ return new LocalizedString(state.getURI() + " cms", Locale.ENGLISH);
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getURI()
+ {
+ return state.getURI();
+ }
+
+ /**
+ *
+ * @param uri
+ */
+ public void setURI(String uri)
+ {
+ state.setURI(uri);
+ }
+}
Copied: trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentEditor.java
(from rev 6247,
trunk/core-cms/src/main/org/jboss/portal/core/cms/editor/CMSContentEditor.java)
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentEditor.java
(rev 0)
+++
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentEditor.java 2007-02-14
00:01:21 UTC (rev 6259)
@@ -0,0 +1,94 @@
+/******************************************************************************
+ * 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.cms.content;
+
+import org.jboss.portal.core.portlet.dashboard.AddWindowContext;
+import org.jboss.portal.core.portlet.dashboard.AbstractContentEditor;
+import org.jboss.portal.core.cms.content.CMSContent;
+import org.jboss.portal.core.model.content.ContentType;
+import org.jboss.portal.cms.CMS;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.cms.model.Folder;
+
+import javax.portlet.RenderRequest;
+import javax.portlet.ActionRequest;
+import java.io.PrintWriter;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CMSContentEditor extends AbstractContentEditor
+{
+
+ /** . */
+ private CMS cms;
+
+ public CMS getCMS()
+ {
+ return cms;
+ }
+
+ public void setCMS(CMS cms)
+ {
+ this.cms = cms;
+ }
+
+ public void show(RenderRequest req, PrintWriter writer)
+ {
+ Command listCMD =
cms.getCommandFactory().createFolderGetListCommand("/default");
+ Folder folder = (Folder)cms.execute(listCMD);
+ List list = folder.getFiles();
+ writer.println("<select name=\"available_instances\"
multiple=\"true\" size=\"20\">\n");
+ for (int i = 0; i < list.size(); i++)
+ {
+ File file = (File)list.get(i);
+ writer.print("<option value=\"");
+ writer.print(file.getBasePath());
+ writer.print("\">");
+ writer.print(file.getName());
+ writer.println("</option>\n");
+ }
+ writer.println("</select>");
+ }
+
+ public void add(ActionRequest req, AddWindowContext ctx)
+ {
+ String[] files = req.getParameterValues("available_instances");
+ try
+ {
+ for (int i = 0; i < files.length; i++)
+ {
+ String file = files[i];
+ CMSContent content = (CMSContent)ctx.createWindow(ContentType.CMS, file);
+
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("Error adding window to region", e);
+ }
+ }
+}
Added: trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentHandler.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentHandler.java
(rev 0)
+++
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentHandler.java 2007-02-14
00:01:21 UTC (rev 6259)
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * 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.cms.content;
+
+import org.jboss.portal.core.model.content.spi.ContentHandler;
+import org.jboss.portal.core.model.content.spi.ContentState;
+import org.jboss.portal.core.impl.model.content.AbstractContentHandler;
+import org.jboss.portal.core.model.content.Content;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CMSContentHandler extends AbstractContentHandler implements ContentHandler
+{
+ public Content newContent(String contextId, ContentState state)
+ {
+ return new CMSContent(state);
+ }
+}
Modified:
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentRenderer.java
===================================================================
---
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentRenderer.java 2007-02-13
23:59:09 UTC (rev 6258)
+++
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentRenderer.java 2007-02-14
00:01:21 UTC (rev 6259)
@@ -23,7 +23,6 @@
package org.jboss.portal.core.cms.content;
import org.jboss.portal.core.impl.model.portal.content.PortletContentRenderer;
-import org.jboss.portal.core.impl.model.content.cms.CMSContent;
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.InstanceContainer;
import org.jboss.portal.core.model.portal.Window;
Deleted: trunk/core-cms/src/main/org/jboss/portal/core/cms/editor/CMSContentEditor.java
===================================================================
---
trunk/core-cms/src/main/org/jboss/portal/core/cms/editor/CMSContentEditor.java 2007-02-13
23:59:09 UTC (rev 6258)
+++
trunk/core-cms/src/main/org/jboss/portal/core/cms/editor/CMSContentEditor.java 2007-02-14
00:01:21 UTC (rev 6259)
@@ -1,94 +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.cms.editor;
-
-import org.jboss.portal.core.portlet.dashboard.AddWindowContext;
-import org.jboss.portal.core.portlet.dashboard.AbstractContentEditor;
-import org.jboss.portal.core.impl.model.content.cms.CMSContent;
-import org.jboss.portal.core.model.content.ContentType;
-import org.jboss.portal.cms.CMS;
-import org.jboss.portal.cms.Command;
-import org.jboss.portal.cms.model.File;
-import org.jboss.portal.cms.model.Folder;
-
-import javax.portlet.RenderRequest;
-import javax.portlet.ActionRequest;
-import java.io.PrintWriter;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class CMSContentEditor extends AbstractContentEditor
-{
-
- /** . */
- private CMS cms;
-
- public CMS getCMS()
- {
- return cms;
- }
-
- public void setCMS(CMS cms)
- {
- this.cms = cms;
- }
-
- public void show(RenderRequest req, PrintWriter writer)
- {
- Command listCMD =
cms.getCommandFactory().createFolderGetListCommand("/default");
- Folder folder = (Folder)cms.execute(listCMD);
- List list = folder.getFiles();
- writer.println("<select name=\"available_instances\"
multiple=\"true\" size=\"20\">\n");
- for (int i = 0; i < list.size(); i++)
- {
- File file = (File)list.get(i);
- writer.print("<option value=\"");
- writer.print(file.getBasePath());
- writer.print("\">");
- writer.print(file.getName());
- writer.println("</option>\n");
- }
- writer.println("</select>");
- }
-
- public void add(ActionRequest req, AddWindowContext ctx)
- {
- String[] files = req.getParameterValues("available_instances");
- try
- {
- for (int i = 0; i < files.length; i++)
- {
- String file = files[i];
- CMSContent content = (CMSContent)ctx.createWindow(ContentType.CMS, file);
-
- }
- }
- catch (Exception e)
- {
- log.error("Error adding window to region", e);
- }
- }
-}
Modified: trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-02-13
23:59:09 UTC (rev 6258)
+++ trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-02-14
00:01:21 UTC (rev 6259)
@@ -672,7 +672,7 @@
<!-- Content editor integration -->
<mbean
- code="org.jboss.portal.core.cms.editor.CMSContentEditor"
+ code="org.jboss.portal.core.cms.content.CMSContentEditor"
name="portal:service=ContentEditor,type=cms"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
@@ -698,4 +698,17 @@
optional-attribute-name="Registry"
proxy-type="attribute">portal:service=ContentRendererRegistry</depends>
</mbean>
+
+ <!-- Content handler integration -->
+ <mbean
+ code="org.jboss.portal.core.cms.content.CMSContentHandler"
+ name="portal:service=ContentHandler,type=cms"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends
+ optional-attribute-name="Registry"
+
proxy-type="attribute">portal:container=PortalObject</depends>
+ <attribute name="ContentType">cms</attribute>
+ </mbean>
</server>