org.codehaus.mojo.webstart
Class JarResource

java.lang.Object
  extended by org.codehaus.mojo.webstart.JarResource

public class JarResource
extends java.lang.Object

This class represents a <jarResource> configuration element from the pom.xml file. It identifies an artifact that is to be processed by the plugin for inclusion in the JNLP bundle.

Since:
19 May 2007
Version:
$Revision: 6588 $
Author:
Kevin Stembridge, $LastChangedBy: bentmann $

Constructor Summary
JarResource()
          Creates a new uninitialized JarResource.
JarResource(org.apache.maven.artifact.Artifact artifact)
          Creates a new JarResource that wraps the given artifact.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns true if the given object is a JarResource and has the same combination of groupId, artifactId, version and classifier.
 org.apache.maven.artifact.Artifact getArtifact()
          Returns the underlying artifact that this instance represents.
 java.lang.String getArtifactId()
          Returns the value of the artifactId field.
 java.lang.String getClassifier()
          Returns the value of the classifier field.
 java.lang.String getGroupId()
          Returns the value of the groupId field.
 java.lang.String getHrefValue()
          Returns the value that should be output for this jar in the href attribute of the jar resource element in the generated JNLP file.
 java.lang.String getMainClass()
          Returns the fully qualified class name of the JNLP application's 'main' class but only if it is contained in the jar represented by this instance.
 java.lang.String getVersion()
          Returns the value of the version field.
 int hashCode()
          
 boolean isIncludeInJnlp()
          Returns the flag that indicates whether or not this resource should be included in the generated JNLP file.
 boolean isOutputJarVersion()
          Returns the flag that indicates whether or not the jar resource element in the generated JNLP file should include a version attribute.
 void setArtifact(org.apache.maven.artifact.Artifact artifact)
          Sets the underlying artifact that this instance represents.
protected  void setHrefValue(java.lang.String hrefValue)
          Sets the value that should be output for this jar in the href attribute of the jar resource element in the generated JNLP file.
protected  void setOutputJarVersion(boolean outputJarVersion)
          Returns the flag that indicates whether or not the jar resource element in the generated JNLP file should include a version attribute.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JarResource

public JarResource()
Creates a new uninitialized JarResource.


JarResource

public JarResource(org.apache.maven.artifact.Artifact artifact)
Creates a new JarResource that wraps the given artifact.

Parameters:
artifact - The artifact that this instance represents.
Throws:
java.lang.IllegalArgumentException - if artifact is null.
Method Detail

equals

public boolean equals(java.lang.Object obj)
Returns true if the given object is a JarResource and has the same combination of groupId, artifactId, version and classifier.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

getArtifactId

public java.lang.String getArtifactId()
Returns the value of the artifactId field.

Returns:
Returns the value of the artifactId field.

getClassifier

public java.lang.String getClassifier()
Returns the value of the classifier field.

Returns:
Returns the value of the classifier field.

getGroupId

public java.lang.String getGroupId()
Returns the value of the groupId field.

Returns:
Returns the value of the groupId field.

getVersion

public java.lang.String getVersion()
Returns the value of the version field.

Returns:
Returns the value of the version field.

getMainClass

public java.lang.String getMainClass()
Returns the fully qualified class name of the JNLP application's 'main' class but only if it is contained in the jar represented by this instance. Only one jarResource per plugin configuration can be declared with a main class. This is the value that will be populated in the generated JNLP file.

Returns:
Returns the value of the mainClass field, or null if the jar represented by this instance is not the one that contains the application's main class.

setOutputJarVersion

protected void setOutputJarVersion(boolean outputJarVersion)
Returns the flag that indicates whether or not the jar resource element in the generated JNLP file should include a version attribute. Default is true.

Parameters:
outputJarVersion -

isOutputJarVersion

public boolean isOutputJarVersion()
Returns the flag that indicates whether or not the jar resource element in the generated JNLP file should include a version attribute. Default is true.

Returns:
Returns the value of the outputJarVersion field.

getArtifact

public org.apache.maven.artifact.Artifact getArtifact()
Returns the underlying artifact that this instance represents.

Returns:
Returns the value of the artifact field.

setArtifact

public void setArtifact(org.apache.maven.artifact.Artifact artifact)
Sets the underlying artifact that this instance represents.

Parameters:
artifact -
Throws:
java.lang.IllegalArgumentException - if artifact is null.

setHrefValue

protected void setHrefValue(java.lang.String hrefValue)
Sets the value that should be output for this jar in the href attribute of the jar resource element in the generated JNLP file. If not set explicitly, this defaults to the file name of the underlying artifact.

Parameters:
hrefValue -

getHrefValue

public java.lang.String getHrefValue()
Returns the value that should be output for this jar in the href attribute of the jar resource element in the generated JNLP file. If not set explicitly, this defaults to the file name of the underlying artifact.

Returns:
The href attribute to be output for this jar resource in the generated JNLP file.

isIncludeInJnlp

public boolean isIncludeInJnlp()
Returns the flag that indicates whether or not this resource should be included in the generated JNLP file. The default is true, but you may want to exclude jars from the JNLP in cases where multiple versions of a jar are included in the JNLP bundle.

Returns:
Returns the value of the includeInJnlp field.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object


Copyright © 2005-2009. All Rights Reserved.