View Javadoc
1   /*
2    * Copyright (C) 2003-2008 eXo Platform SAS.
3    *
4    * This program is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Affero General Public License
6    * as published by the Free Software Foundation; either version 3
7    * of the License, or (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program; if not, see<http://www.gnu.org/licenses/>.
16   */
17  package org.exoplatform.services.wcm.extensions.deployment;
18  
19  import org.exoplatform.container.xml.InitParams;
20  import org.exoplatform.services.deployment.DeploymentPlugin;
21  import org.exoplatform.services.ecm.publication.PublicationService;
22  import org.exoplatform.services.jcr.RepositoryService;
23  import org.exoplatform.services.jcr.ext.common.SessionProvider;
24  import org.exoplatform.services.log.ExoLogger;
25  import org.exoplatform.services.log.Log;
26  import org.exoplatform.services.wcm.extensions.utils.PublicationUtils;
27  import org.exoplatform.services.wcm.publication.WCMPublicationService;
28  
29  /**
30   * Created by The eXo Platform SAS
31   * Author : Hoa Pham
32   * hoa.pham@exoplatform.com
33   * Sep 6, 2008
34   */
35  public class PublicationDeploymentPlugin extends DeploymentPlugin {
36  
37    /** The repository service. */
38    private RepositoryService repositoryService;
39  
40    /** The publication service */
41    private WCMPublicationService wcmPublicationService;
42  
43    /** The publication service */
44    private PublicationService publicationService;
45  
46    /** The log. */
47    private static final Log LOG = ExoLogger.getLogger(PublicationDeploymentPlugin.class.getName());
48    
49    public static final String UPDATE_EVENT = "WCMPublicationService.event.updateState";
50  
51    /**
52     * Instantiates a new xML deployment plugin.
53     *
54     * @param initParams the init params
55     * @param repositoryService the repository service
56     * @param publicationService the publication service
57     */
58    public PublicationDeploymentPlugin(InitParams initParams,
59                                       RepositoryService repositoryService,
60                                       PublicationService publicationService,
61                                       WCMPublicationService wcmPublicationService) {
62      super(initParams);
63      this.repositoryService = repositoryService;
64      this.publicationService = publicationService;
65      this.wcmPublicationService = wcmPublicationService;
66    }
67  
68    /* (non-Javadoc)
69     * @see org.exoplatform.services.deployment.DeploymentPlugin#deploy(org.exoplatform.services.jcr.ext.common.SessionProvider)
70     */
71    public void deploy(SessionProvider sessionProvider) throws Exception {
72      PublicationUtils.deployPublicationToPortal(initParams, repositoryService, wcmPublicationService, sessionProvider, null);
73    }
74  }