Author: nscavell
Date: 2011-09-13 01:13:55 -0400 (Tue, 13 Sep 2011)
New Revision: 7367
Added:
portal/trunk/gadgets/gwtGadgets/
portal/trunk/gadgets/gwtGadgets/mvn-dependencies/
portal/trunk/gadgets/gwtGadgets/mvn-dependencies/gwt-gadgets-1.2.0.jar
portal/trunk/gadgets/gwtGadgets/pom.xml
portal/trunk/gadgets/gwtGadgets/src/
portal/trunk/gadgets/gwtGadgets/src/main/
portal/trunk/gadgets/gwtGadgets/src/main/java/
portal/trunk/gadgets/gwtGadgets/src/main/java/org/
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/ExportImport.gwt.xml
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/Application.java
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/DisplayableException.java
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/GTNMultiUploader.java
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/GateInService.java
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/GateInServiceAsync.java
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/PendingItem.java
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/ServletPath.java
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/TreeImages.java
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/TreeNode.java
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/Application.css
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/blank.png
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/cogwheel.png
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/error-icon.png
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/home-icon.jpg
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/loading.gif
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/success-icon.png
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/warning-icon.png
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/ContainerCallback.java
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/ContainerRequestHandler.java
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/FileDownloadServlet.java
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/FileUploadServlet.java
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/GateInServiceImpl.java
portal/trunk/gadgets/gwtGadgets/src/main/webapp/
portal/trunk/gadgets/gwtGadgets/src/main/webapp/ExportImport.html
portal/trunk/gadgets/gwtGadgets/src/main/webapp/WEB-INF/
portal/trunk/gadgets/gwtGadgets/src/main/webapp/WEB-INF/gadget.xml
portal/trunk/gadgets/gwtGadgets/src/main/webapp/WEB-INF/web.xml
Modified:
portal/trunk/examples/extension/config/src/main/java/conf/configuration.xml
portal/trunk/examples/portal/config/src/main/java/conf/configuration.xml
portal/trunk/gadgets/pom.xml
portal/trunk/packaging/jboss-as5/pkg/pom.xml
portal/trunk/packaging/jboss-as5/pkg/src/main/resources/jboss/server/default/conf/gatein/configuration.xml
portal/trunk/packaging/jboss-as5/pkg/src/main/resources/jboss/server/default/deploy/gatein.ear/META-INF/application.xml
portal/trunk/packaging/jboss-as6/pkg/pom.xml
portal/trunk/packaging/jboss-as6/pkg/src/main/resources/jboss/server/default/conf/gatein/configuration.xml
portal/trunk/packaging/jboss-as6/pkg/src/main/resources/jboss/server/default/deploy/gatein.ear/META-INF/application.xml
portal/trunk/packaging/jetty/pkg/pom.xml
portal/trunk/packaging/jetty/pkg/src/main/resources/jetty/gatein/conf/configuration.xml
portal/trunk/packaging/tomcat/pkg/pom.xml
portal/trunk/packaging/tomcat/pkg/src/main/resources/tomcat/gatein/conf/configuration.xml
portal/trunk/pom.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/group/platform/administrators/navigation.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/group/platform/administrators/pages.xml
Log:
GTNPORTAL-2031: Export/Import Gadget for MOP management.
Modified: portal/trunk/examples/extension/config/src/main/java/conf/configuration.xml
===================================================================
--- portal/trunk/examples/extension/config/src/main/java/conf/configuration.xml 2011-09-13
03:41:42 UTC (rev 7366)
+++ portal/trunk/examples/extension/config/src/main/java/conf/configuration.xml 2011-09-13
05:13:55 UTC (rev 7367)
@@ -64,6 +64,9 @@
<string>eXoGadgets</string>
</value>
<value>
+ <string>gwtGadgets</string>
+ </value>
+ <value>
<string>eXoGadgetServer</string>
</value>
<value>
Modified: portal/trunk/examples/portal/config/src/main/java/conf/configuration.xml
===================================================================
--- portal/trunk/examples/portal/config/src/main/java/conf/configuration.xml 2011-09-13
03:41:42 UTC (rev 7366)
+++ portal/trunk/examples/portal/config/src/main/java/conf/configuration.xml 2011-09-13
05:13:55 UTC (rev 7367)
@@ -63,6 +63,9 @@
<value>
<string>eXoGadgets</string>
</value>
+ <value>
+ <string>gwtGadgets</string>
+ </value>
<value>
<string>eXoGadgetServer</string>
</value>
Added: portal/trunk/gadgets/gwtGadgets/mvn-dependencies/gwt-gadgets-1.2.0.jar
===================================================================
(Binary files differ)
Property changes on:
portal/trunk/gadgets/gwtGadgets/mvn-dependencies/gwt-gadgets-1.2.0.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: portal/trunk/gadgets/gwtGadgets/pom.xml
===================================================================
--- portal/trunk/gadgets/gwtGadgets/pom.xml (rev 0)
+++ portal/trunk/gadgets/gwtGadgets/pom.xml 2011-09-13 05:13:55 UTC (rev 7367)
@@ -0,0 +1,104 @@
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file 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.
+ -->
+
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.gadgets</artifactId>
+ <version>3.2.0-M02-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>exo.portal.gwtGadgets</artifactId>
+ <packaging>war</packaging>
+ <name>GateIn Portal GWT Gadgets Application</name>
+
+ <properties>
+ <com.google.gwt.version>2.1.0</com.google.gwt.version>
+
<com.googlecode.gwtupload.version>0.6.3-compat</com.googlecode.gwtupload.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.gatein.management</groupId>
+ <artifactId>gatein-management-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.common</groupId>
+ <artifactId>common-logging</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.container</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <!-- GWT Dependencies -->
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-servlet</artifactId>
+ <version>${com.google.gwt.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-user</artifactId>
+ <version>${com.google.gwt.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.googlecode.gwtupload</groupId>
+ <artifactId>gwtupload</artifactId>
+ <version>${com.googlecode.gwtupload.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.gwt.google-apis</groupId>
+ <artifactId>gwt-gadgets</artifactId>
+ <version>1.2.0</version>
+ <scope>system</scope>
+
<systemPath>${project.basedir}/mvn-dependencies/gwt-gadgets-1.2.0.jar</systemPath>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>gwtGadgets</finalName>
+
+ <!-- dev mode doesn't seem to work for gadgets, so just including the gwt
plugin for compile -->
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>gwt-maven-plugin</artifactId>
+ <version>2.1.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/ExportImport.gwt.xml
===================================================================
---
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/ExportImport.gwt.xml
(rev 0)
+++
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/ExportImport.gwt.xml 2011-09-13
05:13:55 UTC (rev 7367)
@@ -0,0 +1,47 @@
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file 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.
+ -->
+
+<!DOCTYPE module PUBLIC "//gwt-module/"
+
"http://google-web-toolkit.googlecode.com/svn/tags/2.3.0/distro-source/core/src/gwt-module.dtd">
+<module rename-to="exportimport">
+
+ <!-- Inherit the core Web Toolkit stuff. -->
+ <inherits name='com.google.gwt.user.User'/>
+
+ <!-- inherit css based theme -->
+ <inherits name='com.google.gwt.user.theme.standard.Standard'/>
+
+ <!-- inherit gadget support -->
+ <inherits name="com.google.gwt.gadgets.Gadgets"/>
+
+ <!-- Include GWTUpload library -->
+ <inherits name="gwtupload.GWTUpload"/>
+
+ <!-- Specify the app entry point class. -->
+ <entry-point
class='org.gatein.management.gadget.mop.exportimport.client.Application'/>
+
+ <!-- Specify the application specific style sheet. -->
+ <stylesheet src="Application.css"/>
+
+ <!-- Load dynamically predefined styles in the library when the application starts
-->
+ <stylesheet src="Upload.css"/>
+</module>
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/Application.java
===================================================================
---
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/Application.java
(rev 0)
+++
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/Application.java 2011-09-13
05:13:55 UTC (rev 7367)
@@ -0,0 +1,533 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.management.gadget.mop.exportimport.client;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.logical.shared.OpenEvent;
+import com.google.gwt.event.logical.shared.OpenHandler;
+import com.google.gwt.event.logical.shared.SelectionEvent;
+import com.google.gwt.event.logical.shared.SelectionHandler;
+import com.google.gwt.gadgets.client.Gadget;
+import com.google.gwt.gadgets.client.Gadget.ModulePrefs;
+import com.google.gwt.gadgets.client.UserPreferences;
+import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.rpc.ServiceDefTarget;
+import com.google.gwt.user.client.ui.AbsolutePanel;
+import com.google.gwt.user.client.ui.Anchor;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.CheckBox;
+import com.google.gwt.user.client.ui.DecoratedTabPanel;
+import com.google.gwt.user.client.ui.DecoratorPanel;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.Frame;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HasVerticalAlignment;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.NamedFrame;
+import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.ScrollPanel;
+import com.google.gwt.user.client.ui.Tree;
+import com.google.gwt.user.client.ui.TreeItem;
+import gwtupload.client.IUploader;
+import gwtupload.client.MultiUploader;
+
+import java.util.List;
+
+/**
+ * {@code Application}
+ * <p>
+ * Creates a gadget that will show the sites tree which allows to navigate
+ * between different sites. This gadget allows the administrator of the portal
+ * to import/export sites.
+ * </p>
+ * Created on Dec 29, 2010, 8:01:18 PM
+ *
+ * @author <a href="mailto:nbenothm@redhat.com">Nabil
Benothman</a>
+ * @version 1.0
+ */
+@ModulePrefs(title = "Export/Import Tool", author = "Nabil
Benothman", author_email = "nbenothm(a)redhat.com",
+ description = "This gadget allows the administrator to export/import
sites")
+(a)Gadget.AllowHtmlQuirksMode(false)
+(a)Gadget.UseLongManifestName(false)
+public class Application extends Gadget<UserPreferences>
+{
+ private static final String EXPORT_IMPORT_SERVLET_BASE =
ServletPath.path("/exportimport");
+
+ // asycn services to get requests from the server through ajax.
+ private final GateInServiceAsync gtnService = GWT.create(GateInService.class);
+ private static final String UPLOAD_ACTION_URL = EXPORT_IMPORT_SERVLET_BASE +
"/upload";
+ private static final String DOWNLOAD_ACTION_URL = EXPORT_IMPORT_SERVLET_BASE +
"/download";
+ // gui elements
+ private HTML header;
+ private HTML details;
+ private Button exportButton;
+ private Frame frame;
+ private String exportHref = "";
+
+ private SelectionHandler<TreeItem> selectionHandler;
+ private OpenHandler<TreeItem> openHandler;
+
+ @Override
+ protected void init(UserPreferences preferences)
+ {
+ ((ServiceDefTarget) gtnService).setServiceEntryPoint(EXPORT_IMPORT_SERVLET_BASE +
"/GateInService");
+
+ selectionHandler = createSelectionHandler();
+ openHandler = createOpenHandler();
+
+ TreeImages images = GWT.create(TreeImages.class);
+
+ RootPanel rootPanel = RootPanel.get();
+ rootPanel.setSize("885px", "490px");
+ rootPanel.addStyleName("rootpanelstyle");
+
+ DecoratedTabPanel decoratedTabPanel = new DecoratedTabPanel();
+ decoratedTabPanel.setAnimationEnabled(true);
+ rootPanel.add(decoratedTabPanel, 10, 10);
+ decoratedTabPanel.setSize("870px", "480px");
+
+ AbsolutePanel absolutePanel = new AbsolutePanel();
+ absolutePanel.setSize("847px", "425px");
+
+ DecoratorPanel decoratorPanelWest = new DecoratorPanel();
+ absolutePanel.add(decoratorPanelWest, 10, 10);
+ decoratorPanelWest.setSize("240px", "400px");
+
+ AbsolutePanel treePanel = new AbsolutePanel();
+ treePanel.setSize("230px", "395px");
+ decoratorPanelWest.setWidget(treePanel);
+
+ ScrollPanel treeScrollPanel = new ScrollPanel();
+ treePanel.add(treeScrollPanel, 10, 10);
+ treeScrollPanel.setSize("210px", "375px");
+
+ final Tree tree = getTree(images);
+ treeScrollPanel.setWidget(tree);
+
+ final DecoratorPanel decoratorPanelCenter = new DecoratorPanel();
+
+ absolutePanel.add(decoratorPanelCenter, 256, 10);
+ decoratorPanelCenter.setSize("400px", "402px");
+
+ AbsolutePanel centerAbsolutePanel = new AbsolutePanel();
+ centerAbsolutePanel.setSize("97%", "100%");
+
+ this.header = new HTML("Select an item");
+ this.header.setDirectionEstimator(true);
+ centerAbsolutePanel.add(this.header, 10, 10);
+ this.header.setSize("450px", "50px");
+ this.header.setStyleName("header-style");
+
+ this.details = new HTML("No item selected");
+ centerAbsolutePanel.add(this.details, 10, 76);
+ this.details.setSize("450px", "156px");
+
+ HTML html = new HTML("<hr />", true);
+ centerAbsolutePanel.add(html, 10, 43);
+ html.setSize("380px", "15px");
+
+ this.frame = new NamedFrame("download-frame");
+ frame.setStyleName("download-frame");
+ rootPanel.add(frame);
+
+ this.exportButton = new Button("Export site", new ClickHandler()
+ {
+
+ public void onClick(ClickEvent event)
+ {
+ frame.setUrl(exportHref);
+ }
+ });
+ this.exportButton.setEnabled(false);
+ centerAbsolutePanel.add(this.exportButton, 10, 359);
+ decoratorPanelCenter.setWidget(centerAbsolutePanel);
+ centerAbsolutePanel.setSize("400px", "393px");
+
+ DecoratorPanel decoratorPanelEast = new DecoratorPanel();
+ absolutePanel.add(decoratorPanelEast, 672, 10);
+ decoratorPanelEast.setSize("165px", "405px");
+ AbsolutePanel absolutePanelImportLink = new AbsolutePanel();
+ absolutePanelImportLink.setSize("162px", "395px");
+
+ final Anchor importAnchor = new Anchor("Import site");
+ absolutePanelImportLink.add(importAnchor, 10, 10);
+ importAnchor.setWidth("90%");
+
+ decoratorPanelEast.setWidget(absolutePanelImportLink);
+
+ decoratedTabPanel.add(absolutePanel, "Export/Import sites", false);
+ importAnchor.addClickHandler(new ClickHandler()
+ {
+
+ public void onClick(ClickEvent event)
+ {
+ DialogBox dialogBox = createDialogBox();
+ dialogBox.setPopupPosition(267, 60);
+ dialogBox.show();
+ }
+ });
+
+ decoratedTabPanel.selectTab(0);
+ }
+
+ public native String getPortalContainerName()/*-{
+ return parent.eXo.env.portal.context.substring(1); // remove leading '/'
+ }-*/;
+
+ /**
+ * Create and return the dialog box for the site upload.
+ *
+ * @return a {@code DialogBox}
+ */
+ private DialogBox createDialogBox()
+ {
+
+ // Create a dialog box
+ final DialogBox dialogBox = new DialogBox();
+ dialogBox.setText("Import site");
+ dialogBox.setAnimationEnabled(true);
+ dialogBox.setModal(true);
+ dialogBox.setGlassEnabled(true);
+
+ final AbsolutePanel absolutePanel = new AbsolutePanel();
+ dialogBox.setWidget(absolutePanel);
+ absolutePanel.setStyleName("status-panel");
+ absolutePanel.setSize("400px", "220px");
+
+ final Button importButton = new Button("Import");
+ final CheckBox overwriteBox = new CheckBox("Overwrite the existing
site");
+ final HTML statusImg = new
HTML(" ", true);
+ final Label statusLabel = new Label("status label");
+ final Label headerLabel = new Label("Select file to import :");
+ final AbsolutePanel statusPanel = new AbsolutePanel();
+ headerLabel.setSize("380px", "39px");
+ headerLabel.setStyleName("header-style");
+ absolutePanel.add(headerLabel, 10, 10);
+
+ final MultiUploader uploader = new GTNMultiUploader();
+ uploader.setAvoidRepeatFiles(false);
+ absolutePanel.add(uploader, 10, 46);
+ uploader.setSize("380px", "32px");
+ uploader.addOnChangeUploadHandler(new IUploader.OnChangeUploaderHandler()
+ {
+
+ @Override
+ public void onChange(IUploader uploader)
+ {
+ // Nothing to do
+ if (uploader.getFileName() != null)
+ {
+ importButton.setEnabled(true);
+ }
+ }
+ });
+
+ // Add a finish handler which will notify user once the upload finishes
+ uploader.addOnFinishUploadHandler(new IUploader.OnFinishUploaderHandler()
+ {
+
+ public void onFinish(IUploader uploader)
+ {
+
+ switch (uploader.getStatus())
+ {
+ case SUCCESS:
+ statusLabel.setText("File uploaded with success");
+ statusLabel.setStyleName("success-style");
+ statusImg.setStyleName("success-style-icon");
+ break;
+ case ERROR:
+ statusLabel.setText("File upload error");
+ statusLabel.setStyleName("error-style");
+ statusImg.setStyleName("error-style-icon");
+ break;
+ case CANCELED:
+ statusLabel.setText("File upload canceled");
+ statusLabel.setStyleName("warn-style");
+ statusImg.setStyleName("warn-style-icon");
+ break;
+ default:
+ statusLabel.setText("");
+ statusLabel.setStyleName("blank-style");
+ statusImg.setStyleName("blank-style");
+ break;
+ }
+
+ overwriteBox.setEnabled(true);
+ importButton.setEnabled(true);
+ }
+ });
+ // Add a start handler which will disable the UI until the upload finishes
+ uploader.addOnStartUploadHandler(new IUploader.OnStartUploaderHandler()
+ {
+
+ boolean isShwon = false;
+
+ public void onStart(IUploader uploader)
+ {
+ statusLabel.setText("Process in progress...");
+ statusLabel.setStyleName("progress-style");
+ statusImg.setStyleName("progress-style-icon");
+ overwriteBox.setEnabled(false);
+ importButton.setEnabled(false);
+ if (!isShwon)
+ {
+ statusPanel.setStyleName("status-panel");
+ statusPanel.setSize("380px", "0px");
+ absolutePanel.add(statusPanel, 10, 120);
+
+ Timer t = new Timer()
+ {
+
+ int dx = 5;
+ int height = 0;
+
+ public void run()
+ {
+ height += dx;
+ statusPanel.setHeight(height + "px");
+ if (height >= 45)
+ {
+ cancel(); // Stop the timer
+ }
+ }
+ };
+
+ // Schedule the timer to run once in 100 milliseconds.
+ t.scheduleRepeating(100);
+ isShwon = true;
+ }
+ }
+ });
+ // accept only zip files
+ uploader.setValidExtensions("zip");
+ // You can add customized parameters to servlet call
+ uploader.setServletPath(UPLOAD_ACTION_URL + "?pc=" +
getPortalContainerName());
+
+ overwriteBox.setTitle("If you want to force overwriting an existing site,
check this checkbox");
+ overwriteBox.addClickHandler(new ClickHandler()
+ {
+
+ public void onClick(ClickEvent event)
+ {
+ String url = UPLOAD_ACTION_URL + "?pc=" + getPortalContainerName()
+ "&overwrite=" + overwriteBox.getValue();
+ uploader.setServletPath(url);
+ }
+ });
+
+ absolutePanel.add(overwriteBox, 10, 84);
+ Button closeButton = new Button("Close", new ClickHandler()
+ {
+
+ public void onClick(ClickEvent event)
+ {
+ dialogBox.hide();
+ }
+ });
+ absolutePanel.add(closeButton, 343, 188);
+
+ statusImg.setStyleName("progress-style-icon");
+ statusPanel.add(statusImg, 10, 10);
+ statusImg.setSize("50px", "30px");
+
+ statusPanel.add(statusLabel, 60, 15);
+ statusLabel.setSize("300px", "25px");
+
+ importButton.addClickHandler(new ClickHandler()
+ {
+
+ @Override
+ public void onClick(ClickEvent event)
+ {
+
+ uploader.submit();
+ }
+ });
+ importButton.setEnabled(false);
+ absolutePanel.add(importButton, 10, 188);
+
+ return dialogBox;
+ }
+
+ /**
+ * Create and initialize the site tree
+ *
+ * @param resources
+ * @return
+ */
+ private Tree getTree(TreeImages resources)
+ {
+ Tree tree = new Tree(resources, true);
+ tree.addSelectionHandler(selectionHandler);
+ tree.addOpenHandler(openHandler);
+ tree.setAnimationEnabled(true);
+ tree.setSize("100%", "100%");
+ //final TreeItem rootItem = tree.addItem(getItemString("Sites",
resources.treeRoot()));
+ final TreeNode rootNode = new TreeNode("Sites");
+ final TreeItem rootItem = createItem(rootNode);
+ tree.addItem(rootItem);
+
+ gtnService.getRootNodes(getPortalContainerName(), new
AsyncCallback<List<TreeNode>>()
+ {
+
+ public void onFailure(Throwable caught)
+ {
+ Window.alert("Failed to load sites available for export. See server log
for more details.");
+ }
+
+ public void onSuccess(List<TreeNode> result)
+ {
+ for (TreeNode tn : result)
+ {
+ TreeItem ti = createItem(tn);
+ ti.addItem(new PendingItem());
+ rootItem.addItem(ti);
+ rootNode.addChild(tn);
+ }
+ }
+ });
+
+ rootItem.setState(true);
+
+ return tree;
+ }
+
+ /**
+ * @param text
+ * @param image
+ * @return
+ */
+ private String getItemString(String text, ImageResource image)
+ {
+ // Add the image and text to a horizontal panel
+ HorizontalPanel hPanel = new HorizontalPanel();
+ hPanel.setSpacing(0);
+ hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
+ hPanel.add(new Image(image));
+ HTML headerText = new HTML(text);
+ hPanel.add(headerText);
+ // Return the HTML string for the panel
+ return hPanel.getElement().getString();
+ }
+
+ /**
+ * Create a {@code TreeItem} and set it's user object
+ *
+ * @param tn The user object of the {@code TreeItem}
+ * @return {@code TreeItem}
+ */
+ private TreeItem createItem(TreeNode tn)
+ {
+ TreeItem item = new TreeItem(tn.getText());
+ item.setUserObject(tn);
+
+ return item;
+ }
+
+ private OpenHandler<TreeItem> createOpenHandler()
+ {
+ return new OpenHandler<TreeItem>()
+ {
+ @Override
+ public void onOpen(OpenEvent<TreeItem> event)
+ {
+ final TreeItem target = event.getTarget();
+ final TreeNode tn = (TreeNode) target.getUserObject();
+ String text = target.getText();
+ target.setText("Loading items");
+
+ if (target.getChildCount() > 0)
+ {
+ TreeItem it = target.getChild(0);
+ if (it instanceof PendingItem)
+ {
+ target.removeItem(it);
+ }
+ }
+
+ if (target.getChildCount() == 0)
+ {
+ gtnService.updateItem(getPortalContainerName(), tn, new
AsyncCallback<TreeNode>()
+ {
+
+ public void onFailure(Throwable caught)
+ {
+ Window.alert("Failed to update tree items. See server log for
more details.");
+ Application.this.details.setHTML("Failed to load
sub-tree");
+ }
+
+ public void onSuccess(TreeNode result)
+ {
+
+ for (TreeNode tnChild : result.getChildren())
+ {
+ TreeItem it = Application.this.createItem(tnChild);
+ if (!tnChild.getChildren().isEmpty())
+ {
+ it.addItem(new PendingItem());
+ }
+ target.addItem(it);
+ }
+ }
+ });
+ }
+
+ target.setText(text);
+ }
+ };
+ }
+
+ private SelectionHandler<TreeItem> createSelectionHandler()
+ {
+ return new SelectionHandler<TreeItem>()
+ {
+ @Override
+ public void onSelection(SelectionEvent<TreeItem> event)
+ {
+ final TreeItem item = event.getSelectedItem();
+ TreeNode node = (TreeNode) item.getUserObject();
+ Application.this.header.setHTML(node.getPath());
+ Application.this.details.setHTML(node.getNodeInfo());
+
+ if (node.isExportable())
+ {
+ Application.this.exportHref = DOWNLOAD_ACTION_URL + "?pc=" +
getPortalContainerName() +
+ "&ownerType=" + node.getType() +
"&ownerId=" + node.getSiteName();
+ Application.this.exportButton.setEnabled(true);
+ }
+ else
+ {
+ Application.this.exportButton.setEnabled(false);
+ Application.this.exportHref = "#";
+ }
+ }
+ };
+ }
+}
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/DisplayableException.java
===================================================================
---
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/DisplayableException.java
(rev 0)
+++
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/DisplayableException.java 2011-09-13
05:13:55 UTC (rev 7367)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.management.gadget.mop.exportimport.client;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class DisplayableException extends Exception
+{
+ public DisplayableException(String message)
+ {
+ super(message);
+ }
+}
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/GTNMultiUploader.java
===================================================================
---
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/GTNMultiUploader.java
(rev 0)
+++
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/GTNMultiUploader.java 2011-09-13
05:13:55 UTC (rev 7367)
@@ -0,0 +1,139 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.management.gadget.mop.exportimport.client;
+
+import com.google.gwt.uibinder.client.UiConstructor;
+import gwtupload.client.IFileInput;
+import gwtupload.client.IFileInput.FileInputType;
+import gwtupload.client.IUploadStatus;
+import gwtupload.client.IUploader;
+import gwtupload.client.MultiUploader;
+import gwtupload.client.Uploader;
+
+/**
+ * {@code GTNMultiUploader}
+ * <p>
+ * Implementation of an uploader panel that is able to handle several uploads.
+ * This uploader allows to upload multiple files asynchronously using
<i>Ajax</i>
+ * This version of multi file uploader allows to enable/disable the automatic upload,
i.e
+ * the upload starts right after selecting file. The default version does not allow
+ * this feature and upload is automatic by default.
+ * </p>
+ * Created on Feb 17, 2011, 6:47:18 PM
+ *
+ * @author <a href="mailto:nbenothm@redhat.com">Nabil
Benothman</a>
+ * @version 1.0
+ */
+public class GTNMultiUploader extends MultiUploader
+{
+
+ private boolean automaticUpload;
+
+ /**
+ * Create a new instance of {@code GTNMultiUploader}
+ * Initialize widget components and layout elements.
+ * Uses the default status widget and the standard input file.
+ */
+ public GTNMultiUploader()
+ {
+ super();
+ }
+
+ /**
+ * Create a new instance of {@code GTNMultiUploader}
+ * Initialize widget components and layout elements.
+ * Uses the default status widget.
+ *
+ * @param type
+ * file input to use
+ */
+ @UiConstructor
+ public GTNMultiUploader(FileInputType type)
+ {
+ super(type);
+ }
+
+ /**
+ * Create a new instance of {@code GTNMultiUploader}
+ * Initialize widget components and layout elements.
+ *
+ * @param type
+ * file input to use
+ * @param status
+ * Customized status widget to use
+ */
+ public GTNMultiUploader(FileInputType type, IUploadStatus status)
+ {
+ super(type, status);
+ }
+
+ /**
+ * Create a new instance of {@code GTNMultiUploader}
+ * Initialize widget components and layout elements.
+ *
+ * @param status
+ * Customized status widget to use
+ */
+ public GTNMultiUploader(IUploadStatus status)
+ {
+ super(status);
+ }
+
+ /**
+ * Create a new instance of {@code GTNMultiUploader}
+ * This is the constructor for customized multi-uploaders.
+ *
+ * @param status
+ * Customized status widget to use
+ * @param fileInput
+ * Customized file input
+ */
+ public GTNMultiUploader(IUploadStatus status, IFileInput fileInput)
+ {
+ super(status, fileInput);
+ }
+
+ @Override
+ protected IUploader getUploaderInstance()
+ {
+ Uploader uploader = (Uploader) super.getUploaderInstance();
+ uploader.setAutoSubmit(automaticUpload);
+ return uploader;
+ }
+
+ /**
+ * @return the automaticUpload
+ */
+ public boolean isAutomaticUpload()
+ {
+ return automaticUpload;
+ }
+
+ /**
+ * @param automaticUpload the automaticUpload to set
+ */
+ public void setAutomaticUpload(boolean automaticUpload)
+ {
+ this.automaticUpload = automaticUpload;
+ }
+}
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/GateInService.java
===================================================================
---
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/GateInService.java
(rev 0)
+++
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/GateInService.java 2011-09-13
05:13:55 UTC (rev 7367)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.management.gadget.mop.exportimport.client;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+
+import java.util.List;
+
+/**
+ * {@code GateInService}
+ * <p/>
+ * Created on Jan 3, 2011, 12:28:43 PM
+ *
+ * @author <a href="mailto:nbenothm@redhat.com">Nabil
Benothman</a>
+ * @version 1.0
+ */
+public interface GateInService extends RemoteService
+{
+
+ /**
+ * Update the Tree item asynchronously
+ *
+ * @param containerName name of portal container
+ * @param item The item to be updated
+ * @return the updated tree node
+ * @throws DisplayableException
+ */
+ public TreeNode updateItem(String containerName, TreeNode item) throws Exception;
+
+ /**
+ * Retrieve asynchronously the list of root nodes
+ *
+ * @param containerName The portal container name
+ * @return The list of the root nodes
+ * @throws DisplayableException
+ */
+ public List<TreeNode> getRootNodes(String containerName) throws Exception;
+}
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/GateInServiceAsync.java
===================================================================
---
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/GateInServiceAsync.java
(rev 0)
+++
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/GateInServiceAsync.java 2011-09-13
05:13:55 UTC (rev 7367)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.management.gadget.mop.exportimport.client;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+import java.util.List;
+
+/**
+ * {@code GateInServiceAsync}
+ * <p/>
+ * Created on Jan 3, 2011, 12:29:53 PM
+ *
+ * @author <a href="mailto:nbenothm@redhat.com">Nabil
Benothman</a>
+ * @version 1.0
+ */
+public interface GateInServiceAsync
+{
+
+ /**
+ * Update the Tree item asynchronously
+ *
+ * @param portalContainerName name of portal container
+ * @param item The item to be updated
+ * @param asyncCallback asynchronous callback
+ */
+ public void updateItem(String portalContainerName, TreeNode item,
AsyncCallback<TreeNode> asyncCallback);
+
+ /**
+ * Retrieve asynchronously the list of root nodes
+ *
+ * @param portalContainerName The portal container name
+ * @param asyncCallback asynchronous callback
+ */
+ public void getRootNodes(String portalContainerName,
AsyncCallback<List<TreeNode>> asyncCallback);
+}
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/PendingItem.java
===================================================================
---
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/PendingItem.java
(rev 0)
+++
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/PendingItem.java 2011-09-13
05:13:55 UTC (rev 7367)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.management.gadget.mop.exportimport.client;
+
+import com.google.gwt.safehtml.shared.SafeHtml;
+import com.google.gwt.user.client.ui.TreeItem;
+import com.google.gwt.user.client.ui.Widget;
+
+import java.io.Serializable;
+
+/**
+ * {@code PendingItem}
+ * <p>
+ * Tree item representing a pending item (loading in progress)
+ * </p>
+ * Created on Dec 29, 2010, 1:25:04 PM
+ *
+ * @author <a href="mailto:nbenothm@redhat.com">Nabil
Benothman</a>
+ * @version 1.0
+ */
+public class PendingItem extends TreeItem implements Serializable
+{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Create a new instance of {@code PendingItem}
+ */
+ public PendingItem()
+ {
+ super("Loading sub-tree...");
+ this.setStyleName("gwt-TreeItem-pending");
+ }
+
+ /**
+ * Constructs a tree item with the given HTML.
+ *
+ * @param html the item's HTML
+ */
+ public PendingItem(String html)
+ {
+ this();
+ }
+
+ /**
+ * Constructs a tree item with the given HTML.
+ *
+ * @param html the item's HTML
+ */
+ public PendingItem(SafeHtml html)
+ {
+ super(html);
+ this.setText("Loading sub-tree...");
+ }
+
+ /**
+ * Constructs a tree item with the given <code>Widget</code>.
+ *
+ * @param widget the item's widget
+ */
+ public PendingItem(Widget widget)
+ {
+ super(widget);
+ this.setText("Loading sub-tree...");
+ }
+}
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/ServletPath.java
===================================================================
---
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/ServletPath.java
(rev 0)
+++
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/ServletPath.java 2011-09-13
05:13:55 UTC (rev 7367)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.management.gadget.mop.exportimport.client;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+class ServletPath
+{
+ private static final String SERVLET_CONTEXT = "/gwtGadgets";
+
+ private ServletPath(){}
+
+ static String path(String path)
+ {
+ return SERVLET_CONTEXT + path;
+ }
+}
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/TreeImages.java
===================================================================
---
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/TreeImages.java
(rev 0)
+++
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/TreeImages.java 2011-09-13
05:13:55 UTC (rev 7367)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.management.gadget.mop.exportimport.client;
+
+import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.user.client.ui.Tree;
+
+/**
+ * {@code TreeImages}
+ * <p/>
+ * Created on Jan 6, 2011, 10:45:39 AM
+ *
+ * @author <a href="mailto:nbenothm@redhat.com">Nabil
Benothman</a>
+ * @version 1.0
+ */
+public interface TreeImages extends Tree.Resources
+{
+
+ /**
+ * Use noimage.png, which is a blank 1x1 image.
+ */
+ @Source("../public/images/cogwheel.png")
+ ImageResource treeLeaf();
+
+ @Source("../public/images/home-icon.jpg")
+ ImageResource treeRoot();
+}
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/TreeNode.java
===================================================================
---
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/TreeNode.java
(rev 0)
+++
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/client/TreeNode.java 2011-09-13
05:13:55 UTC (rev 7367)
@@ -0,0 +1,250 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.management.gadget.mop.exportimport.client;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * {@code TreeNode}
+ * <p/>
+ * Created on Dec 29, 2010, 1:25:55 PM
+ *
+ * @author <a href="mailto:nbenothm@redhat.com">Nabil
Benothman</a>
+ * @version 1.0
+ */
+public class TreeNode implements Serializable
+{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private TreeNode parent;
+ private List<TreeNode> children;
+ private String text;
+ private String type;
+ private String siteName;
+ private String nodeInfo;
+ private boolean updated = false;
+ private boolean exportable;
+
+ /**
+ * Create a new instance of {@code TreeNode}
+ */
+ public TreeNode()
+ {
+ this("");
+ }
+
+ /**
+ * Create a new instance of {@code TreeNode}
+ *
+ * @param text The tree node text
+ */
+ public TreeNode(String text)
+ {
+ this.text = text;
+ this.children = new ArrayList<TreeNode>();
+ }
+
+ /**
+ * Create a new instance of {@code TreeNode}
+ *
+ * @param text The tree node text
+ * @param children The tree node children
+ */
+ public TreeNode(String text, List<TreeNode> children)
+ {
+ this.text = text;
+ this.children = children;
+ }
+
+ /**
+ * Return the node informations
+ *
+ * @return The node informations
+ */
+ public String getNodeInfo()
+ {
+ return this.nodeInfo;
+ }
+
+ /**
+ * Setter for the node info
+ *
+ * @param info the info to set
+ */
+ public void setNodeInfo(String info)
+ {
+ this.nodeInfo = info;
+ }
+
+ /**
+ * Add a {@code TreeNode} child to the list of children
+ *
+ * @param child The child to add
+ * @return {@code true} if the child is added successfully else {@code false}
+ */
+ public boolean addChild(TreeNode child)
+ {
+ child.setParent(this);
+ return this.children.add(child);
+ }
+
+ /**
+ * Remove the child, if exists, from the list of children
+ *
+ * @param tn The child to be removed
+ * @return {@code true} if the child is removed successfully else {@code false}
+ */
+ public boolean removeChild(TreeNode tn)
+ {
+ return this.children.remove(tn);
+ }
+
+ /**
+ * @return the children
+ */
+ public List<TreeNode> getChildren()
+ {
+ return this.children;
+ }
+
+ /**
+ * Setter for the children
+ *
+ * @param children the children to set
+ */
+ public void setChildren(List<TreeNode> children)
+ {
+ this.children = children;
+ }
+
+ /**
+ * @return the text
+ */
+ public String getText()
+ {
+ return text;
+ }
+
+ /**
+ * Setter for the text
+ *
+ * @param text the text to set
+ */
+ public void setText(String text)
+ {
+ this.text = text;
+ }
+
+ /**
+ * @return the type
+ */
+ public String getType()
+ {
+ return type;
+ }
+
+ /**
+ * @param type the type to set
+ */
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ /**
+ * @return the path
+ */
+ public String getPath()
+ {
+ return (this.parent != null ? this.parent.getPath() : "") + "
» " + this.text;
+ }
+
+ /**
+ * @return the updated
+ */
+ public boolean isUpdated()
+ {
+ return updated;
+ }
+
+ /**
+ * @param updated the updated to set
+ */
+ public void setUpdated(boolean updated)
+ {
+ this.updated = updated;
+ }
+
+ /**
+ * @return the siteName
+ */
+ public String getSiteName()
+ {
+ return siteName;
+ }
+
+ /**
+ * @param siteName the siteName to set
+ */
+ public void setSiteName(String siteName)
+ {
+ this.siteName = siteName;
+ }
+
+ /**
+ * @return the exportable
+ */
+ public boolean isExportable()
+ {
+ return exportable;
+ }
+
+ /**
+ * @param exportable the exportable to set
+ */
+ public void setExportable(boolean exportable)
+ {
+ this.exportable = exportable;
+ }
+
+ /**
+ * @return the parent
+ */
+ public TreeNode getParent()
+ {
+ return parent;
+ }
+
+ /**
+ * @param parent the parent to set
+ */
+ public void setParent(TreeNode parent)
+ {
+ this.parent = parent;
+ }
+}
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/Application.css
===================================================================
---
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/Application.css
(rev 0)
+++
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/Application.css 2011-09-13
05:13:55 UTC (rev 7367)
@@ -0,0 +1,460 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.
+ */
+
+/** Add css rules here for your application. */
+
+/*
+button {
+ display: block;
+ font-size: 16pt
+}
+
+.widePanel {
+ width: 100%
+}
+
+img {
+ margin-top: 20px;
+}
+
+.gwt-TabLayoutPanel .gwt-TabLayoutPanelContent {
+ overflow: hidden;
+ padding: 5px 5px 5px 5px;
+ border-style: solid;
+ border-width: 2px 2px 2px;
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ -khtml-border-radius: 4px;
+ border-radius: 4px;
+}
+
+.gwt-StackPanel {
+ cursor:default;
+}
+
+.gwt-StackPanel .gwt-StackPanelItem {
+ cursor:default;
+}
+
+body {
+ background-color: white;
+ color: black;
+ font-family: Arial, sans-serif;
+ font-size: small;
+ margin: 5px;
+}
+*/
+
+.rootpanelstyle {
+ border: #AAAAAA solid 2px;
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ -khtml-border-radius: 4px;
+ border-radius: 4px;
+ padding: 5px;
+}
+
+.download-frame {
+ border: 0px;
+ visibility: hidden;
+}
+
+.header-style {
+ text-decoration: none;
+ color: #ff8800;
+ font: bold;
+}
+
+.success-style {
+ text-decoration: none;
+ color: #00ff00;
+ font-weight: bold;
+ height: 35px;
+ padding-left: 10px;
+}
+
+.success-style-icon {
+ text-decoration: none;
+ background-image: url('images/success-icon.png');
+ background-repeat: no-repeat;
+ background-position: left top;
+ padding-right: 5px;
+ height: 35px;
+}
+
+.error-style {
+ text-decoration: none;
+ color: #ff0000;
+ height: 35px;
+ font-weight: bold;
+ padding-left: 10px;
+}
+
+.error-style-icon {
+ background-image: url('images/error-icon.png');
+ background-repeat: no-repeat;
+ background-position: left top;
+ text-decoration: none;
+ height: 35px;
+ padding-right: 5px;
+}
+
+.warn-style {
+ text-decoration: none;
+ color: #ff8800;
+ height: 35px;
+ font-weight: bold;
+ padding-left: 10px;
+}
+
+.warn-style-icon {
+ background-image: url('images/warning-icon.png');
+ background-repeat: no-repeat;
+ background-position: left top;
+ text-decoration: none;
+ height: 35px;
+ padding-right: 5px;
+}
+
+.progress-style{
+ text-decoration: none;
+ color: #0000ff;
+ height: 35px;
+ font-weight: bold;
+ padding-left: 10px;
+}
+
+.progress-style-icon{
+ background-image: url('images/loading.gif');
+ background-repeat: no-repeat;
+ background-position: left top;
+ text-decoration: none;
+ padding-right: 5px;
+ height: 35px;
+}
+
+.blank-style {
+ background-image: url("images/blank.png");
+ background-repeat: no-repeat;
+}
+
+.status-panel {
+ border: #AAAAAA solid 1px;
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ -khtml-border-radius: 4px;
+ border-radius: 4px;
+}
+
+status-panel-no-border {
+ border: #AAAAAA solid 0px;
+}
+
+a {
+ color: darkblue;
+}
+
+a:visited {
+ color: darkblue;
+}
+
+.gwt-DialogBox {
+ /*
+ border: 2px solid #AAAAAA;
+ background-color: white;
+ */
+}
+
+.gwt-DialogBox .Caption {
+ background-image: url(gray_gradient.gif);
+ background-repeat: repeat-x;
+ padding: 4px;
+ padding-bottom: 8px;
+ font-weight: bold;
+ cursor: default;
+}
+
+.gwt-MenuBar {
+ background-color: #C3D9FF;
+ cursor: default;
+}
+
+.gwt-MenuItem {
+ font-size: 80%;
+ margin: 1px;
+ cursor: default;
+}
+
+.gwt-MenuItem-selected {
+ background-color: #E8EEF7;
+}
+
+.gwt-Tree {
+}
+
+.gwt-Tree .gwt-TreeItem {
+ font-size: 80%;
+ cursor: default;
+}
+
+.gwt-Tree .gwt-TreeItem-selected {
+ background-color: #C3D9FF;
+}
+
+.gwt-StackPanel {
+ background-color: white;
+ border: 1px solid #AAAAAA;
+ width: 15em;
+}
+
+.gwt-StackPanel .gwt-StackPanelItem {
+ background-image: url(blue_gradient.gif);
+ background-repeat: repeat-x;
+ background-color: #EEEEEE;
+
+}
+
+.gwt-StackPanel .gwt-StackPanelItem-selected {
+}
+
+.gwt-TabPanel {
+
+}
+
+.gwt-TabPanelBottom {
+ border-left: 1px solid #87b3ff;
+ border-right: 1px solid #87b3ff;
+ border-bottom: 1px solid #87b3ff;
+}
+
+.gwt-TabBar {
+ font-size: smaller;
+}
+
+.gwt-TabBar .gwt-TabBarFirst {
+ height: 100%;
+ border-bottom: 1px solid #87b3ff;
+ border-right: 1px solid #87b3ff;
+ padding-left: 3px;
+}
+
+.gwt-TabBar .gwt-TabBarRest {
+ border-bottom: 1px solid #87b3ff;
+ padding-right: 3px;
+}
+
+.gwt-TabBar .gwt-TabBarItem {
+ border-top: 1px solid #87b3ff;
+ border-bottom: 1px solid #87b3ff;
+ padding: 2px;
+ cursor: hand;
+ white-space: nowrap;
+ border-right: 1px solid #87b3ff;
+}
+
+.gwt-TabBar .gwt-TabBarItem-selected {
+ font-weight: bold;
+ background-color: #e8eef7;
+ border-top: 1px solid #87b3ff;
+ border-right: 1px solid #87b3ff;
+ border-bottom: 1px solid #e8eef7;
+ padding: 2px;
+ cursor: default;
+ white-space: nowrap;
+}
+
+.gwt-PushButton-up {
+ background-color: #C3D9FF;
+ padding: 2px;
+ border: 2px solid transparent;
+ border-color: #E8F1FF rgb(157, 174, 205) rgb(157, 174, 205) rgb(232, 241, 255);
+ cursor: pointer;
+ cursor: hand;
+}
+
+.gwt-PushButton-up-hovering {
+ background-color: #C3D9FF;
+ padding: 2px;
+ border: 2px solid transparent;
+ border-color: #E8F1FF rgb(157, 174, 205) rgb(157, 174, 205) rgb(232, 241, 255);
+ cursor: pointer;
+ cursor: hand;
+}
+
+.gwt-PushButton-down {
+ background-color: #C3D9FF;
+ padding: 2px;
+ border: 2px solid transparent;
+ border-color: #9DAECD rgb(232, 241, 255) rgb(232, 241, 255) rgb(157, 174, 205);
+ cursor: pointer;
+ cursor: hand;
+}
+
+.gwt-PushButton-down-hovering {
+ background-color: #C3D9FF;
+ padding: 2px;
+ border: 2px solid transparent;
+ border-color: #9DAECD rgb(232, 241, 255) rgb(232, 241, 255) rgb(157, 174, 205);
+ cursor: pointer;
+ cursor: hand;
+}
+
+.gwt-ToggleButton-up {
+ background-color: #C3D9FF;
+ padding: 2px;
+ border: 2px solid transparent;
+ border-color: #E8F1FF rgb(157, 174, 205) rgb(157, 174, 205) rgb(232, 241, 255);
+ cursor: pointer;
+ cursor: hand;
+}
+
+.gwt-ToggleButton-up-hovering {
+ background-color: #C3D9FF;
+ padding: 2px;
+ border: 2px solid transparent;
+ border-color: #E8F1FF rgb(157, 174, 205) rgb(157, 174, 205) rgb(232, 241, 255);
+ cursor: pointer;
+ cursor: hand;
+}
+
+.gwt-ToggleButton-down {
+ background-color: #C3D9FF;
+ padding: 2px;
+ background-color: #E8F1FF;
+ border: 2px solid transparent;
+ border-color: #9DAECD rgb(232, 241, 255) rgb(232, 241, 255) rgb(157, 174, 205);
+ cursor: pointer;
+ cursor: hand;
+}
+
+.gwt-ToggleButton-down-hovering {
+ background-color: #C3D9FF;
+ padding: 2px;
+ background-color: #E8F1FF;
+ border: 2px solid transparent;
+ border-color: #9DAECD rgb(232, 241, 255) rgb(232, 241, 255) rgb(157, 174, 205);
+ cursor: pointer;
+ cursor: hand;
+}
+
+.gwt-RichTextArea {
+ border: 1px solid black;
+ background-color: white;
+}
+
+.gwt-RichTextToolbar {
+ background-color: #C3D9FF;
+ padding: 2px;
+}
+
+.gwt-RichTextToolbar .gwt-PushButton-up {
+ margin-right: 2px;
+ border: 1px solid #C3D9FF;
+}
+
+.gwt-RichTextToolbar .gwt-PushButton-up-hovering {
+ margin-right: 2px;
+ border: 1px solid #C3D9FF;
+ border-color: #E8F1FF rgb(157, 174, 205) rgb(157, 174, 205) rgb(232, 241, 255);
+}
+
+.gwt-RichTextToolbar .gwt-PushButton-down {
+ margin-right: 2px;
+ border: 1px solid #C3D9FF;
+ border-color: #9DAECD rgb(232, 241, 255) rgb(232, 241, 255) rgb(157, 174, 205);
+}
+
+.gwt-RichTextToolbar .gwt-PushButton-down-hovering {
+ margin-right: 2px;
+ border: 1px solid #C3D9FF;
+ border-color: #9DAECD rgb(232, 241, 255) rgb(232, 241, 255) rgb(157, 174, 205);
+}
+
+.gwt-RichTextToolbar .gwt-ToggleButton-up {
+ margin-right: 2px;
+ border: 1px solid #C3D9FF;
+}
+
+.gwt-RichTextToolbar .gwt-ToggleButton-up-hovering {
+ margin-right: 2px;
+ border: 1px solid #C3D9FF;
+ border-color: #E8F1FF rgb(157, 174, 205) rgb(157, 174, 205) rgb(232, 241, 255);
+}
+
+.gwt-RichTextToolbar .gwt-ToggleButton-down {
+ margin-right: 2px;
+ background-color: #E8F1FF;
+ border: 1px solid #C3D9FF;
+ border-color: #9DAECD rgb(232, 241, 255) rgb(232, 241, 255) rgb(157, 174, 205);
+}
+
+.gwt-RichTextToolbar .gwt-ToggleButton-down-hovering {
+ margin-right: 2px;
+ background-color: #E8F1FF;
+ border: 1px solid #C3D9FF;
+ border-color: #9DAECD rgb(232, 241, 255) rgb(232, 241, 255) rgb(157, 174, 205);
+}
+
+.gwt-HorizontalSplitPanel {
+ border: 8px solid #C3D9FF;
+}
+
+.gwt-HorizontalSplitPanel .splitter {
+ background-color: #C3D9FF;
+ cursor: move;
+}
+
+.gwt-HorizontalSplitPanel .left {
+ background-color: #E8EEF7;
+}
+
+.gwt-VerticalSplitPanel {
+ border: 8px solid #C3D9FF;
+}
+
+.gwt-VerticalSplitPanel .splitter {
+ background-color: #C3D9FF;
+ height: 8px;
+ cursor: move;
+}
+
+.gwt-SuggestBoxPopup {
+ border: 2px solid #C3D9FF;
+}
+
+.gwt-SuggestBoxPopup .item {
+ padding: 2px;
+}
+
+.gwt-SuggestBoxPopup .item-selected {
+ background-color: #C3D9FF;
+ padding: 2px;
+}
+
+.gwt-DisclosurePanel {
+ border: 2px solid #C3D9FF;
+}
+
+.gwt-DisclosurePanel .header {
+ background-color: #e8eef7;
+ cursor: hand;
+}
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/blank.png
===================================================================
(Binary files differ)
Property changes on:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/blank.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/cogwheel.png
===================================================================
(Binary files differ)
Property changes on:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/cogwheel.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/error-icon.png
===================================================================
(Binary files differ)
Property changes on:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/error-icon.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/home-icon.jpg
===================================================================
(Binary files differ)
Property changes on:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/home-icon.jpg
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/loading.gif
===================================================================
(Binary files differ)
Property changes on:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/loading.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/success-icon.png
===================================================================
(Binary files differ)
Property changes on:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/success-icon.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/warning-icon.png
===================================================================
(Binary files differ)
Property changes on:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/public/images/warning-icon.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/ContainerCallback.java
===================================================================
---
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/ContainerCallback.java
(rev 0)
+++
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/ContainerCallback.java 2011-09-13
05:13:55 UTC (rev 7367)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.management.gadget.mop.exportimport.server;
+
+import org.exoplatform.container.ExoContainer;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public abstract class ContainerCallback<T>
+{
+
+ public abstract T doInContainer(ExoContainer container) throws Exception;
+
+ public <C> C getComponent(ExoContainer container, Class<C>
componentClass)
+ {
+ return componentClass.cast(container.getComponentInstanceOfType(componentClass));
+ }
+}
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/ContainerRequestHandler.java
===================================================================
---
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/ContainerRequestHandler.java
(rev 0)
+++
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/ContainerRequestHandler.java 2011-09-13
05:13:55 UTC (rev 7367)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.management.gadget.mop.exportimport.server;
+
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.RootContainer;
+import org.exoplatform.container.component.RequestLifeCycle;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class ContainerRequestHandler
+{
+
+ private static final Logger log =
LoggerFactory.getLogger(ContainerRequestHandler.class);
+
+ public static <T> T doInRequest(String containerName, ContainerCallback<T>
containerCallback) throws Exception
+ {
+ RootContainer rootContainer = RootContainer.getInstance();
+ PortalContainer container = rootContainer.getPortalContainer(containerName);
+ if (container == null)
+ {
+ throw new RuntimeException("Invalid container name " +
containerName);
+ }
+ ExoContainerContext.setCurrentContainer(container);
+ RequestLifeCycle.begin(container, true);
+ try
+ {
+ return containerCallback.doInContainer(container);
+ }
+ finally
+ {
+ try
+ {
+ RequestLifeCycle.end();
+ }
+ catch (IllegalStateException e)
+ {
+ log.warn("Illegal state exception ending RequestLifeCycle", e);
+ }
+ }
+ }
+}
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/FileDownloadServlet.java
===================================================================
---
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/FileDownloadServlet.java
(rev 0)
+++
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/FileDownloadServlet.java 2011-09-13
05:13:55 UTC (rev 7367)
@@ -0,0 +1,128 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.management.gadget.mop.exportimport.server;
+
+import org.exoplatform.container.ExoContainer;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
+import org.gatein.management.api.ContentType;
+import org.gatein.management.api.PathAddress;
+import org.gatein.management.api.controller.ManagedRequest;
+import org.gatein.management.api.controller.ManagedResponse;
+import org.gatein.management.api.controller.ManagementController;
+import org.gatein.management.api.operation.OperationNames;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import static
org.gatein.management.gadget.mop.exportimport.server.ContainerRequestHandler.*;
+
+/**
+ * {@code FileDownloadServlet}
+ * <p>
+ * The file download servlet. Used for export sites.
+ * </p>
+ * Created on Feb 3, 2011, 3:49:16 PM
+ *
+ * @author <a href="mailto:nbenothm@redhat.com">Nabil
Benothman</a>
+ * @version 1.0
+ */
+public class FileDownloadServlet extends HttpServlet
+{
+
+ private static final Logger log = LoggerFactory.getLogger(FileDownloadServlet.class);
+ private static final SimpleDateFormat SDF = new
SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException
+ {
+ String portalContainerName = request.getParameter("pc");
+ final String type = request.getParameter("ownerType");
+ final String name = request.getParameter("ownerId");
+ String safeName = name.replaceAll("/", "-");
+ if (safeName.startsWith("-"))
+ {
+ safeName = safeName.substring(1);
+ }
+ String filename = new
StringBuilder(type).append("_").append(safeName).append("_").append(getTimestamp()).append(".zip").toString();
+
+ response.setContentType("application/octet-stream; charset=UTF-8");
+ response.setHeader("Content-disposition", "attachment;
filename=\"" + filename + "\"");
+
+ final OutputStream os = response.getOutputStream();
+ try
+ {
+ doInRequest(portalContainerName, new ContainerCallback<Void>()
+ {
+
+ public Void doInContainer(ExoContainer container) throws Exception
+ {
+ ManagementController controller = getComponent(container,
ManagementController.class);
+ PathAddress address = PathAddress.pathAddress("mop",
type+"sites", name);
+
+ ManagedRequest request =
ManagedRequest.Factory.create(OperationNames.EXPORT_RESOURCE, address, ContentType.ZIP);
+ ManagedResponse response = controller.execute(request);
+ if (response.getOutcome().isSuccess())
+ {
+ response.writeResult(os);
+ }
+ else
+ {
+ throw new Exception(response.getOutcome().getFailureDescription());
+ }
+
+ return null;
+ }
+ });
+ os.flush();
+ }
+ catch (Exception e)
+ {
+ log.error("Error during download", e);
+ }
+ finally
+ {
+ if (os != null)
+ {
+ os.close();
+ }
+ }
+ }
+
+ @Override
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException
+ {
+ doGet(request, response);
+ }
+
+ private String getTimestamp()
+ {
+ return SDF.format(new Date());
+ }
+}
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/FileUploadServlet.java
===================================================================
---
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/FileUploadServlet.java
(rev 0)
+++
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/FileUploadServlet.java 2011-09-13
05:13:55 UTC (rev 7367)
@@ -0,0 +1,194 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.management.gadget.mop.exportimport.server;
+
+import gwtupload.server.UploadAction;
+import gwtupload.server.exceptions.UploadActionException;
+import org.apache.commons.fileupload.FileItem;
+import org.exoplatform.container.ExoContainer;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
+import org.gatein.management.api.ContentType;
+import org.gatein.management.api.PathAddress;
+import org.gatein.management.api.controller.ManagedRequest;
+import org.gatein.management.api.controller.ManagedResponse;
+import org.gatein.management.api.controller.ManagementController;
+import org.gatein.management.api.operation.OperationNames;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import static
org.gatein.management.gadget.mop.exportimport.server.ContainerRequestHandler.*;
+
+/**
+ * {@code FileUploadServlet}
+ * <p>
+ * The file upload servlet based on GWT upload, used for import sites.
+ * </p>
+ * Created on Jan 3, 2011, 3:43:36 PM
+ *
+ * @author <a href="mailto:nbenothm@redhat.com">Nabil
Benothman</a>
+ * @version 1.0
+ */
+public class FileUploadServlet extends UploadAction
+{
+
+ private static final Logger log = LoggerFactory.getLogger(FileUploadServlet.class);
+ private static final long serialVersionUID = 1L;
+ private Hashtable<String, String> receivedContentTypes = new
Hashtable<String, String>();
+ /**
+ * Maintain a list with received files and their content types.
+ */
+ private Hashtable<String, File> receivedFiles = new Hashtable<String,
File>();
+
+ /**
+ * Override executeAction to save the received files in a custom place
+ * and delete this items from session.
+ */
+ @Override
+ public String executeAction(HttpServletRequest request, List<FileItem>
sessionFiles) throws UploadActionException
+ {
+ StringBuilder response = new StringBuilder("<response>\n");
+ int count = 0;
+ for (FileItem item : sessionFiles)
+ {
+ //if (false == item.isFormField()) {
+ if (!item.isFormField())
+ {
+ count++;
+ try
+ {
+ // Create a new file based on the remote file name in the client
+ String saveName =
item.getName().replaceAll("[\\\\/><\\|\\s\"'{}()\\[\\]]+",
"_");
+ // Create a temporary file placed in the default system temp folder
+ File file = File.createTempFile(saveName, ".zip");
+ item.write(file);
+
+ // Save a list with the received files
+ receivedFiles.put(item.getFieldName(), file);
+ receivedContentTypes.put(item.getFieldName(), item.getContentType());
+
+ String overwriteVal = request.getParameter("overwrite");
+ boolean overwrite = Boolean.parseBoolean(overwriteVal);
+
+ // process the uploaded file
+ processImport(request.getParameter("pc"), new
FileInputStream(file), overwrite);
+
+ // Compose a xml message with the full file information which can be
parsed in client side
+
response.append("<file-").append(count).append("-field>").append(item.getFieldName()).append("</file-").append(count).append("-field>\n");
+
response.append("<file-").append(count).append("-name>").append(item.getName()).append("</file-").append(count).append("-name>\n");
+
response.append("<file-").append(count).append("-size>").append(item.getSize()).append("</file-").append(count).append("-size>\n");
+
response.append("<file-").append(count).append("-type>").append(item.getContentType()).append("</file-").append(count).append("type>\n");
+ }
+ catch (Exception e)
+ {
+ throw new UploadActionException(e);
+ }
+ }
+ }
+
+ // Remove files from session because we have a copy of them
+ removeSessionFileItems(request);
+
+ // Send information of the received files to the client.
+ return response.append("</response>\n").toString();
+ }
+
+ /**
+ * Get the content of an uploaded file.
+ */
+ @Override
+ public void getUploadedFile(HttpServletRequest request, HttpServletResponse response)
throws IOException
+ {
+ String fieldName = request.getParameter(PARAM_SHOW);
+ File f = receivedFiles.get(fieldName);
+ if (f != null)
+ {
+ response.setContentType(receivedContentTypes.get(fieldName));
+ FileInputStream is = new FileInputStream(f);
+ copyFromInputStreamToOutputStream(is, response.getOutputStream());
+ }
+ else
+ {
+ renderXmlResponse(request, response, ERROR_ITEM_NOT_FOUND);
+ }
+ }
+
+ /**
+ * Remove a file when the user sends a delete request.
+ */
+ @Override
+ public void removeItem(HttpServletRequest request, String fieldName) throws
UploadActionException
+ {
+ File file = receivedFiles.get(fieldName);
+ receivedFiles.remove(fieldName);
+ receivedContentTypes.remove(fieldName);
+ if (file != null)
+ {
+ boolean deleted = file.delete();
+ if (!deleted) log.warn("Could not delete file " + file);
+ }
+ }
+
+ private void processImport(final String containerName, final InputStream in, final
boolean overwrite) throws Exception
+ {
+
+ doInRequest(containerName, new ContainerCallback<Void>()
+ {
+
+ @Override
+ public Void doInContainer(ExoContainer container) throws Exception
+ {
+ ManagementController controller = getComponent(container,
ManagementController.class);
+
+ Map<String, List<String>> attributes = Collections.emptyMap();
+ if (overwrite)
+ {
+ attributes = new HashMap<String, List<String>>(1);
+ attributes.put("import-strategy",
Collections.singletonList("overwrite"));
+ }
+ ManagedRequest request = ManagedRequest.Factory.create(
+ OperationNames.IMPORT_RESOURCE, PathAddress.pathAddress("mop"),
+ attributes, in, ContentType.ZIP);
+
+ ManagedResponse response = controller.execute(request);
+ if (!response.getOutcome().isSuccess())
+ {
+ throw new Exception(response.getOutcome().getFailureDescription());
+ }
+
+ return null;
+ }
+ });
+
+ }
+}
Added:
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/GateInServiceImpl.java
===================================================================
---
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/GateInServiceImpl.java
(rev 0)
+++
portal/trunk/gadgets/gwtGadgets/src/main/java/org/gatein/management/gadget/mop/exportimport/server/GateInServiceImpl.java 2011-09-13
05:13:55 UTC (rev 7367)
@@ -0,0 +1,193 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.management.gadget.mop.exportimport.server;
+
+import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+import com.google.gwt.user.server.rpc.SerializationPolicy;
+import com.google.gwt.user.server.rpc.SerializationPolicyLoader;
+import org.exoplatform.container.ExoContainer;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
+import org.gatein.management.api.ContentType;
+import org.gatein.management.api.PathAddress;
+import org.gatein.management.api.controller.ManagedRequest;
+import org.gatein.management.api.controller.ManagedResponse;
+import org.gatein.management.api.controller.ManagementController;
+import org.gatein.management.api.operation.OperationNames;
+import org.gatein.management.api.operation.model.ReadResourceModel;
+import org.gatein.management.gadget.mop.exportimport.client.DisplayableException;
+import org.gatein.management.gadget.mop.exportimport.client.GateInService;
+import org.gatein.management.gadget.mop.exportimport.client.TreeNode;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static
org.gatein.management.gadget.mop.exportimport.server.ContainerRequestHandler.*;
+
+/**
+ * {@code GateInServiceImpl}
+ * <p>
+ * The {@code GateInService} remote servlet implementation.
+ * </p>
+ * Created on Jan 3, 2011, 12:30:45 PM
+ *
+ * @author <a href="mailto:nbenothm@redhat.com">Nabil
Benothman</a>
+ * @version 1.0
+ */
+public class GateInServiceImpl extends RemoteServiceServlet implements GateInService
+{
+ private static final Logger log = LoggerFactory.getLogger(GateInService.class);
+
+ @Override
+ protected SerializationPolicy doGetSerializationPolicy(HttpServletRequest request,
String moduleBaseURL, String strongName)
+ {
+ // Code taken from RemoteServiceServlet
+ String serializationPolicyFilePath =
SerializationPolicyLoader.getSerializationPolicyFileName("/exportimport/" +
strongName);
+
+ // Open the RPC resource file and read its contents.
+ InputStream is =
getServletContext().getResourceAsStream(serializationPolicyFilePath);
+ try
+ {
+ if (is != null)
+ {
+ try
+ {
+ return SerializationPolicyLoader.loadFromStream(is, null);
+ }
+ catch (ParseException e)
+ {
+ log.error("Failed to parse the policy file '" +
serializationPolicyFilePath + "'", e);
+ }
+ catch (IOException e)
+ {
+ log.error("Could not read the policy file '" +
serializationPolicyFilePath + "'", e);
+ }
+ }
+ else
+ {
+ String message = "ERROR: The serialization policy file '"
+ + serializationPolicyFilePath
+ + "' was not found; did you forget to include it in this
deployment?";
+ log.error(message);
+ }
+ }
+ finally
+ {
+ if (is != null)
+ {
+ try
+ {
+ is.close();
+ }
+ catch (IOException e)
+ {
+ // Ignore this error
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Update the Tree item asynchronously
+ *
+ * @param containerName name of portal container
+ * @param tn The item to be updated
+ * @return the updated tree node
+ */
+ public TreeNode updateItem(String containerName, TreeNode tn)
+ {
+ //TODO: Do we need this ?
+ return tn;
+ }
+
+ /**
+ * Retrieve asynchronously the list of root nodes
+ *
+ * @param containerName The portal container name
+ * @return The list of the root nodes
+ */
+ public List<TreeNode> getRootNodes(String containerName) throws Exception
+ {
+ try
+ {
+ return doInRequest(containerName, new
ContainerCallback<List<TreeNode>>()
+ {
+ public List<TreeNode> doInContainer(ExoContainer container) throws
Exception
+ {
+ ManagementController controller = getComponent(container,
ManagementController.class);
+ List<TreeNode> nodes = new ArrayList<TreeNode>();
+ nodes.add(getSiteTypeNode(controller, "portal"));
+ nodes.add(getSiteTypeNode(controller, "group"));
+
+ return nodes;
+ }
+ });
+ }
+ catch (Exception e)
+ {
+ log.error("Exception obtaining portal and group site names.", e);
+ throw e;
+ }
+ }
+
+ private TreeNode getSiteTypeNode(ManagementController controller, String siteType)
throws Exception
+ {
+ try
+ {
+ ManagedRequest request = ManagedRequest.Factory.create(
+ OperationNames.READ_RESOURCE,
+ PathAddress.pathAddress("mop", siteType + "sites"),
+ ContentType.JSON);
+
+ ManagedResponse response = controller.execute(request);
+ if (!response.getOutcome().isSuccess())
+ {
+ throw new Exception(response.getOutcome().getFailureDescription());
+ }
+
+ ReadResourceModel result = (ReadResourceModel) response.getResult();
+ List<TreeNode> children = new
ArrayList<TreeNode>(result.getChildren().size());
+ for (String siteName : result.getChildren())
+ {
+ TreeNode siteNode = new TreeNode(siteName);
+ siteNode.setExportable(true);
+ siteNode.setType(siteType);
+ siteNode.setSiteName(siteName);
+ children.add(siteNode);
+ }
+
+ return new TreeNode(siteType, children);
+ }
+ catch (Exception e)
+ {
+ log.error("Exception getting site type " + siteType + "
node.", e);
+ throw e;
+ }
+ }
+}
Added: portal/trunk/gadgets/gwtGadgets/src/main/webapp/ExportImport.html
===================================================================
--- portal/trunk/gadgets/gwtGadgets/src/main/webapp/ExportImport.html
(rev 0)
+++ portal/trunk/gadgets/gwtGadgets/src/main/webapp/ExportImport.html 2011-09-13 05:13:55
UTC (rev 7367)
@@ -0,0 +1,44 @@
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file 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.
+ -->
+
+<!doctype html>
+<html>
+<head>
+ <meta http-equiv="content-type" content="text/html;
charset=UTF-8">
+ <title>MOP Export Import</title>
+ <script type="text/javascript" language="javascript"
src="exportimport/exportimport.nocache.js"></script>
+</head>
+<body>
+
+<h1>ExportImport</h1>
+
+<div id="rootpanelstyle"></div>
+<iframe src="javascript:''" id="__gwt_historyFrame"
tabIndex='-1'
+ style="position:absolute;width:0;height:0;border:0"></iframe>
+<noscript>
+ <div style="width: 22em; position: absolute; left: 50%; margin-left: -11em;
color: red; background-color: white; border: 1px solid red; padding: 4px; font-family:
sans-serif">
+ Your web browser must have JavaScript enabled
+ in order for this application to display correctly.
+ </div>
+</noscript>
+</body>
+</html>
\ No newline at end of file
Added: portal/trunk/gadgets/gwtGadgets/src/main/webapp/WEB-INF/gadget.xml
===================================================================
--- portal/trunk/gadgets/gwtGadgets/src/main/webapp/WEB-INF/gadget.xml
(rev 0)
+++ portal/trunk/gadgets/gwtGadgets/src/main/webapp/WEB-INF/gadget.xml 2011-09-13 05:13:55
UTC (rev 7367)
@@ -0,0 +1,32 @@
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file 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.
+ -->
+
+<gadgets
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_1
http://www.gatein.org/xml/ns/gadgets_1_0"
+
xmlns="http://www.gatein.org/xml/ns/gadgets_1_0">
+
+ <gadget name="SiteExportImport">
+ <path>/exportimport/Application.gadget.xml</path>
+ </gadget>
+
+</gadgets>
\ No newline at end of file
Added: portal/trunk/gadgets/gwtGadgets/src/main/webapp/WEB-INF/web.xml
===================================================================
--- portal/trunk/gadgets/gwtGadgets/src/main/webapp/WEB-INF/web.xml
(rev 0)
+++ portal/trunk/gadgets/gwtGadgets/src/main/webapp/WEB-INF/web.xml 2011-09-13 05:13:55
UTC (rev 7367)
@@ -0,0 +1,80 @@
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file 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.
+ -->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd" >
+
+<web-app>
+
+ <display-name>gwtGadgets</display-name>
+
+ <!-- TODO: Determine if these parameters (maxSize and slowUploads) is what we want
for this -->
+ <context-param>
+ <!-- max size of the upload request -->
+ <param-name>maxSize</param-name>
+ <param-value>3145728</param-value>
+ </context-param>
+
+ <context-param>
+ <!--
+ Useful in development mode to slow down the uploads in fast networks.
+ Put the number of milliseconds to sleep in each block received in the server.
+ false or 0, means don't use slow uploads
+ -->
+ <param-name>slowUploads</param-name>
+ <param-value>50</param-value>
+ </context-param>
+
+ <!-- GateIn service servlet -->
+ <servlet>
+ <servlet-name>gtnService</servlet-name>
+
<servlet-class>org.gatein.management.gadget.mop.exportimport.server.GateInServiceImpl</servlet-class>
+ </servlet>
+
+ <!-- file upload servlet-->
+ <servlet>
+ <servlet-name>uploadServlet</servlet-name>
+
<servlet-class>org.gatein.management.gadget.mop.exportimport.server.FileUploadServlet</servlet-class>
+ </servlet>
+
+ <servlet>
+ <servlet-name>downloadServlet</servlet-name>
+
<servlet-class>org.gatein.management.gadget.mop.exportimport.server.FileDownloadServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>gtnService</servlet-name>
+ <url-pattern>/exportimport/GateInService</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>uploadServlet</servlet-name>
+ <url-pattern>/exportimport/upload</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>downloadServlet</servlet-name>
+ <url-pattern>/exportimport/download</url-pattern>
+ </servlet-mapping>
+
+</web-app>
Modified: portal/trunk/gadgets/pom.xml
===================================================================
--- portal/trunk/gadgets/pom.xml 2011-09-13 03:41:42 UTC (rev 7366)
+++ portal/trunk/gadgets/pom.xml 2011-09-13 05:13:55 UTC (rev 7367)
@@ -35,5 +35,6 @@
<module>core</module>
<module>server</module>
<module>eXoGadgets</module>
+ <module>gwtGadgets</module>
</modules>
</project>
Modified: portal/trunk/packaging/jboss-as5/pkg/pom.xml
===================================================================
--- portal/trunk/packaging/jboss-as5/pkg/pom.xml 2011-09-13 03:41:42 UTC (rev 7366)
+++ portal/trunk/packaging/jboss-as5/pkg/pom.xml 2011-09-13 05:13:55 UTC (rev 7367)
@@ -909,6 +909,12 @@
<type>war</type>
</dependency>
<dependency>
+ <?move gatein.ear/gwtGadgets.war?>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.gwtGadgets</artifactId>
+ <type>war</type>
+ </dependency>
+ <dependency>
<?move gatein.ear/web.war?>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.portlet.web</artifactId>
Modified:
portal/trunk/packaging/jboss-as5/pkg/src/main/resources/jboss/server/default/conf/gatein/configuration.xml
===================================================================
---
portal/trunk/packaging/jboss-as5/pkg/src/main/resources/jboss/server/default/conf/gatein/configuration.xml 2011-09-13
03:41:42 UTC (rev 7366)
+++
portal/trunk/packaging/jboss-as5/pkg/src/main/resources/jboss/server/default/conf/gatein/configuration.xml 2011-09-13
05:13:55 UTC (rev 7367)
@@ -48,6 +48,9 @@
<string>eXoGadgets</string>
</value>
<value>
+ <string>gwtGadgets</string>
+ </value>
+ <value>
<string>eXoGadgetServer</string>
</value>
<value>
Modified:
portal/trunk/packaging/jboss-as5/pkg/src/main/resources/jboss/server/default/deploy/gatein.ear/META-INF/application.xml
===================================================================
---
portal/trunk/packaging/jboss-as5/pkg/src/main/resources/jboss/server/default/deploy/gatein.ear/META-INF/application.xml 2011-09-13
03:41:42 UTC (rev 7366)
+++
portal/trunk/packaging/jboss-as5/pkg/src/main/resources/jboss/server/default/deploy/gatein.ear/META-INF/application.xml 2011-09-13
05:13:55 UTC (rev 7367)
@@ -34,6 +34,12 @@
</module>
<module>
<web>
+ <web-uri>gwtGadgets.war</web-uri>
+ <context-root>gwtGadgets</context-root>
+ </web>
+ </module>
+ <module>
+ <web>
<web-uri>eXoGadgetServer.war</web-uri>
<context-root>eXoGadgetServer</context-root>
</web>
Modified: portal/trunk/packaging/jboss-as6/pkg/pom.xml
===================================================================
--- portal/trunk/packaging/jboss-as6/pkg/pom.xml 2011-09-13 03:41:42 UTC (rev 7366)
+++ portal/trunk/packaging/jboss-as6/pkg/pom.xml 2011-09-13 05:13:55 UTC (rev 7367)
@@ -900,6 +900,12 @@
<type>war</type>
</dependency>
<dependency>
+ <?move gatein.ear/gwtGadgets.war?>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.gwtGadgets</artifactId>
+ <type>war</type>
+ </dependency>
+ <dependency>
<?move gatein.ear/web.war?>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.portlet.web</artifactId>
Modified:
portal/trunk/packaging/jboss-as6/pkg/src/main/resources/jboss/server/default/conf/gatein/configuration.xml
===================================================================
---
portal/trunk/packaging/jboss-as6/pkg/src/main/resources/jboss/server/default/conf/gatein/configuration.xml 2011-09-13
03:41:42 UTC (rev 7366)
+++
portal/trunk/packaging/jboss-as6/pkg/src/main/resources/jboss/server/default/conf/gatein/configuration.xml 2011-09-13
05:13:55 UTC (rev 7367)
@@ -48,6 +48,9 @@
<string>eXoGadgets</string>
</value>
<value>
+ <string>gwtGadgets</string>
+ </value>
+ <value>
<string>eXoGadgetServer</string>
</value>
<value>
Modified:
portal/trunk/packaging/jboss-as6/pkg/src/main/resources/jboss/server/default/deploy/gatein.ear/META-INF/application.xml
===================================================================
---
portal/trunk/packaging/jboss-as6/pkg/src/main/resources/jboss/server/default/deploy/gatein.ear/META-INF/application.xml 2011-09-13
03:41:42 UTC (rev 7366)
+++
portal/trunk/packaging/jboss-as6/pkg/src/main/resources/jboss/server/default/deploy/gatein.ear/META-INF/application.xml 2011-09-13
05:13:55 UTC (rev 7367)
@@ -34,6 +34,12 @@
</module>
<module>
<web>
+ <web-uri>gwtGadgets.war</web-uri>
+ <context-root>gwtGadgets</context-root>
+ </web>
+ </module>
+ <module>
+ <web>
<web-uri>eXoGadgetServer.war</web-uri>
<context-root>eXoGadgetServer</context-root>
</web>
Modified: portal/trunk/packaging/jetty/pkg/pom.xml
===================================================================
--- portal/trunk/packaging/jetty/pkg/pom.xml 2011-09-13 03:41:42 UTC (rev 7366)
+++ portal/trunk/packaging/jetty/pkg/pom.xml 2011-09-13 05:13:55 UTC (rev 7367)
@@ -783,6 +783,12 @@
<type>war</type>
</dependency>
<dependency>
+ <?rename gwtGadgets.war?>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.gwtGadgets</artifactId>
+ <type>war</type>
+ </dependency>
+ <dependency>
<?rename web.war?>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.portlet.web</artifactId>
Modified:
portal/trunk/packaging/jetty/pkg/src/main/resources/jetty/gatein/conf/configuration.xml
===================================================================
---
portal/trunk/packaging/jetty/pkg/src/main/resources/jetty/gatein/conf/configuration.xml 2011-09-13
03:41:42 UTC (rev 7366)
+++
portal/trunk/packaging/jetty/pkg/src/main/resources/jetty/gatein/conf/configuration.xml 2011-09-13
05:13:55 UTC (rev 7367)
@@ -48,6 +48,9 @@
<string>eXoGadgets</string>
</value>
<value>
+ <string>gwtGadgets</string>
+ </value>
+ <value>
<string>eXoGadgetServer</string>
</value>
<value>
Modified: portal/trunk/packaging/tomcat/pkg/pom.xml
===================================================================
--- portal/trunk/packaging/tomcat/pkg/pom.xml 2011-09-13 03:41:42 UTC (rev 7366)
+++ portal/trunk/packaging/tomcat/pkg/pom.xml 2011-09-13 05:13:55 UTC (rev 7367)
@@ -781,6 +781,12 @@
<type>war</type>
</dependency>
<dependency>
+ <?rename gwtGadgets.war?>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.gwtGadgets</artifactId>
+ <type>war</type>
+ </dependency>
+ <dependency>
<?rename web.war?>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.portlet.web</artifactId>
Modified:
portal/trunk/packaging/tomcat/pkg/src/main/resources/tomcat/gatein/conf/configuration.xml
===================================================================
---
portal/trunk/packaging/tomcat/pkg/src/main/resources/tomcat/gatein/conf/configuration.xml 2011-09-13
03:41:42 UTC (rev 7366)
+++
portal/trunk/packaging/tomcat/pkg/src/main/resources/tomcat/gatein/conf/configuration.xml 2011-09-13
05:13:55 UTC (rev 7367)
@@ -48,6 +48,9 @@
<string>eXoGadgets</string>
</value>
<value>
+ <string>gwtGadgets</string>
+ </value>
+ <value>
<string>eXoGadgetServer</string>
</value>
<value>
Modified: portal/trunk/pom.xml
===================================================================
--- portal/trunk/pom.xml 2011-09-13 03:41:42 UTC (rev 7366)
+++ portal/trunk/pom.xml 2011-09-13 05:13:55 UTC (rev 7367)
@@ -561,6 +561,12 @@
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.gwtGadgets</artifactId>
+ <version>3.2.0-M02-SNAPSHOT</version>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.portlet.web</artifactId>
<version>3.2.0-M02-SNAPSHOT</version>
<type>war</type>
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/group/platform/administrators/navigation.xml
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/group/platform/administrators/navigation.xml 2011-09-13
03:41:42 UTC (rev 7366)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/group/platform/administrators/navigation.xml 2011-09-13
05:13:55 UTC (rev 7367)
@@ -52,6 +52,12 @@
<label>Services Management</label>
<page-reference>group::/platform/administrators::servicesManagement</page-reference>
</node>
+
+ <node>
+ <name>siteExportImport</name>
+ <label>Site Export/Import</label>
+
<page-reference>group::/platform/administrators::siteExportImport</page-reference>
+ </node>
</node>
</page-nodes>
</node-navigation>
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/group/platform/administrators/pages.xml
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/group/platform/administrators/pages.xml 2011-09-13
03:41:42 UTC (rev 7366)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/group/platform/administrators/pages.xml 2011-09-13
05:13:55 UTC (rev 7367)
@@ -103,4 +103,19 @@
<show-info-bar>false</show-info-bar>
</gadget-application>
</page>
+
+ <page>
+ <name>siteExportImport</name>
+ <title>Site Export/Import</title>
+
<access-permissions>manager:/platform/administrators</access-permissions>
+ <edit-permission>manager:/platform/administrators</edit-permission>
+ <gadget-application>
+ <gadget>
+ <gadget-ref>SiteExportImport</gadget-ref>
+ </gadget>
+ <title>Site Export/Import</title>
+
<access-permissions>manager:/platform/administrators</access-permissions>
+ <show-info-bar>false</show-info-bar>
+ </gadget-application>
+ </page>
</page-set>