Author: julien(a)jboss.com
Date: 2008-06-09 06:27:59 -0400 (Mon, 09 Jun 2008)
New Revision: 10957
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/ModelImporter.java
Modified:
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
Log:
rename StructuralContextImporter to ModelImporter
Modified:
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
===================================================================
---
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-06-09
10:25:23 UTC (rev 10956)
+++
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-06-09
10:27:59 UTC (rev 10957)
@@ -148,7 +148,7 @@
</constructor>
</bean>
- <bean name="StructuralStateContextImporter"
class="org.jboss.portal.presentation.portal.servlet.StructuralStateContextImporter">
+ <bean name="StructuralStateContextImporter"
class="org.jboss.portal.presentation.portal.servlet.ModelImporter">
<property name="servletContext"><inject
bean="ServletContext"/></property>
<property name="portalNodeManager"><inject
bean="PortalNodeManager"/></property>
<property name="layoutStore"><inject
bean="LayoutStore"/></property>
Copied:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/ModelImporter.java
(from rev 10942,
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java)
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/ModelImporter.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/ModelImporter.java 2008-06-09
10:27:59 UTC (rev 10957)
@@ -0,0 +1,95 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.presentation.portal.servlet;
+
+import org.jboss.portal.presentation.portal.model.object.PortalNodeManager;
+import org.jboss.portal.presentation.portal.model.ModelImporter;
+import org.jboss.portal.presentation.portal.model.object.ContextNode;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
+import org.jboss.portal.common.io.IOTools;
+
+import javax.servlet.ServletContext;
+import java.io.InputStream;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ModelImporter
+{
+
+ /** . */
+ private ServletContext servletContext;
+
+ /** . */
+ private PortalNodeManager portalNodeManager;
+
+ /** . */
+ private LayoutStore layoutStore;
+
+ public ServletContext getServletContext()
+ {
+ return servletContext;
+ }
+
+ public void setServletContext(ServletContext servletContext)
+ {
+ this.servletContext = servletContext;
+ }
+
+ public PortalNodeManager getPortalNodeManager()
+ {
+ return portalNodeManager;
+ }
+
+ public void setPortalNodeManager(PortalNodeManager portalNodeManager)
+ {
+ this.portalNodeManager = portalNodeManager;
+ }
+
+ public LayoutStore getLayoutStore()
+ {
+ return layoutStore;
+ }
+
+ public void setLayoutStore(LayoutStore layoutStore)
+ {
+ this.layoutStore = layoutStore;
+ }
+
+ public void start() throws Exception
+ {
+ InputStream in =
servletContext.getResourceAsStream("/WEB-INF/page-structure.xml");
+
+ //
+ try
+ {
+ ContextNode root = portalNodeManager.getRoot();
+ new org.jboss.portal.presentation.portal.model.ModelImporter(root,
layoutStore).importDocument(in);
+ }
+ finally
+ {
+ IOTools.safeClose(in);
+ }
+ }
+}