|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.sling.installer.api.tasks.InstallTask
public abstract class InstallTask
Base class for tasks that can be executed by the
OsgiInstaller.
The task is invoked by the installer through the execute(InstallationContext)
method. During execution the task should use the setFinishedState(ResourceState)
or setFinishedState(ResourceState, String) method once the task is
performed or the task decided that the task can never be performed.
If the task needs to be retried, the implementation should just not alter the
state at all. The installer will invoke the tasks at a later time again for
retrying.
| Field Summary | |
|---|---|
static java.lang.String |
ASYNC_ATTR_NAME
Attribute which is set by the OSGi installer for asynchronous execution. |
| Constructor Summary | |
|---|---|
InstallTask(TaskResourceGroup erl)
Constructor for the task |
|
| Method Summary | |
|---|---|
int |
compareTo(InstallTask o)
All comparisons are based on getSortKey(). |
boolean |
equals(java.lang.Object o)
|
abstract void |
execute(InstallationContext ctx)
This is the heart of the task - it performs the actual task. |
TaskResource |
getResource()
Return the corresponding resource - depending on the task this might be null. |
TaskResourceGroup |
getResourceGroup()
Return the corresponding resource - depending on the task this might be null. |
abstract java.lang.String |
getSortKey()
Tasks are sorted according to this key. |
int |
hashCode()
|
boolean |
isAsynchronousTask()
If this an asynchronous task it should return true
The OSGi installer will set the attribute ASYNC_ATTR_NAME
with an integer value. |
void |
setFinishedState(ResourceState state)
Set the finished state for the resource. |
void |
setFinishedState(ResourceState state,
java.lang.String alias)
Set the finished state for the resource and the alias |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String ASYNC_ATTR_NAME
1.
| Constructor Detail |
|---|
public InstallTask(TaskResourceGroup erl)
erl - The resource group or null.| Method Detail |
|---|
public TaskResource getResource()
public TaskResourceGroup getResourceGroup()
public abstract void execute(InstallationContext ctx)
ctx - The installation context.public abstract java.lang.String getSortKey()
public void setFinishedState(ResourceState state)
state - The new state.
public void setFinishedState(ResourceState state,
java.lang.String alias)
state - The new state.alias - The new aliaspublic java.lang.String toString()
toString in class java.lang.Objectpublic final boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic final int hashCode()
hashCode in class java.lang.Objectpublic final int compareTo(InstallTask o)
compareTo in interface java.lang.Comparable<InstallTask>public boolean isAsynchronousTask()
true
The OSGi installer will set the attribute ASYNC_ATTR_NAME
with an integer value.
The next time, after the asynchronous task has been run and
the OSGi installer has restarted, this attribute will be set
on the resource.
Asynchronous tasks should only be used for tasks which require
the OSGi installer to stop and force it to restart, like
a bundle update of the installer itself or a system update.
The OSGi installer stops itself for an asynchronous task and
is not able to restart itself!
true
otherwise false
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||