Storing or uploading a asset (pdf,png) files using java into cms

As per my requirement i want to store a pdf or png format documents into the CMS using java. can you please guide me how to proceed further.

Have you taken a look at the Hippo Content Export / Import tool? We’ve used it in the past on a few different solutions and found that it is helpful

Thanks for your reply. we checked that one but i didn’t found any java related example there. they are provided groovy script only.

Hi,

Groovy code can be easily convertible to Java code as Groovy allows most Java style code plus their own shortcuts.
And, the built-in REST Service [1] is actually a Java implementation similarly to what you’re seeing in the groovy examples. See [2] and the other Java sources.

Woonsan

[1] https://bloomreach-forge.github.io/content-export-import/builtin-rest-services.html
[2] https://github.com/bloomreach-forge/content-export-import/blob/develop/repository-jaxrs/src/main/java/org/onehippo/forge/content/exim/repository/jaxrs/ContentEximImportService.java

Thanks Woonsanko for your inputs.

If possible can you please provide the example how to invoke the above EximImportService.java using java component. I already understand the code but here problem is invoking the service using testing method. I’m unable to create content node structure for the pdf docuemnt (The asset is take as HippoBean as primary type , I’m facing difficult for creating the content node for pdf via java). If possible please provide the test class for import and export service using java.

Thanks and have a nice day.
Anji

As it is a JAX-RS service, I don’t think it’s proper to use it in a groovy updater script directly.
Perhaps you can ask for some help from our professional consulting services about how to convert the groovy example to a java module to fulfill your use cases.

Woonsan