|
UC Berkeley Group for User Interface Research Updated November 17, 2000 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.berkeley.guir.lib.schema.Schema
Represents a valid Schema (fieldnames plus value types) and valid properties in that Schema. Essentially, this allows us to have an extensible hashtable that has some basic form of type-checking.
An example Schema file follows:
# # This file describes what OSKI's vCalendar schema looks like. # That is, it defines what are valid fields, and what are valid values # for those fields. # # Lists values / properties that are valid within a schema. # # In order, the needed sections are: # [NAME] # [PROPERTIES] # [FIELDS] # # "X-" means allow anything starting with "X-" # "*" means allow anything # "#" means allow digits # "$DATE" means allow dates # #: * # : * ; * ; [LIST | SINGLETON] # [NAME] OskiEvent Schema;1.0 [PROPERTIES] VALUE:INLINE, URL, CONTENT-ID, CID, X-, TYPE:WAVE, PCM, VCARD, X-, RSVP:YES, NO, EXPECT:FYI, REQUIRE, REQUEST, IMMEDIATE, CHARSET:*, PCM:*, DELEGATED:X-, X-:*, ROLE:ATTENDEE, ORGANIZER, OWNER, DELEGATE, X-, LANGUAGE:*, STATUS:ACCEPTED, NEEDS ACTION, SENT, TENTATIVE, CONFIRMED, DECLINED, COMPLETED, WAVE:*, ENCODING:7BIT, 8BIT, QUOTED-PRINTABLE, BASE64, X-, VCARD:*, [FIELDS] X- :*, ;ROLE ;SINGLETON DCREATED :*, ; ;SINGLETON TRANSP :#, ; ;SINGLETON RRULE :*, ; ;SINGLETON UID :*, ; ;SINGLETON DUE :*, ; ;SINGLETON RNUM :#, ; ;SINGLETON AALARM :*, ;TYPE, VALUE, ;SINGLETON URL :*, ; ;SINGLETON MALARM :*, ;TYPE, VALUE, ;SINGLETON RELATED-TO:*, ; ;SINGLETON RDATE :$DATE, ; ;UNILIST DALARM :*, ;TYPE, VALUE, ;SINGLETON PALARM :*, ;TYPE, VALUE, ;SINGLETON SEQUENCE :#, ; ;SINGLETON ATTENDEE :*, ;ROLE, STATUS, VALUE, TYPE, ;MULTILIST EXRULE :*, ; ;SINGLETON DTEND :$DATE, ; ;SINGLETON DTSTART :$DATE, ; ;SINGLETON SUMMARY :*, ; ;SINGLETON LOCATION :*, ;VALUE, TYPE, ;SINGLETON ATTACH :*, ;VALUE, ;MULTILIST COMPLETED :*, ; ;SINGLETON EXDATE :$DATE, ; ;UNILIST DESCRIPTION:*, ;ENCODING, ;SINGLETON PRIORITY :#, ; ;SINGLETON LAST-MODIFIED:$DATE, ; ;SINGLETON CLASS :PUBLIC, PRIVATE, CONFIDENTIAL, X-, ; ;SINGLETON STATUS:ACCEPTED, NEEDS ACTION, SENT, TENTATIVE, CONFIRMED, DECLINED, COMPLETED, DELEGATED, X-, ; ;SINGLETON RESOURCES:CATERING, CHAIRS, EASEL, PROJECTOR, VCR, VEHICLE, X-, ; ;UNILIST CATEGORIES:APPOINTMENT, BUSINESS, EDUCATION, HOLIDAY, MEETING, MISCELLANEOUS, PERSONAL, PHONE CALL, SICK DAY, SPECIAL OCCASION, TRAVEL, VACATION, X-, ; ;UNILIST
This software is distributed under the Berkeley Software License.
Revisions: - GUIRLib-v1.0-1.0.0, Nov 27 1998, JH Created class - GUIRLib-v1.2-1.0.0, Jun 22 2000, JH Touched for GUIRLib release - GUIRLib-v1.3-1.0.0, Aug 11 2000, JH Touched for GUIRLib release - GUIRLib-v1.4-1.0.0, Aug 31 2000, JH Touched for GUIRLib release
Field Summary | |
static String |
D_ALL
Accept any String. |
static String |
D_DATE
Accept any valid ISO8601 date. |
static String |
D_DIGIT
Accept any String of digits. |
static String |
D_EXTENSION
Accept any String starting with "X-". |
static String[] |
DIRECTIVES_FIELDS
This lists the valid directives that field values can have. |
static String[] |
DIRECTIVES_PROPERTIES
This lists the valid directives that property values can have. |
static int |
FLAG_MULTILIST
|
static int |
FLAG_SINGLETON
|
static int |
FLAG_UNILIST
|
static String |
MULTILIST
|
static String |
SINGLETON
|
static String |
UNILIST
|
Constructor Summary | |
Schema(InputStream istream)
Create a Schema using parameters from the given filename. |
|
Schema(String newSchemaName,
String newVersion)
Create a new Schema object with the specified name and version. |
Method Summary | |
void |
addField(String strFieldName)
Add a field to be considered valid in this Schema. |
void |
addFieldProperty(String strFieldName,
String strPropertyName)
Add a property to a field. |
void |
addFieldValue(String strFieldName,
String strValue)
Add a value to a field. |
void |
addProperty(String strPropertyName)
Add a property that is considered valid. |
void |
addPropertyValue(String strPropertyName,
String strValue)
Add a value to a property that is considered valid. |
String |
getSchemaName()
Get the name for this Schema. |
String |
getSchemaVersion()
Get the version value for this Schema. |
Enumeration |
getValidFieldProperties(String strFieldName)
Get the properties valid for a field. |
Enumeration |
getValidFields()
Get the fields valid in this schema. |
Enumeration |
getValidFieldValues(String strFieldName)
|
Enumeration |
getValidProperties()
Get the properties valid for a field. |
Enumeration |
getValidPropertyValues(String strProperty)
|
void |
importSchema(InputStream istream)
Import a schema from an inputstream. |
boolean |
isList(String strFieldName)
See if the specified field name is a list or not. |
boolean |
isMultiList(String strFieldName)
See if the specified field name is a multi list or not. |
boolean |
isSingleton(String strFieldName)
See if the specified field name is a singleton or not. |
boolean |
isUniList(String strFieldName)
See if the specified field name is a uni list or not. |
boolean |
isValidField(String strFieldName)
See if the specified field name is a valid one. |
boolean |
isValidFieldProperty(String strFieldName,
String strPropertyName)
See if the specified property is valid for the specified field. |
boolean |
isValidFieldValue(String strFieldName,
String strValue)
See if the specified value is valid for the specified field. |
boolean |
isValidProperty(String strPropertyName)
See if the specified property is valid in general. |
boolean |
isValidPropertyValue(String strPropertyName,
String strValue)
See if the specified property is valid for the specified field. |
static void |
main(String[] argv)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String SINGLETON
public static final String UNILIST
public static final String MULTILIST
public static final int FLAG_SINGLETON
public static final int FLAG_UNILIST
public static final int FLAG_MULTILIST
public static final String D_EXTENSION
public static final String D_ALL
public static final String D_DIGIT
public static final String D_DATE
public static final String[] DIRECTIVES_FIELDS
public static final String[] DIRECTIVES_PROPERTIES
Constructor Detail |
public Schema(String newSchemaName, String newVersion)
newSchemaName
- is the name to set the schema.newVersion
- is the version to set to.public Schema(InputStream istream) throws IOException
strFileName
- is the filename to open.Method Detail |
public String getSchemaName()
public String getSchemaVersion()
public boolean isSingleton(String strFieldName)
NoSuchElementException
- if the field name does not exist.public boolean isUniList(String strFieldName)
public boolean isMultiList(String strFieldName)
public boolean isList(String strFieldName)
NoSuchElementException
- if the field name does not exist.public boolean isValidField(String strFieldName)
public boolean isValidFieldValue(String strFieldName, String strValue)
public boolean isValidFieldProperty(String strFieldName, String strPropertyName)
public boolean isValidProperty(String strPropertyName)
public boolean isValidPropertyValue(String strPropertyName, String strValue)
public Enumeration getValidFields()
public Enumeration getValidFieldValues(String strFieldName)
public Enumeration getValidProperties()
public Enumeration getValidPropertyValues(String strProperty)
public Enumeration getValidFieldProperties(String strFieldName)
public void importSchema(InputStream istream) throws IOException
public void addProperty(String strPropertyName)
strPropertyName
- is the name of the property.public void addPropertyValue(String strPropertyName, String strValue)
strPropertyName
- is the name of the property. This is created if
it does not already exist.strValue
- is the name of the value that will be considered valid.public void addField(String strFieldName)
strFieldName
- is the name of the field.public void addFieldProperty(String strFieldName, String strPropertyName)
strFieldName
- is the name of the field.strPropertyName
- is the name of the property to add.public void addFieldValue(String strFieldName, String strValue)
strFieldName
- is the name of the field.strValue
- is the name of the value to add.public String toString()
toString
in class Object
public static void main(String[] argv) throws Exception
|
Copyright Information | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |