org.hydrateframework.gen.schema
Class Family

java.lang.Object
  extended by org.hydrateframework.gen.schema.SchemaElementBase
      extended by org.hydrateframework.gen.schema.Family
All Implemented Interfaces:
SchemaElement
Direct Known Subclasses:
Family

public class Family
extends SchemaElementBase

Version:
@(#)$Revision: 1.10 $ The family class represents a family of classes, enumerations, relationships and xml schemas. Families may include other families through the Include element

 <Family name="TestFamilyFail" namespace="org.hydrateframework.model.test">
     <Include file="Include.xml"/>
     
     <Enumeration .../>
     <Class .../>
     <Relationship .../>
     <XMLSChema .../>
     
 </Family>
Author:
David Chamberlin

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.hydrateframework.gen.schema.SchemaElement
SchemaElement.HighlightType
 
Field Summary
protected  java.util.List<ClassDef> classDefs
           
protected  java.lang.String comment
           
protected  java.lang.String name
           
protected  java.lang.String namespace
           
protected  java.util.List<Relationship> relationships
           
protected  java.lang.String revision
           
protected  java.lang.String tablespace
           
protected  java.util.Map<java.lang.String,Type> types
           
protected  java.net.URL url
           
 
Fields inherited from class org.hydrateframework.gen.schema.SchemaElementBase
ATTR_MANDATORY, ATTR_MANDATORYNOOVR, ATTR_NOOVR, ATTR_OPTIONAL, ATTR_OPTIONALNOOVR, BOOL_FALSE, BOOL_NOT, BOOL_NOTSET, BOOL_TRUE, NAME, valid
 
Constructor Summary
Family()
           
 
Method Summary
 void addClassDef(java.lang.String name, ClassDef classDef)
           
 void addEnumeration(java.lang.String name, Enumeration enm)
           
 void addType(java.lang.String name, Type type)
           
 ClassDef findClassDef(java.lang.String name)
           
 Relationship findRelationship(java.lang.String name)
           
 Type findType(java.lang.String name)
           
 XMLSchema findXMLSchema(java.lang.String name)
           
 java.lang.Class getAttributeClass()
           
 java.lang.Class getClassDefClass()
           
 ClassDef[] getClassDefs()
          Get a list of class definitions that have been declared to be part of this family.
 java.lang.String getComment()
           
 java.lang.Class getComparatorClass()
           
 java.lang.String getDataService()
           
 java.lang.String getDefaultTablespace()
          Return the name of the default tablespace for this family or null if there is no default set
 java.lang.Class getEnumerationClass()
           
 Enumeration[] getEnumerations()
          Get a list of enumerations that are part of this family.
protected  java.lang.String getFamilyElementName()
           
 SchemaElement.HighlightType getHighlightType()
           
 java.util.List<Family> getIncludedFamilies()
          Get a list of families that were included into this family
 Family getIncludedIn()
          Get the family that this family has been included in.
 ClassDef[] getInUseClassDefs(int inContext)
          Get a list of class definitions that have been declared to be part of this family and Are in use in the given context.
 java.lang.String getJavaDir()
          return the name of the directory in which java classes would be put corresponding to the package for this family.
 java.lang.String getJavaName()
           
 java.lang.String getJavaPackageName()
          Return the dot-separated package name to use for java objects.
 java.lang.Class getKeyClass()
           
 java.lang.Class getMethodClass()
           
 java.lang.String getName()
          Get the name of the family.
 NamingPolicy getNamingPolicy()
           
 java.awt.Point getNextDefPosition()
           
 SchemaElementBase getOverrides()
           
 java.lang.String getProperty(java.lang.String name)
           
 java.lang.Class getRelationshipClass()
           
 Relationship[] getRelationships()
          Get a list of relationships that have been declared to be part of this family.
 java.lang.String getRevision()
           
 Type[] getTypes()
          Get a list of types (that is class definitions and enumerations) that were declared to be part of this family.
 java.net.URL getURL()
          Get the file that was/is to be used to store information about this family.
 java.lang.Class getXMLSchemaClass()
           
 java.lang.Class getXMLSchemaElementClass()
           
 XMLSchema[] getXMLSchemas()
          Get a list of XML Schemas that are part of this family.
 boolean isValid(java.lang.StringBuffer reason)
          Determine if the schema element just read is valid.
 void notifyUpdate(SchemaElement element)
          Notify a schema element that the schema element it is overriding has changed
 SchemaElement override(Family family)
          Override the schema element from ain included file.
 boolean readFromURL(java.net.URL url)
          Read a family definition from a file.
 boolean readFromXmlDoc(java.util.Stack<java.lang.String> readContext, org.w3c.dom.Element elem)
          Read the element from the DOM model
 void readTypes(java.util.Stack<java.lang.String> readContext, org.w3c.dom.Element elem)
          Read all types that are active in this family and create the overrides
 void reloadFile()
           
 void resolve()
           
 void setIncludedIn(Family family)
          If this is not a top level family - in other words it has been included in another file, set the family object that it has been included in.
 void setName(java.lang.String name)
           
 void setProperties(java.util.Properties props)
           
 void setURL(java.net.URL url)
          Set the file to be used to store information about this family.
 boolean shouldWrite()
           
 java.lang.String toString()
           
 java.lang.String toSummary()
           
 void writeToXmlDoc(SAXWriter wrt)
          Notify the contentHandler of the state of this class
 
Methods inherited from class org.hydrateframework.gen.schema.SchemaElementBase
addBoolAttribute, addEnumAttribute, addIntAttribute, addListAttribute, addStringAttribute, isValidIdentifier, newElement, printAttrWarning, printWarning, readBoolAttribute, readEnumAttribute, readIntAttribute, readListAttribute, readStringAttribute, refEquals, supersedes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

url

protected java.net.URL url

name

protected java.lang.String name

namespace

protected java.lang.String namespace

tablespace

protected java.lang.String tablespace

comment

protected java.lang.String comment

revision

protected java.lang.String revision

types

protected java.util.Map<java.lang.String,Type> types

classDefs

protected java.util.List<ClassDef> classDefs

relationships

protected java.util.List<Relationship> relationships
Constructor Detail

Family

public Family()
Method Detail

getOverrides

public SchemaElementBase getOverrides()
Specified by:
getOverrides in class SchemaElementBase

toSummary

public java.lang.String toSummary()

getNamingPolicy

public NamingPolicy getNamingPolicy()

getJavaPackageName

public java.lang.String getJavaPackageName()
Return the dot-separated package name to use for java objects.

Returns:
the package name

getComment

public java.lang.String getComment()

getRevision

public java.lang.String getRevision()

getDefaultTablespace

public java.lang.String getDefaultTablespace()
Return the name of the default tablespace for this family or null if there is no default set

Returns:
the tablespace name

getJavaDir

public java.lang.String getJavaDir()
return the name of the directory in which java classes would be put corresponding to the package for this family.

Returns:
the directory name.

getRelationships

public Relationship[] getRelationships()
Get a list of relationships that have been declared to be part of this family.

Returns:
the list of relationships.

getClassDefs

public ClassDef[] getClassDefs()
Get a list of class definitions that have been declared to be part of this family.

Returns:
the class definition list

getInUseClassDefs

public ClassDef[] getInUseClassDefs(int inContext)
Get a list of class definitions that have been declared to be part of this family and Are in use in the given context.

Returns:
the class definition list

getTypes

public Type[] getTypes()
Get a list of types (that is class definitions and enumerations) that were declared to be part of this family.

Returns:
the type list.

getEnumerations

public Enumeration[] getEnumerations()
Get a list of enumerations that are part of this family.

Returns:
the list of enumerations.

getXMLSchemas

public XMLSchema[] getXMLSchemas()
Get a list of XML Schemas that are part of this family.

Returns:
the list of XML Schemas.

setURL

public void setURL(java.net.URL url)
Set the file to be used to store information about this family.

Parameters:
file - the file to be used.

getURL

public java.net.URL getURL()
Get the file that was/is to be used to store information about this family.

Returns:
the file object.

setName

public void setName(java.lang.String name)

getName

public java.lang.String getName()
Get the name of the family.

Returns:
the name.

getJavaName

public java.lang.String getJavaName()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getDataService

public java.lang.String getDataService()

getNextDefPosition

public java.awt.Point getNextDefPosition()

readFromURL

public boolean readFromURL(java.net.URL url)
Read a family definition from a file. This method may be called recursively to load included families. is at the top of the stack, the file it was included from is next, etc.

Parameters:
file - the file to read
Returns:

reloadFile

public void reloadFile()

setIncludedIn

public void setIncludedIn(Family family)
If this is not a top level family - in other words it has been included in another file, set the family object that it has been included in. Note that this implies that families that are loaded into memory for editing, both in their own right as top-level families and as included families in other files, must be represented by separate Family objects.

Parameters:
family - the family object that this family has been included in.

getIncludedIn

public Family getIncludedIn()
Get the family that this family has been included in.

Returns:
the family

getIncludedFamilies

public java.util.List<Family> getIncludedFamilies()
Get a list of families that were included into this family

Returns:
the list of included families

findType

public Type findType(java.lang.String name)

findClassDef

public ClassDef findClassDef(java.lang.String name)

addType

public void addType(java.lang.String name,
                    Type type)

addClassDef

public void addClassDef(java.lang.String name,
                        ClassDef classDef)

addEnumeration

public void addEnumeration(java.lang.String name,
                           Enumeration enm)

readTypes

public void readTypes(java.util.Stack<java.lang.String> readContext,
                      org.w3c.dom.Element elem)
Read all types that are active in this family and create the overrides


readFromXmlDoc

public boolean readFromXmlDoc(java.util.Stack<java.lang.String> readContext,
                              org.w3c.dom.Element elem)
Description copied from interface: SchemaElement
Read the element from the DOM model

Parameters:
readContext - the context within the XML of the read operation. This is used to help pinpoint the source of an error.
elem - the DOM element to use to initialize this class.

findXMLSchema

public XMLSchema findXMLSchema(java.lang.String name)

findRelationship

public Relationship findRelationship(java.lang.String name)

getFamilyElementName

protected java.lang.String getFamilyElementName()

writeToXmlDoc

public void writeToXmlDoc(SAXWriter wrt)
                   throws org.xml.sax.SAXException
Notify the contentHandler of the state of this class

Parameters:
contentHandler - the content handler to notify of events.
Throws:
org.xml.sax.SAXException

resolve

public void resolve()

notifyUpdate

public void notifyUpdate(SchemaElement element)
Description copied from interface: SchemaElement
Notify a schema element that the schema element it is overriding has changed

Parameters:
element - the overridden schema element.

override

public SchemaElement override(Family family)
Description copied from interface: SchemaElement
Override the schema element from ain included file. The implementation of this method should make a new SchemaElement, that knows that it is overriding this element. It should also remember the identity of the schema element that has overridden it (i.e. the element it returns so that it can notify it via the SchemaElement.notifyUpdate(SchemaElement) method when this element changes.

Parameters:
family - the family in which the overridden element is to be created
Returns:
the new schema element that overrides this one.

isValid

public boolean isValid(java.lang.StringBuffer reason)
Description copied from interface: SchemaElement
Determine if the schema element just read is valid.

Parameters:
reason - the reason for the failure (or warning) if any should be appended to this string buffer.
Returns:
true if the element is valid, false otherwise.

shouldWrite

public boolean shouldWrite()

setProperties

public void setProperties(java.util.Properties props)

getProperty

public java.lang.String getProperty(java.lang.String name)

getClassDefClass

public java.lang.Class getClassDefClass()

getAttributeClass

public java.lang.Class getAttributeClass()

getComparatorClass

public java.lang.Class getComparatorClass()

getEnumerationClass

public java.lang.Class getEnumerationClass()

getKeyClass

public java.lang.Class getKeyClass()

getMethodClass

public java.lang.Class getMethodClass()

getRelationshipClass

public java.lang.Class getRelationshipClass()

getXMLSchemaClass

public java.lang.Class getXMLSchemaClass()

getXMLSchemaElementClass

public java.lang.Class getXMLSchemaElementClass()

getHighlightType

public SchemaElement.HighlightType getHighlightType()


Copyright © 2000 The Hydrate Project. All Rights Reserved.