Package org.nuxeo.runtime.reload
Class ReloadComponent
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.runtime.reload.ReloadComponent
- All Implemented Interfaces:
Adaptable,Component,Extensible,ReloadService,TimestampedService
- Author:
- Bogdan Stefanescu
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static org.osgi.framework.Bundleprotected Longstatic final StringThe reload strategy to adopt for hot reload.static final Stringstatic final Stringstatic final StringFields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, nameFields inherited from interface org.nuxeo.runtime.reload.ReloadService
AFTER_RELOAD_EVENT_ID, BEFORE_RELOAD_EVENT_ID, FLUSH_EVENT_ID, FLUSH_SEAM_EVENT_ID, RELOAD_EVENT_ID, RELOAD_SEAM_EVENT_ID, RELOAD_TOPIC -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(ComponentContext context) Activates the component.protected voidclearJarFileFactoryCache(ReloadResult result) copyBundlesToDeploy(ReloadContext context) protected voidMethod copied from commons-io:commons-io:2.6 to handle replace if exist on Windows.voiddeactivate(ComponentContext context) Deactivates the component.protected ReloadResultdeployBundles(List<File> bundlesToDeploy) voidflush()Sends a runtime event with idReloadService.FLUSH_EVENT_IDso that listeners can be notified that a flush is needed (after a reload for instance).voidSends an event that can trigger reset of JaasCache.voidSends a runtime event with idReloadService.FLUSH_SEAM_EVENT_ID.protected static Filestatic org.osgi.framework.Bundlestatic org.osgi.framework.BundleContextgetOSGIBundleName(File file) Returns the OSGI bundle name if given file can be identified as an OSGI bundle, or null.protected static FileReturns the last time one of the flush commands where called on this service instance (ReloadService.flush()orReloadService.flushJaasCache()orReloadService.flushSeamComponents(), or null if never called.protected voidLogs theComponentManagerstatus.voidreload()Sends a runtime event with idReloadService.RELOAD_EVENT_IDso that listeners can be notified that a reload has been done.reloadBundles(ReloadContext context) Called by ReloadServiceInvoker#hotReloadBundles.voidReloads runtime framework propertiesvoidSends a runtime event with idReloadService.RELOAD_SEAM_EVENT_IDvoidRuns the deployment preprocessor.protected voidSets the last date date to current date timestampprotected URLprotected URLtoURL(org.osgi.framework.Bundle bundle) This method needs to be called before bundle uninstallation, otherwiseBundle.getLocation()throw a NPE.protected voidtriggerReload(String eventId) protected voidtriggerReloadWithNewTransaction(String eventId) protected ReloadResultundeployBundles(List<String> bundleNames) Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
addRuntimeMessage, addRuntimeMessage, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterContribution, unregisterExtensionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrderMethods inherited from interface org.nuxeo.runtime.service.TimestampedService
getLastModified, setLastModified
-
Field Details
-
RELOAD_STRATEGY_PARAMETER
The reload strategy to adopt for hot reload. Default value isRELOAD_STRATEGY_VALUE_DEFAULT.- Since:
- 9.3
- See Also:
-
RELOAD_STRATEGY_VALUE_STANDBY
- See Also:
-
RELOAD_STRATEGY_VALUE_RESTART
- See Also:
-
RELOAD_STRATEGY_VALUE_DEFAULT
- See Also:
-
bundle
protected static org.osgi.framework.Bundle bundle -
lastFlushed
-
-
Constructor Details
-
ReloadComponent
public ReloadComponent()
-
-
Method Details
-
getBundleContext
public static org.osgi.framework.BundleContext getBundleContext() -
getBundle
public static org.osgi.framework.Bundle getBundle() -
activate
Description copied from interface:ComponentActivates the component.This method is called by the runtime when a component is activated.
- Specified by:
activatein interfaceComponent- Overrides:
activatein classDefaultComponent- Parameters:
context- the runtime context
-
deactivate
Description copied from interface:ComponentDeactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
deactivatein interfaceComponent- Overrides:
deactivatein classDefaultComponent- Parameters:
context- the runtime context
-
reload
public void reload()Description copied from interface:ReloadServiceSends a runtime event with idReloadService.RELOAD_EVENT_IDso that listeners can be notified that a reload has been done.Also calls
ReloadService.reloadProperties()by default, but not other reload methods as they could alter the running application behaviour.- Specified by:
reloadin interfaceReloadService- See Also:
-
reloadProperties
Description copied from interface:ReloadServiceReloads runtime framework properties- Specified by:
reloadPropertiesin interfaceReloadService- Throws:
IOException
-
reloadSeamComponents
public void reloadSeamComponents()Description copied from interface:ReloadServiceSends a runtime event with idReloadService.RELOAD_SEAM_EVENT_ID- Specified by:
reloadSeamComponentsin interfaceReloadService
-
flush
public void flush()Description copied from interface:ReloadServiceSends a runtime event with idReloadService.FLUSH_EVENT_IDso that listeners can be notified that a flush is needed (after a reload for instance).Also calls
ReloadService.flushJaasCache()by default, but not other flush methods as they could alter the running application behaviour.- Specified by:
flushin interfaceReloadService- See Also:
-
flushJaasCache
public void flushJaasCache()Description copied from interface:ReloadServiceSends an event that can trigger reset of JaasCache.- Specified by:
flushJaasCachein interfaceReloadService
-
flushSeamComponents
public void flushSeamComponents()Description copied from interface:ReloadServiceSends a runtime event with idReloadService.FLUSH_SEAM_EVENT_ID.- Specified by:
flushSeamComponentsin interfaceReloadService
-
reloadBundles
Description copied from interface:ReloadServiceCalled by ReloadServiceInvoker#hotReloadBundles.- Specified by:
reloadBundlesin interfaceReloadService- Returns:
- the result of hot reload operation
- Throws:
org.osgi.framework.BundleException
-
copyBundlesToDeploy
protected List<File> copyBundlesToDeploy(ReloadContext context) throws org.osgi.framework.BundleException - Throws:
org.osgi.framework.BundleException
-
copyFile
Method copied from commons-io:commons-io:2.6 to handle replace if exist on Windows.- Throws:
IOException- Since:
- 2021.19
-
deployBundles
protected ReloadResult deployBundles(List<File> bundlesToDeploy) throws org.osgi.framework.BundleException - Throws:
org.osgi.framework.BundleException
-
undeployBundles
protected ReloadResult undeployBundles(List<String> bundleNames) throws org.osgi.framework.BundleException - Throws:
org.osgi.framework.BundleException
-
clearJarFileFactoryCache
-
toURL
This method needs to be called before bundle uninstallation, otherwiseBundle.getLocation()throw a NPE. -
toURL
-
logComponentManagerStatus
protected void logComponentManagerStatus()Logs theComponentManagerstatus. -
lastFlushed
Description copied from interface:ReloadServiceReturns the last time one of the flush commands where called on this service instance (ReloadService.flush()orReloadService.flushJaasCache()orReloadService.flushSeamComponents(), or null if never called.- Specified by:
lastFlushedin interfaceReloadService
-
setFlushedNow
protected void setFlushedNow()Sets the last date date to current date timestamp- Since:
- 5.6
-
runDeploymentPreprocessor
Description copied from interface:ReloadServiceRuns the deployment preprocessor.- Specified by:
runDeploymentPreprocessorin interfaceReloadService- Throws:
IOException- See Also:
-
getAppDir
-
getWarDir
-
getOSGIBundleName
Description copied from interface:ReloadServiceReturns the OSGI bundle name if given file can be identified as an OSGI bundle, or null. The OSGI bundle can be a jar or an exploded jar on file system.- Specified by:
getOSGIBundleNamein interfaceReloadService
-
triggerReloadWithNewTransaction
-
triggerReload
-