com.atlassian.plugin
Class JarPluginArtifact
java.lang.Object
com.atlassian.plugin.JarPluginArtifact
- All Implemented Interfaces:
- PluginArtifact, PluginArtifact.AllowsReference, PluginArtifact.HasExtraModuleDescriptors
public final class JarPluginArtifact
- extends Object
- implements PluginArtifact, PluginArtifact.AllowsReference, PluginArtifact.HasExtraModuleDescriptors
The implementation of PluginArtifact that is backed by a jar file.
- Since:
- 2.0.0
- See Also:
PluginArtifact
JarPluginArtifact
public JarPluginArtifact(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(File jarFile,
PluginArtifact.AllowsReference.ReferenceMode referenceMode)
- Construct a PluginArtifact for a jar file and specify whether reference installation is supported.
- Parameters:
jarFile - the jar file comprising the artifact.referenceMode - The ReferenceMode used to implement allowsReference().
doesResourceExist
public boolean doesResourceExist(String name)
- Specified by:
doesResourceExist in interface PluginArtifact
- Returns:
- true if the resource exists in this artifact, otherwise false
getResourceAsStream
public InputStream getResourceAsStream(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 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 String toString()
- Overrides:
toString in class Object
getInputStream
public 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 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.
extraModuleDescriptorFiles
public Set<String> extraModuleDescriptorFiles(String rootFolder)
- Specified by:
extraModuleDescriptorFiles in interface PluginArtifact.HasExtraModuleDescriptors
- Returns:
- An Iterable containing the paths to any additional xml files found in scan folders
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 © 2015 Atlassian. All rights reserved.