As described above, classes used for Nucleus components typically implement a large number of standard interfaces. When you create classes, you can greatly simplify your task by extending the atg.nucleus.GenericService class. This class implements most of the key Nucleus interfaces, so classes that extend it also implement those interfaces.

Furthermore, two important interfaces, atg.naming.NameContext and atg.naming.NameContextBindingEventSource, are implemented by a subclass of GenericService, atg.nucleus.GenericContext, described later. Thus, a class can implement these interfaces by extending the GenericContext class.

When you create a component that extends GenericService, you should be aware of the following:

  • The method doStartService is called after Nucleus creates the component, installed it into the naming hierarchy, set all of its property values from the properties file, and added all of its event listeners from the properties file. Your component must override doStartService to perform any required initialization—for example, create server ports and start threads. If initialization problems occur, the method can throw a ServiceException.

  • The method doStopService is called when the service stops. The component must override this method to stop any processes that were started by this component—for example, close open file descriptors and server ports, stop any threads that this component started, and remove any event listeners that it added. However, the service should be prepared to start up again, possibly with new configuration values. When it restarts, the component is notified by calling doStartService.

  • GenericService contains an implementation of atg.nucleus.logging.ApplicationLogging, thereby providing your service with a simple way to log events. For example, your service might log an error like this:

    catch (SomeException exc) {
      if (isLoggingError ()) {
        logError ("Something went terribly wrong", exc);

    The logError call might or might not include an exception. There are similar calls for the Error, Warning, Info, and Debug logging levels. See the Logging and Data Collection chapter.

  • GenericService includes a default servlet to use for Oracle ATG Web Commerce Dynamo Server Admin. If your component wishes to use a different servlet to display information about itself in the Administration Interface, it should override createAdminServlet to create the servlet that should be used. See Customizing the ATG Dynamo Server Admin Interface.

  • GenericService implements a method called getAbsoluteName that returns the absolute name of the component as seen in the Nucleus namespace.

  • GenericService implements a couple of methods for resolving names in the Nucleus namespace. The method resolveName resolves a name relative to the component’s parent. For example:

    resolveName ("Pricer")

    returns a pointer to the component named Pricer that is a child of the component’s parent. The method tries to create the component from a configuration file if it cannot be found. GenericService also implements the ComponentNameResolver interface, so that you can pass the resolveName method a ComponentName key string, as well as a component’s real relative name. See ComponentName.

Your component might not need to use all or any of this functionality. You should, however, be aware that all of these functions are available if your component extends GenericService.

Note: Be sure not to have a getName or setName method in a component that subclasses GenericService. If you do, your component’s Nucleus pathname can become confused.