View Javadoc
1   /*
2    * Copyright (c) 2002-2017, Mairie de Paris
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions
7    * are met:
8    *
9    *  1. Redistributions of source code must retain the above copyright notice
10   *     and the following disclaimer.
11   *
12   *  2. Redistributions in binary form must reproduce the above copyright notice
13   *     and the following disclaimer in the documentation and/or other materials
14   *     provided with the distribution.
15   *
16   *  3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17   *     contributors may be used to endorse or promote products derived from
18   *     this software without specific prior written permission.
19   *
20   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30   * POSSIBILITY OF SUCH DAMAGE.
31   *
32   * License 1.0
33   */
34  package fr.paris.lutece.plugins.appcenter.modules.fastdeployapplication.service.vcs;
35  
36  import fr.paris.lutece.plugins.appcenter.modules.fastdeployapplication.business.CommandResult;
37  import fr.paris.lutece.plugins.appcenter.modules.fastdeployapplication.business.vcs.AbstractVCSUser;
38  import fr.paris.lutece.plugins.appcenter.modules.fastdeployapplication.web.exception.VCSUserNotSignedException;
39  import fr.paris.lutece.util.ReferenceList;
40  import java.io.File;
41  import java.io.FileNotFoundException;
42  
43  public interface IVCSService<T extends AbstractVCSUser>
44  {
45      void init( );
46  
47      /**
48       * Get the ReferenceList of the tags of a site
49       * 
50       * @param strUrlSite
51       *            the Url of the repo
52       * @param user
53       *            the VCS user
54       * @param strSiteName
55       *            the name of the site
56       * @return the ReferenceList of the tags of the repo
57       */
58      ReferenceList getTagsSite( String strUrlSite, T user, String strSiteName );
59  
60      /**
61       * Perform the checkout of the site
62       * 
63       * @param strSiteName
64       *            the site name
65       * @param strUrl
66       *            the url of the repo
67       * @param user
68       *            the VCS user
69       * @param commandResult
70       *            the command result
71       * @param strBranch
72       *            the branch
73       * @param strTag
74       *            the tag
75       * @return
76       */
77      String doCheckoutSite( String strSiteName, String strUrl, T user, CommandResult commandResult, String strBranch, String strTag );
78  
79      /**
80       * Get the reference list of the upgrades SQL Files
81       * 
82       * @param strSiteName
83       *            the site name
84       * @param strUrlSite
85       *            the url of the repo
86       * @param user
87       *            the VCS user
88       * @return the reference list of the upgrades files
89       */
90      ReferenceList getUpgradesFiles( String strSiteName, String strUrlSite, T user );
91  
92      /**
93       * Get the inpustream of the upgrade SQL File
94       * 
95       * @param strSiteName
96       *            the site name
97       * @param strUrlSite
98       *            the url of the repo
99       * @param user
100      *            the VCS user
101      * @param strFileName
102      *            the file name
103      * @return the inputstream of the upgrade file
104      */
105     File getUpgradeFile( String strSiteName, String strUrlSite, T user, String strFileName ) throws FileNotFoundException;
106 
107     /**
108      * Get the artifact id of the site in the VCS (it's often the site name)
109      * 
110      * @param strPathRepo
111      *            the path of the repository
112      * @return the artifact id of the site
113      */
114     String getArtifactId( String strPathRepo );
115 
116     /**
117      * Check if the repo is public or private
118      * 
119      * @return true if the repo is private, false otherwise
120      */
121     boolean isPrivate( );
122 
123     /**
124      * Check if the provided VCS User is authorized to access to repo
125      * 
126      * @param strRepoUrl
127      * @param user
128      * @throws VCSUserNotSignedException
129      */
130     void checkAuthentication( String strRepoUrl, T user ) throws VCSUserNotSignedException;
131     
132     /**
133      * Get the type of the VCS Service
134      * @return the type of the VCS Service
135      */
136     String getVCSType( );
137 }