cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically add File System Receivers to Web Projects?

tvaughan77
Champ in-the-making
Champ in-the-making
Hi,

For the longest time, I've had just 2 web projects in my Alfresco installation and as our business has grown, so too have the number of servers we need to deploy to.  Each time we need to  add server capacity, our sys admins would go be able to use puppet to quickly push out a new server with an installed File System Receiver, but then they'd manually go in to Alfresco and add a new File System Receiver in our web projects' "Actions -> Edit Web Projects -> Configure Deployment Receivers" page.  Over time, we've accumulated about 20 different deployment receivers, duplicated in both web projects.

We're about to add 4 or more new web projects and the thought of manually adding each FSR to each web project is really unappealing.  Is there a programmatic way to do this?  Any config file or DB table I can hack?
2 REPLIES 2

mrogers
Star Contributor
Star Contributor
There's nothing out of the box.    However the deployment config is just a child node of the web project node with a particular content model and assoc.    You could write a web script to create one. 

The code that will do it for you see CreateWebsiteWizard.java and EditWebsiteWizard.java   (And yes it needs a re-factor :cry: )

romschn
Star Collaborator
Star Collaborator
Below is how you can achieve this programatically.

1. Write a Java backed webscript
2. The backend java class for webscript will read the webproject dns name passed as a webscript argument.
3. It will fetch the webproject noderef using webproject service.
4. Create an XML file to configure deployment receivers to be read programatically.
5. Create DeploymentServerConfig objects and set the required deployment receiver properties accrodingly after reading from the XML file.
6. Add the Deployment receiver to the webproject as below
this.serviceRegistry.getNodeService().createNode(WebProjectNodeRef, WCMAppModel.ASSOC_DEPLOYMENTSERVER, WCMAppModel.ASSOC_DEPLOYMENTSERVER, WCMAppModel.TYPE_DEPLOYMENTSERVER, DeploymentServerConfig.getRepoProps());

You may get a clear idea if you refer to saveDeploymentServerConfig() in CreateWebSiteWizard.java.

Hope it helps.

Thanks
Getting started

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.