|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.ic.doc.automed.reps.Schema
public class Schema
The Schema class represents a database schema as a set of SchemaObject
s. Each schema may be extensional (i.e. correspond to
source real data source) or intentional (i.e. be defined the use
of one or more Transformation
objects linking to an
extentional Schema. @see Scheme @see Construct
Field Summary | |
---|---|
static int |
DATA_SOURCE_TYPE
In addition to the properties of STORED_TYPE schemas, DATA_SOURCE_TYPE schemas have some external data source that they represent. |
static java.awt.Color |
default_datasource_color
Default Color to use when creating a new data source schema |
static java.awt.Color |
default_extensional_database_color
Default Color to use when creating a new extensional database |
static java.awt.Color |
default_extensional_schema_color
Default Color to use when creating a new extensional schema |
static int |
LIST_SCHEMA_LONG
Constant used to indicate where schemes in schemas must be listed with all details, including the OBID as returned by SchemaObject.getOBID() SchemaObject}, and the Construct
as returned by SchemaObject.getConstruct() . |
static int |
LIST_SCHEMA_NORMAL
Constant used to indicate where schemes in schemas must be listed with all the type of each SchemaObject prefixing the scheme of
each object. |
static int |
LIST_SCHEMA_SHORT
Constant used to indicate where schemes in schemas must be listed with the minimum of detail. |
static int |
MATERIALISED_TYPE
In addition to the properties of STORED_TYPE schemas, MATERIALISED_TYPE schemas may have data stored in the repository. |
static int |
NEW_SCHEMA_Y_OFFSET
Default distance to place a new schema created by a transformation from the schema it is created from |
static int |
STORED_TYPE
All details about the constructs of STORED_TYPE schemas are held in the repository, and this type my exist in isolation.. |
static int |
VIRTUAL_TYPE
No details are held in the repository about VIRTUAL_TYPE schemas, other than the name of schema. |
Constructor Summary | |
---|---|
Schema(java.lang.String schemaName)
Deprecated. Not the correct way to do things!!!! see #createSchema()
Just create an empty Schema object with name
dmle 9/11/2005 |
Method Summary | |
---|---|
boolean |
addSchemaChangeListener(SchemaChangeListener scl)
|
static boolean |
addSchemasListener(SchemasListener nl)
Add an instance of any class implementing interface SchemasListener such that it will be notified of any adding
or deleting of schemas that may occur. |
Schema |
applyAddTransformation(Construct toObjectConstructType,
AutoMedType amtype,
java.lang.Object[] toObject,
java.lang.String function,
java.lang.String constraint)
|
Schema |
applyAddTransformation(Construct toObjectConstructType,
java.lang.Object[] toObject,
java.lang.String function,
java.lang.String constraint)
Returns the Schema which is the result of applying an
ADD transformation. |
Schema |
applyAddTransformation(Construct toObjectConstructType,
java.lang.Object[] toObject,
java.lang.String function,
java.lang.String constraint,
java.lang.String newSchemaName)
Returns the Schema which is the result of applying an
ADD transformation. |
Schema |
applyAddTransformation(Construct type,
java.lang.String scheme,
java.lang.String function,
java.lang.String constraint)
|
Schema |
applyContractTransformation(SchemaObject fromObject,
java.lang.String function,
java.lang.String constraint)
Returns the Schema which is the result of applying a
CONTRACT transformation. |
Schema |
applyContractTransformation(SchemaObject fromObject,
java.lang.String function,
java.lang.String constraint,
java.lang.String newSchemaName)
Returns the Schema which is the result of applying a
CONTRACT transformation. |
Schema |
applyDeleteTransformation(SchemaObject fromObject,
java.lang.String function,
java.lang.String constraint)
Returns the Schema which is the result of applying a
DELETE transformation. |
Schema |
applyDeleteTransformation(SchemaObject fromObject,
java.lang.String function,
java.lang.String constraint,
java.lang.String newSchemaName)
Returns the Schema which is the result of applying a
DELETE transformation. |
Schema |
applyExtendTransformation(Construct toObjectConstructType,
java.lang.Object[] toObject,
java.lang.String function,
java.lang.String constraint)
Returns the Schema which is the result of applying an
EXTEND transformation. |
Schema |
applyExtendTransformation(Construct toObjectConstructType,
java.lang.Object[] toObject,
java.lang.String function,
java.lang.String constraint,
java.lang.String newSchemaName)
Returns the Schema which is the result of applying an
EXTEND transformation. |
Schema |
applyExtendTransformation(Construct type,
java.lang.String scheme,
java.lang.String function,
java.lang.String constraint)
|
Schema |
applyIdentTransformation(Schema otherSchema)
Links this schema to another schema which should have exactly the same structure, i.e. |
Schema |
applyRenameTransformation(SchemaObject fromObject,
java.lang.Object[] toObject)
Returns the Schema which is the result of applying a
RENAME transformation. |
Schema |
applyRenameTransformation(SchemaObject fromObject,
java.lang.Object[] toObject,
java.lang.String newSchemaName)
Returns the Schema which is the result of applying a
RENAME transformation. |
protected void |
checkEditable()
Checks whether a schema is editable. |
static Schema |
checkSchemaName(java.lang.StringBuffer schemaName)
Check if a given schema name already been assigned. |
static void |
clearSchemas()
This method empties all the cached Schema, SchemaObject, Transformation, AccessMethods and Protocols that have been cached. |
boolean |
contains(SchemaObject so)
Determine if a SchemaObject exists in this Schema |
boolean |
contains(java.lang.String name)
Determine if the SchemaObject that has the supplied name
exists in this Schema |
boolean |
containsSchemaObject(java.lang.String name)
|
java.lang.String |
createFollowingSchemaName()
|
java.lang.String |
createFollowingSchemaName(java.lang.String name)
Generate a name of a schema that "appears" to be following the name used for this Schema, and which has not already been used as a Schema name |
static Schema |
createSchema(java.lang.String schemaName)
Creates a new STORED_TYPE schema. |
static Schema |
createSchema(java.lang.String schemaName,
boolean isDataSource)
Creates a new schema. |
protected static Schema |
createSchema(java.lang.String schemaName,
int type,
Schema subnetSchema)
Creates a new schema. |
SchemaObject |
createSchemaObject(Construct cType,
AutoMedType amtype,
java.lang.Object[] schemeObjects)
|
SchemaObject |
createSchemaObject(Construct cType,
java.lang.Object[] schemeObjects)
Creates a schema object. |
SchemaObject |
createSchemaObject(Construct cType,
java.lang.Object[] schemeObjects,
int tid)
Create a schema object with type_id |
java.lang.String |
debugString()
A String representation of this object useful for debugging code |
SchemaObject[] |
differenceByName(Schema s2)
Return an SchemaObject array containing the difference
by name between this schema (s1) and the schema passed as a parameter
(s2). |
static boolean |
exists(java.lang.String schemaName)
Returns true is the named schema exists |
void |
exportSchemaObjects(java.io.OutputStream os)
|
void |
exportSchemaObjects(java.io.PrintWriter pw)
|
Schema |
extendToMatch(Schema schemaToAdd)
Create a new Schema which contains the same set of constructs as the current schema, plus all those constructs of another schema, which are defined via extend operators. |
java.util.List |
findAllPathwayAbstractions(Schema target)
Find abstractions of all transformation pathways from this schema to another schema |
java.util.List |
findAllPathways(Schema target)
|
Schema[] |
findAttachedDataSources()
Deprecated. Use getAttachedSchemas(int) instead.
Returns an array of Schema's that are connected to this schema by some
transformation pathway and are data sources (including this schema itself
if it is a data source). For each schema s returned, s.isDataSource() is
true. |
Schema[] |
findAttachedExtDBs()
Deprecated. Use getAttachedSchemas(int) instead.
Returns an array of Schema's that are connected to this schema by some
transformation pathway and have extensional data (including this schema
itself if it has extensional data). For each schema s returned,
s.isExtDB() is true. |
Schema[] |
findAttachedExtSchemas()
Deprecated. Use getAttachedSchemas(int) instead.
Returns an array of Schema's that are connected to this schema by some
transformation pathway and are extensional schemas (including this schema
itself if it is an extensional schema). For each schema s returned,
s.isExtSchema() is true. |
Schema[] |
findShortestPath(Schema target)
Returns an array of schemas such that: There is a transformation between each pair of adjacent schamas. |
java.awt.Point |
getAbsolutePosition()
Same behaviour as getPosition() since Schema instances
are not placed relative to other Positionable s. |
AccessMethod[] |
getAccessMethods()
Find the AccessMethod s that may be used to access the
physical database system that holds this Schema . |
java.lang.Object[] |
getAllSchemeNames()
Returns an Object array of schemes of all the schema objects
that belong to the schema. |
java.lang.Object[] |
getAllSchemeNames(boolean keyOnly)
|
java.lang.Object[] |
getAllSchemeNames(boolean all,
int idDepth,
int typeDepth)
|
java.lang.Object[] |
getAllSchemeNames(boolean all,
int idDepth,
int typeDepth,
boolean keyOnly)
|
java.lang.String |
getAllSchemeNamesString()
Returns the scheme representation (of type String )
of the schemes of all the schema objects that belong to the
schema. |
java.lang.String |
getAllSchemeNamesString(boolean keyOnly)
|
java.lang.String |
getAllSchemeNamesString(boolean all,
int idDepth,
int typeDepth)
|
java.lang.String |
getAllSchemeNamesString(boolean all,
int idDepth,
int typeDepth,
boolean keyOnly)
|
Schema[] |
getAttachedSchemas(int type)
Returns an array of Schema's that are connected to this schema by some pathway. |
java.util.List |
getAttributeDomains()
Return the attribute domain specifications |
java.awt.Color |
getBackgroundColor()
|
static java.lang.String |
getCloseSchemeBracket()
find what string is used to deliminate the closing of a scheme name, such as the ">>" in "<<person>>" or "<<person,name>>". |
DataSource |
getDataSource()
Create the DataSource object representing the data source represented
by this schema |
SchemaObject[] |
getDependentSchemaObjects(SchemaObject so)
Return all SchemaObject s of a particular Construct in this Schema which have a reference to the
given SchemaObject in
their scheme. |
SchemaObject[] |
getDependentSchemaObjects(SchemaObject so,
Construct c)
Return those SchemaObject s of a particular Construct in this Schema which have a reference to the
given SchemaObject in
their scheme. |
java.awt.Color |
getForegroundColor()
|
java.lang.String |
getGlobalName()
Returns the global schema name |
PersistentKey |
getKey()
|
static Schema |
getKnownSchema(int sid)
Use to obtain a schema that is known to exist, and therefore no sense in trapping NotFoundException. |
static Schema |
getKnownSchema(java.lang.String name)
Use to obtain a schema that is known to exist, and therefore no sense in trapping NotFoundException. |
java.lang.String |
getLabel()
Get the text used to label this Schema. |
java.awt.Point |
getLabelPosition()
|
int |
getLabelXPos()
|
int |
getLabelYPos()
|
java.util.Map |
getModels()
Get all associated models to a schema object. |
java.lang.String |
getModelsAsString()
Works similar to getModels() method except that this method
returns a delimited string of Model s' names |
java.lang.String |
getName()
Find the name of the schema. |
static java.lang.String |
getName(int SID)
Returns the name of a schema from its SID without instantiating it |
static java.lang.String |
getOpenSchemeBracket()
Find what string is used to deliminate the opening of a scheme name, such as the "<<" in "<<person>>" or "<<person,name>>". |
java.util.Map |
getPersistentAttributes()
|
java.awt.Point |
getPosition()
Return the Point that represents the position of this
Positionable in a Panel . |
Positionable |
getPositionedRelativeTo()
Return the Positionable this is relative to. |
java.lang.Object |
getRepObject()
|
static Schema |
getSchema(int sid)
Returns the Schema object which has the given schema
identifier (SID). |
static Schema |
getSchema(java.lang.String schemaName)
Returns the Schema object with the given name. |
static int[] |
getSchemaIDs()
Returns an array of SID of all the schemas found in the STR. |
static java.lang.String[] |
getSchemaNames()
Returns an array of names of all the schemas found in the STR. |
SchemaObject |
getSchemaObject(java.lang.String name)
|
SchemaObject |
getSchemaObject(java.lang.String name,
int searchMethod)
Return the SchemaObject that has the supplied name in
this schema. |
SchemaObject |
getSchemaObjectByName(java.lang.String name)
Deprecated. Return the SchemaObject that has the supplied name in
this schema. Note that the String supplied must match exactly
the name of the SchemaObject as returned by SchemaObject.getSchemeNamesString() |
SchemaObject[] |
getSchemaObjects()
Returns an array of schema objects (of class SchemaObject )
that belong to the schema. |
static Schema[] |
getSchemas()
Find all Schema instances held in the repository. |
int |
getSID()
Returns the schema identifier (SID) of the schema. |
Schema |
getSubnetSchema()
Find the extensional schema in the same subnetwork as this Schema. |
java.awt.Color |
getTextColor()
|
Transformation[] |
getTransformations()
Return an array of all Transformation that go out
from a particular schema. |
protected Transformation[] |
getTransformationsFrom()
Returns an array of Transformation 's that have this schema
as the fromSchema field in the transformation table of the
STR. |
protected Transformation[] |
getTransformationsTo()
Returns an array of Transformation 's that have this schema
as the toSchema field in the transformation table of the
STR. |
int |
getType()
Return the type (VIRTUAL_TYPE, STORED_TYPE, ...) of this schema.. |
int |
getXPos()
|
int |
getYPos()
|
protected boolean |
hasObject(SchemaObject so)
Determines if the schema contains the given schema object. |
void |
importSchemaObjects(java.io.InputStream is)
|
SchemaObject[] |
intersectionByName(Schema s2)
Return an SchemaObject array containing the intersection by
name between this schema (s1) and the schema passed as a
parameter (s2). |
boolean |
isDataSource()
Deprecated. use getType() instead.
Determines whether or not the schema represents an external data
source. |
boolean |
isExtDB()
Deprecated. use getType() instead.
Determines whether or not the schema represents an extentional
database. |
boolean |
isExtSchema()
Deprecated. use getType() instead.
Determines whether or not the schema is an extentional schema. |
void |
listSchema()
List the Schema to the current output in a form designed for human interpretation. |
void |
listSchema(java.io.PrintStream out)
Shorthand for calling listSchema(out,LIST_SCHEMA_NORMAL) |
void |
listSchema(java.io.PrintStream out,
int mode)
Shorthand for calling listSchema(out,LIST_SCHEMA_NORMAL,false) |
void |
listSchema(java.io.PrintStream out,
int mode,
boolean keyOnly)
List the Schema to an output stream, using the specified format. |
Schema[] |
match(Schema s2)
Return a array of two Schemas, which are formed by extending two conformed schemes such that they are identical. |
Schema |
newapplyExtendTransformation(Construct type,
java.lang.String scheme,
java.lang.String function,
java.lang.String constraint)
|
void |
oldRetract()
|
Schema |
prefixAllNodalNames(java.lang.String prefix)
Create a new Schema which contains the same set of constructs as an existing, except each has been renamed to have a common prefix if it is of Construct type Nodal. |
Transformation |
prefixSchemaObjectName(java.lang.String prefix,
SchemaObject nodeObject)
Create a new Schema if the SchemaObject is a Nodal object, where the SchemaObject has had a
prefix applied to the node name, |
static Schema |
read(java.io.InputStream is)
A variant of read(InputStream, String) , where the name
of the new Schema created is taken from that held in the textual
description read from the InputStream. |
static Schema |
read(java.io.InputStream is,
java.lang.String name)
Read a schema description held in a textually format (possibly created by write() ) into the repository. |
java.lang.Object[] |
readSchemeDefinition(Construct cons,
java.lang.String sd)
Take a String containing the definition of a scheme of a SchemaObject and create an Object array that would be used in creating the SchemaObject |
static void |
reloadSchemas()
|
void |
remove()
Removes the Schema from the repository. |
static void |
remove(java.lang.String schemaName)
Removes the Schema with the given schemaName. |
void |
removeAccessMethods()
Remove all AccessMethod s recorded for this schema. |
boolean |
removeSchemaChangeListener(SchemaChangeListener scl)
|
void |
removeSchemaObjects()
Removes all schema objects that belong to the schema, i.e., the schema's SchemaObject list is emptied. |
static boolean |
removeSchemasListener(SchemasListener nl)
Remove an instance of any class implementing interface SchemasListener such that it will no longer
be notified of any adding
or deleting of schemas that may occur. |
void |
retract()
Removes the Schema from the repository, together with any SchemaObject s left in the schema, and any
Transformation s that link to this schema. |
static void |
retract(java.lang.String schemaName)
Removes any Schema with the given name from the repository, together with any SchemaObject s left in the schema, and
any Transformation s that link to this schema. |
void |
setAbsolutePosition(int x,
int y)
Same behaviour as #setPosition() since Schema instances
are not placed relative to other Positionable s. |
void |
setAttributeDomains(java.util.List domainSpec)
Manually set the domain information for some attributes. |
void |
setBackgroundColor(java.awt.Color c)
|
void |
setDataSource(boolean dataSource)
Deprecated. use {@link setType) instead. Sets whether or not the schema represents an external data source. |
void |
setExtDB(boolean extDB)
Deprecated. use {@link setType) instead. Sets whether or not the schema represents an extentional database. |
void |
setExtSchema(boolean extSchema)
Deprecated. use {@link setType) instead. Sets whether or not the schema is an extentional schema. |
void |
setForegroundColor(java.awt.Color c)
|
void |
setGlobalName(java.lang.String globalName)
The original (global) name of a schema as advertised by a peer. |
void |
setLabel(java.lang.String label)
|
void |
setLabelPosition(int x,
int y)
|
void |
setLabelXPos(int x)
|
void |
setLabelYPos(int y)
|
void |
setName(java.lang.String name)
Set the name of a Schema. |
static void |
setOpenCloseSchemeBracket(java.lang.String openScheme,
java.lang.String closeScheme)
Set the String |
void |
setPosition(int x,
int y)
|
void |
setTextColor(java.awt.Color c)
|
void |
setType(int type)
Set what type of Schema this is. |
void |
setXPos(int x)
|
void |
setYPos(int y)
|
java.lang.String |
toString()
|
Schema |
union(Schema s2)
Return an Schema (su) containing the union of
SchemaObject s in this schema (s1) and the
schema passed as a parameter (s2). |
SchemaObject[] |
unionByName(Schema s2)
Return an SchemaObject array containing the union by
name between this schema (s1) and the schema passed as a
parameter (s2). |
void |
updateSchemaObjectNameHashMap()
Update this Schema's hashmap of how each SchemaObject in
the schema is named. |
void |
write()
Write to the standard out a text representation of this Schema object, in a form suitable for human interpretation, and suitable for being used as the input to #read() |
void |
write(java.io.OutputStream os)
|
void |
write(java.io.OutputStream os,
int format)
|
void |
write(java.io.PrintWriter pw)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int NEW_SCHEMA_Y_OFFSET
public static final java.awt.Color default_datasource_color
public static final java.awt.Color default_extensional_database_color
public static final java.awt.Color default_extensional_schema_color
public static final int LIST_SCHEMA_SHORT
public static final int LIST_SCHEMA_NORMAL
SchemaObject
prefixing the scheme of
each object.
public static final int LIST_SCHEMA_LONG
SchemaObject.getOBID()
SchemaObject}, and the Construct
as returned by SchemaObject.getConstruct()
.
public static final int VIRTUAL_TYPE
public static final int STORED_TYPE
public static final int MATERIALISED_TYPE
public static final int DATA_SOURCE_TYPE
AutoMedWrapper
s, and the details of the
data source are recorded in AccessMethod
.
Constructor Detail |
---|
public Schema(java.lang.String schemaName)
#createSchema()
Just create an empty Schema object with name
dmle 9/11/2005
Method Detail |
---|
public static void reloadSchemas()
public static Schema createSchema(java.lang.String schemaName, boolean isDataSource)
schemaName
- name of the schema.isDataSource
- set to true
if the schema
represents an external data source; false
if just STORED_TYPE.public static Schema createSchema(java.lang.String schemaName)
schemaName
- name of the schema.isDataSource
- set to true
if the schema
represents an external data source; false
otherwise.protected static Schema createSchema(java.lang.String schemaName, int type, Schema subnetSchema)
schemaName
- name of the schema.type
- of schema (DATA_SOURCE_TYPE, ...).subnetSchema
- is the Schema which is the extensional schema of
the subnet: set null if this is the subnet schemapublic static Schema checkSchemaName(java.lang.StringBuffer schemaName)
schemaName
- a schema name to check
protected void checkEditable()
InconsistentException
public static void remove(java.lang.String schemaName) throws NotFoundException, IntegrityException
Schema.remove()
of the Schema with the given name.
schemaName
- the name of the schema to be removed from the
repository
NotFoundException
IntegrityException
public void remove() throws IntegrityException
SchemaObject
s left in this schema, nor any
Transformation
s that link to this schema.
IntegrityException
- if the schema is an extentional schema
containing one or more SchemaObject
s, or any schema that
has one or more Transformation
s attached.public SchemaObject[] getDependentSchemaObjects(SchemaObject so)
SchemaObject
s of a particular Construct
in this Schema
which have a reference to the
given SchemaObject
in
their scheme.
so
- The SchemaObject
which dependents of are to be found.public SchemaObject[] getDependentSchemaObjects(SchemaObject so, Construct c)
SchemaObject
s of a particular Construct
in this Schema
which have a reference to the
given SchemaObject
in
their scheme.
so
- The SchemaObject
which dependents of are to be found.c
- The Construct
type of the SchemaObject
s to
return. If null, then all SchemaObject
s are returnedpublic void retract() throws IntegrityException
SchemaObject
s left in the schema, and any
Transformation
s that link to this schema.
IntegrityException
public void oldRetract() throws IntegrityException
IntegrityException
public static void retract(java.lang.String schemaName)
SchemaObject
s left in the schema, and
any Transformation
s that link to this schema. If no such
schema exists, this method does nothing.
public SchemaObject createSchemaObject(Construct cType, java.lang.Object[] schemeObjects, int tid) throws TypeMismatchException, IntegrityException
TypeMismatchException
IntegrityException
public SchemaObject createSchemaObject(Construct cType, java.lang.Object[] schemeObjects) throws TypeMismatchException, IntegrityException
cType
- construct type (of class Construct
) of the
schema object.schemeObjects
- an array of string values and/or schema
objects contained in the scheme of the new schema object. Only one
string value is allowed in the array which represents the name/value
of the schema object.
IntegrityException
- if the scheme contains references to
schema objects from a different subnet.
TypeMismatchException
public SchemaObject createSchemaObject(Construct cType, AutoMedType amtype, java.lang.Object[] schemeObjects) throws TypeMismatchException, IntegrityException
TypeMismatchException
IntegrityException
public int getSID()
public java.lang.String getName()
public Schema getSubnetSchema()
Tranformation
instances link the extensional schema with other Schema instances
that belong to the same subnet. IDENT Transformation instances
link subnets together where they have two Schemas which have
identical SchemaObject schemes.
public int getXPos()
getXPos
in interface Positionable
public int getYPos()
getYPos
in interface Positionable
public void setXPos(int x)
setXPos
in interface Positionable
public void setYPos(int y)
setYPos
in interface Positionable
public void setPosition(int x, int y)
setPosition
in interface Positionable
public void setAbsolutePosition(int x, int y)
#setPosition()
since Schema
instances
are not placed relative to other Positionable
s.
setAbsolutePosition
in interface Positionable
public java.awt.Point getPosition()
Positionable
Point
that represents the position of this
Positionable
in a Panel
. Note that depending on
the implementation of the interface, this might a coordinate
relative to some other positionable
getPosition
in interface Positionable
public java.awt.Point getAbsolutePosition()
getPosition()
since Schema
instances
are not placed relative to other Positionable
s.
getAbsolutePosition
in interface Positionable
public Positionable getPositionedRelativeTo()
Positionable
Positionable
this is relative to. If not relative
to some other Positionable
then return null.
getPositionedRelativeTo
in interface Positionable
public int getLabelXPos()
getLabelXPos
in interface Positionable
public int getLabelYPos()
getLabelYPos
in interface Positionable
public java.awt.Point getLabelPosition()
getLabelPosition
in interface Positionable
public void setLabelXPos(int x)
setLabelXPos
in interface Positionable
public void setLabelYPos(int y)
setLabelYPos
in interface Positionable
public void setLabelPosition(int x, int y)
setLabelPosition
in interface Positionable
public java.lang.String getLabel()
getName()
at least in that any characters that need escaping
for printing are escaped.
getLabel
in interface Positionable
public void setLabel(java.lang.String label)
setLabel
in interface Positionable
public java.lang.Object getRepObject()
getRepObject
in interface Positionable
public void setName(java.lang.String name) throws IntegrityException
name
- new name to give to the schema
IntegrityException
- if another schema already exists with this
name in the repositorypublic void setGlobalName(java.lang.String globalName)
localName
- the original (global) name assigned to this schemapublic java.lang.String getGlobalName()
public static java.lang.String getName(int SID) throws InconsistentException
SID
- The schema id for which the name will be returned
InconsistentException
public int getType()
public boolean isExtSchema()
getType()
instead.
Determines whether or not the schema is an extentional schema.
true
if the schema is an extentional schema;
false
if it is an intentional schema.public boolean isExtDB()
getType()
instead.
Determines whether or not the schema represents an extentional
database.
true
if the schema represents an extentional
database; false
otherwise.public boolean isDataSource()
getType()
instead.
Determines whether or not the schema represents an external data
source.
true
if the schema represents an external
data source; false
otherwise.public SchemaObject[] getSchemaObjects()
SchemaObject
)
that belong to the schema.
SchemaObject
)
that belong to the schema.public java.lang.Object[] getAllSchemeNames()
Object
array of schemes of all the schema objects
that belong to the schema.
public java.lang.Object[] getAllSchemeNames(boolean keyOnly)
public java.lang.Object[] getAllSchemeNames(boolean all, int idDepth, int typeDepth)
public java.lang.Object[] getAllSchemeNames(boolean all, int idDepth, int typeDepth, boolean keyOnly)
public java.lang.String getAllSchemeNamesString()
String
)
of the schemes of all the schema objects that belong to the
schema.
public java.lang.String getAllSchemeNamesString(boolean keyOnly)
public java.lang.String getAllSchemeNamesString(boolean all, int idDepth, int typeDepth)
public java.lang.String getAllSchemeNamesString(boolean all, int idDepth, int typeDepth, boolean keyOnly)
public void setType(int type)
Schema
this is.
public void setExtSchema(boolean extSchema)
extSchema
- set to true
if the schema is an
extentional schema; false
otherwise.public void setExtDB(boolean extDB)
extDB
- set to true
if the schema represents an
extentional database; false
otherwise.public void setDataSource(boolean dataSource)
dataSource
- set to true
if the schema represents an
external data source; false
otherwise.
InconsistentException
public void removeSchemaObjects() throws IntegrityException
SchemaObject
list is emptied.
IntegrityException
public static boolean exists(java.lang.String schemaName)
schemaName
- name of the schema to check for the existance ofpublic static Schema getSchema(java.lang.String schemaName) throws NotFoundException
Schema
object with the given name.
schemaName
- name of the schema.
Schema
object with the
given name, or null if it does not exist.
NotFoundException
- if no schema with the given name exists
in the repositorypublic static java.lang.String[] getSchemaNames()
public static int[] getSchemaIDs()
public static Schema[] getSchemas()
Schema
instances held in the repository.
public static Schema getSchema(int sid) throws NotFoundException
Schema object which has the given schema
identifier (SID).
- Parameters:
sid
- the SID of the Schema
to
return
- Returns:
- the
Schema object which has the SID.
- Throws:
NotFoundException
- if no schema exists in the repository
with this SID
public static Schema getKnownSchema(int sid)
exists(String)
public static Schema getKnownSchema(java.lang.String name)
exists(String)
protected boolean hasObject(SchemaObject so)
true
if the schema contains the given schema object;
false
otherwise.protected Transformation[] getTransformationsFrom()
Transformation
's that have this schema
as the fromSchema
field in the transformation table of the
STR.
Transformation
's that have this schema
as the fromSchema
field in the transformation table of the
STR.protected Transformation[] getTransformationsTo()
Transformation
's that have this schema
as the toSchema
field in the transformation table of the
STR.
Transformation
's that have this schema
as the toSchema
field in the transformation table of the
STR.public Schema applyIdentTransformation(Schema otherSchema) throws SchemasNotIdenticalException
SchemaObject
in this schema
there is another SchemaObject
in the other schema that has
the same scheme viewed as text (but migtht have a different identifier
SchemasNotIdenticalException
public Schema applyAddTransformation(Construct toObjectConstructType, java.lang.Object[] toObject, java.lang.String function, java.lang.String constraint) throws TypeMismatchException, IntegrityException
Schema
which is the result of applying an
ADD transformation.
toObjectConstructType
- the construct type (see Construct
) of
the resulting transformation object.toObject
- the scheme (in an Object
array) that forms the
output of the transformation.function
- the query that expresses the extent of the construct
being transformed.constraint
- the constraint associated with the transformation
(if any).
Schema
which is the result of applying an
ADD transformation.
IntegrityException
TypeMismatchException
public Schema applyAddTransformation(Construct toObjectConstructType, AutoMedType amtype, java.lang.Object[] toObject, java.lang.String function, java.lang.String constraint) throws TypeMismatchException, IntegrityException
TypeMismatchException
IntegrityException
public Schema applyAddTransformation(Construct toObjectConstructType, java.lang.Object[] toObject, java.lang.String function, java.lang.String constraint, java.lang.String newSchemaName) throws TypeMismatchException, IntegrityException
Schema
which is the result of applying an
ADD transformation.
toObjectConstructType
- the construct type (see Construct
) of
the resulting transformation object.toObject
- the scheme (in an Object
array) that forms the
output of the transformation.function
- the query that expresses the extent of the construct
being transformed.constraint
- the constraint associated with the transformation
(if any).newSchemaName
- the name of the resultant schema.
Schema
which is the result of applying an
ADD transformation.
TypeMismatchException
IntegrityException
public Schema applyDeleteTransformation(SchemaObject fromObject, java.lang.String function, java.lang.String constraint) throws TypeMismatchException, IntegrityException
Schema
which is the result of applying a
DELETE transformation.
fromObject
- the SchemaObject
to be deleted in the
transformation. Note that this schema object must belong to the given
fromSchema.function
- the query that expresses the extent of the construct
being transformed.constraint
- the constraint associated with the transformation
(if any).
Schema
which is the result of applying a
DELETE transformation.
TypeMismatchException
IntegrityException
public Schema applyDeleteTransformation(SchemaObject fromObject, java.lang.String function, java.lang.String constraint, java.lang.String newSchemaName) throws TypeMismatchException, IntegrityException
Schema
which is the result of applying a
DELETE transformation.
fromObject
- the SchemaObject
to be deleted in the
transformation. Note that this schema object must belong to the given
fromSchema.function
- the query that expresses the extent of the construct
being transformed.constraint
- the constraint associated with the transformation
(if any).newSchemaName
- the name of the resultant schema.
Schema
which is the result of applying a
DELETE transformation.
TypeMismatchException
IntegrityException
public Schema applyRenameTransformation(SchemaObject fromObject, java.lang.Object[] toObject) throws TypeMismatchException, IntegrityException
Schema
which is the result of applying a
RENAME transformation.
fromObject
- the SchemaObject
to be renamed in the
transformation. Note that this schema object must belong to the given
fromSchema.toObject
- the scheme (in an Object
array) that forms the
output of the transformation. (The construct type of toObject must
be the same as the fromObject).
Schema
which is the result of applying a
RENAME transformation.
TypeMismatchException
IntegrityException
public Schema applyRenameTransformation(SchemaObject fromObject, java.lang.Object[] toObject, java.lang.String newSchemaName) throws TypeMismatchException, IntegrityException
Schema
which is the result of applying a
RENAME transformation.
fromObject
- the SchemaObject
to be renamed in the
transformation. Note that this schema object must belong to the given
fromSchema.toObject
- the scheme (in an Object
array) that forms the
output of the transformation. (The construct type of toObject must
be the same as the fromObject).newSchemaName
- the name of the resultant schema.
Schema
which is the result of applying a
RENAME transformation.
TypeMismatchException
IntegrityException
public Schema applyExtendTransformation(Construct toObjectConstructType, java.lang.Object[] toObject, java.lang.String function, java.lang.String constraint) throws TypeMismatchException, IntegrityException
Schema
which is the result of applying an
EXTEND transformation.
toObjectConstructType
- the construct type (see Construct
) of
the resulting transformation object.toObject
- the scheme (in an Object
array) that forms the
output of the transformation.function
- the query that expresses the extent of the construct
being transformed.constraint
- the constraint associated with the transformation
(if any).
Schema
which is the result of applying an
EXTEND transformation.
TypeMismatchException
IntegrityException
- if the scheme contains references to
schema objects from a different subnet.public Schema applyAddTransformation(Construct type, java.lang.String scheme, java.lang.String function, java.lang.String constraint) throws TypeMismatchException, IntegrityException, SyntaxException, NotFoundException
TypeMismatchException
IntegrityException
SyntaxException
NotFoundException
public Schema applyExtendTransformation(Construct type, java.lang.String scheme, java.lang.String function, java.lang.String constraint) throws TypeMismatchException, IntegrityException, SyntaxException, NotFoundException
TypeMismatchException
IntegrityException
SyntaxException
NotFoundException
public Schema newapplyExtendTransformation(Construct type, java.lang.String scheme, java.lang.String function, java.lang.String constraint) throws TypeMismatchException, IntegrityException, SyntaxException, NotFoundException
TypeMismatchException
IntegrityException
SyntaxException
NotFoundException
public java.lang.String createFollowingSchemaName()
public java.lang.String createFollowingSchemaName(java.lang.String name)
public Schema applyExtendTransformation(Construct toObjectConstructType, java.lang.Object[] toObject, java.lang.String function, java.lang.String constraint, java.lang.String newSchemaName) throws TypeMismatchException, IntegrityException
Schema
which is the result of applying an
EXTEND transformation.
toObjectConstructType
- the construct type (see Construct
) of
the resulting transformation object.toObject
- the scheme (in an Object
array) that forms the
output of the transformation.function
- the query that expresses the extent of the construct
being transformed.constraint
- the constraint associated with the transformation
(if any).newSchemaName
- the name of the resultant schema.
Schema
which is the result of applying an
EXTEND transformation.
TypeMismatchException
IntegrityException
public Schema applyContractTransformation(SchemaObject fromObject, java.lang.String function, java.lang.String constraint) throws TypeMismatchException, IntegrityException
Schema
which is the result of applying a
CONTRACT transformation.
fromObject
- the SchemaObject
to be contracted in the
transformation. Note that this schema object must belong to the given
fromSchema.function
- the query that expresses the extent of the construct
being transformed.constraint
- the constraint associated with the transformation
(if any).
Schema
which is the result of applying a
CONTRACT transformation.
TypeMismatchException
IntegrityException
public Schema applyContractTransformation(SchemaObject fromObject, java.lang.String function, java.lang.String constraint, java.lang.String newSchemaName) throws TypeMismatchException, IntegrityException
Schema
which is the result of applying a
CONTRACT transformation.
fromObject
- the SchemaObject
to be contracted in the
transformation. Note that this schema object must belong to the given
fromSchema.function
- the query that expresses the extent of the construct
being transformed.constraint
- the constraint associated with the transformation
(if any).newSchemaName
- the name of the resultant schema.
Schema
which is the result of applying a
CONTRACT transformation.
TypeMismatchException
IntegrityException
public static void clearSchemas()
public SchemaObject getSchemaObjectByName(java.lang.String name)
SchemaObject
that has the supplied name in
this schema. Note that the String supplied must match exactly
the name of the SchemaObject
as returned by SchemaObject.getSchemeNamesString()
public SchemaObject getSchemaObject(java.lang.String name) throws NotFoundException
NotFoundException
public SchemaObject getSchemaObject(java.lang.String name, int searchMethod) throws NotFoundException
SchemaObject
that has the supplied name in
this schema. Note that the String supplied must match exactly
the name of the SchemaObject
as returned by SchemaObject.getSchemeNamesString()
name
- the String name of the SchemaObject
searchMethod
- must be one of SEARCH_BY_KEY_NAME
,
SEARCH_BY_FULL_NAME
or SEARCH_BY_KEY_THEN_FULL_NAME
NotFoundException
- if no SchemaObject
with the
supplied named existspublic boolean contains(SchemaObject so)
SchemaObject
exists in this Schema
a
- SchemaObject
to test for membership
Schema
public boolean contains(java.lang.String name)
SchemaObject
that has the supplied name
exists in this Schema
name
- the String name of the SchemaObject
Schema
public boolean containsSchemaObject(java.lang.String name)
public void updateSchemaObjectNameHashMap()
SchemaObject
in
the schema is named. This method should not now need to be
called by user programs since the map is supposed to be kept up
to date, but if you suspect problems (and in particular is a
object found in listSchema()
is not found by getSchemaObjectByName(String)
) then call this method.
public static void setOpenCloseSchemeBracket(java.lang.String openScheme, java.lang.String closeScheme)
Strings that is used to open and
close a scheme name,
such as the "<<" and ">>" in "<<person>>"
or "<<person,name>>".
By default these are set to "<<" and ">>". Normally
these pairs would be set to one of "<" and ">", or
"<<" and ">>", or "?" (open double chevron) and
"?" (close double chevron)
- Parameters:
openScheme
- the string to open schemes withcloseScheme
- the String to close schemes with
public static java.lang.String getOpenSchemeBracket()
String
used to deliminate the opening of a scheme namepublic static java.lang.String getCloseSchemeBracket()
String
used to deliminate the closing of a scheme namepublic SchemaObject[] differenceByName(Schema s2)
SchemaObject
array containing the difference
by name between this schema (s1) and the schema passed as a parameter
(s2). Thus the returned array will contain any SchemaObject
that appears this Schema
, but which there is not object in
s2
with the same textual name. Thus the array will
not contain an object from s1 named "<<person>>" if there is
another object in s2 called "<<person>>", even if those two
objects have diffient OBIDs.
s2
- the Schema to be subtracted from this Schema s1
public SchemaObject[] unionByName(Schema s2)
SchemaObject
array containing the union by
name between this schema (s1) and the schema passed as a
parameter (s2). Thus the returned array will contain any SchemaObject
that appears in s1, plus those
objects in s2 with different textual names. Thus
the array will not contain an object from s2 named
"<<person>>" if there is another object in s1 called
"<<person>>", even if the two objects have different OBIDs.
s2
- the Schema to be unioned with this Schema s1
public Schema[] match(Schema s2)
SchemaObject
s that have the same
Construct
and scheme also have the same real world
semantics an extent.
s2
- a Schema
conformed with this Schema
Schema
s, which have an ident Transformation
between them, where the first is extended from
this Schema
and then second is extended from s2.public Schema union(Schema s2)
Schema
(su) containing the union of
SchemaObject
s in this schema (s1) and the
schema passed as a parameter (s2). SchemaObjects which
have the same name in s1,s2 will have their extent in
su be defined as the union of the extents of the two
SchemaObjects in s1,s2. In effect, this produces a
similar result as the global-as-view (GAV) approach to schema
integration when it combines two schemas together.
s2
- the Schema to be unioned with this Schema s1
public java.lang.Object[] readSchemeDefinition(Construct cons, java.lang.String sd) throws SyntaxException, NotFoundException
cons
- The Construct
which the SchemaObject belows to. This
is used to determine if a String in the scheme is interpreted at an
reference to another SchemaObject or not.sd
- The scheme definition that is the String representation of
a SchemaOBject that could exist in this Schema.
SyntaxException
NotFoundException
public SchemaObject[] intersectionByName(Schema s2) throws InconsistentException
SchemaObject
array containing the intersection by
name between this schema (s1) and the schema passed as a
parameter (s2). The returned array will contain any SchemaObject
that appears in s1, and for which there is an object
with the same name in s2. Thus
the array will contain an object from s1 named
"<<person>>" only if there is an object in s2 called
"<<person>>".
s2
- the Schema to be intersected with this Schema s1
InconsistentException
public void listSchema() throws InconsistentException
SchemaObject
in the Schema is prefixed by
its Construct
name as defined in the MDR.
InconsistentException
public void listSchema(java.io.PrintStream out, int mode, boolean keyOnly) throws InconsistentException
out
- the PrintStream to which the output is directedmode
- sets the exact format of the output, selecting one
of the following:keyOnly
- if true, do not include non-key fields in attributes
LIST_SCHEMA_SHORT
list only the scheme of each object
in the schema.
LIST_SCHEMA_NORMAL
list the scheme of the object, prefixed
by the model name, object construct type, and object id
LIST_SCHEMA_LONG
list the scheme of the each object
prefixed by the construct type (this is the default for versions
of listSchema that have no mode).
InconsistentException
public void listSchema(java.io.PrintStream out)
public void listSchema(java.io.PrintStream out, int mode)
public Transformation[] getTransformations()
Transformation
that go out
from a particular schema.
schema
- The Schema
object for which the list of
transformations is to be obtained.
public Schema prefixAllNodalNames(java.lang.String prefix) throws IntegrityException
Construct
type Nodal.
For example, if s1>>
was a schema containing ER entities <<e1>>, <<e2>> and
relationship <<r,e1,e2>>, and we called this method
with prefix <<s1.>>, then
the new schema would contain <<s1.e1>>, <<s1.e2>>
and <<r,s1.e1,s1.e2>>
prefix
- The String
to prefix to all Nodal names
IntegrityException
public Transformation prefixSchemaObjectName(java.lang.String prefix, SchemaObject nodeObject) throws IntegrityException
SchemaObject
is a Nodal object, where the SchemaObject has had a
prefix applied to the node name,
prefix
- The String
to prefix to Nodal namesnodeObject
- The SchemaObject
, which is Nodal, will have
its node names changed
IntegrityException
public Schema extendToMatch(Schema schemaToAdd)
schemaToAdd
- The Schema
which is to have the constructs
added to make it match this schema.
Construct
s of @param schemaToAddpublic Schema[] findAttachedExtSchemas() throws IntegrityException
getAttachedSchemas(int)
instead.
Returns an array of Schema's that are connected to this schema by some
transformation pathway and are extensional schemas (including this schema
itself if it is an extensional schema). For each schema s returned,
s.isExtSchema() is true.
IntegrityException
public Schema[] findAttachedExtDBs() throws IntegrityException
getAttachedSchemas(int)
instead.
Returns an array of Schema's that are connected to this schema by some
transformation pathway and have extensional data (including this schema
itself if it has extensional data). For each schema s returned,
s.isExtDB() is true.
IntegrityException
public Schema[] findAttachedDataSources() throws IntegrityException
getAttachedSchemas(int)
instead.
Returns an array of Schema's that are connected to this schema by some
transformation pathway and are data sources (including this schema itself
if it is a data source). For each schema s returned, s.isDataSource() is
true.
IntegrityException
public Schema[] getAttachedSchemas(int type) throws IntegrityException
int
- One of VIRTUAL_TYPE
, STORED_TYPE
,
MATERIALISED_TYPE
, or DATA_SOURCE_TYPE
. All
Schema
s of the type, or after, in this list will be
returned. Hence using VIRTUAL_TYPE will return all attached
schemas.
IntegrityException
public Schema[] findShortestPath(Schema target) throws IntegrityException
s
- The schema to find the shortest path to from this schema
IntegrityException
public java.util.List findAllPathways(Schema target) throws IntegrityException
IntegrityException
public java.util.List findAllPathwayAbstractions(Schema target) throws IntegrityException
target
- the target Schema
List
a list containing all pathways
IntegrityException
public DataSource getDataSource()
DataSource
object representing the data source represented
by this schema
public AccessMethod[] getAccessMethods()
AccessMethod
s that may be used to access the
physical database system that holds this Schema
.
AccessMethod
s that may be used to
access a physical database containing this Schema
.public void removeAccessMethods()
AccessMethod
s recorded for this schema.
public java.awt.Color getForegroundColor()
getForegroundColor
in interface Positionable
public void setForegroundColor(java.awt.Color c)
setForegroundColor
in interface Positionable
public java.awt.Color getBackgroundColor()
getBackgroundColor
in interface Positionable
public void setBackgroundColor(java.awt.Color c)
setBackgroundColor
in interface Positionable
public java.awt.Color getTextColor()
getTextColor
in interface Positionable
public void setTextColor(java.awt.Color c)
setTextColor
in interface Positionable
public void importSchemaObjects(java.io.InputStream is) throws java.io.IOException, SyntaxException, NotFoundException, TypeMismatchException
java.io.IOException
SyntaxException
NotFoundException
TypeMismatchException
public void exportSchemaObjects(java.io.OutputStream os)
public void exportSchemaObjects(java.io.PrintWriter pw)
public static Schema read(java.io.InputStream is) throws java.io.IOException, SyntaxException, NotFoundException, TypeMismatchException
read(InputStream, String)
, where the name
of the new Schema created is taken from that held in the textual
description read from the InputStream.
java.io.IOException
SyntaxException
NotFoundException
TypeMismatchException
public static Schema read(java.io.InputStream is, java.lang.String name) throws java.io.IOException, SyntaxException, NotFoundException, TypeMismatchException
write()
) into the repository. The contents of
the file must have the schema objects in the correct order, such
that if one object depends on the existance of anther schema
object, then that second schema object is placed first in the
file.
is
- an InputStream to read the text description from.name
- is the name to give the new Schema
java.io.IOException
SyntaxException
NotFoundException
TypeMismatchException
public void write()
#read()
public void write(java.io.OutputStream os)
public void write(java.io.OutputStream os, int format) throws java.io.IOException
java.io.IOException
public void write(java.io.PrintWriter pw)
public java.lang.String debugString()
public boolean addSchemaChangeListener(SchemaChangeListener scl)
public boolean removeSchemaChangeListener(SchemaChangeListener scl)
public static boolean addSchemasListener(SchemasListener nl)
SchemasListener
such that it will be notified of any adding
or deleting of schemas that may occur.
public static boolean removeSchemasListener(SchemasListener nl)
SchemasListener
such that it will no longer
be notified of any adding
or deleting of schemas that may occur.
public java.lang.String toString()
toString
in class java.lang.Object
public PersistentKey getKey()
getKey
in interface PersistentObject
PersistentObject.getKey()
public java.util.Map getPersistentAttributes()
getPersistentAttributes
in interface PersistentObject
PersistentObject.getPersistentAttributes()
public java.util.Map getModels()
Map
a collection of model objectspublic java.lang.String getModelsAsString()
getModels()
method except that this method
returns a delimited string of Model
s' names
public void setAttributeDomains(java.util.List domainSpec)
domainSpec
- is a list of AttributeDomain
objectspublic java.util.List getAttributeDomains()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |