cancel
Showing results for 
Search instead for 
Did you mean: 

Export and Import through API

arnab_thokder
Champ in-the-making
Champ in-the-making
I am using alfresco 2.0 in windows with tomcat server and oracle database.

I am not able to understand the following code given in the wiki link http://wiki.alfresco.com/wiki/Export_and_Import :

// 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);

// setup an ACP Package Handler to export to an ACP file format
ExportPackageHandler handler = new ACPExportPackageHandler(…);

// now export (note: we're not interested in progress in the example)
exporter.exportView(handler, parameters, null);

Can anyone please explain how it will work… especially how the handler is being created and how 'exporter' will be obtained.

Is there any other way to export or import programmatically?

Thanks in advance.

Arnab
4 REPLIES 4

davidc
Star Contributor
Star Contributor
The handler is created via
new
.  The parameters to the constructor inform the exporter where to place the exported contents.

The exporter is the Exporter Service which is referenced by injecting it via Spring.  The bean is called 'ExporterService'.

jensgoldhammer
Champ in-the-making
Champ in-the-making
Hello,

I am a newbie in using this functions of the webclient api. I tried to get the import and export working, but also the firstFoundationClient does not work in my environment.
Can somebody deliver a working example maybe included in a project?

I am using Alfresco 2.9B (tomcat preconfigured).
Thanks,
Jens

dacia_berlina
Champ in-the-making
Champ in-the-making
Hi

Does someone manage to make an export import through API ? I spend 2 days looking for some usefull documentation and dind't find anything i could use.

The exporter is the Exporter Service which is referenced by injecting it via Spring. The bean is called 'ExporterService'. - what does this mean ? Can you copy paste an example ?

I have a separate applications who will make export/import to an alfresco 3 labs installation.
How can i get that exporter variable?

I found something :
ExporterService exporterService = getRepositoryImpl().getServiceRegistry().getExporterService();
But how do i get the RepositoryImpl ? I have just a WebServiceFactory…

Or:
ExporterService exporter = getServiceRegistry().getExporterService();
Same question… how do i get a ServiceRegistry ??

I hope someone(probably nobody) will have 1 minute to write an answer here..
Thanks!

mdutoo
Champ on-the-rise
Champ on-the-rise
Hi dacia_berlina

If you've only got a WebServiceFactory, it means you're using Alfresco through its webservice client. However Import / Export is not available using webservices to my knowledge.

Native APIs like ServiceRegistry and other services are only available locally in the Alfresco server. To take advantage of them, the easiest is to write a javascript or Java webscript (see webscript APIs on the wiki).

A little bit harder would be to write a Spring extension to Alfresco. You can see how it's done in the server side part of the ETL Connector extension for Alfresco (contributed on the Alfresco forge at http://forge.alfresco.com/projects/etlconnector/). Maybe you could even use it and provide ACP XML to it over REST HTTP ?