View Javadoc
1   package org.codehaus.mojo.webstart.dependency;
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 org.apache.maven.artifact.Artifact;
23  import org.codehaus.mojo.webstart.dependency.filenaming.DependencyFilenameStrategy;
24  import org.codehaus.mojo.webstart.sign.SignConfig;
25  
26  import java.io.File;
27  import java.util.List;
28  import java.util.Map;
29  
30  /**
31   * To configure a task on a jnlp dependency.
32   * <p/>
33   * Created on 1/4/14.
34   *
35   * @author Tony Chemit <chemit@codelutin.com>
36   * @since 1.0-beta-5
37   */
38  public class JnlpDependencyConfig
39  {
40      /**
41       * Global configuration used by all dependencies.
42       */
43      private final JnlpDependencyGlobalConfig globalConfig;
44  
45      /**
46       * Artifact to treat.
47       */
48      private final Artifact artifact;
49  
50      /**
51       * Should we use the outputJarVersion convention?
52       */
53      private final boolean outputJarVersion;
54      
55      /**
56       * Should we use unique versions?
57       */
58      private final boolean useUniqueVersions;
59  
60      /**
61       * Working directory to process this jnlp dependency.
62       */
63      private File workingDirectory;
64  
65      public JnlpDependencyConfig( JnlpDependencyGlobalConfig globalConfig, Artifact artifact, String finalName,
66                                   boolean outputJarVersion, boolean useUniqueVersions)
67      {
68          this.globalConfig = globalConfig;
69          this.artifact = artifact;
70          this.outputJarVersion = outputJarVersion;
71          this.useUniqueVersions = useUniqueVersions;
72          this.workingDirectory = new File( globalConfig.getWorkingDirectory(), finalName );
73      }
74  
75      public Artifact getArtifact()
76      {
77          return artifact;
78      }
79  
80      public File getWorkingDirectory()
81      {
82          return workingDirectory;
83      }
84  
85      public boolean isOutputJarVersion()
86      {
87          return outputJarVersion;
88      }
89  
90      public boolean isUseUniqueVersions() {
91  		return useUniqueVersions;
92  	}
93  
94  	public DependencyFilenameStrategy getDependencyFilenameStrategy()
95      {
96          return globalConfig.getDependencyFilenameStrategy();
97      }
98  
99      public File getFinalDirectory()
100     {
101         return globalConfig.getFinalDirectory();
102     }
103 
104     /**
105      * Returns the flag that indicates whether or not jar resources
106      * will be compressed using pack200.
107      *
108      * @return Returns the value of the pack200.enabled field.
109      */
110     public boolean isPack200()
111     {
112         return globalConfig.isPack200();
113     }
114 
115     /**
116      * Returns the files to be passed without pack200 compression.
117      *
118      * @return Returns the list value of the pack200.passFiles.
119      */
120     public List<String> getPack200PassFiles()
121     {
122         return globalConfig.getPack200PassFiles();
123     }
124 
125     /**
126      * Returns the flag that indicates whether or not a gzip should be
127      * created for each jar resource.
128      *
129      * @return Returns the value of the gzip field.
130      */
131     public boolean isGzip()
132     {
133         return globalConfig.isGzip();
134     }
135 
136     public boolean isVerbose()
137     {
138         return globalConfig.isVerbose();
139     }
140 
141     public SignConfig getSign()
142     {
143         return globalConfig.getSign();
144     }
145 
146     public Map<String, String> getUpdateManifestEntries()
147     {
148         return globalConfig.getUpdateManifestEntries();
149     }
150 
151     public boolean isUnsignAlreadySignedJars()
152     {
153         return globalConfig.isUnsignAlreadySignedJars();
154     }
155 
156     public boolean isCanUnsign()
157     {
158         return globalConfig.isCanUnsign();
159     }
160 
161     public boolean isSign()
162     {
163         return globalConfig.isSign();
164     }
165 
166     public boolean isUpdateManifest()
167     {
168         return globalConfig.isUpdateManifest();
169     }
170 }