Version of ingestFormat that fails in Fedora 3.0
Old version version of ingest with ingestFormat equal to "foxml1.0"
This fails in Fedora 3.0. giving the error:
fedora.server.errors.ObjectValidityException: Unsupported format: foxml1.0
Code example that generates error:
import fedora.server.types.gen.RepositoryInfo;
import java.io.*;
public class FedoraIngest {
private static final String protocol = "http";
private static final String host = "localhost";
private static final int port = 8080;
private static final String usr = "fedoraAdmin";
private static final String pwd = "pass";
private static final String collection = "swhp";
// private static final String foxmlSrc = "/Users/bill/projects/fedora/"
// + collection + "/";
private static final String foxmlSrc = "/Users/silvi003/Desktop/bill"
+ collection + "/";
public static void main(String[] argv) throws Exception {
String[] dir = new java.io.File(foxmlSrc).list(new FOXMLFilter());
FedoraSOAPClient caller = new FedoraSOAPClient(protocol, host, port, usr, pwd);
// test client connection status with the most basic call...
for (int i = 0; i< dir.length; i++) {
String pid = dir[i];
System.out.println("FedoraIngest " + pid);
try {
FileInputStream fis = null;
String fedoraPid = null;
File foxml = new File(foxmlSrc + pid);
fis = new FileInputStream(foxml);
fedoraPid = caller.ingest(fis, "foxml1.0", "ingest of " + pid);
System.out.println("new fedora object: " + fedoraPid);
}
catch (Exception excp) {
System.out.println("ingest error: " + excp.getMessage());
excp.printStackTrace();
}
}
}
}
Version of ingestFormat that works in Fedora 3.0
The ingestFormat value of "info:fedora/fedora-system:FOXML-1.1" works
in Fedora 3.0.
I found this value in the config file:
$FEDORA_SRC_HOME/src/properties/server/fedora/server/resources/Server.properties
Code example that works:
import fedora.server.types.gen.RepositoryInfo;
import java.io.*;
public class FedoraIngestOneFile {
private static final String protocol = "http";
private static final String host = "localhost";
private static final int port = 8080;
private static final String usr = "fedoraAdmin";
private static final String pwd = "pass";
public static void main(String[] argv) throws Exception {
FedoraSOAPClient caller = new FedoraSOAPClient(protocol, host, port, usr, pwd);
String FileName = "/Users/silvi003/Desktop/umndob_msp01688";
try {
File foxml = new File(FileName);
FileInputStream fis = new FileInputStream(foxml);
String fedoraPid = caller.ingest(fis, "info:fedora/fedora-system:FOXML-1.1", "ingest of " + FileName);
System.out.println("new fedora object: " + fedoraPid);
}
catch (Exception excp) {
System.out.println("ingest error: " + excp.getMessage());
excp.printStackTrace();
}
}
}