View Javadoc
1   package org.codehaus.mojo.webstart.generator;
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  
25  /**
26   * Created on 1/5/14.
27   *
28   * @author Tony Chemit <chemit@codelutin.com>
29   * @since 1.0-beta-5
30   */
31  public abstract class AbstractGeneratorExtraConfigWithDeps
32      implements GeneratorExtraConfigWithDeps
33  {
34  
35      private final String libPath;
36  
37      private final boolean pack200;
38  
39      private final boolean outputJarVersions;
40      
41      private final boolean useUniqueVersions;
42  
43      private final Artifact artifactWithMainClass;
44  
45      private final DependencyFilenameStrategy dependencyFilenameStrategy;
46  
47      public AbstractGeneratorExtraConfigWithDeps( String libPath, boolean pack200, boolean outputJarVersions,
48              									 boolean useUniqueVersions, Artifact artifactWithMainClass,
49                                                   DependencyFilenameStrategy dependencyFilenameStrategy )
50      {
51  
52          this.libPath = libPath;
53          this.pack200 = pack200;
54          this.outputJarVersions = outputJarVersions;
55          this.useUniqueVersions = useUniqueVersions;
56          this.artifactWithMainClass = artifactWithMainClass;
57          this.dependencyFilenameStrategy = dependencyFilenameStrategy;
58      }
59  
60      /**
61       * {@inheritDoc}
62       */
63      public boolean isPack200()
64      {
65          return pack200;
66      }
67  
68      /**
69       * {@inheritDoc}
70       */
71      public boolean isOutputJarVersions()
72      {
73          return outputJarVersions;
74      }
75  
76      /**
77       * {@inheritDoc}
78       */
79      public boolean isUseUniqueVersions()
80      {
81          return useUniqueVersions;
82      }
83      
84      /**
85       * {@inheritDoc}
86       */
87      public String getLibPath()
88      {
89          return libPath;
90      }
91  
92      /**
93       * {@inheritDoc}
94       */
95      public boolean isArtifactWithMainClass( Artifact artifact )
96      {
97          return artifactWithMainClass != null && artifactWithMainClass.equals( artifact );
98      }
99  
100     /**
101      * {@inheritDoc}
102      */
103     public String getDependencyFilename( Artifact artifact, Boolean outputJarVersion, Boolean useUniqueVersions )
104     {
105         return dependencyFilenameStrategy.getDependencyFilename( artifact, outputJarVersion, useUniqueVersions );
106     }
107 }