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.commons.collections.MapUtils;
23  import org.codehaus.mojo.webstart.pack200.Pack200Config;
24  import org.codehaus.mojo.webstart.dependency.filenaming.DependencyFilenameStrategy;
25  import org.codehaus.mojo.webstart.sign.SignConfig;
26  
27  import java.io.File;
28  import java.util.Collections;
29  import java.util.List;
30  import java.util.Map;
31  
32  /**
33   * Created on 1/4/14.
34   *
35   * @author Tony Chemit <chemit@codelutin.com>
36   * @since 1.0-beta-5
37   */
38  public class JnlpDependencyGlobalConfig
39  {
40  
41      private final ClassLoader loader;
42  
43      private final File workingDirectory;
44  
45      private final File finalDirectory;
46  
47      private final Pack200Config pack200;
48  
49      private final SignConfig sign;
50  
51      private final Map<String, String> updateManifestEntries;
52  
53      private final boolean gzip;
54  
55      private final boolean verbose;
56  
57      private final boolean unsignAlreadySignedJars;
58  
59      private final boolean canUnsign;
60  
61      private final DependencyFilenameStrategy dependencyFilenameStrategy;
62  
63      public JnlpDependencyGlobalConfig( ClassLoader loader, DependencyFilenameStrategy dependencyFilenameStrategy,
64                                         File workingDirectory, File finalDirectory, Pack200Config pack200,
65                                         SignConfig sign, Map<String, String> updateManifestEntries, boolean gzip,
66                                         boolean verbose, boolean unsignAlreadySignedJars, boolean canUnsign )
67      {
68          this.loader = loader;
69          this.dependencyFilenameStrategy = dependencyFilenameStrategy;
70          this.workingDirectory = workingDirectory;
71          this.finalDirectory = finalDirectory;
72          this.pack200 = pack200;
73          this.sign = sign;
74          this.updateManifestEntries = Collections.unmodifiableMap( updateManifestEntries );
75          this.gzip = gzip;
76          this.verbose = verbose;
77          this.unsignAlreadySignedJars = unsignAlreadySignedJars;
78          this.canUnsign = canUnsign;
79      }
80  
81  
82      public DependencyFilenameStrategy getDependencyFilenameStrategy()
83      {
84          return dependencyFilenameStrategy;
85      }
86  
87      public File getWorkingDirectory()
88      {
89          return workingDirectory;
90      }
91  
92      public File getFinalDirectory()
93      {
94          return finalDirectory;
95      }
96  
97      /**
98       * Returns the files to be passed without pack200 compression.
99       *
100      * @return Returns the list value of the pack200.passFiles.
101      */
102     public List<String> getPack200PassFiles()
103     {
104         return isPack200() ? pack200.getPassFiles() : null;
105     }
106 
107     public SignConfig getSign()
108     {
109         return sign;
110     }
111 
112     public Map<String, String> getUpdateManifestEntries()
113     {
114         return updateManifestEntries;
115     }
116 
117     public boolean isGzip()
118     {
119         return gzip;
120     }
121 
122     public boolean isVerbose()
123     {
124         return verbose;
125     }
126 
127     public boolean isUnsignAlreadySignedJars()
128     {
129         return unsignAlreadySignedJars;
130     }
131 
132     public boolean isCanUnsign()
133     {
134         return canUnsign;
135     }
136 
137     public boolean isSign()
138     {
139         return sign != null;
140     }
141 
142     public ClassLoader getLoader()
143     {
144         return loader;
145     }
146 
147     public boolean isUpdateManifest()
148     {
149         return MapUtils.isNotEmpty( updateManifestEntries );
150     }
151 
152     public boolean isPack200()
153     {
154         return pack200 != null && pack200.isEnabled();
155     }
156 }