org.openide.modules 7.27.1

org.openide.modules
Class ModuleInstall

java.lang.Object
  extended by org.openide.util.SharedClassObject
      extended by org.openide.modules.ModuleInstall
All Implemented Interfaces:
Externalizable, Serializable

public class ModuleInstall
extends SharedClassObject

Optional custom module lifecycle hooks. Most modules should not need this.

Specify this class in the manifest file with OpenIDE-Module-Install.

See Also:
Serialized Form

Constructor Summary
ModuleInstall()
           
 
Method Summary
protected  boolean clearSharedData()
           
 void close()
          Called when all modules agreed with closing and NetBeans will be closed.
 boolean closing()
          Called when NetBeans is about to exit.
 void installed()
          Deprecated. Use restored() instead.
 void restored()
          Called when an already-installed module is restored (during startup).
 void uninstalled()
          Called when the module is disabled while the application is still running.
 void updated(int release, String specVersion)
          Deprecated. Use restored() instead.
 void validate()
          Called when a module is being considered for loading.
 
Methods inherited from class org.openide.util.SharedClassObject
addNotify, addPropertyChangeListener, equals, finalize, findObject, findObject, firePropertyChange, getLock, getProperty, hashCode, initialize, putProperty, putProperty, readExternal, removeNotify, removePropertyChangeListener, reset, writeExternal, writeReplace
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModuleInstall

public ModuleInstall()
Method Detail

validate

public void validate()
              throws IllegalStateException
Called when a module is being considered for loading. (This would be before installed(), restored(), or updated(int, java.lang.String) are called.) If something is critically wrong with the module (missing ad-hoc dependency, missing license key, etc.) then IllegalStateException may be thrown to prevent it from being loaded (preferably with a localized annotation). The default implementation does nothing. The module cannot assume much about when this method will be called; specifically it cannot rely on layers or manifest sections to be ready, nor for the module's classloader to exist in the system class loader (so if loading bundles, icons, and so on, specifically pass in the class loader of the install class rather than relying on the default modules class loader).

Throws:
IllegalStateException
Since:
1.24

installed

@Deprecated
public void installed()
Deprecated. Use restored() instead.


restored

public void restored()
Called when an already-installed module is restored (during startup). Should perform whatever initializations are required.

Note that it is possible for module code to be run before this method is called, and that code must be ready nonetheless. For example, data loaders might be asked to recognize a file before the module is "restored". For this reason, but more importantly for general performance reasons, modules should avoid doing anything here that is not strictly necessary - often by moving initialization code into the place where the initialization is actually first required (if ever). This method should serve as a place for tasks that must be run once during every startup, and that cannot reasonably be put elsewhere.

Basic programmatic services are available to the module at this stage - for example, its class loader is ready for general use, any objects registered declaratively to lookup are ready to be queried, and so on.


updated

@Deprecated
public void updated(int release,
                               String specVersion)
Deprecated. Use restored() instead.


uninstalled

public void uninstalled()
Called when the module is disabled while the application is still running. Should remove whatever functionality that it had registered in restored().

Beware: in practice there is no way to ensure that this method will really be called. The module might simply be deleted or disabled while the application is not running. In fact this is always the case in NetBeans 6.0; the Plugin Manager only uninstalls or disables modules between restarts. This method will still be called if you reload a module during development.


closing

public boolean closing()
Called when NetBeans is about to exit. The default implementation returns true. The module may cancel the exit if it is not prepared to be shut down.

Returns:
true if it is ok to exit

close

public void close()
Called when all modules agreed with closing and NetBeans will be closed.


clearSharedData

protected boolean clearSharedData()
Overrides:
clearSharedData in class SharedClassObject

org.openide.modules 7.27.1

Built on December 7 2011.  |  Portions Copyright 1997-2011 Oracle. All rights reserved.