View Javadoc
1   /*
2    * Copyright (c) 2002-2020, City of 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.business;
35  
36  import java.util.HashMap;
37  import java.util.List;
38  import java.util.Map;
39  
40  import org.apache.commons.lang.StringUtils;
41  
42  import fr.paris.lutece.plugins.appcenter.modules.fastdeployapplication.business.fastaction.IAction;
43  import fr.paris.lutece.plugins.appcenter.modules.fastdeployapplication.service.MavenService;
44  import fr.paris.lutece.portal.service.util.AppLogService;
45  
46  public class ServerApplicationInstance implements Cloneable
47  {
48      private String _strCode;
49      private String _strCodeEnvironment;
50      private String _strName;
51      private String _strI18nKeyName;
52      private String _strHostName;
53  
54      // private String _strServerName;
55      private String _strFtpDirectoryInstall;
56      private String _strFtpDirectoryScript;
57      private String _strFtpDirectoryDump;
58      private String _strFtpDirectoryContext;
59  
60      private FtpInfo _ftpInfo;
61      private String _strType;
62      private HashMap<String, String> _hashMavenProfile;
63      private String _strBeanName;
64      private Integer _nStatus;
65      private List<IAction> _listServerApplicationAction;
66      private Map<String, String> _mapComplementaryInfos = new HashMap<>( );
67  
68      public String getName( )
69      {
70          return _strName;
71      }
72  
73      public void setName( String strName )
74      {
75          _strName = strName;
76      }
77  
78      public String getI18nKeyName( )
79      {
80          return _strI18nKeyName;
81      }
82  
83      public void setI18nKeyName( String strName )
84      {
85          _strI18nKeyName = strName;
86      }
87  
88      public String getFtpDirectoryInstall( )
89      {
90          return _strFtpDirectoryInstall;
91      }
92  
93      public void setFtpDirectoryInstall( String strFtpDeployDirectoryTarget )
94      {
95          _strFtpDirectoryInstall = strFtpDeployDirectoryTarget;
96      }
97  
98      public void setCode( String _strCode )
99      {
100         this._strCode = _strCode;
101     }
102 
103     public String getCode( )
104     {
105         return _strCode;
106     }
107 
108     public void setCodeEnvironment( String _strCodeEnvironment )
109     {
110         this._strCodeEnvironment = _strCodeEnvironment;
111     }
112 
113     public String getCodeEnvironment( )
114     {
115         return _strCodeEnvironment;
116     }
117 
118     public void setFtpInfo( FtpInfo _ftpInfo )
119     {
120         this._ftpInfo = _ftpInfo;
121     }
122 
123     public FtpInfo getFtpInfo( )
124     {
125         return _ftpInfo;
126     }
127 
128     public String getMavenProfile( int nIdApplication )
129     {
130         String strMavenProfile = MavenService.getService( ).getMvnProfilSaved( Integer.toString( nIdApplication ), _strCodeEnvironment, _strCode );
131         if ( StringUtils.isEmpty( strMavenProfile ) )
132         {
133             if ( ( _strCodeEnvironment != null ) && ( _hashMavenProfile != null ) && _hashMavenProfile.containsKey( _strCodeEnvironment ) )
134             {
135                 return _hashMavenProfile.get( _strCodeEnvironment );
136             }
137         }
138 
139         return strMavenProfile;
140     }
141 
142     public void setType( String _strType )
143     {
144         this._strType = _strType;
145     }
146 
147     public String getType( )
148     {
149         return _strType;
150     }
151 
152     public void setHashMavenProfile( HashMap<String, String> _hashMavenProfile )
153     {
154         this._hashMavenProfile = _hashMavenProfile;
155     }
156 
157     public HashMap<String, String> getHashMavenProfile( )
158     {
159         return _hashMavenProfile;
160     }
161 
162     public String getBeanName( )
163     {
164         return _strBeanName;
165     }
166 
167     public void setBeanName( String strBeanName )
168     {
169         _strBeanName = strBeanName;
170     }
171 
172     public void setStatus( Integer _nStatus )
173     {
174         this._nStatus = _nStatus;
175     }
176 
177     public Integer getStatus( )
178     {
179         return _nStatus;
180     }
181 
182     public void setListServerApplicationAction( List<IAction> _listServerApplicationAction )
183     {
184         this._listServerApplicationAction = _listServerApplicationAction;
185     }
186 
187     public List<IAction> getListServerApplicationAction( )
188     {
189         return _listServerApplicationAction;
190     }
191 
192     public String getFtpDirectoryDump( )
193     {
194         return _strFtpDirectoryDump;
195     }
196 
197     public void setFtpDirectoryDump( String _strFtpDirectoryDumpFile )
198     {
199         this._strFtpDirectoryDump = _strFtpDirectoryDumpFile;
200     }
201 
202     public String getFtpDirectoryContext( )
203     {
204         return _strFtpDirectoryContext;
205     }
206 
207     public void setFtpDirectoryContext( String _strFtpDirectoryContext )
208     {
209         this._strFtpDirectoryContext = _strFtpDirectoryContext;
210     }
211 
212     public String getFtpDirectoryScript( )
213     {
214         return _strFtpDirectoryScript;
215     }
216 
217     public void setFtpDirectoryScript( String _strFtpDirectoryScript )
218     {
219         this._strFtpDirectoryScript = _strFtpDirectoryScript;
220     }
221 
222     public Map<String, String> getMapComplementaryInfos( )
223     {
224         return _mapComplementaryInfos;
225     }
226 
227     public void setMapComplementaryInfos( Map<String, String> _mapComplementaryInfos )
228     {
229         this._mapComplementaryInfos = _mapComplementaryInfos;
230     }
231 
232     public String getHostName( )
233     {
234         return _strHostName;
235     }
236 
237     public void setHostName( String _strHostName )
238     {
239         this._strHostName = _strHostName;
240     }
241 
242     public Object clone( )
243     {
244         Object o = null;
245         try
246         {
247             o = super.clone( );
248         }
249         catch( CloneNotSupportedException cnse )
250         {
251 
252             AppLogService.error( "error during clone of Server Application Instance", cnse );
253         }
254         return o;
255     }
256 
257 }