atg.nucleus
Class Nucleus

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.nucleus.GenericContext
              extended by atg.nucleus.Nucleus
All Implemented Interfaces:
NameContext, NameContextBindingEventSource, NameContextBindingListener, NameContextElement, atg.naming.NameContextPreBindingEventSource, NameResolver, AdminableService, atg.nucleus.ConfigurationLockRegistry, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener, javax.servlet.Servlet, javax.servlet.ServletContext

public class Nucleus
extends GenericContext
implements javax.servlet.Servlet

A Nucleus serves two purposes: it is the root of a NameContext hierarchy, and it implements the policies for resolving names in the hierarchy.

Because a Nucleus is the root of the naming hierarchy, the Nucleus has no enclosing NameContext, its name is null, and its absolute name is "/".

When a Nucleus is constructed, it must be passed the configuration path. From there, the Nucleus will find its own configuration, including the property "initialServiceName". This initial service name is then resolved, which causes the rest of the services to be started.


Nested Class Summary
 class Nucleus.ValidationRunner
           
 
Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 boolean mAllowReloadableComponents
           
 java.lang.String mLastValidationFailureReason
           
static int RESTART_STATUS
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
Nucleus(java.lang.String pConfigPath)
          Constructs a new Nucleus.
Nucleus(java.lang.String pConfigPath, java.lang.String pRelativePathPrefix, LogListener pListener)
          Constructs a new Nucleus.
 
Method Summary
 void addCachedResolveTime(long pTime)
           
 void addComponentListener(atg.nucleus.ComponentListener l)
          add a ComponentListener -- delegated to ComponentRegistry which monitors component activations/deactivations.
 void addConfigurationListener(atg.nucleus.ConfigurationListener l)
          add a ConfigurationListener
 void addPostStartupAction(atg.nucleus.PostStartupAction pPostStartupAction)
          Add a start-up action to be performed after startup.
 void addUnCachedResolveTime(long pTime)
           
protected  javax.servlet.Servlet createAdminServlet()
          Creates and returns a new Servlet that will administer this service.
protected  MultipleConfigurationFinder createConfigurationFinder()
          Creates and returns the MultipleConfigurationFinder that will be used to find configurations.
 void destroy()
          Called when the servlet is to be destroyed
static boolean displayLicense(Nucleus pNucleus)
          Displays the license in an AWT frame, returns true if accepted, false if not.
protected  javax.servlet.Servlet fetchNextServlet()
           
 void fireConfigurationDeleted(atg.nucleus.ConfigurationEvent evt)
          fire a ConfigurationEvent deletion
 void fireConfigurationUpdated(atg.nucleus.ConfigurationEvent evt)
          fire a ConfigurationEvent update
protected  java.lang.String formatServiceName(java.lang.String pServiceName, javax.servlet.http.HttpServletRequest pRequest)
           
 java.lang.String getAbsoluteElementName(NameContextElement pElement, java.lang.String pName)
          Returns what would be the absolute name of the specified element if it were contained by the specified element.
 java.lang.String getAbsoluteName(NameContextElement pElement)
          Returns the absolute name of the specified NameContextElement.
 java.lang.String getAdminServerPrefix()
           
 atg.nucleus.AllowedClasses getAllowedClasses()
          The object that determines which classes may or may not be used in Nucleus.
 java.lang.String[] getAllowedClassNames()
           
 byte[] getAllowedClassNamesSignature()
           
 boolean getAllowReloadableComponents()
           
 java.lang.String[] getApplicationNames()
           
 java.lang.String[] getApplicationURLs()
           
 BeanConfigurator getBeanConfigurator()
          Returns the BeanConfigurator that should be used to configure a bean from Properties.
 boolean getCheckFileNameCase()
          Whether or not we check the case of property file names against the canonical case used by the OS.
 boolean getCheckForSerFiles()
          Whether or not we check for .ser files when instantiating beans.
static java.lang.ClassLoader getClassLoader()
          Returns the global class loader for all Nuclei.
 atg.nucleus.ComponentLockManager getComponentLockManager()
          Get the component lock manager.
 java.io.File[] getConfigPath()
           
 java.lang.String getConfigPath(java.lang.String pServerName)
          Returns the config path for a specified server name
 java.lang.String[] getConfigPathNames()
          The current configpath, separated into individual config path entries.
 atg.nucleus.ConfigurationCacheEntry getConfigurationCacheEntry(java.lang.String pConfigName)
          Gets the cached Configuration object
 atg.nucleus.ConfigurationCacheEntry getConfigurationCacheEntry(java.lang.String pConfigName, boolean pForceRefresh)
          Gets the cached Configuration object
 long getConfigurationCheckMilliseconds()
           
 java.lang.String getConfigurationCompileCommand()
          Returns the command used to compile java configurations
 atg.nucleus.ConfigurationFileSystems getConfigurationFileSystems()
          Return the ConfigurationFileSystems object for this Nucleus
 ConfigurationFinder getConfigurationFinder()
          Returns the ConfigurationFinder that should be used to obtain the Configuration for a given configuration name.
 atg.nucleus.ConfigurationListener[] getConfigurationListeners()
          Returns the list of configuration listeners as an array property.
 java.util.Dictionary getConfigurations(java.lang.String pName)
          Return a dictionary of Configurations that exist within some potential NameContext.
 java.util.Dictionary getConfigurations(java.lang.String pName, boolean pForceRefresh)
          Return a dictionary of Configurations that exist within some potential NameContext.
 atg.nucleus.ConfigurationUpdater getConfigurationUpdater(java.lang.String pFileSystemName)
          Returns the ConfigurationUpdater that should be used to update a ConfigurationState in the named file system.
 boolean getCreateSourceTemplates()
           
 atg.nucleus.ConfigCreationFilter getCreationFilter()
          Set the creation filter used, if any.
 atg.nucleus.ConfigurationUpdater getDefaultConfigurationUpdater(java.lang.String pFileSystemName)
          Returns a ConfigurationUpdater that will update a component in the default file system for updates, or a given file system, whichever is the more specific.
 java.lang.String getDefaultLanguage()
           
 java.util.Locale getDefaultLocale()
          Returns the server's locale.
 java.lang.String getDefaultRegion()
           
 int getDefaultStyleIndex()
           
 boolean getEnableLinks()
           
 java.util.Properties getEnvironment()
           
 atg.nucleus.SoftSelfCleaningCache getGlobalComponentCache()
           
static Nucleus getGlobalNucleus()
          Returns a reference to the global Nucleus for the current web application.
 java.lang.String getInitialServiceName()
          Returns the name of the initial service to start
 JavaConfigurationClassLoaders getJavaConfigurationClassLoaders()
          Returns the object used to obtain class loaders for configuration directories.
static java.lang.Throwable getLicenseFailureException()
           
 boolean getLogResourceNames()
           
 atg.nucleus.dms.DASMessageSource getMessageSource()
           
 atg.naming.NameUnresolver getNameUnresolver()
          Returns the NameUnresolver associated with this Nucleus' global scope.
 java.lang.String getNextServlet()
           
static atg.nucleus.registry.NucleusRegistry getNucleusRegistry()
          Returns the Nucleus registry used to hold per web app nuclei.
 boolean getOldParamBehavior()
           
 PropertyValueFormatters getPropertyValueFormatters()
          Returns the table mapping property class to property value formatter
 int getReferenceCount()
           
 boolean getRegisterRequestComponents()
          Will the Nucleus NameUnresolver register request scoped components?
 boolean getRegisterSessionComponents()
          Will the Nucleus NameUnresolver register session scoped components?
 java.lang.String getRelativePathPrefix()
           
 atg.nucleus.ComponentSecurityDomain getSecurityDomain()
          Returns the component security domain used by Nucleus.
 boolean getSendD4StyleEvents()
           
 javax.servlet.ServletConfig getServletConfig()
          Returns the configuration for this Servlet
 javax.servlet.ServletContext getServletContext()
          Returns the context for this servlet (if any)
 java.lang.String getServletInfo()
          Returns the information string for this servlet
 boolean getShellRestart()
          Does this nucleus support the restart operation? (i.e.
 long getStartTime()
          Time in millis at which this nucleus was created.
static Nucleus getSystemNucleus()
           
 boolean getUseJavaConfigurationFinder()
          Whether or not we use the JavaConfigurationFinder to check for .java or .class files which will, when compiled and instantiated, serve as a component instance.
 UserAuthority getUserAuthority()
          Returns the user authority used for ACL resolution in Nucleus.
 boolean getWarningAboutImproperScopeAccess()
          Gets the flag indicating whether the warning is wanted.
 void init(javax.servlet.ServletConfig pServletConfig)
          Initializes this Servlet with the specified configuration
protected  void initCreationFilter()
          Instantiates a new creation filter from the atg.nucleus.Nucleus.creationFilterClass property.
 boolean isCachingGlobalComponents()
          Returns true if this Nucleus is caching global components.
 boolean isDebugComponentLocking()
          Whether to attempt to debug component locking.
 boolean isFilteredComponent(java.lang.String pName)
          Whether or not the specified component name was previously filtered.
 boolean isFirstTime()
           
 boolean isGCAfterStartup()
          Returns the flag indicating if Nucleus should perform a GC after starting up.
static boolean isSingleNucleus()
          Returns true if there is only a single nucleus in the JVM.
 boolean isStopping()
           
 boolean isWarningAboutImproperScopeAccess()
          Gets the flag indicating whether the warning is wanted.
static java.lang.Class loadClass(java.lang.String pClassName)
          Load a class using Nucleus' own class loader.
static void main(java.lang.String[] pArgs)
          Runs the Nucleus
 void makeNewClassLoader()
          Instantiates a new development class loader and sets it as the global class loader for Nucleus, if a class path has been specified for it.
static java.lang.String[] parseNucleusClassPath()
          Returns an array of strings representing the parsed Nucleus class path.
protected  void performPostStartupActions()
          Perform any post start-up actions previously added.
protected  void performPostStartupActions(atg.nucleus.PostStartupAction[] pStartupActions)
          Perform the specified startup actions.
 void registerValidateableService(Validateable pService)
          Registers the specified service with the list of services to be validated periodically.
 void removeComponentListener(atg.nucleus.ComponentListener l)
          remove a ComponentListener
 void removeConfigurationListener(atg.nucleus.ConfigurationListener l)
          remove a ConfigurationListener
 void removeLiveComponent(java.lang.Object pComponent)
          Remove a live component from the Nucleus, stopping it as cleanly as possible and removing it from its parent context.
 void reportCachePerformance()
           
 java.lang.Object resolveName(ComponentName pName, NameContext pNameContext, boolean pCreate)
          Resolves the specified name in the specified context.
 java.lang.Object resolveName(java.lang.String pName, NameContext pNameContext, boolean pCreate)
          Resolves the specified name in the specified context.
 void service(javax.servlet.http.HttpServletRequest pRequest, javax.servlet.http.HttpServletResponse pResponse)
          Handles http requests
 void service(javax.servlet.ServletRequest pRequest, javax.servlet.ServletResponse pResponse)
          Handles requests
 void setAdminServerPrefix(java.lang.String pAdminServerPrefix)
          Sets the property AdminServerPrefix.
 void setAllowedClassNames(java.lang.String[] pAllowedClassNames)
          The list of class names allowed to be used as Nucleus Services.
 void setAllowedClassNamesSignature(byte[] pAllowedClassNamesSignature)
           
 void setAllowReloadableComponents(boolean pAllow)
          Configures if Nucleus will respect the $reloadable attribute in .properties files.
 void setApplicationNames(java.lang.String[] pApplicationNames)
           
 void setApplicationURLs(java.lang.String[] pApplicationURLs)
           
 void setCacheGlobalComponents(boolean pCache)
          Sets if the Nucleus is caching global components
 void setCheckFileNameCase(boolean pCheckCase)
          Whether or not we check the case of property file names against the canonical case used by the OS.
 void setCheckForSerFiles(boolean pCheckForSerFiles)
           
static void setClassLoader(java.lang.ClassLoader pClassLoader)
          Sets the global class loader for this nucleus.
 void setComponentLockManager(atg.nucleus.ComponentLockManager pComponentLockManager)
          Set the component lock manager.
 void setConfigPath(java.io.File[] pConfigPath)
          The current configpath as configured by nucleus.
 void setConfigurationCheckMilliseconds(long pConfigurationCheckMilliseconds)
           
 void setConfigurationCompileCommand(java.lang.String pConfigurationCompileCommand)
          Sets the command used to compile java configurations
 void setConfigurationListeners(atg.nucleus.ConfigurationListener[] pConfigurationListeners)
          Set the list of configuration listeners as an array property.
 void setCreateSourceTemplates(boolean pCreateSourceTemplates)
           
 void setCreationFilter(atg.nucleus.ConfigCreationFilter pCreationFilter)
          Get the creation filter used, if any.
 void setDebugComponentLocking(boolean pDebugComponentLocking)
          Whether to attempt to debug component locking.
 void setDefaultLanguage(java.lang.String pDefaultLanguage)
          Sets the property DefaultLanguage.
 void setDefaultRegion(java.lang.String pDefaultRegion)
          Sets the property DefaultRegion.
 void setDefaultStyleIndex(int pDefaultStyleIndex)
          Sets the property LicenseFailureException.
 void setDocumentRoot(java.io.File pPath)
          Override the implementation of the setDocumentRoot to update the doc root for the docroot config path entry
 void setEnableLinks(boolean pEnableLinks)
          Sets the property EnableLinks.
 void setEnvironment(java.util.Properties pEnvironment)
          The classpath entries that are configured in the Nucleus.properties file.
 void setGCAfterStartup(boolean pGCAfterStartup)
          Sets the flag indicating if Nucleus should perform a GC after starting up.
 void setInitialServiceName(java.lang.String pInitialServiceName)
          Sets the name of the initial service
static void setLicenseFailureException(java.lang.Throwable pLicenseFailureException)
          Sets the property LicenseFailureException.
 void setLogResourceNames(boolean pLogResourceNames)
          Sets the property LogResourceNames.
 void setMessageSource(atg.nucleus.dms.DASMessageSource pMessageSource)
           
 void setNextServlet(java.lang.String pNextServlet)
          The next servlet to render if we don't find a component for the specified URL.
 void setOldParamBehavior(boolean pOldParamBehavior)
           
 void setReferenceCount(int pReferenceCount)
          Sets the property ReferenceCount.
 void setRegisterNucleusShutdownHook(boolean pRegisterNucleusShutdownHook)
          Sets the flag indicating if Nucleus should register a shutdown during startup
 void setRegisterRequestComponents(boolean pRegisterRequestComponents)
          Will the Nucleus NameUnresolver register request scoped components?
 void setRegisterSessionComponents(boolean pRegisterSessionComponents)
          Will the Nucleus NameUnresolver register session scoped components?
 void setRelativePathPrefix(java.lang.String pRelativePathPrefix)
          The path name prepended onto relative paths that do not have an explicit "./" in front of them.
 void setSendD4StyleEvents(boolean pSendD4StyleEvents)
           
 void setUseJavaConfigurationFinder(boolean pUseFinder)
          Whether or not we use the JavaConfigurationFinder.
 void setWarningAboutImproperScopeAccess(boolean pWarn)
          Sets the flag which enables or disables the warning.
 Nucleus spawnNucleus(java.lang.ClassLoader pClassLoader, java.lang.String pConfig, java.lang.String pPathPrefix)
          Spawns a new Nucleus using the given class loader and the given configpath
static Nucleus startNucleus(java.lang.String[] pArgs)
          Creates a Nucleus initialized from a set of command line args, then returns it.
static Nucleus startNucleusCheckLicense(java.lang.String[] pArgs)
          Creates a Nucleus initialized from a set of command line args, then returns it.
 void stopService()
          Stops the service.
 void waitForInitialization()
          Returns after this Nucleus has completely initialized itself.
 
Methods inherited from class atg.nucleus.GenericContext
addNameContextBindingListener, addNameContextPreBindingListener, clearElementLock, doStopService, getAttribute, getAttributeNames, getConfigurationLock, getContext, getDocumentRoot, getElement, getElementLock, getInitParameter, getInitParameterNames, getMajorVersion, getMimeType, getMimeTyper, getMinorVersion, getNameContextBindingListeners, getNameContextPreBindingListeners, getNamedDispatcher, getPendingElement, getRealPath, getRequestDispatcher, getResource, getResourceAsStream, getResourcePaths, getServerInfo, getServlet, getServletContextName, getServletNames, getServlets, isElementBound, listElement, listElementNames, listElements, log, log, log, notifyAddedObject, notifyRemovedObject, preNotifyAddedObject, preNotifyRemovedObject, putElement, putPendingElement, removeAttribute, removeElement, removeNameContextBindingListener, removeNameContextPreBindingListener, removePendingElement, setAttribute, setMimeTyper, startService
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, doStartService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface atg.naming.NameContextElement
getName, getNameContext
 
Methods inherited from interface atg.naming.NameContextBindingListener
nameContextElementBound, nameContextElementUnbound
 
Methods inherited from interface atg.naming.NameContextElement
getName, getNameContext
 
Methods inherited from interface atg.naming.NameContextBindingListener
nameContextElementBound, nameContextElementUnbound
 
Methods inherited from interface atg.naming.NameContextElement
getName, getNameContext
 
Methods inherited from interface atg.naming.NameContextBindingListener
nameContextElementBound, nameContextElementUnbound
 

Field Detail

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values

RESTART_STATUS

public static final int RESTART_STATUS
See Also:
Constant Field Values

mAllowReloadableComponents

public boolean mAllowReloadableComponents

mLastValidationFailureReason

public java.lang.String mLastValidationFailureReason
Constructor Detail

Nucleus

public Nucleus(java.lang.String pConfigPath,
               java.lang.String pRelativePathPrefix,
               LogListener pListener)
Constructs a new Nucleus.

Parameters:
pConfigPath - the configuration path that will be used to find configuration files
pRelativePathPrefix - prepend this path prefix onto relative path names in .properties files (can be null for no prefix)
pListener - a listener to use for receiving log events

Nucleus

public Nucleus(java.lang.String pConfigPath)
Constructs a new Nucleus.

Parameters:
pConfigPath - the configuration path that will be used to find configuration files
Method Detail

isCachingGlobalComponents

public boolean isCachingGlobalComponents()
Returns true if this Nucleus is caching global components.

Returns:
boolean true if global components are cached

getGlobalComponentCache

public atg.nucleus.SoftSelfCleaningCache getGlobalComponentCache()

getAllowReloadableComponents

public boolean getAllowReloadableComponents()

setAllowReloadableComponents

public void setAllowReloadableComponents(boolean pAllow)
Configures if Nucleus will respect the $reloadable attribute in .properties files. On production environments we typically want Nucleus to ignore this and disable the reloadable components feature.


setCacheGlobalComponents

public void setCacheGlobalComponents(boolean pCache)
Sets if the Nucleus is caching global components

Parameters:
pCache - Flag controlling cache use. True means do cache, false means do not cache.

getStartTime

public long getStartTime()
Time in millis at which this nucleus was created.


getMessageSource

public atg.nucleus.dms.DASMessageSource getMessageSource()

setMessageSource

public void setMessageSource(atg.nucleus.dms.DASMessageSource pMessageSource)

getSendD4StyleEvents

public boolean getSendD4StyleEvents()

setSendD4StyleEvents

public void setSendD4StyleEvents(boolean pSendD4StyleEvents)

getOldParamBehavior

public boolean getOldParamBehavior()

setOldParamBehavior

public void setOldParamBehavior(boolean pOldParamBehavior)

setWarningAboutImproperScopeAccess

public void setWarningAboutImproperScopeAccess(boolean pWarn)
Sets the flag which enables or disables the warning.

Parameters:
boolean - true if we want the warning, false otherwise

getWarningAboutImproperScopeAccess

public boolean getWarningAboutImproperScopeAccess()
Gets the flag indicating whether the warning is wanted.

Returns:
true if we want the warning, false otherwise

isWarningAboutImproperScopeAccess

public boolean isWarningAboutImproperScopeAccess()
Gets the flag indicating whether the warning is wanted.

Returns:
true if we want the warning, false otherwise.

setLogResourceNames

public void setLogResourceNames(boolean pLogResourceNames)
Sets the property LogResourceNames.

Parameters:
pLogResourceNames - new value to set

getLogResourceNames

public boolean getLogResourceNames()
Returns:
The value of the property LogResourceNames.

setDefaultRegion

public void setDefaultRegion(java.lang.String pDefaultRegion)
Sets the property DefaultRegion. If the user.region system property is not set, this is used as the default region.

Parameters:
pDefaultRegion - new value to set

getDefaultRegion

public java.lang.String getDefaultRegion()
Returns:
The value of the property DefaultRegion.

setDefaultLanguage

public void setDefaultLanguage(java.lang.String pDefaultLanguage)
Sets the property DefaultLanguage. If the user.language system property is not set, then this is used as the default language.

Parameters:
pDefaultLanguage - new value to set

getDefaultLanguage

public java.lang.String getDefaultLanguage()
Returns:
The value of the property DefaultLanguage.

getDefaultLocale

public java.util.Locale getDefaultLocale()
Returns the server's locale. This is here so that nucleus components can set default locale properties to the default server's locale.


setAdminServerPrefix

public void setAdminServerPrefix(java.lang.String pAdminServerPrefix)
Sets the property AdminServerPrefix. If this is not null, all URLs for static files in the admin server are prefixed with this value.

Parameters:
pAdminServerPrefix - new value to set

getAdminServerPrefix

public java.lang.String getAdminServerPrefix()
Returns:
The value of the property AdminServerPrefix.

setLicenseFailureException

public static void setLicenseFailureException(java.lang.Throwable pLicenseFailureException)
Sets the property LicenseFailureException. If non-null, then we have already failed to find a license and no one should attempt to start another Nucleus is this ClassLoader.


getLicenseFailureException

public static java.lang.Throwable getLicenseFailureException()
Returns:
The value of the property LicenseFailureException.

setDefaultStyleIndex

public void setDefaultStyleIndex(int pDefaultStyleIndex)
Sets the property LicenseFailureException. If non-null, then we have already failed to find a license and no one should attempt to start another Nucleus is this ClassLoader.


getDefaultStyleIndex

public int getDefaultStyleIndex()
Returns:
The value of the property default style index.

getGlobalNucleus

public static Nucleus getGlobalNucleus()
Returns a reference to the global Nucleus for the current web application. The global Nucleus is determined by looking up a Nucleus from a map keyed off of the Thread.currentThread().getContextClassLoader(). If a Nucleus has not been configured for the current web application (see web.xml example in dyn.ear), then this method will return the system Nucleus. The system Nucleus loads classes via the primordial class loader.


getSystemNucleus

public static Nucleus getSystemNucleus()

setEnableLinks

public void setEnableLinks(boolean pEnableLinks)
Sets the property EnableLinks. When true, nucleus parses the .lnk files which define symbolic links in the document root directory.


getEnableLinks

public boolean getEnableLinks()
Returns:
The value of the property EnableLinks.

displayLicense

public static boolean displayLicense(Nucleus pNucleus)
Displays the license in an AWT frame, returns true if accepted, false if not.


getConfigurationUpdater

public atg.nucleus.ConfigurationUpdater getConfigurationUpdater(java.lang.String pFileSystemName)
Returns the ConfigurationUpdater that should be used to update a ConfigurationState in the named file system.

Parameters:
pFileSystemName - the name of the file system in which updates are to take place. If null, a ConfigurationUpdater is returned that works with all defined file systems, targeting the last.

getDefaultConfigurationUpdater

public atg.nucleus.ConfigurationUpdater getDefaultConfigurationUpdater(java.lang.String pFileSystemName)
Returns a ConfigurationUpdater that will update a component in the default file system for updates, or a given file system, whichever is the more specific.

Parameters:
pFileSystemName - the name of a "preferred" file system in which updates are to take place.

removeLiveComponent

public void removeLiveComponent(java.lang.Object pComponent)
Remove a live component from the Nucleus, stopping it as cleanly as possible and removing it from its parent context.


getConfigurations

public java.util.Dictionary getConfigurations(java.lang.String pName)
Return a dictionary of Configurations that exist within some potential NameContext.


getConfigurations

public java.util.Dictionary getConfigurations(java.lang.String pName,
                                              boolean pForceRefresh)
Return a dictionary of Configurations that exist within some potential NameContext.


setDocumentRoot

public void setDocumentRoot(java.io.File pPath)
Override the implementation of the setDocumentRoot to update the doc root for the docroot config path entry

Overrides:
setDocumentRoot in class GenericContext

getConfigurationFinder

public ConfigurationFinder getConfigurationFinder()
Returns the ConfigurationFinder that should be used to obtain the Configuration for a given configuration name.


getConfigurationFileSystems

public atg.nucleus.ConfigurationFileSystems getConfigurationFileSystems()
Return the ConfigurationFileSystems object for this Nucleus


getBeanConfigurator

public BeanConfigurator getBeanConfigurator()
Returns the BeanConfigurator that should be used to configure a bean from Properties.


getPropertyValueFormatters

public PropertyValueFormatters getPropertyValueFormatters()
Returns the table mapping property class to property value formatter


getConfigurationCacheEntry

public atg.nucleus.ConfigurationCacheEntry getConfigurationCacheEntry(java.lang.String pConfigName)
Gets the cached Configuration object


getConfigurationCacheEntry

public atg.nucleus.ConfigurationCacheEntry getConfigurationCacheEntry(java.lang.String pConfigName,
                                                                      boolean pForceRefresh)
Gets the cached Configuration object


createConfigurationFinder

protected MultipleConfigurationFinder createConfigurationFinder()
Creates and returns the MultipleConfigurationFinder that will be used to find configurations. Subclasses may override this to add their own configuration finders to the list.

Parameters:
pFileSystems - the set of VirtualFileSystems that will be used to find configuration files

waitForInitialization

public void waitForInitialization()
Returns after this Nucleus has completely initialized itself. This should only be called from threads that are known not to be called in Nucleus' main initialization path, e.g. request handling threads or RMI threads.


getCreateSourceTemplates

public boolean getCreateSourceTemplates()

setCreateSourceTemplates

public void setCreateSourceTemplates(boolean pCreateSourceTemplates)

getNameUnresolver

public atg.naming.NameUnresolver getNameUnresolver()
Returns the NameUnresolver associated with this Nucleus' global scope.


addComponentListener

public void addComponentListener(atg.nucleus.ComponentListener l)
add a ComponentListener -- delegated to ComponentRegistry which monitors component activations/deactivations.


removeComponentListener

public void removeComponentListener(atg.nucleus.ComponentListener l)
remove a ComponentListener


getConfigurationListeners

public atg.nucleus.ConfigurationListener[] getConfigurationListeners()
Returns the list of configuration listeners as an array property.


setConfigurationListeners

public void setConfigurationListeners(atg.nucleus.ConfigurationListener[] pConfigurationListeners)
Set the list of configuration listeners as an array property.


addConfigurationListener

public void addConfigurationListener(atg.nucleus.ConfigurationListener l)
add a ConfigurationListener


removeConfigurationListener

public void removeConfigurationListener(atg.nucleus.ConfigurationListener l)
remove a ConfigurationListener


fireConfigurationUpdated

public void fireConfigurationUpdated(atg.nucleus.ConfigurationEvent evt)
fire a ConfigurationEvent update


fireConfigurationDeleted

public void fireConfigurationDeleted(atg.nucleus.ConfigurationEvent evt)
fire a ConfigurationEvent deletion


getInitialServiceName

public java.lang.String getInitialServiceName()
Returns the name of the initial service to start


setInitialServiceName

public void setInitialServiceName(java.lang.String pInitialServiceName)
Sets the name of the initial service


getConfigurationCompileCommand

public java.lang.String getConfigurationCompileCommand()
Returns the command used to compile java configurations


setConfigurationCompileCommand

public void setConfigurationCompileCommand(java.lang.String pConfigurationCompileCommand)
Sets the command used to compile java configurations


isGCAfterStartup

public boolean isGCAfterStartup()
Returns the flag indicating if Nucleus should perform a GC after starting up.


setRegisterNucleusShutdownHook

public void setRegisterNucleusShutdownHook(boolean pRegisterNucleusShutdownHook)
Sets the flag indicating if Nucleus should register a shutdown during startup


setGCAfterStartup

public void setGCAfterStartup(boolean pGCAfterStartup)
Sets the flag indicating if Nucleus should perform a GC after starting up.


getConfigurationCheckMilliseconds

public long getConfigurationCheckMilliseconds()

setConfigurationCheckMilliseconds

public void setConfigurationCheckMilliseconds(long pConfigurationCheckMilliseconds)

getCheckFileNameCase

public boolean getCheckFileNameCase()
Whether or not we check the case of property file names against the canonical case used by the OS. On Unix this configuration is ignored.


setCheckFileNameCase

public void setCheckFileNameCase(boolean pCheckCase)
Whether or not we check the case of property file names against the canonical case used by the OS. On Unix this configuration is ignored.


getUseJavaConfigurationFinder

public boolean getUseJavaConfigurationFinder()
Whether or not we use the JavaConfigurationFinder to check for .java or .class files which will, when compiled and instantiated, serve as a component instance. The use of the JavaConfigurationFinder is expensive since it searches the configuration path for these additional files.


setUseJavaConfigurationFinder

public void setUseJavaConfigurationFinder(boolean pUseFinder)
Whether or not we use the JavaConfigurationFinder.


getCheckForSerFiles

public boolean getCheckForSerFiles()
Whether or not we check for .ser files when instantiating beans. This can speed up startup time somewhat if you set this to false by default. It will disable the use of any ser files in your classpath for instantiating beans however.


setCheckForSerFiles

public void setCheckForSerFiles(boolean pCheckForSerFiles)

getRegisterSessionComponents

public boolean getRegisterSessionComponents()
Will the Nucleus NameUnresolver register session scoped components?


setRegisterSessionComponents

public void setRegisterSessionComponents(boolean pRegisterSessionComponents)
Will the Nucleus NameUnresolver register session scoped components?


getRegisterRequestComponents

public boolean getRegisterRequestComponents()
Will the Nucleus NameUnresolver register request scoped components?


setRegisterRequestComponents

public void setRegisterRequestComponents(boolean pRegisterRequestComponents)
Will the Nucleus NameUnresolver register request scoped components?


getJavaConfigurationClassLoaders

public JavaConfigurationClassLoaders getJavaConfigurationClassLoaders()
Returns the object used to obtain class loaders for configuration directories.


setEnvironment

public void setEnvironment(java.util.Properties pEnvironment)
The classpath entries that are configured in the Nucleus.properties file. If no class path entries are configured here, this value is null.


getEnvironment

public java.util.Properties getEnvironment()

setRelativePathPrefix

public void setRelativePathPrefix(java.lang.String pRelativePathPrefix)
The path name prepended onto relative paths that do not have an explicit "./" in front of them.


getRelativePathPrefix

public java.lang.String getRelativePathPrefix()

setConfigPath

public void setConfigPath(java.io.File[] pConfigPath)
The current configpath as configured by nucleus. It is configured by the nucleus.properties file, if it is set.

Note that since the configpath can also contain entries which do not refer to files, but rather to file system components, this configpath is partial. Use the configPathNames property instead to get all the config path entries.


getConfigPath

public java.io.File[] getConfigPath()

getConfigPathNames

public java.lang.String[] getConfigPathNames()
The current configpath, separated into individual config path entries.


setNextServlet

public void setNextServlet(java.lang.String pNextServlet)
The next servlet to render if we don't find a component for the specified URL. This is configured as a String and retrieved as a service so that we don't have to do the resolveName before the Nucleus is configured.


getNextServlet

public java.lang.String getNextServlet()

fetchNextServlet

protected javax.servlet.Servlet fetchNextServlet()

setApplicationURLs

public void setApplicationURLs(java.lang.String[] pApplicationURLs)

getApplicationURLs

public java.lang.String[] getApplicationURLs()

setApplicationNames

public void setApplicationNames(java.lang.String[] pApplicationNames)

getApplicationNames

public java.lang.String[] getApplicationNames()

setAllowedClassNames

public void setAllowedClassNames(java.lang.String[] pAllowedClassNames)
The list of class names allowed to be used as Nucleus Services. If this is non-null, then every Nucleus service must be in this list, or must be a subclass of something in this list.


getAllowedClassNames

public java.lang.String[] getAllowedClassNames()

setAllowedClassNamesSignature

public void setAllowedClassNamesSignature(byte[] pAllowedClassNamesSignature)

getAllowedClassNamesSignature

public byte[] getAllowedClassNamesSignature()

getAllowedClasses

public atg.nucleus.AllowedClasses getAllowedClasses()
The object that determines which classes may or may not be used in Nucleus.


getAbsoluteName

public java.lang.String getAbsoluteName(NameContextElement pElement)
Returns the absolute name of the specified NameContextElement. The absolute name is formed by concatenating the names of all the ancestors and separating those names with '/' characters.


getAbsoluteElementName

public java.lang.String getAbsoluteElementName(NameContextElement pElement,
                                               java.lang.String pName)
Returns what would be the absolute name of the specified element if it were contained by the specified element.


resolveName

public java.lang.Object resolveName(ComponentName pName,
                                    NameContext pNameContext,
                                    boolean pCreate)
Resolves the specified name in the specified context.

Parameters:
pName - the name to be resolved
pNameContext - the NameContext to which the name is relative
pCreate - flag indicating whether Nucleus should attempt to create the object if it does not already exist in the naming hierarchy.
Returns:
the Object to which the name resolves, or null if the name could not be resolved. Any errors that occur are directed to listeners of the Nucleus.

resolveName

public java.lang.Object resolveName(java.lang.String pName,
                                    NameContext pNameContext,
                                    boolean pCreate)
Resolves the specified name in the specified context.

Parameters:
pName - the name to be resolved
pNameContext - the NameContext to which the name is relative
pCreate - flag indicating whether Nucleus should attempt to create the object if it does not already exist in the naming hierarchy.
Returns:
the Object to which the name resolves, or null if the name could not be resolved. Any errors that occur are directed to listeners of the Nucleus.

registerValidateableService

public final void registerValidateableService(Validateable pService)
Registers the specified service with the list of services to be validated periodically. This also validates the service immediately.


init

public void init(javax.servlet.ServletConfig pServletConfig)
          throws javax.servlet.ServletException
Initializes this Servlet with the specified configuration

Specified by:
init in interface javax.servlet.Servlet
Throws:
javax.servlet.ServletException - if an error occurred while initializing the Servlet

getServletConfig

public javax.servlet.ServletConfig getServletConfig()
Returns the configuration for this Servlet

Specified by:
getServletConfig in interface javax.servlet.Servlet

getServletContext

public javax.servlet.ServletContext getServletContext()
Returns the context for this servlet (if any)


getServletInfo

public java.lang.String getServletInfo()
Returns the information string for this servlet

Specified by:
getServletInfo in interface javax.servlet.Servlet

destroy

public void destroy()
Called when the servlet is to be destroyed

Specified by:
destroy in interface javax.servlet.Servlet

service

public void service(javax.servlet.ServletRequest pRequest,
                    javax.servlet.ServletResponse pResponse)
             throws javax.servlet.ServletException,
                    java.io.IOException
Handles requests

Specified by:
service in interface javax.servlet.Servlet
Throws:
javax.servlet.ServletException - if an error occurred while processing the servlet request
java.io.IOException - if an error occurred while reading or writing the servlet request

formatServiceName

protected java.lang.String formatServiceName(java.lang.String pServiceName,
                                             javax.servlet.http.HttpServletRequest pRequest)

service

public void service(javax.servlet.http.HttpServletRequest pRequest,
                    javax.servlet.http.HttpServletResponse pResponse)
             throws javax.servlet.ServletException,
                    java.io.IOException
Handles http requests

Throws:
javax.servlet.ServletException - if an error occurred while processing the servlet request
java.io.IOException - if an error occurred while reading or writing the servlet request

createAdminServlet

protected javax.servlet.Servlet createAdminServlet()
Creates and returns a new Servlet that will administer this service. By default, this creates a ServiceAdminServlet, but subclasses may create their own servlets.

Overrides:
createAdminServlet in class GenericService

isSingleNucleus

public static boolean isSingleNucleus()
Returns true if there is only a single nucleus in the JVM.


getConfigPath

public java.lang.String getConfigPath(java.lang.String pServerName)
Returns the config path for a specified server name


getShellRestart

public boolean getShellRestart()
Does this nucleus support the restart operation? (i.e. was it started by a shell program that a) passed in -shellrestart and b) will loop around if the java process exits with the restart exit code).


isStopping

public boolean isStopping()
Returns:
The value of the property Stopping. This property gets set to true before the dynamo starts the shutdown process.

setReferenceCount

public void setReferenceCount(int pReferenceCount)
Sets the property ReferenceCount. Used by the NucleusServlet to keep track of the number of web applications that are using this nucleus.

Parameters:
pReferenceCount - new value to set

getReferenceCount

public int getReferenceCount()
Returns:
The value of the property ReferenceCount.

setCreationFilter

public void setCreationFilter(atg.nucleus.ConfigCreationFilter pCreationFilter)
Get the creation filter used, if any.


getCreationFilter

public atg.nucleus.ConfigCreationFilter getCreationFilter()
Set the creation filter used, if any.


setDebugComponentLocking

public void setDebugComponentLocking(boolean pDebugComponentLocking)
Whether to attempt to debug component locking.


isDebugComponentLocking

public boolean isDebugComponentLocking()
Whether to attempt to debug component locking.


setComponentLockManager

public void setComponentLockManager(atg.nucleus.ComponentLockManager pComponentLockManager)
Set the component lock manager. This is a ClientLockManager subclass used only if debugComponentLocking is true.


getComponentLockManager

public atg.nucleus.ComponentLockManager getComponentLockManager()
Get the component lock manager. This is a ClientLockManager subclass used only if debugComponentLocking is true.


isFilteredComponent

public boolean isFilteredComponent(java.lang.String pName)
Whether or not the specified component name was previously filtered.

Parameters:
pName - the name (nucleus path) of the component which may have been previously filtered.

stopService

public void stopService()
                 throws ServiceException
Stops the service. This will be called when this server is shutting down.

Specified by:
stopService in interface ServiceListener
Overrides:
stopService in class GenericService
Throws:
ServiceException - if an error occurred while attempting to stop the service.

getUserAuthority

public UserAuthority getUserAuthority()
Returns the user authority used for ACL resolution in Nucleus. This will always be a proxy.


getSecurityDomain

public atg.nucleus.ComponentSecurityDomain getSecurityDomain()
Returns the component security domain used by Nucleus.


getClassLoader

public static java.lang.ClassLoader getClassLoader()
Returns the global class loader for all Nuclei.


setClassLoader

public static void setClassLoader(java.lang.ClassLoader pClassLoader)
Sets the global class loader for this nucleus. Web application nuclei should always used the classloader assigned the the web application they are running in.


parseNucleusClassPath

public static java.lang.String[] parseNucleusClassPath()
Returns an array of strings representing the parsed Nucleus class path.


makeNewClassLoader

public void makeNewClassLoader()
Instantiates a new development class loader and sets it as the global class loader for Nucleus, if a class path has been specified for it.


initCreationFilter

protected void initCreationFilter()
Instantiates a new creation filter from the atg.nucleus.Nucleus.creationFilterClass property.


loadClass

public static java.lang.Class loadClass(java.lang.String pClassName)
                                 throws java.lang.ClassNotFoundException
Load a class using Nucleus' own class loader.

Throws:
java.lang.ClassNotFoundException

spawnNucleus

public Nucleus spawnNucleus(java.lang.ClassLoader pClassLoader,
                            java.lang.String pConfig,
                            java.lang.String pPathPrefix)
Spawns a new Nucleus using the given class loader and the given configpath

Parameters:
pClassLoader - the classloader to be used by this Nucleus
pConfig - the config path for this nucleus
pPathPrefix - the prefix applied to relative path names that do not start with "./". Allows services to define files that should be run on a per-instance basis.

getNucleusRegistry

public static atg.nucleus.registry.NucleusRegistry getNucleusRegistry()
Returns the Nucleus registry used to hold per web app nuclei.

Returns:
NucleusRegistry

main

public static void main(java.lang.String[] pArgs)
Runs the Nucleus


startNucleus

public static Nucleus startNucleus(java.lang.String[] pArgs)
Creates a Nucleus initialized from a set of command line args, then returns it.


startNucleusCheckLicense

public static Nucleus startNucleusCheckLicense(java.lang.String[] pArgs)
Creates a Nucleus initialized from a set of command line args, then returns it.


isFirstTime

public boolean isFirstTime()

addCachedResolveTime

public void addCachedResolveTime(long pTime)

addUnCachedResolveTime

public void addUnCachedResolveTime(long pTime)

reportCachePerformance

public void reportCachePerformance()

addPostStartupAction

public void addPostStartupAction(atg.nucleus.PostStartupAction pPostStartupAction)
Add a start-up action to be performed after startup. These actions are performed in the main Nucleus start-up thread immediately after the running property is set to true.

Parameters:
pPostStartupAction - the post start-up action add to the list of actions to be performed at the end of startup.

performPostStartupActions

protected void performPostStartupActions()
Perform any post start-up actions previously added. Any runtime errors will be logged via logError.


performPostStartupActions

protected void performPostStartupActions(atg.nucleus.PostStartupAction[] pStartupActions)
Perform the specified startup actions.

Parameters:
pStartupActions - the startup actions to invoke.