Package org.apache.wiki.ui.progress

# Class DefaultProgressManager

java.lang.Object
org.apache.wiki.ui.progress.DefaultProgressManager

All Implemented Interfaces:
  `ProgressManager`

public class DefaultProgressManager extends Object implements ProgressManager
Manages progressing items. In general this class is used whenever JSPWiki is doing something which may require a long time. In addition, this manager provides a JSON interface for finding remotely what the progress is. The JSON object name is JSON_PROGRESSTRACKER = ""progressTracker"".

Since:
  2.6

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`class`
`DefaultProgressManager.JSONTracker`
Provides access to a progress indicator, assuming you know the ID.

## Field Summary

### Fields inherited from interface org.apache.wiki.ui.progress.ProgressManager

`JSON_PROGRESSTRACKER`

## Constructor Summary

Constructors
Constructor
Description
`DefaultProgressManager()`
Creates a new ProgressManager.

## Method Summary

Modifier and Type
Method
Description
`String`
`getNewProgressIdentifier()`
You can use this to get an unique process identifier.
`int`
`getProgress(String id)`
Get the progress in percents.
`void`
`startProgress(ProgressItem pi, String id)`
Call this method to get your ProgressItem into the ProgressManager queue.
`void`
`stopProgress(String id)`
Call this method to remove your ProgressItem from the queue (after which getProgress() will no longer find it.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### DefaultProgressManager

public DefaultProgressManager()
Creates a new ProgressManager.

## Method Details

### getNewProgressIdentifier

public String getNewProgressIdentifier()
You can use this to get an unique process identifier.

Specified by:
  `getNewProgressIdentifier` in interface `ProgressManager`
Returns:
  A new random value

### startProgress

public void startProgress(ProgressItem pi, String id)
Call this method to get your ProgressItem into the ProgressManager queue. The ProgressItem will be moved to state STARTED.

Specified by:
  `startProgress` in interface `ProgressManager`
Parameters:
  `pi` - ProgressItem to start
  `id` - The progress identifier

### stopProgress

public void stopProgress(String id)
Call this method to remove your ProgressItem from the queue (after which getProgress() will no longer find it. The ProgressItem will be moved to state STOPPED.

Specified by:
  `stopProgress` in interface `ProgressManager`
Parameters:
  `id` - The progress identifier

### getProgress

public int getProgress(String id) throws IllegalArgumentException
Get the progress in percents.

Specified by:
  `getProgress` in interface `ProgressManager`
Parameters:
  `id` - The progress identifier.
Returns:
  a value between 0 to 100 indicating the progress
Throws:
  `IllegalArgumentException` - If no such progress item exists.