CSV Import Wizard

From Gcube Wiki
Revision as of 15:30, 5 October 2012 by Federico.defaveri (Talk | contribs)

Jump to: navigation, search

The CSV Import Wizard is a generic GWT widget for the import of a CSV file in a destination system. The widget has been developed using the GXT 2.2.x framework.

The CSV Import Wizard aims to help all the components that needs to integrate a CSV import procedure in their system.

The CSV import is made of those main steps:

  • the CSV file retrieving from a source like a local file system, a user workspace or an FTP site.
  • the definition of CSV parsing information like the presence of a header, the file encoding, the separator.
  • the final import in a target system like a service in the infrastructure or an FTP site.

The widget is pluggable to support different CSV sources and different target. A default local file system source is distributed with the widget.

A workspace source can be added through the CSV Import Wizard Workspace component.

Installation

In order to use the widget you need to perform those steps:

  1. add the widget library as project dependency
  2. add this entry to your <project>.gwt.xml file:
    <inherits name='org.gcube.portlets.user.csvimportwizard.CSVImportWizard'/>
  3. add those entries to your web.xml files:
    <servlet> 
     	<servlet-name>CSVImportService</servlet-name>
		<servlet-class>org.gcube.portlets.user.csvimportwizard.server.CSVImportServiceImpl</servlet-class>
    </servlet>
 
    <servlet-mapping>
       <servlet-name>CSVImportService</servlet-name>
       <url-pattern>/[[APPLICATION NAME]]/CSVImportService</url-pattern>
    </servlet-mapping>
 
    <servlet> 
     	<servlet-name>CSVServlet</servlet-name>
		<servlet-class>org.gcube.portlets.user.csvimportwizard.server.CSVServlet</servlet-class>
    </servlet>
 
    <servlet-mapping>
       <servlet-name>CSVServlet</servlet-name>
       <url-pattern>/[[APPLICATION NAME]]/CSVServlet</url-pattern>
    </servlet-mapping>

where [APPLICATION NAME] is your gwt application name.

If you want to use the local file system source you need to add also those lines:

 
    <servlet> 
     	<servlet-name>LocalUploadServlet</servlet-name>
		<servlet-class>org.gcube.portlets.user.csvimportwizard.server.local.LocalUploadServlet</servlet-class>
    </servlet>
 
    <servlet-mapping>
       <servlet-name>LocalUploadServlet</servlet-name>
       <url-pattern>/[[APPLICATION NAME]]/LocalUploadServlet</url-pattern>
    </servlet-mapping>