Package org.apache.tools.ant.taskdefs
Class AbstractJarSignerTask
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.AbstractJarSignerTask
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
The alias of signer.static final String
error string for unit test verification: "jar must be set through jar attribute or nested filesets"the filesets of the jars to signprotected File
The name of the jar file.protected static final String
name of JDK program we are looking forprotected String
password for the key in the storeprotected String
The url or path of keystore file.protected String
The maximum amount of memory to use for Jar signerprotected String
password for the storeprotected String
type of store,-storetype paramprotected boolean
strict checkingprotected boolean
verbose outputFields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a nested <arg> element that can be used to specify command line arguments not supported via specific attributes.protected void
addArgument
(ExecTask cmd, Commandline.Argument arg) add an argument to a commandvoid
addFileset
(FileSet set) Adds a set of files to signvoid
Add a system property.protected void
add a value argument to a commandprotected void
init processing logic; this is retained through our execution(s)protected void
bindToKeystore
(ExecTask cmd) bind to a keystore if the attributes are thereprotected ExecTask
create the jarsigner executable taskAdds a path of files to sign.protected Path
clone our path and add all explicitly specified FileSets as well, patch in the jar attribute as a new fileset if it is defined.clone our filesets vector, and patch in the jar attribute as a new fileset, if is definedprotected void
declareSysProperty
(ExecTask cmd, Environment.Variable property) protected void
any cleanup logicget the redirector.protected boolean
Has either a path or a fileset been specified?void
the alias to sign under; requiredprotected void
setCommonOptions
(ExecTask cmd) these are options common to signing and verifyingvoid
setExecutable
(String executable) Sets the actual executable command to invoke, instead of the binaryjarsigner
found in Ant's JDK.void
the jar file to sign; requiredvoid
setKeypass
(String keypass) password for private key (if different); optionalvoid
setKeystore
(String keystore) keystore location; requiredvoid
setMaxmemory
(String max) Set the maximum memory to be used by the jarsigner processvoid
setProviderArg
(String providerArg) Sets the value for the -providerArg command line argument.void
setProviderClass
(String providerClass) Sets the value for the -providerClass command line argument.void
setProviderName
(String providerName) Sets the value for the -providerName command line argument.void
setStorepass
(String storepass) password for keystore integrity; requiredvoid
setStoretype
(String storetype) keystore type; optionalvoid
setStrict
(boolean strict) do strict checkingvoid
setVerbose
(boolean verbose) Enable verbose output when signing; optional: default falseMethods inherited from class org.apache.tools.ant.Task
bindToOwner, execute, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
-
Field Details
-
ERROR_NO_SOURCE
error string for unit test verification: "jar must be set through jar attribute or nested filesets"- See Also:
-
JARSIGNER_COMMAND
-
jar
The name of the jar file. -
alias
The alias of signer. -
keystore
The url or path of keystore file. -
storepass
password for the store -
storetype
type of store,-storetype param -
keypass
password for the key in the store -
verbose
protected boolean verboseverbose output -
strict
protected boolean strictstrict checking- Since:
- Ant 1.9.1
-
maxMemory
The maximum amount of memory to use for Jar signer -
filesets
-
-
Constructor Details
-
AbstractJarSignerTask
public AbstractJarSignerTask()
-
-
Method Details
-
setMaxmemory
Set the maximum memory to be used by the jarsigner process- Parameters:
max
- a string indicating the maximum memory according to the JVM conventions (e.g. 128m is 128 Megabytes)
-
setJar
-
setAlias
the alias to sign under; required- Parameters:
alias
- the alias to sign under
-
setKeystore
keystore location; required- Parameters:
keystore
- the keystore location
-
setStorepass
password for keystore integrity; required- Parameters:
storepass
- the password for the keystore
-
setStoretype
keystore type; optional- Parameters:
storetype
- the keystore type
-
setKeypass
password for private key (if different); optional- Parameters:
keypass
- the password for the key (if different)
-
setVerbose
public void setVerbose(boolean verbose) Enable verbose output when signing; optional: default false- Parameters:
verbose
- if true enable verbose output
-
setStrict
public void setStrict(boolean strict) do strict checking- Parameters:
strict
- boolean- Since:
- Ant 1.9.1
-
addFileset
Adds a set of files to sign- Parameters:
set
- a set of files to sign- Since:
- Ant 1.4
-
addSysproperty
Add a system property.- Parameters:
sysp
- system property.
-
createPath
Adds a path of files to sign.- Returns:
- a path of files to sign.
- Since:
- Ant 1.7
-
setProviderName
Sets the value for the -providerName command line argument.- Parameters:
providerName
- the value for the -providerName command line argument- Since:
- Ant 1.10.6
-
setProviderClass
Sets the value for the -providerClass command line argument.- Parameters:
providerClass
- the value for the -providerClass command line argument- Since:
- Ant 1.10.6
-
setProviderArg
Sets the value for the -providerArg command line argument.- Parameters:
providerArg
- the value for the -providerArg command line argument- Since:
- Ant 1.10.6
-
addArg
Adds a nested <arg> element that can be used to specify command line arguments not supported via specific attributes.- Parameters:
arg
- the argument to add- Since:
- Ant 1.10.6
-
beginExecution
protected void beginExecution()init processing logic; this is retained through our execution(s) -
endExecution
protected void endExecution()any cleanup logic -
getRedirector
get the redirector. Non-null between invocations ofbeginExecution()
andendExecution()
- Returns:
- a redirector or null
-
setExecutable
Sets the actual executable command to invoke, instead of the binaryjarsigner
found in Ant's JDK.- Parameters:
executable
- the command to invoke.- Since:
- Ant 1.8.0
-
setCommonOptions
these are options common to signing and verifying- Parameters:
cmd
- command to configure
-
declareSysProperty
protected void declareSysProperty(ExecTask cmd, Environment.Variable property) throws BuildException - Parameters:
cmd
- command to configureproperty
- property to set- Throws:
BuildException
- if the property is not correctly defined.
-
bindToKeystore
bind to a keystore if the attributes are there- Parameters:
cmd
- command to configure
-
createJarSigner
create the jarsigner executable task- Returns:
- a task set up with the executable of jarsigner, failonerror=true and bound to our redirector
-
createUnifiedSources
-
createUnifiedSourcePath
clone our path and add all explicitly specified FileSets as well, patch in the jar attribute as a new fileset if it is defined.- Returns:
- a path that contains all files to sign
- Since:
- Ant 1.7
-
hasResources
protected boolean hasResources()Has either a path or a fileset been specified?- Returns:
- true if a path or fileset has been specified.
- Since:
- Ant 1.7
-
addValue
-
addArgument
add an argument to a command- Parameters:
cmd
- command to manipulatearg
- argument to add
-