gr.uoa.di.madgik.grs.record.field
Class FieldDefinition

java.lang.Object
  extended by gr.uoa.di.madgik.grs.record.field.FieldDefinition
Direct Known Subclasses:
FileFieldDefinition, ObjectFieldDefinition, StringFieldDefinition, URLFieldDefinition

public abstract class FieldDefinition
extends java.lang.Object

The field definition represents the scheme of a single Field and holds all the metadata available for the Field. All extending classes of this class must define a default no arguments constructor

Author:
gpapanikos

Field Summary
static int DefaultChunkSize
          The default chunk size to be used during partial transfer.
static IBuffer.TransportDirective DefaultDirective
          The default IBuffer.TransportDirective to be used by the FieldDefinition.
static boolean DefaultDoCompress
          The default value for the compression option.
static java.lang.String DefaultMimeType
          The default MIME type to be used by the FieldDefinition.
 
Constructor Summary
FieldDefinition()
           
 
Method Summary
 void deflate(java.io.DataOutput out)
          Deflates the field definition in the provided stream and calls extendDeflate(DataOutput)
 boolean equals(java.lang.Object obj)
          
abstract  void extendDeflate(java.io.DataOutput out)
          Method to be implemented by class extenders to deflate additional information
abstract  boolean extendEquals(java.lang.Object obj)
          Method to be implemented by extenders to check if two instances are equal
abstract  void extendFromXML(org.w3c.dom.Element element)
           
abstract  void extendInflate(java.io.DataInput in)
          Method to be implemented by the class extenders to inflate additional information previously deflated
abstract  void extendToXML(org.w3c.dom.Document doc, org.w3c.dom.Element element)
           
 void fromXML(org.w3c.dom.Element element)
           
 int getChunkSize()
          Retrieves the chunk size in bytes that will be used during partial transfer
 java.lang.String getMimeType()
          Gets the MIME type
 java.lang.String getName()
          Gets the field name
 IBuffer.TransportDirective getTransportDirective()
          Retrieves the transport directive to be used during transfer
 void inflate(java.io.DataInput in)
          Inflates the field definition from the previously deflated stream.
 boolean isCompress()
          Whether or not compression will be used during transfer
 void setChunkSize(int chunkSize)
          Sets the chunk size in bytes that will be used during partial transfer
 void setCompress(boolean compress)
          Sets whether compression should be used during transfer
 void setMimeType(java.lang.String mimeType)
          Sets the MIME type
 void setName(java.lang.String name)
          Sets the name of the field
 void setTransportDirective(IBuffer.TransportDirective directive)
          Sets the transport directive to be used during transfer
 org.w3c.dom.Element toXML(org.w3c.dom.Document doc)
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DefaultDirective

public static final IBuffer.TransportDirective DefaultDirective
The default IBuffer.TransportDirective to be used by the FieldDefinition. Currently set to IBuffer.TransportDirective.Inherit


DefaultMimeType

public static final java.lang.String DefaultMimeType
The default MIME type to be used by the FieldDefinition. Currently set to text/plain

See Also:
Constant Field Values

DefaultDoCompress

public static final boolean DefaultDoCompress
The default value for the compression option. Currently set to false

See Also:
Constant Field Values

DefaultChunkSize

public static final int DefaultChunkSize
The default chunk size to be used during partial transfer. Currently set to 500K

See Also:
Constant Field Values
Constructor Detail

FieldDefinition

public FieldDefinition()
Method Detail

setName

public void setName(java.lang.String name)
Sets the name of the field

Parameters:
name - the field name

getName

public java.lang.String getName()
Gets the field name

Returns:
the field name

setMimeType

public void setMimeType(java.lang.String mimeType)
Sets the MIME type

Parameters:
mimeType - the MIME type

getMimeType

public java.lang.String getMimeType()
Gets the MIME type

Returns:
the MIME type

setCompress

public void setCompress(boolean compress)
Sets whether compression should be used during transfer

Parameters:
compress - whether or not to use compression during transfer

isCompress

public boolean isCompress()
Whether or not compression will be used during transfer

Returns:
whether or not compression will be used during transfer

setChunkSize

public void setChunkSize(int chunkSize)
Sets the chunk size in bytes that will be used during partial transfer

Parameters:
chunkSize - the chunk size in bytes that will be used during partial transfer

getChunkSize

public int getChunkSize()
Retrieves the chunk size in bytes that will be used during partial transfer

Returns:
the chunk size in bytes that will be used during partial transfer

setTransportDirective

public void setTransportDirective(IBuffer.TransportDirective directive)
Sets the transport directive to be used during transfer

Parameters:
directive - the directive to be used

getTransportDirective

public IBuffer.TransportDirective getTransportDirective()
Retrieves the transport directive to be used during transfer

Returns:
the transport directive to be used during transfer

equals

public boolean equals(java.lang.Object obj)

The properties checked for equality are the configuration values that can be set for the FieldDefinition and additionally, the extendEquals(Object) is invoked to check the extender equality logic

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

extendEquals

public abstract boolean extendEquals(java.lang.Object obj)
Method to be implemented by extenders to check if two instances are equal

Parameters:
obj - the instance to check for equality
Returns:
true if equal, false otherwise

deflate

public void deflate(java.io.DataOutput out)
             throws GRS2RecordSerializationException
Deflates the field definition in the provided stream and calls extendDeflate(DataOutput)

Parameters:
out - the stream to deflate to
Throws:
GRS2RecordSerializationException - A serialization error occurred

toXML

public final org.w3c.dom.Element toXML(org.w3c.dom.Document doc)
                                throws GRS2RecordSerializationException,
                                       GRS2RecordDefinitionException,
                                       org.w3c.dom.DOMException
Throws:
GRS2RecordSerializationException
GRS2RecordDefinitionException
org.w3c.dom.DOMException

extendToXML

public abstract void extendToXML(org.w3c.dom.Document doc,
                                 org.w3c.dom.Element element)
                          throws GRS2RecordSerializationException
Throws:
GRS2RecordSerializationException

extendFromXML

public abstract void extendFromXML(org.w3c.dom.Element element)
                            throws GRS2RecordSerializationException
Throws:
GRS2RecordSerializationException

extendDeflate

public abstract void extendDeflate(java.io.DataOutput out)
                            throws GRS2RecordSerializationException
Method to be implemented by class extenders to deflate additional information

Parameters:
out - the stream to deflate to
Throws:
GRS2RecordSerializationException - A serialization error occurred

inflate

public void inflate(java.io.DataInput in)
             throws GRS2RecordSerializationException
Inflates the field definition from the previously deflated stream. After the internal information is retrieved, the extendInflate(DataInput) is invoked

Parameters:
in - the stream to inflate from
Throws:
GRS2RecordSerializationException - A deserialization error occurred

fromXML

public final void fromXML(org.w3c.dom.Element element)
                   throws GRS2RecordSerializationException,
                          GRS2RecordDefinitionException,
                          org.w3c.dom.DOMException
Throws:
GRS2RecordSerializationException
GRS2RecordDefinitionException
org.w3c.dom.DOMException

extendInflate

public abstract void extendInflate(java.io.DataInput in)
                            throws GRS2RecordSerializationException
Method to be implemented by the class extenders to inflate additional information previously deflated

Parameters:
in - the stream to inflate from
Throws:
GRS2RecordSerializationException - A deserialization error occurred