project.biota.util
Class ResourceObject

java.lang.Object
  extended byproject.biota.util.ResourceObject

public class ResourceObject
extends Object

A class holding the information for a resource.

Author:
Kimmy Lin

Field Summary
static int FOURDSERVER
          A constant indicating a 4D Server resource.
static int FOURDWEB
          A constant indicating a Biota onboard Web Server resource.
static int UNKNOWN
          A constant indicating a unknown type of resource.
 
Constructor Summary
ResourceObject(String name, project.biota.resource.Resource resource)
          Constructs a ResourceObject to hold the information for a resource.
 
Method Summary
 String getConcatSeparator(String schema, String conceptName)
          Gets the symbol used for concatenating field values to concstruct a concept value.
 String getConceptSchemaLocation(String schema)
          Gets the location of the conceptual schema.
 int getConceptType(String schema, String conceptName)
          Gets the type of the concept specified by conceptName.
 Object getConnection()
          Gets a connection to this resource.
 String getDefaultInventoryClause()
          Gets the default concept for a DiGIR inventory request.
 String getDefaultRecordSchemaLocation()
          Gets the default record schema location for this resource.
 String getDefaultRequestType()
          Gets the default operation of a DiGIR request.
 List getFields(String schema, String conceptName)
          Gets the list of the fields mapped to the concept specified by conceptName.
 project.biota.resource.Table[] getForeignTables(String tableName)
          Gets the children table of the table specified by tableName in the resource configuration's table structure.
 String getJoinKeyTable(String tableName, project.biota.resource.Table joinTable)
          Gets the key used to join with its parent table in the resource configuration's table structure.
 int getMaxInventoryRecords()
          Gets the maximum number of records presented in a DiGIR inventory response.
 int getMaxSearchRecords()
          Gets the maximum number of records presented in a DiGIR search response.
 String getName()
          Gets the name of this resource.
 String getPrimaryKey(String tableName)
          Gets the primary key for the table specified by tableName.
 String getResourceMainTable()
          Gets the database main table for this resource.
 project.biota.resource.Metadata getResourceMetadata()
          Gets the Metadata object of this resource.
 int getResourceType()
          Gets the type of this resource.
 boolean isConceptReturnable(String schema, String conceptName)
          Checks whether a concept is returnable for this resource.
 boolean isConceptSearchable(String schema, String conceptName)
          Checks whether a concept is searchable for this resource.
 boolean isConceptSupported(String schema, String conceptName)
          Checks whether the concept specified by conceptName is supported in this resource.
 boolean isResourceOK()
          Checks whether this resource is correctly initialized.
 boolean isSchemaConcept(String schema, String conceptName)
          Checks whether the specified concept is defined in the conceptual schema.
 boolean isSchemaSupported(String schema)
          Checks whether the specified conceptual schema is supported by this resource.
 boolean needConcat(String schema, String conceptName)
          Checks whether a concept's value needs to be concatenated by multiple database field values.
 void setDateLastUpdated(String dateLastUpdated)
          Sets the date when this resource is last updated in the resource's metadata.
 void setNumberOfRecords(int num)
          Sets the number of records in this resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN

public static final int UNKNOWN
A constant indicating a unknown type of resource.

See Also:
Constant Field Values

FOURDSERVER

public static final int FOURDSERVER
A constant indicating a 4D Server resource.

See Also:
Constant Field Values

FOURDWEB

public static final int FOURDWEB
A constant indicating a Biota onboard Web Server resource.

See Also:
Constant Field Values
Constructor Detail

ResourceObject

public ResourceObject(String name,
                      project.biota.resource.Resource resource)
Constructs a ResourceObject to hold the information for a resource.

Parameters:
name - the name of the resource
resource - the Resource object that holds the metadata for the resource
Method Detail

getName

public String getName()
Gets the name of this resource. Each resource's name needs to be unique.

Returns:
the name of this resource

isResourceOK

public boolean isResourceOK()
Checks whether this resource is correctly initialized.

Returns:
true if this resource is correctly initialized, false otherwise

isSchemaSupported

public boolean isSchemaSupported(String schema)
Checks whether the specified conceptual schema is supported by this resource.

Parameters:
schema - the conceptual schema to check
Returns:
true if this conceptual schema is supported by this resource

isSchemaConcept

public boolean isSchemaConcept(String schema,
                               String conceptName)
Checks whether the specified concept is defined in the conceptual schema.

Parameters:
schema - the schema this concept belongs to
conceptName - the name of the concept
Returns:
true if the concept is defined in the conceptual schema

isConceptSupported

public boolean isConceptSupported(String schema,
                                  String conceptName)
Checks whether the concept specified by conceptName is supported in this resource.

Parameters:
conceptName - the name of the concept
Returns:
true if the concept is supported in this resource

isConceptSearchable

public boolean isConceptSearchable(String schema,
                                   String conceptName)
Checks whether a concept is searchable for this resource.

Parameters:
schema - the schema this concept belongs to
conceptName - the name of the concept
Returns:
true if this concept is searchable

isConceptReturnable

public boolean isConceptReturnable(String schema,
                                   String conceptName)
Checks whether a concept is returnable for this resource.

Parameters:
schema - the schema this concept belongs to
conceptName - the name of the concept
Returns:
true if this concept is returnable

needConcat

public boolean needConcat(String schema,
                          String conceptName)
Checks whether a concept's value needs to be concatenated by multiple database field values.

Parameters:
schema - the schema this concept belongs to
conceptName - the name of the concept to check
Returns:
true if the concept's value need to be concatenated

getConcatSeparator

public String getConcatSeparator(String schema,
                                 String conceptName)
Gets the symbol used for concatenating field values to concstruct a concept value. The symbol is default to a space if none is specified in the resource's configuration file.

Parameters:
schema - the schema this concept belongs to
conceptName - the name of the concept
Returns:
the symbol used to concatenate mutiple value

getFields

public List getFields(String schema,
                      String conceptName)
Gets the list of the fields mapped to the concept specified by conceptName.

Parameters:
schema - the schema this concept belongs to
conceptName - the name of the concept
Returns:
a List object contains the fields mapped to the concept

getConceptType

public int getConceptType(String schema,
                          String conceptName)
Gets the type of the concept specified by conceptName. It's one of the following: xsi:decimal, xsi:integer, xsi:string, xsi:dateTime

Parameters:
schema - the schema this concept belongs to
conceptName - the name of the concept
Returns:
the type of the concept

getResourceType

public int getResourceType()
Gets the type of this resource. It needs to be either FOURDWEB or FOURDSERVER.

Returns:
the type of this resource
See Also:
FOURDWEB, FOURDSERVER

getResourceMainTable

public String getResourceMainTable()
Gets the database main table for this resource. This information is only set when the resource type is FOURDSERVER.

Returns:
the table name of the main table in this resource

getResourceMetadata

public project.biota.resource.Metadata getResourceMetadata()
Gets the Metadata object of this resource.

Returns:
the Metadata object of this resource.

getPrimaryKey

public String getPrimaryKey(String tableName)
Gets the primary key for the table specified by tableName. This information is only set for FOURDSERVER type of resources.

Parameters:
tableName - the name of the table
Returns:
the primary key of the table

getJoinKeyTable

public String getJoinKeyTable(String tableName,
                              project.biota.resource.Table joinTable)
Gets the key used to join with its parent table in the resource configuration's table structure. This information is only set for FOURDSERVER type of resources.

Parameters:
tableName - the name of the table
Returns:
the primary key of the table

getForeignTables

public project.biota.resource.Table[] getForeignTables(String tableName)
Gets the children table of the table specified by tableName in the resource configuration's table structure. This information is only set for FOURDSERVER type of resources.

Parameters:
tableName - the name of the table
Returns:
an array of Table object

getConnection

public Object getConnection()
Gets a connection to this resource. If this resource is of type FOURDWEB, it returns a HttpURLConnection. If this is of type FOURDSERVER, it returns a SQL Connection.

Returns:
a Object that's either a HttpURLConnection or a SQL Connection

getDefaultInventoryClause

public String getDefaultInventoryClause()
Gets the default concept for a DiGIR inventory request.

Returns:
the default inventory concept string of this resource

getDefaultRequestType

public String getDefaultRequestType()
Gets the default operation of a DiGIR request.

Returns:
the default operation of a DiGIR request

getDefaultRecordSchemaLocation

public String getDefaultRecordSchemaLocation()
Gets the default record schema location for this resource. This record schema is used to construct the concepts required in a DiGIR response to a search request.

Returns:
the default record schema location of this resource

getConceptSchemaLocation

public String getConceptSchemaLocation(String schema)
Gets the location of the conceptual schema.

Parameters:
schema - the schema this concept belongs to
Returns:
the location of the conceptual schema

setNumberOfRecords

public void setNumberOfRecords(int num)
Sets the number of records in this resource. This method is called when updating the metadata for this resource.

Parameters:
num - the number of the records in the resource

setDateLastUpdated

public void setDateLastUpdated(String dateLastUpdated)
Sets the date when this resource is last updated in the resource's metadata. For now, it's only effective for resource of the type 4D built-in web server.

Parameters:
dateLastUpdated - the string of the last update date for this resource

getMaxSearchRecords

public int getMaxSearchRecords()
Gets the maximum number of records presented in a DiGIR search response.

Returns:
the maximum number of records presented in a DiGIR search response

getMaxInventoryRecords

public int getMaxInventoryRecords()
Gets the maximum number of records presented in a DiGIR inventory response.

Returns:
the maximum number of records presented in a DiGIR inventory response


Copyright © 2004 University of Massachusetts at Boston. All Rights Reserved.