|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.infoengine.SAK.IeService
Use the Server Access Kit (SAK) to access the Info*Engine Server programmatically.
The SAK, embodied in the IeService Object, is a Java object that provides access to the Info*Engine server. It executes Info*Engine templates and tasks. It allows the caller to obtain the raw output from these, and it also supports creation and management of an internal collection of Info*Engine group objects.
To use the SAK, you must instantiate an IeService object and then use the IeService object to initiate Info*Engine requests by supplying the URLs of templates and tasks. After initiating a request and providing optional parameter names and values, you can use the IeService object to obtain an input stream. From the input stream, you can read the result of the request, or if a task is initiated, you can request that the results of the task be added to an internally maintained collection of Info*Engine group objects. By using the IeService object methods that provide access to the internal collection, you can obtain groups, elements, and attributes from the collection.
Field Summary | |
private IeCollection |
collection
|
private URLConnection |
connection
|
private String |
contentType
|
private boolean |
exceptionsEnabled
|
private boolean |
firstContent
|
private InputStream |
inputStream
|
private String |
languagePreferences
|
private OutputStream |
outputStream
|
private String |
password
|
private String |
requestBoundary
|
private static String |
RESOURCE
|
private String |
serverUri
|
private URL |
url
|
private String |
username
|
Constructor Summary | |
IeService()
Create an instance that is not associated with any particular server. |
|
IeService(String serverUri)
Create an instance assocated with an Info*Engine server identified by the specified URI. |
Method Summary | |
void |
addAttributeValue(String gName,
int index,
String attName,
Object attValue)
add an attribute value to a group |
void |
addGroup(Group group)
Adds a group to the internal collection. |
void |
beginRequest(String templatePath)
Initiate a request to the Info*Engine server. |
Object |
clone()
Returns a shallow copy of the object. |
Att |
getAttribute(String groupName,
int index,
String attrName)
Return a named attribute of an element selected by index. |
Att |
getAttribute(String groupName,
String keyName,
String keyValue,
String attrName)
Return a named attribute of an element selected by attribute name and value. |
Enumeration |
getAttributeNames(String name,
int index)
Return the names of the attributes of an element of a group. |
String |
getAttributeValue(String groupName,
int index,
String attrName)
Return the value of a named attribute of an element selected by index. |
String |
getAttributeValue(String groupName,
String keyName,
String keyValue,
String attrName)
Return the value of a named attribute of an element selected by attribute name and value. |
Vector |
getAttributeValues(String groupName,
int index,
String attrName)
Return the values of a named attribute of an element selected by index. |
Vector |
getAttributeValues(String groupName,
String keyName,
String keyValue,
String attrName)
Return the values of a named attribute of an element selected by attribute name and value. |
IeCollection |
getCollection()
Return the object that holds the internal collection of Info*Engine group objects. |
Vector |
getColumn(String groupName,
String attrName)
Return all of the values of a named attribute of all elements of a group. |
String |
getContentType()
Return the MIME content type associated with the server response. |
int |
getElementCount(String name)
Return the number of elements in a group. |
Enumeration |
getElements(String name)
Return the elements of a group as an Enumeration. |
boolean |
getEnableExceptions()
Return an indication of whether exceptions will be thrown when returned from tasks have any groups that contain status values indicating failures. |
Group |
getGroup()
Return a group from the internal collection, as an Info*Engine Group object. |
Group |
getGroup(String name)
Return a group from the internal collection, as an Info*Engine Group object. |
Enumeration |
getGroupNames()
Return the names of the groups contained in the internal collection. |
String |
getGroupXML(String name)
Return a group from the internal collection, as a String in Info*Engine format. |
InputStream |
getInputStream()
Return an input stream containing the server's response to the request. |
Locale |
getLocale()
Return the locale that is currently associated with this service object. |
String |
getMessage(String name)
Return the message string associated with a group. |
Content |
getNextContent()
Return the next MIME content object from the server response stream. |
Vector |
getRow(String groupName,
int index)
Return all of the values of an element of a group. |
int |
getStatus(String name)
Return the status value associated with a group. |
void |
removeAllGroups()
Remove all groups from the collection. |
void |
removeGroup(String name)
Remove a group from the collection. |
void |
sendCollection()
Send the internal collection to the server. |
void |
sendContent(String contentType,
String name,
String filename,
InputStream is)
Send content of the request to the server. |
void |
sendGroup(String name)
Send a group from the internal collection to the server. |
void |
sendParameter(String name,
String value)
Send a parameter of the request to the server. |
void |
setAttributeValue(String gName,
int index,
String attName,
Object attValue)
set an attribute value in a group |
void |
setCollection(IeCollection collection)
Sets the object that holds the internal collection of Info*Engine group objects. |
void |
setCredentials(String name,
String password)
Establish the name and password of the user for which requests will be made. |
void |
setEnableExceptions(boolean enable)
Enable or disable the throwing of exceptions when tasks return groups that contain status values indicating failures. |
void |
setLanguagePreferences(String languagePreferences)
Establish the language preferences that will be used by Info*Engine in selecting an appropriate locale for each request. |
void |
setLocale(Locale locale)
Establish the locale that will be used in generating localized messages such as error messages. |
void |
setServerUri(String serverUri)
Establish the URI of the server to which requests will be sent. |
String |
toString()
Read all of the content objects returned in the server response and concatenate their String representations. |
void |
updateCollection()
Get the next Content object from the server response stream and merge the Info*Engine group objects contained within it into the internal collection. |
void |
updateCollection(Content content)
Merge the Info*Engine group objects contained within a Content object into the internal collection. |
void |
updateCollection(IeCollection collection)
Merge the Info*Engine groups contained within a specified collection into the internal collection. |
void |
writeNextContent(OutputStream os)
Write the next Content object to an output stream. |
void |
writeNextContent(Writer writer)
Write the next Content object to a Writer. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static String RESOURCE
private IeCollection collection
private URLConnection connection
private String contentType
private boolean exceptionsEnabled
private boolean firstContent
private InputStream inputStream
private String languagePreferences
private OutputStream outputStream
private String password
private String requestBoundary
private String serverUri
private URL url
private String username
Constructor Detail |
public IeService()
public IeService(String serverUri)
serverUri
- the URI of the server with which this instance
will be associatedMethod Detail |
public void setServerUri(String serverUri)
serverUri
- the URI of the server to which requests will be sentpublic void setCredentials(String name, String password)
name
- the username of the userpassword
- the user's passwordpublic void setLanguagePreferences(String languagePreferences)
languagePreferences
- the language preferences, encoded as for an
HTTP Accept-Language headerpublic void setLocale(Locale locale)
locale
- the locale to be used in generating localized messagespublic Locale getLocale()
public void beginRequest(String templatePath) throws IeServiceException
templatePath
- the pathname of a template or task.
IeServiceException
- if the request was not initiated
successfullypublic void sendParameter(String name, String value) throws IeServiceException
name
- the name of the parametervalue
- the value of the parameter
IeServiceException
- if the parameter was not sent
successfullypublic void sendGroup(String name) throws IeServiceException
name
- the name of the group to send
IeServiceException
- if the content was not sent
successfullypublic void sendCollection() throws IeServiceException
IeServiceException
- if the content was not sent
successfullypublic void sendContent(String contentType, String name, String filename, InputStream is) throws IeServiceException
contentType
- the MIME type of the contentname
- the name of the contentfilename
- the file name, if any, associated with the contentis
- the input stream containing the content
IeServiceException
- if the content was not sent
successfullypublic InputStream getInputStream() throws IeServiceException
IeServiceException
- if the input stream could not be
obtained successfully, possibly
because the request failedpublic String getContentType() throws IeServiceException
IeServiceException
- if the content type could not be
obtained successfully, possibly because
the request failedpublic Content getNextContent() throws IeServiceException
IeServiceException
- if the next content object was not
obtained successfully, possibly because
the request failedpublic void writeNextContent(OutputStream os) throws IeServiceException
os
- the output stream on which to write the content
IeServiceException
- if the next content object was not
obtained successfully, or the output
was not written successfullypublic void writeNextContent(Writer writer) throws IeServiceException
writer
- the Writer on which to write the content
IeServiceException
- if the next content object was not
obtained successfully, or the output
was not written successfullypublic void setEnableExceptions(boolean enable)
enable
- true if the throwing of exceptions is to be enabled,
false if the throwing of exception is to be disabled.public boolean getEnableExceptions()
public IeCollection getCollection()
public void setCollection(IeCollection collection)
collection
- The Info*Engine collectionpublic void updateCollection() throws IeServiceException
IeServiceException
- if the collection was not updated
successfully, possibly because the
request failed, so no XML objects were
obtained from the serverpublic void updateCollection(Content content) throws IeServiceException
content
- the Content object to be merged
IeServiceException
- if the collection was not updated
successfully, possibly because the
Content object did not contain a
valid set of Info*Engine groupspublic void updateCollection(IeCollection collection) throws IeServiceException
collection
- the external collection to be merged into the
internal collection
IeServiceException
- if the collection was not updated
successfully, possibly because the
request failed, so no XML objects were
obtained from the serverpublic Enumeration getGroupNames()
public Group getGroup()
public Group getGroup(String name)
name
- The name of the group to return. If null is specified,
the last group in the collection is returned.
public void addGroup(Group group)
group
- the Info*Engine group to addpublic String getGroupXML(String name)
name
- the name of the group to return
public int getElementCount(String name)
name
- the name of the group
public Enumeration getElements(String name)
name
- the name of the group
public Enumeration getAttributeNames(String name, int index)
name
- the name of the groupindex
- the index of the element
public Att getAttribute(String groupName, int index, String attrName)
groupName
- the name of the group from which to retrieve the
attributeindex
- the index of the element to select from the groupattrName
- the name of the attribute to retrieve from the group
public Att getAttribute(String groupName, String keyName, String keyValue, String attrName)
groupName
- the name of the group from which to retrieve the
attributekeyName
- the name of the attribute used as a key to select an
element from the group.keyValue
- the value of the attribute used as a key to select an
element from the groupattrName
- the name of the attribute to return from the selected
element
public Vector getAttributeValues(String groupName, int index, String attrName)
groupName
- the name of the group from which to retrieve the
attribute valuesindex
- the index of the element to select from the groupattrName
- the name of the attribute from which to retrieve values
public Vector getAttributeValues(String groupName, String keyName, String keyValue, String attrName)
groupName
- the name of the group from which to retrieve the
attribute valueskeyName
- the name of the attribute used as a key to select an
element from the groupkeyValue
- the value of the attribute used as a key to select an
element from the groupattrName
- the name of the attribute from which to retrieve values
public String getAttributeValue(String groupName, int index, String attrName)
groupName
- the name of the group from which to get the valueindex
- the index of the element to select from the groupattrName
- the name of the attribute from which to retrieve a
value
public String getAttributeValue(String groupName, String keyName, String keyValue, String attrName)
groupName
- the name of the group from which to get the valuekeyName
- the name of the attribute used as a key to select an
element from the groupkeyValue
- the value of the attribute used as a key to select an
element from the groupattrName
- the name of the attribute from which to retrieve a
value
public Vector getRow(String groupName, int index)
groupName
- the name of the groupindex
- the index of the element
public Vector getColumn(String groupName, String attrName)
groupName
- the name of the groupattrName
- the name of the attribute
public int getStatus(String name)
name
- the name of the group
public String getMessage(String name)
name
- the name of the group
public void removeGroup(String name)
name
- the name of the group to removepublic void removeAllGroups()
public String toString()
public final Object clone() throws CloneNotSupportedException
CloneNotSupportedException
public void setAttributeValue(String gName, int index, String attName, Object attValue)
gName
- - the name of the groupindex
- - the element index to add the attribute inattName
- - the name of the attribute to setattValue
- - the attribute valuepublic void addAttributeValue(String gName, int index, String attName, Object attValue)
gName
- - the name of the groupindex
- - the element index to add the attribute inattName
- - the name of the attribute to setattValue
- - the attribute value
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |