org.equanda.util.ymport
Class ImportUtil

java.lang.Object
  extended by org.equanda.util.ymport.ImportUtil

public final class ImportUtil
extends Object

utility for sending a file or strings to the import servlet and getting the answer

Author:
NetRom team, Joachim Van der Auwera

Method Summary
static String importData(String importData, String urlString, ImportCredentials credentials)
          sends data to the import servlet
static String importFile(String fileName, String urlString, ImportCredentials credentials)
          sends the content of a file to the import servlet not used anymore
static String importStrings(String[] lines, String urlString, ImportCredentials credentials)
          sends strings to the import servlet
static String quote(String in)
          properly quote a string for import, so the result has quotes added at the beginning and end, and has all quotes in the string doubles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

importStrings

public static String importStrings(String[] lines,
                                   String urlString,
                                   ImportCredentials credentials)
                            throws Exception
sends strings to the import servlet

Parameters:
lines - Strings wich are sent to the import servlet
urlString - url to connect to
credentials - credentials
Returns:
error string from import, null when no error
Throws:
Exception - on failure

importData

public static String importData(String importData,
                                String urlString,
                                ImportCredentials credentials)
                         throws Exception
sends data to the import servlet

Parameters:
importData - data which is sent to the import servlet
urlString - url to connect to
credentials - credentials
Returns:
error string from import, null when no error
Throws:
Exception - on failure

importFile

public static String importFile(String fileName,
                                String urlString,
                                ImportCredentials credentials)
                         throws Exception
sends the content of a file to the import servlet not used anymore

Parameters:
fileName - path to the file
urlString - url to connect to
credentials - credentials
Returns:
error string from import, null when no error
Throws:
Exception - on failure

quote

public static String quote(String in)
properly quote a string for import, so the result has quotes added at the beginning and end, and has all quotes in the string doubles.

Parameters:
in - string to be quoted
Returns:
properly quoted string


Copyright © 2007-2009. All Rights Reserved.