com.metamatrix.common.extensionmodule
Class ExtensionModuleDescriptor

java.lang.Object
  extended by com.metamatrix.common.extensionmodule.ExtensionModuleDescriptor
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable
Direct Known Subclasses:
JDBCExtensionDescriptor

public class ExtensionModuleDescriptor
extends java.lang.Object
implements java.lang.Comparable, java.io.Serializable

This interface describes an immutable lightweight serializable object for describing an extension module as it exists in the Platform at a given point in time.

If ordered (using Collections.sort or something else based on their compareTo(java.lang.Object) method), they should be ordered according to their search position. Equality should, therefore, also be based on their search position - the search position should be a unique integer across all extension modules at a given point in time (if position is changed, the entire list should be refreshed). Therefore, one should never mix ExtensionModuleDescriptor instances that were retrieved from the server at different points in time.

(Note: Classes which implement this interface should also explicitly implement the java.io.Serializable interface.)

See Also:
Serialized Form

Field Summary
protected  long checksum
           
protected  java.lang.String createdBy
           
protected  java.lang.String creationDate
           
protected  java.lang.String desc
           
protected  boolean enabled
           
protected  java.lang.String lastUpdatedBy
           
protected  java.lang.String lastUpdatedDate
           
protected  java.lang.String name
           
protected  int position
           
protected  java.lang.String type
           
 
Constructor Summary
ExtensionModuleDescriptor()
           
ExtensionModuleDescriptor(ExtensionModuleDescriptor clone)
           
ExtensionModuleDescriptor(java.lang.String name, java.lang.String type, int position, boolean enabled, java.lang.String desc, java.lang.String createdBy, java.lang.String creationDate, java.lang.String lastUpdatedBy, java.lang.String lastUpdatedDate, long checksum)
           
 
Method Summary
 int compareTo(java.lang.Object obj)
          Compares this object to another.
 boolean equals(java.lang.Object obj)
          Returns true if the specified object is semantically equal to this instance.
 long getChecksum()
          The checksum of the contents of the extension module - this can be used to quickly compare if the contents stored are the same as, for example, the contents of a local file.
 java.lang.String getCreatedBy()
          Principal name who created this extension module
 java.lang.String getCreationDate()
          String date this extension module was created (in String form using DateUtil).
 java.lang.String getDescription()
          Optional description of this extension module - may be null.
 java.lang.String getLastUpdatedBy()
          Principal name who last updated this extension module
 java.lang.String getLastUpdatedDate()
          String date this extension module was last updated (in String form using DateUtil).
 java.lang.String getName()
          Name (e.g.
 int getPosition()
          Position of this extension module in search order - zero based.
 java.lang.String getType()
          Type of this extension module
 boolean isEnabled()
          Whether this extension module is enabled for searching or not (it may exist yet be disabled; it will not be searched)
 void setChecksum(long sum)
           
 void setCreatedBy(java.lang.String by)
           
 void setCreationDate(java.lang.String date)
           
 void setDescription(java.lang.String description)
           
 void setEnabled(boolean isEnabled)
           
 void setLastUpdatedBy(java.lang.String by)
           
 void setLastUpdatedDate(java.lang.String date)
           
 void setName(java.lang.String newName)
           
 void setPosition(int pos)
           
 void setType(java.lang.String newType)
           
 java.lang.String toString()
          Return the string form of this ExtensionModuleDescriptor.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

type

protected java.lang.String type

position

protected int position

enabled

protected boolean enabled

desc

protected java.lang.String desc

createdBy

protected java.lang.String createdBy

creationDate

protected java.lang.String creationDate

lastUpdatedBy

protected java.lang.String lastUpdatedBy

lastUpdatedDate

protected java.lang.String lastUpdatedDate

checksum

protected long checksum
Constructor Detail

ExtensionModuleDescriptor

public ExtensionModuleDescriptor()

ExtensionModuleDescriptor

public ExtensionModuleDescriptor(java.lang.String name,
                                 java.lang.String type,
                                 int position,
                                 boolean enabled,
                                 java.lang.String desc,
                                 java.lang.String createdBy,
                                 java.lang.String creationDate,
                                 java.lang.String lastUpdatedBy,
                                 java.lang.String lastUpdatedDate,
                                 long checksum)

ExtensionModuleDescriptor

public ExtensionModuleDescriptor(ExtensionModuleDescriptor clone)
Method Detail

getName

public java.lang.String getName()
Name (e.g. filename) of this extension module

Returns:
name of extension module

getType

public java.lang.String getType()
Type of this extension module

Returns:
type of this extension module

getPosition

public int getPosition()

Position of this extension module in search order - zero based. This number itself is not important, what is imporant is the relative ordering of all extension modules, which this attribute indicates.

The position attribute does not have to be the same integer for a given extension module over time. In particular, when the list of modules is re-ordered, any extension module may be given a new position. Furthermore, as extension modules are added and deleted, the list of positions does not have to be a continuous sequence - there can be gaps, and there doesn't necessarily have to be a zero-th extension module (even though the search position is zero-based.)

Returns:
position in search order

isEnabled

public boolean isEnabled()
Whether this extension module is enabled for searching or not (it may exist yet be disabled; it will not be searched)

Returns:
enabled for searching

getDescription

public java.lang.String getDescription()
Optional description of this extension module - may be null.

Returns:
description

getCreatedBy

public java.lang.String getCreatedBy()
Principal name who created this extension module

Returns:
name of principal who created the extension module

getCreationDate

public java.lang.String getCreationDate()
String date this extension module was created (in String form using DateUtil).

Returns:
date of the creation

getLastUpdatedBy

public java.lang.String getLastUpdatedBy()
Principal name who last updated this extension module

Returns:
name of principal who last updated the extension module

getLastUpdatedDate

public java.lang.String getLastUpdatedDate()
String date this extension module was last updated (in String form using DateUtil).

Returns:
date of last update

getChecksum

public long getChecksum()
The checksum of the contents of the extension module - this can be used to quickly compare if the contents stored are the same as, for example, the contents of a local file. This checksum will have been generated with a java.util.zip.CRC32 instance, using the entire byte array of the extension module as it was added.

Returns:
checksum of the contents of the extension module

compareTo

public int compareTo(java.lang.Object obj)

Compares this object to another. If the specified object is an instance of the ExtensionModuleDescriptor class, then this method compares the contents; otherwise, it throws a ClassCastException (as instances are comparable only to instances of the same class).

Note: this method should be consistent with equals(), meaning that (compare(x, y)==0) == (x.equals(y)).

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
obj - the object that this instance is to be compared to.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object, respectively.
Throws:
java.lang.AssertionError - if the specified object reference is null
java.lang.ClassCastException - if the specified object's type prevents it from being compared to this instance.

equals

public boolean equals(java.lang.Object obj)
Returns true if the specified object is semantically equal to this instance. Note: this method should be consistent with compareTo().

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object that this instance is to be compared to.
Returns:
whether the object is equal to this object.

toString

public java.lang.String toString()
Return the string form of this ExtensionModuleDescriptor.

Overrides:
toString in class java.lang.Object
Returns:
the string form of this ExtensionModuleDescriptor

setName

public void setName(java.lang.String newName)

setType

public void setType(java.lang.String newType)

setPosition

public void setPosition(int pos)

setEnabled

public void setEnabled(boolean isEnabled)

setDescription

public void setDescription(java.lang.String description)

setCreatedBy

public void setCreatedBy(java.lang.String by)

setCreationDate

public void setCreationDate(java.lang.String date)

setLastUpdatedBy

public void setLastUpdatedBy(java.lang.String by)

setLastUpdatedDate

public void setLastUpdatedDate(java.lang.String date)

setChecksum

public void setChecksum(long sum)


Copyright © 2009. All Rights Reserved.