06-17-2010 11:20 AM
import java.io.File;
import java.io.FileNotFoundException;
import org.alfresco.repo.importer.ACPImportPackageHandler;
import org.alfresco.repo.importer.ImporterComponent;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.view.ExporterCrawlerParameters;
import org.alfresco.service.cmr.view.ImportPackageHandler;
import org.alfresco.service.cmr.view.Location;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
// define which part of the Repository to export
Location location = new Location(new StoreRef("workspace", "SpacesStore"));
location.setPath("/");
ExporterCrawlerParameters parameters = new ExporterCrawlerParameters();
parameters.setExportFrom(location);
String cheminFichierZip = "C:/Documents and Settings/user/Bureau/fichierEssai.zip";
File fichierZip = new File(cheminFichierZip);
ImportPackageHandler handler = new ACPImportPackageHandler (fichierZip,"utf-8");
// import (note: in this example we're not interested in progress)
ImporterComponent importer = new ImporterComponent() ;
importer.importView(handler,location,null,null);
}
}
import java.io.FileNotFoundException;
import javax.jcr.Node;
import javax.jcr.Repository;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
String result = "";
try {
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:alfresco/application-context.xml");
Repository repository = (Repository)context.getBean("JCR.Repository");
SimpleCredentials credentials = new SimpleCredentials("admin", "admin".toCharArray());
Session session = repository.login(credentials);
Node rootNode = session.getRootNode();
result = "Root node: path=" + rootNode.getPath() + ", type=" + rootNode.getPrimaryNodeType().getName();
} catch (Exception e) {
System.out.println("Error: " + e.getMessage());
}
System.out.println(result);
}
}
Et après 10 secondes il me renvoit : 06-22-2010 08:06 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.