NetKernel APIs


com.ten60.netkernel.container
Class Container

java.lang.Object
  extended bycom.ten60.netkernel.urii.representation.SimpleRepresentationImpl
      extended bycom.ten60.netkernel.container.ComponentImpl
          extended bycom.ten60.netkernel.container.Container
All Implemented Interfaces:
IAspectBinaryStream, IComponent, IURAspect, IURRepresentation

public final class Container
extends ComponentImpl

Main class for NetKernel. It is responsible for starting and stopping all other components


Field Summary
static String DEFAULT_CONFIG
          default path for system configuration
static String NETKERNEL_URN
          kernel URN
static URIdentifier URI
          our URI
static String VERSION
          version number
 
Fields inherited from class com.ten60.netkernel.urii.representation.SimpleRepresentationImpl
mMeta
 
Constructor Summary
Container(String aBasePath)
          Creates a new instance of Container
Container(String aBasePath, String aConfig)
           
 
Method Summary
 void doPeriodicHouseKeeping()
          periodic housekeeping involves giving all our system components a chance to do housekeeping
 String getBasePath()
          return the absolute basepath that this container is using
 String getBasePathURI()
          return the absolute basepath URI that this container is using - use this for guaranteed *nix/Win32 platform independence
 URL getBootloaderConfigURL()
          returns the URL where the bootloader configuration is being read from
 IComponent getComponent(URIdentifier aURI)
          return a component with the given URI, null if none is found
 String getConfigURI()
          return the absolute config URI that this container is using
 ClassLoader getExternalRequestClassLoader()
          returns a classloader with access to all classes and resources of the module which holds the internal transport
 URL getKernelSourceURL()
          returns the URL where the kernel classes are being loaded from, if they are being loaded from the classpath null is returned.
 ThreadGroup getRootThreadGroup()
          returns the root thread group
 String getScratchPath()
          return the absolute scratch dir path that this container is using
 String getScratchPathURI()
           
 long getUptime()
          returns the number of milliseconds of uptime
 boolean isReady()
          returns true if container is fully started and accepting requests
 Boolean isRestart()
          returns true if the outer bootloader should restart rather than terminate when this container terminates
 boolean isStarted()
          Return true if the container is started
static void main(String[] args)
          main method to start the component with a given basepath and optional configuration as arguments 1 and 2.
 URLConnection openConnection(URL u)
           
 IURRepresentation requestResource(URIdentifier aURI, Class aAspectClass, Map aArgs)
          API for embedded/JMX to allow requests to be made on the container for resources
 void restart(boolean aHot)
          restart the container to detect an changed modules without downtime
 void start()
          Starts the container and wait for restart or stop
 void start(Container aContainer)
          Starts the container
 void stop()
          stops the container
 void write(OutputStream aStream)
          writes the state of the container out to the given stream as XML
 
Methods inherited from class com.ten60.netkernel.container.ComponentImpl
getEncoding, getURI
 
Methods inherited from class com.ten60.netkernel.urii.representation.SimpleRepresentationImpl
getAspect, getAspects, getMeta, hasAspect
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ten60.netkernel.urii.IURRepresentation
getAspect, getAspects, getMeta, hasAspect
 

Field Detail

URI

public static final URIdentifier URI
our URI


DEFAULT_CONFIG

public static final String DEFAULT_CONFIG
default path for system configuration

See Also:
Constant Field Values

VERSION

public static final String VERSION
version number

See Also:
Constant Field Values

NETKERNEL_URN

public static final String NETKERNEL_URN
kernel URN

See Also:
Constant Field Values
Constructor Detail

Container

public Container(String aBasePath)
Creates a new instance of Container

Parameters:
aBasePath - basepath (filename) that config path and all paths in config are offset from

Container

public Container(String aBasePath,
                 String aConfig)
Method Detail

main

public static void main(String[] args)
main method to start the component with a given basepath and optional configuration as arguments 1 and 2. Container waits for a newline on System.in before shutting down the container.


isRestart

public Boolean isRestart()
returns true if the outer bootloader should restart rather than terminate when this container terminates


isReady

public boolean isReady()
returns true if container is fully started and accepting requests


getRootThreadGroup

public ThreadGroup getRootThreadGroup()
returns the root thread group


getUptime

public long getUptime()
returns the number of milliseconds of uptime


start

public void start(Container aContainer)
           throws NetKernelException
Starts the container

Specified by:
start in interface IComponent
Overrides:
start in class ComponentImpl
Parameters:
aContainer - not used, implemented as part of IComponent
Throws:
NetKernelException

start

public void start()
           throws NetKernelException
Starts the container and wait for restart or stop

Throws:
NetKernelException

isStarted

public boolean isStarted()
Return true if the container is started


stop

public void stop()
          throws NetKernelException
stops the container

Specified by:
stop in interface IComponent
Overrides:
stop in class ComponentImpl
Throws:
NetKernelException

restart

public void restart(boolean aHot)
restart the container to detect an changed modules without downtime


getComponent

public IComponent getComponent(URIdentifier aURI)
return a component with the given URI, null if none is found


getBasePath

public String getBasePath()
return the absolute basepath that this container is using


getScratchPath

public String getScratchPath()
return the absolute scratch dir path that this container is using


getConfigURI

public String getConfigURI()
return the absolute config URI that this container is using


getBasePathURI

public String getBasePathURI()
return the absolute basepath URI that this container is using - use this for guaranteed *nix/Win32 platform independence


getScratchPathURI

public String getScratchPathURI()
Returns:
the absolute scratchpath URI that this container is using - use this for guaranteed *nix/Win32 platform independence

doPeriodicHouseKeeping

public void doPeriodicHouseKeeping()
periodic housekeeping involves giving all our system components a chance to do housekeeping

Specified by:
doPeriodicHouseKeeping in interface IComponent
Overrides:
doPeriodicHouseKeeping in class ComponentImpl

requestResource

public IURRepresentation requestResource(URIdentifier aURI,
                                         Class aAspectClass,
                                         Map aArgs)
                                  throws NetKernelException
API for embedded/JMX to allow requests to be made on the container for resources

Parameters:
aURI - the URI to get the representation for
aArgs - any arguments to pass through with the request
Returns:
the resulting resource representation which will implement the specified interface
Throws:
NetKernelException - thrown if we fail to execute the request for any reason

getExternalRequestClassLoader

public ClassLoader getExternalRequestClassLoader()
                                          throws NetKernelException
returns a classloader with access to all classes and resources of the module which holds the internal transport

Throws:
NetKernelException

openConnection

public URLConnection openConnection(URL u)
                             throws IOException
Throws:
IOException

write

public void write(OutputStream aStream)
           throws IOException
writes the state of the container out to the given stream as XML

Specified by:
write in interface IAspectBinaryStream
Overrides:
write in class ComponentImpl
Throws:
IOException

getBootloaderConfigURL

public URL getBootloaderConfigURL()
                           throws MalformedURLException
returns the URL where the bootloader configuration is being read from

Throws:
MalformedURLException

getKernelSourceURL

public URL getKernelSourceURL()
                       throws IOException
returns the URL where the kernel classes are being loaded from, if they are being loaded from the classpath null is returned.

Throws:
IOException

NetKernel APIs


Copyright © 2002-2004 1060 Research Ltd. All Rights Reserved.