}
@Override
- //public Class<ImportsCommon> getCommonPartClass() {
- public Class getCommonPartClass() {
- try {
- return Class.forName("org.collectionspace.services.imports.ImportsCommon");//.class;
- } catch (ClassNotFoundException e){
- return null;
- }
+ public Class<?> getCommonPartClass() {
+ return ImportsCommon.class;
}
-
- /* KRUFT:
-
- 1) here is how you can deal with poxpayloads:
- //PoxPayloadIn input = new PoxPayloadIn(xmlPayload);
- //ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(input);
- 2) here are some notes:
- //First, save the import request to a local file.
- // It may be huge. To accept a stream, send it as an upload request; see acceptUpload()
- 3) useful for debugging:
- System.out.println("\r\n\r\n\r\n=====================\r\n RUNNING create with xmlPayload: \r\n"+xmlPayload);
- */
-
-
- //public static final String TEMPLATE_DIR = "/src/trunk/services/imports/service/src/main/resources/templates";
-
private static String _templateDir = null;
public static String getTemplateDir(){
if (_templateDir == null){
import org.apache.commons.logging.Log;\r
import org.apache.commons.logging.LogFactory;\r
import org.collectionspace.services.nuxeo.client.java.NuxeoClientEmbedded;\r
-import org.collectionspace.services.nuxeo.client.java.NuxeoConnector;\r
import org.collectionspace.services.nuxeo.client.java.NuxeoConnectorEmbedded;\r
import org.nuxeo.ecm.core.api.repository.RepositoryInstance;\r
-//import org.nuxeo.ecm.core.client.NuxeoClient;\r
import org.nuxeo.ecm.core.io.DocumentPipe;\r
import org.nuxeo.ecm.core.io.DocumentReader;\r
import org.nuxeo.ecm.core.io.DocumentWriter;\r
\r
// based loosely on package org.nuxeo.ecm.shell.commands.io.ImportCommand;\r
public class ImportCommand {\r
- private static final Log log = LogFactory.getLog(ImportCommand.class);\r
+ private static final Log logger = LogFactory.getLog(ImportCommand.class);\r
\r
public String run(String src, String dest) throws Exception {\r
File file = new File(src);\r
///cspace way of configuring client and auth:\r
NuxeoClientEmbedded client = NuxeoConnectorEmbedded.getInstance().getClient();\r
- RepositoryInstance repository = client.openRepository();\r
+ RepositoryInstance repoSession = client.openRepository();\r
try {\r
- return importTree(repository, file, dest);\r
+ return importTree(repoSession, file, dest);\r
} finally {\r
- repository.close();\r
+// repository.close();\r
+ client.releaseRepository(repoSession);\r
}\r
}\r
\r