Improved bfn related xml importer
[cdmlib-apps.git] / app-import / src / main / java / eu / etaxonomy / cdm / app / common / CdmImportSources.java
index 7d89e30f3acc82dc237699074fd12f8712b56d18..1ba6cdad6390e6f133f7119905c445d769e238fe 100644 (file)
@@ -9,8 +9,13 @@
 */\r
 package eu.etaxonomy.cdm.app.common;\r
 \r
+import java.net.URI;\r
+import java.net.URL;\r
+\r
 import org.apache.log4j.Logger;\r
-import eu.etaxonomy.cdm.common.AccountStore;\r
+\r
+import eu.etaxonomy.cdm.app.berlinModelImport.SourceBase;\r
+import eu.etaxonomy.cdm.app.tcs.TcsSources;\r
 import eu.etaxonomy.cdm.io.common.Source;\r
 \r
 /**\r
@@ -18,86 +23,94 @@ import eu.etaxonomy.cdm.io.common.Source;
  * @date 21.04.2010\r
  *\r
  */\r
-public class CdmImportSources {\r
+public class CdmImportSources extends SourceBase{\r
        @SuppressWarnings("unused")\r
        private static final Logger logger = Logger.getLogger(CdmImportSources.class);\r
        \r
+       public static Source ROTE_LISTE_DB(){\r
+               String dbms = Source.ORACLE;\r
+               String strServer = "xxx";\r
+               String strDB = "dbName";\r
+               int port = 1433;\r
+               String userName = "adam";\r
+               return  makeSource(dbms, strServer, strDB, port, userName, null);\r
+       }\r
 \r
-       public static Source AFRICA_CHECKLIST_ACCESS(){\r
-               //      \r
+       \r
+       public static Source GLOBIS(){\r
+               String dbms = Source.SQL_SERVER_2005;\r
+               String strServer = "LENOVO-T61";\r
+               String strDB = "globis";\r
+               int port = 0001;\r
+               String userName = "user";\r
+               return  makeSource(dbms, strServer, strDB, port, userName, null);\r
+       }\r
+\r
+       public static Source GLOBIS_ODBC(){\r
+               String dbms = Source.ODDBC;\r
+               String strServer = "LENOVO-T61";\r
+               String strDB = "globis";\r
+               int port = 1433;\r
+               String userName = "sa";\r
+               return  makeSource(dbms, strServer, strDB, port, userName, null);\r
+       }\r
+       \r
+       public static Source GLOBIS_MDB(){\r
                String dbms = Source.ACCESS;\r
                String strServer = null;\r
-               //String strDB = "fernsTest";\r
-               String strDB = "C:\\localCopy\\Data\\eflora\\africa\\checklist_flore_afrique_centrale_corr.mdb";\r
-               int port = 1433;\r
+               String strDB = "C:\\localCopy\\Data\\globis\\globis.mdb";\r
+               int port = -1;\r
                String userName = "";\r
                return  makeSource(dbms, strServer, strDB, port, userName, null);\r
        }\r
 \r
-       \r
-       public static Source AFRICA_FERNS_ACCESS(){\r
-               //      \r
+       public static Source GLOBIS_MDB_20120928(){\r
                String dbms = Source.ACCESS;\r
                String strServer = null;\r
-               //String strDB = "fernsTest";\r
-               String strDB = "C:\\localCopy\\Data\\eflora\\africa\\Synopsis_Database_corrected.mdb";\r
-               int port = 1433;\r
+               String strDB = "C:\\localCopy\\Data\\globis\\globis.20120928.mdb";\r
+               int port = -1;\r
                String userName = "";\r
                return  makeSource(dbms, strServer, strDB, port, userName, null);\r
        }\r
 \r
-       public static Source AFRICA_FERNS_ACCESS_OLD(){\r
-               //      \r
+       public static Source GLOBIS_MDB_20140113(){\r
                String dbms = Source.ACCESS;\r
                String strServer = null;\r
-               //String strDB = "fernsTest";\r
-               String strDB = "C:\\localCopy\\Data\\eflora\\africa\\Mail_2010_05_05\\test.mdb";\r
-               int port = 1433;\r
+               String strDB = "C:\\localCopy\\Data\\globis\\globis_20140113.mdb";\r
+               int port = -1;\r
                String userName = "";\r
                return  makeSource(dbms, strServer, strDB, port, userName, null);\r
        }\r
-\r
        \r
-       public static Source GLOBIS(){\r
-               //      BerlinModel - Pesi-ERMS\r
-               String dbms = Source.SQL_SERVER_2005;\r
-               String strServer = "LENOVO-T61";\r
-               String strDB = "globis";\r
-               int port = 1433;\r
-               String userName = "adam";\r
+       //Problem MS Access ODBC Driver does not work on PESIIMPORT 3\r
+       @Deprecated\r
+       public static Source GLOBIS_MDB_20140113_PESIIMPORT(){\r
+               String dbms = Source.ACCESS;\r
+               String strServer = null;\r
+               String strDB = "\\\\PESIIMPORT3\\globis\\globis_20140113.mdb";\r
+               int port = -1;\r
+               String userName = "";\r
                return  makeSource(dbms, strServer, strDB, port, userName, null);\r
        }\r
-\r
-       public static Source GLOBIS_ODBC(){\r
-               //      BerlinModel - Pesi-ERMS\r
-               String dbms = Source.ODDBC;\r
-               String strServer = "LENOVO-T61";\r
-               String strDB = "globis";\r
+       \r
+       public static Source GLOBIS_MDB_20140113_PESIIMPORT_SQLSERVER(){\r
+               String dbms = Source.SQL_SERVER_2008;\r
+               String strServer = "PESIIMPORT3";\r
+               String strDB = "globis_orig_20140113";\r
                int port = 1433;\r
-               String userName = "sa";\r
+               String userName = "globisImport";\r
                return  makeSource(dbms, strServer, strDB, port, userName, null);\r
        }\r
        \r
-       \r
-       /**\r
-        * Initializes the source.\r
-        * @param dbms\r
-        * @param strServer\r
-        * @param strDB\r
-        * @param port\r
-        * @param userName\r
-        * @param pwd\r
-        * @return the source\r
-        */\r
-       private static Source makeSource(String dbms, String strServer, String strDB, int port, String userName, String pwd ){\r
-               //establish connection\r
-               Source source = null;\r
-               source = new Source(dbms, strServer, strDB);\r
-               source.setPort(port);\r
-                       \r
-               pwd = AccountStore.readOrStorePassword(dbms, strServer, userName, pwd);\r
-               source.setUserAndPwd(userName, pwd);\r
-               // write pwd to account store\r
-               return source;\r
+       public static URI SYNTHESYS_SPECIMEN(){\r
+               //              tcsXmlTest.xml\r
+               URL url = new TcsSources().getClass().getResource("/specimen/SynthesysSpecimenExample.xls");\r
+               String sourceUrl = url.toString();\r
+               URI uri = URI.create(sourceUrl);\r
+               return uri;     \r
        }\r
+       \r
+       \r
+       \r
+\r
 }\r