Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

arch.module
Class JXModule  view JXModule download JXModule.java

java.lang.Object
  extended byarch.module.JXModule

public abstract class JXModule
extends java.lang.Object

In order to deal with the complexity of building a desktop system, JD4X is divided into modules and each module deals with a specific area of the desktop functionality. The whole JD4X system consist of major modules which implements the basic desktop features and minor modules which are designed to dynamically extend any other area of the desktop feature such as devices, functionality and much more. JXModule is the super class of all modules in the JD4X system. It defines the properties of a basic module. See the design and specification document for more details. The contract both explicitly and implicitly defined for all of its subclasses MUST be adhered to strictly, in order to produce a safe and compliant JXModule. Caution: Any method that has to be implemented must be multi-thread safe such that it can be executed by multiple threads concurrently, in other words it should be final and/or synchronized. This will apply to all subclasses of the JXModule. This class is designed for inheritance only and it should never be directly manipulated by any of its subclasses or clients other than the JD4X core module. Subclasses MUST provide a valid value for all its state fields or else it will be considered an invalid module and its behaviour becomes undefined.

Since:
JD4X 1.0
Version:
0.1, 15/05/2003

Field Summary
private  arch.module.icore.JXCoreModuleInterface control
          A reference to the core module that initialized this module.
private  int hValue
          Cached hash value
private  int moduleID
          Defines an id to represent the module.
private  float version
          Defines the module version.
 
Constructor Summary
protected JXModule()
          Only a subclass is allowed to create an instance of it.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compare two modules for equality.
abstract  java.lang.String getCredits()
          It allows the module developer to provide his/her information.
 java.lang.Integer getModuleID()
          Get the module ID value.
 java.lang.Float getVersion()
          Get the module version number.
 int hashCode()
          The hash value is computed using the method proposed by Joshua Bloch in Effective Java.
abstract  arch.message.error.JXError init()
          It allows the module to do its own initialization of resources and to prepare the module to do useful task.
 boolean isJXCoreModuleValid()
          Allow the submodule to check if a valid core module has been registered with it.
protected  void makeRequest(arch.message.request.JXRequest[] req)
          To make a direct request to JUNK locally without going through the network.
 void setJXCoreModule(arch.module.icore.JXCoreModuleInterface core)
          Allow the JD4X core module (JUNK) to register itself with the other submodules.
protected  void setModuleID(int newModuleID)
          protected void setModuleID(int newModuleID)
protected  void setVersion(float newVersion)
          Set the version number to a new value.
abstract  arch.message.error.JXError shutdown()
          It allows the module to do its own clean up of resources and do any other task for the module to shutdown.
 java.lang.String toString()
          A string representation of this module with its module ID and version number.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

moduleID

private int moduleID
Defines an id to represent the module. It is used to compare for equality.


version

private float version
Defines the module version. It is used to compare for equality.


hValue

private int hValue
Cached hash value


control

private arch.module.icore.JXCoreModuleInterface control
A reference to the core module that initialized this module.

Constructor Detail

JXModule

protected JXModule()
Only a subclass is allowed to create an instance of it. This class is designed for inheritance and no direct instantiation is allowed. It also initializes the module to an invalid state such that it cannot be used as a stand alone instance without a subclass implementation. This constructor is provided for future serialization of subclasses.

Method Detail

equals

public boolean equals(java.lang.Object obj)
Compare two modules for equality. Two modules are considered equal if their id and version are equal. No two module should have the same id but different functionality. Check the JD4X documentation to see which id range has already been taken for the major modules. Independent developers intending to create their own minor and/or major modules should coordinate with the JD4X project team to get their own range if they want their distribution to work correctly with the JD4X project team's work. Subclasses should consider not overridding it as this definition should be sufficient.


getCredits

public abstract java.lang.String getCredits()
It allows the module developer to provide his/her information. The basic information should be short and should include the following format each on its own line:
Module: Name, version
Develop By: Name, . Name, . [...]


getVersion

public final java.lang.Float getVersion()
Get the module version number.


getModuleID

public final java.lang.Integer getModuleID()
Get the module ID value.


hashCode

public int hashCode()
The hash value is computed using the method proposed by Joshua Bloch in Effective Java. Due to the fact that there are limited modules at any given active time, this simple function should be sufficient for most use.


init

public abstract arch.message.error.JXError init()
It allows the module to do its own initialization of resources and to prepare the module to do useful task. It must be implemented by all subclasses of JXModule. It must be designed to be idempotent. This method is automatically called by the core module when it creates the module.


isJXCoreModuleValid

public boolean isJXCoreModuleValid()
Allow the submodule to check if a valid core module has been registered with it. If no valid core module has been registered the submodule will not be able to make any request to it.


makeRequest

protected final void makeRequest(arch.message.request.JXRequest[] req)
To make a direct request to JUNK locally without going through the network. This ensures a faster response time to a request that is made to JUNK on the local host. This method is part of the call back framework design build into the JD4X system.


setVersion

protected final void setVersion(float newVersion)
Set the version number to a new value.


setModuleID

protected final void setModuleID(int newModuleID)
protected void setModuleID(int newModuleID)


setJXCoreModule

public final void setJXCoreModule(arch.module.icore.JXCoreModuleInterface core)
Allow the JD4X core module (JUNK) to register itself with the other submodules. Each submodule can only be registered with a core module once, which is during its first initialization. Any other attempt to register a new core module will not be allowed and implies a security bleach. This method is part of the call back framework design build into the JD4X system.


shutdown

public abstract arch.message.error.JXError shutdown()
It allows the module to do its own clean up of resources and do any other task for the module to shutdown. It must be implemented by all subclasses of JXModule. This method is automatically called by the core module when it needs to shutdown the module.


toString

public java.lang.String toString()
A string representation of this module with its module ID and version number. Subclasses should override it to provide a more specific information representation. The exact details of the representation are unspecified and subject to change, but the following maybe regarded as typical: JD4X . It can be interpreted as module id = 7 and version = 0.1.