View Javadoc
1   package org.apache.maven.plugin.eclipse;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.io.File;
23  import java.net.URL;
24  
25  import org.apache.maven.artifact.repository.ArtifactRepository;
26  import org.apache.maven.plugin.ide.IdeDependency;
27  
28  public class WorkspaceConfiguration
29  {
30      private File workspaceDirectory;
31  
32      private URL codeStylesURL;
33  
34      private String activeCodeStyleProfileName;
35  
36      private ArtifactRepository localRepository;
37  
38      private String defaultClasspathContainer;
39  
40      private IdeDependency[] workspaceArtefacts;
41  
42      private String defaultDeployServerId;
43  
44      private String defaultDeployServerName;
45  
46      public File getWorkspaceDirectory()
47      {
48          return this.workspaceDirectory;
49      }
50  
51      public void setWorkspaceDirectory( File dir )
52      {
53          this.workspaceDirectory = dir;
54      }
55  
56      public URL getCodeStylesURL()
57      {
58          return this.codeStylesURL;
59      }
60  
61      public void setCodeStylesURL( URL url )
62      {
63          this.codeStylesURL = url;
64      }
65  
66      public String getActiveStyleProfileName()
67      {
68          return this.activeCodeStyleProfileName;
69      }
70  
71      public void setActiveStyleProfileName( String name )
72      {
73          this.activeCodeStyleProfileName = name;
74      }
75  
76      public ArtifactRepository getLocalRepository()
77      {
78          return localRepository;
79      }
80  
81      public void setLocalRepository( ArtifactRepository localRepository )
82      {
83          this.localRepository = localRepository;
84      }
85  
86      public String getDefaultClasspathContainer()
87      {
88          return defaultClasspathContainer;
89      }
90  
91      public void setDefaultClasspathContainer( String defaultClasspathContainer )
92      {
93          this.defaultClasspathContainer = defaultClasspathContainer;
94      }
95  
96      public IdeDependency[] getWorkspaceArtefacts()
97      {
98          return workspaceArtefacts;
99      }
100 
101     public void setWorkspaceArtefacts( IdeDependency[] workspaceArtefacts )
102     {
103         this.workspaceArtefacts = workspaceArtefacts;
104     }
105 
106     public String getDefaultDeployServerId()
107     {
108         return defaultDeployServerId;
109     }
110 
111     public void setDefaultDeployServerId( String defaultDeployServerId )
112     {
113         this.defaultDeployServerId = defaultDeployServerId;
114     }
115 
116     public String getDefaultDeployServerName()
117     {
118         return defaultDeployServerName;
119     }
120 
121     public void setDefaultDeployServerName( String defaultDeployServerName )
122     {
123         this.defaultDeployServerName = defaultDeployServerName;
124     }
125 
126     /**
127      * @return the defined websphere server version and null if the target is no websphere.
128      */
129     public String getWebsphereVersion()
130     {
131         if ( getDefaultDeployServerId() != null && getDefaultDeployServerId().startsWith( "was." ) )
132         {
133             if (getDefaultDeployServerId().contains("v7"))
134             {
135                 return "7.0";
136             }
137             if (getDefaultDeployServerId().contains("v61"))
138             {
139                 return "6.1";
140             }
141             if (getDefaultDeployServerId().contains("v6"))
142             {
143                 return "6.0";
144             }
145             if (getDefaultDeployServerId().contains("v51"))
146             {
147                 return "5.1";
148             }
149             if (getDefaultDeployServerId().contains("v5"))
150             {
151                 return "5.0";
152             }
153         }
154         return null;
155     }
156 
157 }