org.xwiki.extension.handler.internal
Class AbstractExtensionHandler

java.lang.Object
  extended by org.xwiki.extension.handler.internal.AbstractExtensionHandler
All Implemented Interfaces:
ExtensionHandler
Direct Known Subclasses:
JarExtensionHandler, XarExtensionHandler

public abstract class AbstractExtensionHandler
extends Object
implements ExtensionHandler

Base class for ExtensionHandler implementations.

Since:
4.0M1

Field Summary
protected  org.slf4j.Logger logger
          The logger to log.
 
Constructor Summary
AbstractExtensionHandler()
           
 
Method Summary
 void checkInstall(Extension extension, String namespace, Request request)
          Check if installing the passed extension is allowed.
 void checkUninstall(InstalledExtension extension, String namespace, Request request)
          Check if uninstalling the passed extension is allowed.
 void initialize(LocalExtension localExtension, String namespace)
          Initialize the provided local extension (during application startup, re-initialization...).
 void upgrade(LocalExtension previousLocalExtension, LocalExtension newLocalExtension, String namespace, Request request)
          Upgrade the provided local extension.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xwiki.extension.handler.ExtensionHandler
install, uninstall
 

Field Detail

logger

@Inject
protected org.slf4j.Logger logger
The logger to log.

Constructor Detail

AbstractExtensionHandler

public AbstractExtensionHandler()
Method Detail

upgrade

public void upgrade(LocalExtension previousLocalExtension,
                    LocalExtension newLocalExtension,
                    String namespace,
                    Request request)
             throws InstallException
Description copied from interface: ExtensionHandler
Upgrade the provided local extension.

Specified by:
upgrade in interface ExtensionHandler
Parameters:
previousLocalExtension - the previous installed version of the extension
newLocalExtension - the extension to install
namespace - the namespace from where to uninstall the extension
request - extra parameters
Throws:
InstallException - error when trying to upgrade the extension

initialize

public void initialize(LocalExtension localExtension,
                       String namespace)
                throws ExtensionException
Description copied from interface: ExtensionHandler
Initialize the provided local extension (during application startup, re-initialization...).

Specified by:
initialize in interface ExtensionHandler
Parameters:
localExtension - the extension to install
namespace - the namespace where to install the extension
Throws:
ExtensionException - error when trying to install the extension

checkInstall

public void checkInstall(Extension extension,
                         String namespace,
                         Request request)
                  throws InstallException
Description copied from interface: ExtensionHandler
Check if installing the passed extension is allowed.

It is generally used to do some non generic checking of whether or not it is possible to install the passed extension (not the right environment, not enough rights, etc.).

Specified by:
checkInstall in interface ExtensionHandler
Parameters:
extension - the extension to install
namespace - the namespace from where to install
request - extra parameters
Throws:
InstallException - installing the extension will fail

checkUninstall

public void checkUninstall(InstalledExtension extension,
                           String namespace,
                           Request request)
                    throws UninstallException
Description copied from interface: ExtensionHandler
Check if uninstalling the passed extension is allowed.

It is generally used to do some non generic checking of whether or not it is possible to uninstall the passed extension (not the right environment, not enough rights, etc.).

Specified by:
checkUninstall in interface ExtensionHandler
Parameters:
extension - the extension to uninstall
namespace - the namespace from where to uninstall
request - extra parameters
Throws:
UninstallException - uninstalling the extension will fail