Expand my Community achievements bar.

SOLVED

Is there anyways we can use java code to replicate a package that is created using java code?

Avatar

Level 1

I've created a package using java code as follows.

 

Session session = slingRepository.loginAdministrative(null);

JcrPackageManager packageManager =  (JcrPackageManager)PackagingService.getPackageManager(session);

JcrPackage pack = packageManager.create(PACKAGE_GROUPNAME, packageName, PACKAGE_VERSION);

Now I need to replicate this package on all the publishers inside java code. However, I am unable to find any API that can do this. Can anyone please help me with the same?

 

Thanks,

Kinjal

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi Kinjal,

Use https://docs.adobe.com/docs/en/aem/6-0/develop/ref/javadoc/com/day/cq/replication/AgentManager.html to retrieve your agents and https://docs.adobe.com/docs/en/aem/6-0/develop/ref/javadoc/com/day/cq/replication/Agent.html API to replicate you data across.

P.S. Day was smart, not to club everything into one API, so to use replication you setup agents and use Agent API, to create packages you use PackageManger API's

Regards,

Peter

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi Kinjal,

Use https://docs.adobe.com/docs/en/aem/6-0/develop/ref/javadoc/com/day/cq/replication/AgentManager.html to retrieve your agents and https://docs.adobe.com/docs/en/aem/6-0/develop/ref/javadoc/com/day/cq/replication/Agent.html API to replicate you data across.

P.S. Day was smart, not to club everything into one API, so to use replication you setup agents and use Agent API, to create packages you use PackageManger API's

Regards,

Peter