com.atlassian.plugin
Class JarPluginArtifact

java.lang.Object
  extended by com.atlassian.plugin.JarPluginArtifact
All Implemented Interfaces:
PluginArtifact, PluginArtifact.AllowsReference

public final class JarPluginArtifact
extends java.lang.Object
implements PluginArtifact, PluginArtifact.AllowsReference

The implementation of PluginArtifact that is backed by a jar file.

Since:
2.0.0
See Also:
PluginArtifact

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.plugin.PluginArtifact
PluginArtifact.AllowsReference
 
Nested classes/interfaces inherited from interface com.atlassian.plugin.PluginArtifact.AllowsReference
PluginArtifact.AllowsReference.Default
 
Constructor Summary
JarPluginArtifact(java.io.File jarFile)
          Construct a PluginArtifact for a jar file which does not allow reference installation.
JarPluginArtifact(java.io.File jarFile, boolean allowsReference)
          Construct a PluginArtifact for a jar file and specify whether reference installation is supported.
 
Method Summary
 boolean allowsReference()
          Query whether or not the PluginArtifact may be reference installed.
 boolean containsJavaExecutableCode()
           
 boolean doesResourceExist(java.lang.String name)
           
 java.io.InputStream getInputStream()
           
 java.lang.String getName()
           
 java.io.InputStream getResourceAsStream(java.lang.String fileName)
           
 java.io.File toFile()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JarPluginArtifact

public JarPluginArtifact(java.io.File jarFile)
Construct a PluginArtifact for a jar file which does not allow reference installation.

Parameters:
jarFile - the jar file comprising the artifact.

JarPluginArtifact

public JarPluginArtifact(java.io.File jarFile,
                         boolean allowsReference)
Construct a PluginArtifact for a jar file and specify whether reference installation is supported.

Parameters:
jarFile - the jar file comprising the artifact.
allowsReference - true iff reference installation is permitted.
Method Detail

doesResourceExist

public boolean doesResourceExist(java.lang.String name)
Specified by:
doesResourceExist in interface PluginArtifact
Returns:
true if the resource exists in this artifact, otherwise false

getResourceAsStream

public java.io.InputStream getResourceAsStream(java.lang.String fileName)
                                        throws PluginParseException
Specified by:
getResourceAsStream in interface PluginArtifact
Returns:
an input stream for the this file in the jar. Closing this stream also closes the jar file this stream comes from.
Throws:
PluginParseException - if the there was an exception retrieving the resource from the artifact

getName

public java.lang.String getName()
Specified by:
getName in interface PluginArtifact
Returns:
the original name of the plugin artifact file. Typically used for persisting it to disk with a meaningful name.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getInputStream

public java.io.InputStream getInputStream()
Specified by:
getInputStream in interface PluginArtifact
Returns:
a buffered file input stream of the file on disk. This input stream is not resettable.

toFile

public java.io.File toFile()
Specified by:
toFile in interface PluginArtifact
Returns:
the artifact as a file, or its underlying file if it is already one

containsJavaExecutableCode

public boolean containsJavaExecutableCode()
Specified by:
containsJavaExecutableCode in interface PluginArtifact
Returns:
true if the plugin contains or references java executable code.

allowsReference

public boolean allowsReference()
Description copied from interface: PluginArtifact.AllowsReference
Query whether or not the PluginArtifact may be reference installed.

Specified by:
allowsReference in interface PluginArtifact.AllowsReference
Returns:
true iff the artifact may be reference installed.


Copyright © 2013 Atlassian. All Rights Reserved.