com.atlassian.gadgets.refimpl
Class GadgetStateFactoryImpl
java.lang.Object
com.atlassian.gadgets.refimpl.GadgetStateFactoryImpl
- All Implemented Interfaces:
- GadgetStateFactory
public class GadgetStateFactoryImpl
- extends Object
- implements GadgetStateFactory
A reference implementation of GadgetStateFactory. Internally, it creates GadgetState instances using
a sequential ID, starting with 1000. The next available ID is stored in the global PluginSettings object.
The retrieval and update of the ID is synchronized, so this class is safe to use concurrently from multiple threads.
It is not, however, safe to use concurrently across multiple clustered application instances, as there is no
way to ensure that the PluginSettings retrieval and update occurs atomically. Host applications that may be
deployed in a clustered environment should be sure to use their own GadgetStateFactory implementation.
Other than the gadget ID and spec URI, all other gadget properties will be set to the default values determined by
GadgetState.Builder.
|
Constructor Summary |
GadgetStateFactoryImpl(com.atlassian.sal.api.pluginsettings.PluginSettingsFactory pluginSettingsFactory,
com.atlassian.sal.api.transaction.TransactionTemplate txTemplate)
Constructs a new GadgetStateFactoryImpl that uses the specified PluginSettingsFactory to store
the next available gadget ID. |
|
Method Summary |
GadgetState |
createGadgetState(URI gadgetSpecUri)
Creates a new GadgetState instance from the specified spec URI, using the next available unique ID. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GadgetStateFactoryImpl
public GadgetStateFactoryImpl(com.atlassian.sal.api.pluginsettings.PluginSettingsFactory pluginSettingsFactory,
com.atlassian.sal.api.transaction.TransactionTemplate txTemplate)
- Constructs a new
GadgetStateFactoryImpl that uses the specified PluginSettingsFactory to store
the next available gadget ID.
- Parameters:
pluginSettingsFactory - the factory used to retrieve the global PluginSettings instancetxTemplate - the transaction provider for creating new gadget states
createGadgetState
public GadgetState createGadgetState(URI gadgetSpecUri)
- Creates a new
GadgetState instance from the specified spec URI, using the next available unique ID. The
specified gadgetSpecUri is stored directly in the returned GadgetState object, and is not fetched
or validated in any way.
- Specified by:
createGadgetState in interface GadgetStateFactory
- Parameters:
gadgetSpecUri - the URI that the gadget spec file for the new gadget can be retrieved from
- Returns:
- a new
GadgetState instance constructed from the specified spec URI
Copyright © 2010 Atlassian. All Rights Reserved.