View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.plugin.eclipse.osgiplugin;
20  
21  import java.io.File;
22  import java.io.IOException;
23  import java.util.jar.JarFile;
24  import java.util.jar.Manifest;
25  
26  /**
27   * Represents an Eclipse plugin that it's packaged as a jar
28   * 
29   * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
30   * @version $Id: PackagedPlugin.java 728546 2008-12-21 22:56:51Z bentmann $
31   */
32  public class PackagedPlugin
33      extends AbstractEclipseOsgiPlugin
34  {
35      public PackagedPlugin( File jar )
36          throws IOException
37      {
38          super( jar );
39      }
40  
41      public boolean hasManifest()
42          throws IOException
43      {
44          return getJar().getManifest() != null;
45      }
46  
47      public JarFile getJar()
48          throws IOException
49      {
50          return new JarFile( getFile(), false );
51      }
52  
53      public Manifest getManifest()
54          throws IOException
55      {
56          return getJar().getManifest();
57      }
58  
59      public File getJarFile()
60          throws IOException
61      {
62          return getFile();
63      }
64  
65  }