|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractMap
java.util.HashMap
com.sun.portal.search.soif.SOIF
SOIF (Summary Object Interchange Format) is a general purpose syntax and data structure for representing meta data. It is commonly used to create summaries, or Resource Descriptions, for storage, indexing, and transmission purposes.
A SOIF object has a standard serialized form, for example:
@DOCUMENT { http://www.siroe.com content-type{29}: text/html; charset=iso-8859-1 title{16}: Siroe Consulting author-1{14}: William Lawson author-2{16}: Gregory Blaxland author-3{17}: William Wentworth description{245}: Siroe Consulting - Business & Industry Solutions - Downloads - Documentation - Developers - Partners - Executives - Press Company Info - Investor Relations - News & Events - Feature Stories - Employment - Siroe Labs Copyright 1994-2002 Siroe Consulting }
Each SOIF object has a schema (eg, DOCUMENT) and URL.
SOIF attribute values can be plain text or binary.
Multivalued attributes are supported.
The standard SOIF serialized form uses UTF-8 encoding
for all character based data.
SOIF attribute names are case-insensitive.
More information on SOIF and the RDM search protocol can be found at http://www.w3.org/TR/NOTE-rdm.html
AVPair
,
Serialized FormField Summary | |
static String |
defaultEncoding
Default char encoding. |
static String |
INVALIDSOIF
Error message for invalid SOIF. |
Constructor Summary | |
SOIF()
Constructor. |
|
SOIF(byte[] data)
Constructor. |
|
SOIF(byte[] data,
Set allowed)
Constructor. |
|
SOIF(byte[] data,
String encoding)
Constructor. |
|
SOIF(byte[] data,
String encoding,
Set allowed)
Constructor. |
|
SOIF(String schemaName,
String URL)
Constructor. |
Method Summary | |
void |
absorb(SOIF s)
Copies all data from another SOIF without replacement. |
void |
absorb(SOIF s,
String[] filter)
Copies selected data from another SOIF without replacement Ignores case of all attribute names. |
boolean |
contains(String a)
Tests for attribute existence. |
boolean |
containsKey(Object key)
Case insensistive collection function. |
int |
contentSize()
|
Object |
get(Object key)
Case insensistive collection function. |
int |
getAttributeCount()
|
Set |
getAttributes()
|
String[] |
getAttributesArray()
|
AVPair |
getAVPair(String a)
Gets an AVPair by attribute. |
byte[] |
getBytes(String a)
Gets a byte array value by attribute. |
byte[] |
getBytes(String a,
int n)
Gets a byte array value by multivalue attribute and index. |
String |
getSchemaName()
|
String[] |
getStringValues(String a)
Gets all valid values of this attribute. |
String |
getURL()
|
String |
getValue(String a)
Gets a String value by attribute. |
String |
getValue(String a,
int n)
Gets a String value by multivalue attribute and index. |
boolean |
insert(AVPair a)
Inserts an AVPair, which may be either single or multivalued. |
boolean |
insert(String a,
byte[] b)
Inserts a byte array valued attribute. |
boolean |
insert(String a,
byte[] b,
int n)
Inserts a String valued attribute with index. |
boolean |
insert(String a,
String v)
Inserts a String valued attribute. |
boolean |
insert(String a,
String v,
int n)
Inserts a String valued attribute with index. |
void |
merge(SOIF s)
Copies all data from another SOIF with replacement. |
void |
merge(SOIF s,
String[] filter)
Copies selected data from another SOIF with replacement. |
Object |
put(Object key,
Object value)
Case insensistive collection function. |
Object |
remove(Object key)
Case insensistive collection function. |
boolean |
remove(String a)
Removes an attribute. |
boolean |
remove(String a,
int n)
Removes an attribute by index. |
boolean |
rename(String a,
String b)
Renames attribute a to b. |
void |
replace(AVPair avp)
Replaces an attribute-value pair by name. |
void |
replace(String a,
String v)
Replaces a single-valued attribute. |
void |
replace(String a,
String v,
int n)
Replaces a multivalued attribute by index. |
void |
setSchemaName(String s)
Sets the SOIF schema name. |
void |
setURL(String u)
Sets the SOIF URL. |
void |
squeezeMV()
Squeezes multivalued attributes. |
byte[] |
toByteArray()
Creates a byte array representation of this SOIF. |
byte[] |
toByteArray(Set allowed)
Creates a byte array representation of this SOIF. |
byte[] |
toByteArray(String enc)
Creates a byte array representation of this SOIF. |
byte[] |
toByteArray(String enc,
Set allowed)
Creates a byte array representation of this SOIF. |
String |
toString()
*WARNING*: This should be used for debugging only. |
Methods inherited from class java.util.HashMap |
clear, clone, containsValue, entrySet, isEmpty, keySet, putAll, size, values |
Methods inherited from class java.util.AbstractMap |
equals, hashCode |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
equals, hashCode |
Field Detail |
public static String defaultEncoding
public static String INVALIDSOIF
Constructor Detail |
public SOIF()
public SOIF(String schemaName, String URL)
schemaName
- the SOIF schema nameURL
- the SOIF URLpublic SOIF(byte[] data, String encoding, Set allowed) throws IOException
data
- a byte array SOIF representationencoding
- character encoding for byte/String conversionallowed
- a restricted attribute set for the conversion (use lower case)
SOIFException
- on parsing error
IOException
- if byte array is emptypublic SOIF(byte[] data, String encoding) throws IOException
data
- a byte array SOIF representationencoding
- character encoding for byte/String conversion
SOIFException
- on parsing error
IOException
- if byte array is emptypublic SOIF(byte[] data, Set allowed) throws IOException
data
- a byte array SOIF representationallowed
- a restricted attribute set for the conversion (use lower case)
SOIFException
- if parsing error
IOException
- if byte array is emptypublic SOIF(byte[] data) throws IOException
data
- a byte array SOIF representation
SOIFException
- if parsing error
IOException
- if byte array is emptyMethod Detail |
public String getSchemaName()
public void setSchemaName(String s)
public String getURL()
public void setURL(String u)
public String getValue(String a)
a
- the attribute namepublic String[] getStringValues(String a)
a
- the attribute name
public byte[] getBytes(String a)
a
- the attribute namepublic String getValue(String a, int n)
a
- the attribute namen
- the indexpublic byte[] getBytes(String a, int n)
a
- the attribute namen
- the indexpublic AVPair getAVPair(String a)
a
- the attribute namepublic boolean contains(String a)
a
- the attribute name
public boolean insert(String a, String v)
a
- the attribute namev
- the String value to insert
public boolean insert(String a, byte[] b)
a
- the attribute nameb
- the byte array value to insert
public boolean insert(String a, String v, int n)
a
- the attribute namev
- the String value to insertn
- the multivalue index position for this value
public boolean insert(String a, byte[] b, int n)
a
- the attribute nameb
- the byte array value to insertn
- the multivalue index position for this value
public boolean insert(AVPair a)
a
- the AVPair to insert
public void replace(String a, String v)
a
- the attibute namev
- the attribute valuepublic void replace(String a, String v, int n)
a
- the attibute namev
- the attribute valuen
- the multivalued index position to replacepublic void replace(AVPair avp)
avp
- the attibute-value pairpublic boolean remove(String a)
a
- the attibute name
public boolean remove(String a, int n)
public boolean rename(String a, String b)
public void merge(SOIF s)
public void merge(SOIF s, String[] filter)
public void absorb(SOIF s)
public void absorb(SOIF s, String[] filter)
public void squeezeMV()
public Set getAttributes()
public String[] getAttributesArray()
public int getAttributeCount()
public int contentSize()
public Object put(Object key, Object value)
public Object get(Object key)
public Object remove(Object key)
public boolean containsKey(Object key)
public byte[] toByteArray() throws IOException
UnsupportedEncodingException
IOException
public byte[] toByteArray(Set allowed) throws IOException
allowed
- a restricted attribute set for the conversion (use lower case)
UnsupportedEncodingException
IOException
public byte[] toByteArray(String enc) throws IOException
enc
- character encoding for String/byte conversion
UnsupportedEncodingException
IOException
SOIFInputStream.readSOIF()
,
SOIFOutputStream.write(SOIF s)
public byte[] toByteArray(String enc, Set allowed) throws IOException
enc
- character encoding for String/byte conversionallowed
- a restricted attribute set for the conversion (use lower case)
IOException
SOIFInputStream.readSOIF()
,
SOIFOutputStream.write(SOIF s)
public String toString()
toByteArray()
,
SOIFInputStream.readSOIF()
,
SOIFOutputStream.write(SOIF s)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |