Importer für Personen (Rumpf)

git-svn-id: https://svn.libreccm.org/ccm/trunk@1083 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2011-09-01 05:36:07 +00:00
parent 62c6880332
commit 9809b53dae
4 changed files with 115 additions and 0 deletions

View File

@ -8,9 +8,11 @@
<provides>
<table name="ct_sci_members"/>
<initializer class="com.arsdigita.cms.contenttypes.SciMemberInitializer"/>
<initializer class="com.arsdigita.cms.dabin.PersonImporterInitializer"/>
</provides>
<scripts>
<schema directory="ccm-sci-types-member"/>
<data class="com.arsdigita.cms.contenttypes.SciMemberLoader"/>
<data class="com.arsdigita.cms.dabin.PersonImporterLoader"/>
</scripts>
</load>

View File

@ -0,0 +1,80 @@
package com.arsdigita.cms.dabin;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.Folder;
import com.arsdigita.packaging.Program;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import org.apache.commons.cli.CommandLine;
/**
*
* @author Jens Pelzetter
* @version $Id$
*/
public class PersonImporter extends Program {
private Properties config;
private ContentSection section;
private Folder memberFolder;
private Folder authorsFolder;
private Folder miscFolder;
public PersonImporter() {
this(true);
}
public PersonImporter(final boolean startup) {
super("PersonImporter",
"0.1.0",
"configFile",
startup);
}
@Override
protected void doRun(final CommandLine cmdLine) {
final String args[];
String mySqlHost;
String mySqlUser;
String mySqlPassword;
String mySqlDb;
System.out.println("");
System.out.println("");
System.out.println("PersonImporter is starting...");
//Get command line arguments...
args = cmdLine.getArgs();
if (args.length != 1) {
System.out.println("Invalid number of arguments.");
help(System.err);
System.exit(-1);
}
config = new Properties();
try {
config.loadFromXML(new FileInputStream(args[0]));
} catch (FileNotFoundException ex) {
System.err.printf("Configuration file '%s' not found:\n", args[0]);
ex.printStackTrace(System.err);
System.exit(-1);
} catch (IOException ex) {
System.err.printf("Failed to read configuration file '%s' "
+ "not found:\n",
args[0]);
ex.printStackTrace(System.err);
System.exit(-1);
}
mySqlHost = config.getProperty("mysql.host", "localhost");
mySqlUser = config.getProperty("mysql.user");
mySqlPassword = config.getProperty("mysql.password");
mySqlDb = config.getProperty("mysql.db");
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -0,0 +1,16 @@
package com.arsdigita.cms.dabin;
import com.arsdigita.runtime.CompoundInitializer;
/**
*
* @author Jens Pelzetter
* @version $Id$
*/
public class PersonImporterInitializer extends CompoundInitializer {
public PersonImporterInitializer() {
super();
}
}

View File

@ -0,0 +1,17 @@
package com.arsdigita.cms.dabin;
import com.arsdigita.loader.PackageLoader;
import com.arsdigita.runtime.ScriptContext;
/**
*
* @author Jens Pelzetter
* @version $Id$
*/
public class PersonImporterLoader extends PackageLoader {
public void run(final ScriptContext ctx) {
//Nothing yet
}
}