| java.util.HashMap com.sun.portal.search.soif.SOIF
SOIF | public class SOIF extends HashMap (Code) | | 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
See Also: AVPair |
Constructor Summary | |
public | SOIF() Constructor. | public | SOIF(String schemaName, String URL) Constructor. | public | SOIF(byte[] data, String encoding, Set allowed) Constructor. | public | SOIF(byte[] data, String encoding) Constructor. | public | SOIF(byte[] data, Set allowed) Constructor. | public | SOIF(byte[] data) Constructor. |
Method Summary | |
public void | absorb(SOIF s) Copies all data from another SOIF without replacement. | public void | absorb(SOIF s, String[] filter) Copies selected data from another SOIF without replacement
Ignores case of all attribute names. | public boolean | contains(String a) Tests for attribute existence. | public boolean | containsKey(Object key) Case insensistive collection function. | public int | contentSize() | public Object | get(Object key) Case insensistive collection function. | public AVPair | getAVPair(String a) Gets an AVPair by attribute. | public int | getAttributeCount() | public Set | getAttributes() the set of all attribute names in this SOIF.e.g. | public String[] | getAttributesArray() the set of all attribute names in this SOIF as an array.e.g. | public byte[] | getBytes(String a) Gets a byte array value by attribute. | public byte[] | getBytes(String a, int n) Gets a byte array value by multivalue attribute and index. | public String | getSchemaName() | public String[] | getStringValues(String a) Gets all valid values of this attribute. | public String | getURL() | public String | getValue(String a) Gets a String value by attribute. | public String | getValue(String a, int n) Gets a String value by multivalue attribute and index. | public boolean | insert(String a, String v) Inserts a String valued attribute. | public boolean | insert(String a, byte[] b) Inserts a byte array valued attribute. | public boolean | insert(String a, String v, int n) Inserts a String valued attribute with index. | public boolean | insert(String a, byte[] b, int n) Inserts a String valued attribute with index. | public boolean | insert(AVPair a) Inserts an AVPair, which may be either single or multivalued. | public void | merge(SOIF s) Copies all data from another SOIF with replacement. | public void | merge(SOIF s, String[] filter) Copies selected data from another SOIF with replacement. | public Object | put(Object key, Object value) Case insensistive collection function. | public boolean | remove(String a) Removes an attribute. | public boolean | remove(String a, int n) Removes an attribute by index. | public Object | remove(Object key) Case insensistive collection function. | public boolean | rename(String a, String b) Renames attribute a to b. | public void | replace(String a, String v) Replaces a single-valued attribute. | public void | replace(String a, String v, int n) Replaces a multivalued attribute by index. | public void | replace(AVPair avp) Replaces an attribute-value pair by name. | public void | setSchemaName(String s) Sets the SOIF schema name. | public void | setURL(String u) Sets the SOIF URL. | public void | squeezeMV() Squeezes multivalued attributes. | public byte[] | toByteArray() Creates a byte array representation of this SOIF. | public byte[] | toByteArray(Set allowed) Creates a byte array representation of this SOIF. | public byte[] | toByteArray(String enc) Creates a byte array representation of this SOIF. | public byte[] | toByteArray(String enc, Set allowed) Creates a byte array representation of this SOIF. | public String | toString() WARNING*: This should be used for debugging only. |
ENC_8BIT | final static int ENC_8BIT(Code) | | |
ENC_DEFAULT | final static int ENC_DEFAULT(Code) | | |
ENC_UTF16 | final static int ENC_UTF16(Code) | | |
ENC_UTF8 | final static int ENC_UTF8(Code) | | |
INVALIDSOIF | public static String INVALIDSOIF(Code) | | Error message for invalid SOIF.
|
defaultEncoding | public static String defaultEncoding(Code) | | Default char encoding.
|
SOIF | public SOIF()(Code) | | Constructor.
Creates an empty SOIF object with schema = "-" and URL = "-"
|
SOIF | public SOIF(String schemaName, String URL)(Code) | | Constructor.
Creates an empty SOIF object with the given schema and URL.
Parameters: schemaName - the SOIF schema name Parameters: URL - the SOIF URL |
SOIF | public SOIF(byte[] data, String encoding, Set allowed) throws IOException(Code) | | Constructor. Creates a SOIF by parsing the given byte array using the
given character encoding.
Parameters: data - a byte array SOIF representation Parameters: encoding - character encoding for byte/String conversion Parameters: allowed - a restricted attribute set for the conversion (use lower case) throws: SOIFException - on parsing error throws: IOException - if byte array is empty |
SOIF | public SOIF(byte[] data, String encoding) throws IOException(Code) | | Constructor. Creates a SOIF by parsing the given byte array using the
given character encoding.
Parameters: data - a byte array SOIF representation Parameters: encoding - character encoding for byte/String conversion throws: SOIFException - on parsing error throws: IOException - if byte array is empty |
SOIF | public SOIF(byte[] data, Set allowed) throws IOException(Code) | | Constructor. Creates a SOIF by parsing the given byte array using the
default character encoding (UTF-8).
Parameters: data - a byte array SOIF representation Parameters: allowed - a restricted attribute set for the conversion (use lower case) throws: SOIFException - if parsing error throws: IOException - if byte array is empty |
SOIF | public SOIF(byte[] data) throws IOException(Code) | | Constructor. Creates a SOIF by parsing the given byte array using the
default character encoding (UTF-8).
Parameters: data - a byte array SOIF representation throws: SOIFException - if parsing error throws: IOException - if byte array is empty |
absorb | public void absorb(SOIF s)(Code) | | Copies all data from another SOIF without replacement.
Ignores case of all attribute names.
|
absorb | public void absorb(SOIF s, String[] filter)(Code) | | Copies selected data from another SOIF without replacement
Ignores case of all attribute names.
|
contains | public boolean contains(String a)(Code) | | Tests for attribute existence.
Ignores case of attribute name.
Parameters: a - the attribute name true if the attribute exists in this SOIF |
containsKey | public boolean containsKey(Object key)(Code) | | Case insensistive collection function.
|
contentSize | public int contentSize()(Code) | | the entire contents size of all AVPairs in this SOIF |
getAVPair | public AVPair getAVPair(String a)(Code) | | Gets an AVPair by attribute.
Ignores case of attribute name.
Parameters: a - the attribute name |
getAttributeCount | public int getAttributeCount()(Code) | | the number of attributes in this SOIF. |
getAttributes | public Set getAttributes()(Code) | | the set of all attribute names in this SOIF.e.g. for Bob-1, Bob-2, Jim-1, return { Bob, Jim } |
getAttributesArray | public String[] getAttributesArray()(Code) | | the set of all attribute names in this SOIF as an array.e.g. for Bob-1, Bob-2, Jim-1, return { Bob, Jim } |
getBytes | public byte[] getBytes(String a)(Code) | | Gets a byte array value by attribute.
Ignores case of attribute name.
Parameters: a - the attribute name |
getBytes | public byte[] getBytes(String a, int n)(Code) | | Gets a byte array value by multivalue attribute and index.
Ignores case of attribute name.
Parameters: a - the attribute name Parameters: n - the index |
getSchemaName | public String getSchemaName()(Code) | | the SOIF schema name. |
getStringValues | public String[] getStringValues(String a)(Code) | | Gets all valid values of this attribute.
an array of Strings formultiple values for an attribute, e.g., for Bob, returnvalues for Bob-1 and Bob-2.Ignores case of attribute name. Parameters: a - the attribute name |
getValue | public String getValue(String a)(Code) | | Gets a String value by attribute.
Ignores case of attribute name.
Parameters: a - the attribute name |
getValue | public String getValue(String a, int n)(Code) | | Gets a String value by multivalue attribute and index.
Ignores case of attribute name.
Parameters: a - the attribute name Parameters: n - the index |
insert | public boolean insert(String a, String v)(Code) | | Inserts a String valued attribute.
Ignores case of attribute name.
Parameters: a - the attribute name Parameters: v - the String value to insert true if added, false if ignored (duplicate) |
insert | public boolean insert(String a, byte[] b)(Code) | | Inserts a byte array valued attribute.
Ignores case of attribute name.
Parameters: a - the attribute name Parameters: b - the byte array value to insert true if added, false if ignored (duplicate) |
insert | public boolean insert(String a, String v, int n)(Code) | | Inserts a String valued attribute with index.
Ignores case of attribute name.
Parameters: a - the attribute name Parameters: v - the String value to insert Parameters: n - the multivalue index position for this value true if added, false if ignored (duplicate or MV index already taken) |
insert | public boolean insert(String a, byte[] b, int n)(Code) | | Inserts a String valued attribute with index.
Ignores case of attribute name.
Parameters: a - the attribute name Parameters: b - the byte array value to insert Parameters: n - the multivalue index position for this value true if added, false if ignored (duplicate or MV index already taken) |
insert | public boolean insert(AVPair a)(Code) | | Inserts an AVPair, which may be either single or multivalued.
Ignores case of attribute name.
Parameters: a - the AVPair to insert true if added, false if ignored (duplicate attribute name). |
merge | public void merge(SOIF s)(Code) | | Copies all data from another SOIF with replacement.
Ignores case of all attribute names.
|
merge | public void merge(SOIF s, String[] filter)(Code) | | Copies selected data from another SOIF with replacement.
Ignores case of all attribute names.
|
remove | public boolean remove(String a)(Code) | | Removes an attribute.
Ignores case of attribute name.
Parameters: a - the attibute name true if present and removed, false otherwise |
remove | public boolean remove(String a, int n)(Code) | | Removes an attribute by index.
Ignores case of attribute name.
true if present and removed, false if not |
rename | public boolean rename(String a, String b)(Code) | | Renames attribute a to b.
Ignores case of attribute name.
true if successful |
replace | public void replace(String a, String v)(Code) | | Replaces a single-valued attribute.
Inserts the attribute if not already present.
Ignores case of attribute name.
Parameters: a - the attibute name Parameters: v - the attribute value Parameters: s - the attribute |
replace | public void replace(String a, String v, int n)(Code) | | Replaces a multivalued attribute by index.
Inserts the attribute if not already present.
Ignores case of attribute name.
Parameters: a - the attibute name Parameters: v - the attribute value Parameters: n - the multivalued index position to replace |
replace | public void replace(AVPair avp)(Code) | | Replaces an attribute-value pair by name.
Ignores case of attribute name.
Parameters: avp - the attibute-value pair |
setSchemaName | public void setSchemaName(String s)(Code) | | Sets the SOIF schema name.
|
squeezeMV | public void squeezeMV()(Code) | | Squeezes multivalued attributes. Packs the AVPair arrays
by closing any holes in them towards index zero.
|
toByteArray | public byte[] toByteArray(Set allowed) throws IOException(Code) | | Creates a byte array representation of this SOIF.
Convert this SOIF to a byte array.
Parameters: allowed - a restricted attribute set for the conversion (use lower case) this SOIF as a byte array using the current encoding throws: UnsupportedEncodingException - throws: IOException - |
|
|