|
Foundation |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.services.publish.ViewerEntry
public class ViewerEntry
Represents a viewer entry that can then be added to a result package for publishing. In the MVA Publishing Framework, a viewer is a custom-written template that contains HTML tags for formatting result set package content for view-only transports, such as e-mail. The viewer file is applied to the package during package publishing. A viewer file is particularly useful for rendering a SAS data set in a tabular format for viewing in e-mail. Also, it is useful for streaming dynamic information in the form of a binary file or a URL for inclusion in an electronic newsletter format.
The viewer is not used for rendering purposes in the Java Publishing Framework, but viewer entries can be published and retrieved.
See Constructing a Result Package to Publish for an example of how this class is used.
Field Summary |
---|
Fields inherited from class com.sas.services.publish.AbstractEntry |
---|
BINARY_COMPAT_VERSION, CATALOG_COMPAT_VERSION, DATASET_COMPAT_VERSION, DEFAULT_ENTRY_VERSION, HTML_COMPAT_VERSION, MDDB_COMPAT_VERSION, NESTEDPACKAGE_COMPAT_VERSION, REFERENCE_COMPAT_VERSION, SQLVIEW_COMPAT_VERSION, TEXT_COMPAT_VERSION, VIEWER_COMPAT_VERSION |
Fields inherited from interface com.sas.services.publish.ViewerEntryInterface |
---|
HTML_VIEWER, TEXT_VIEWER |
Constructor Summary | |
---|---|
|
ViewerEntry()
Creates a default instance. |
protected |
ViewerEntry(java.lang.Class theClass)
Creates a new text file entry exporting a remote object using RMI socket factories appropriate for the specified class. |
|
ViewerEntry(java.io.File file,
int viewerType)
Creates a viewer entry. |
|
ViewerEntry(java.io.InputStream inputStream,
java.lang.String name,
int viewerType)
Creates a viewer entry. |
Method Summary | |
---|---|
protected void |
closeEntry()
Remove any temporary files needed for inputstream re-use and mark this entry as closed. |
void |
consumeStream()
Consume and close the input stream provided on the constructor. |
protected void |
finalize()
At finalize time, cleanup temporary files if necessary. |
java.lang.String |
getEncoding()
Returns the encoding of the viewer. |
java.io.InputStream |
getInputStream()
Gets the input stream for this binary file entry. |
java.io.InputStream |
getInputStream(java.lang.Object streamID)
Deprecated. Use getInputStream() which now supports remote
input streams. |
java.lang.String |
getMIMEType()
Returns the MIME type associated with this viewer entry. |
java.lang.String |
getName()
Returns the name of the file. |
java.io.Reader |
getReader()
Gets reader for the text file entry. |
java.io.Reader |
getReader(java.lang.Object readerID)
Deprecated. Use getReader() which now supports remote readers.
|
com.sas.io.RemoteInputStreamInterface |
getRemoteInputStream(java.lang.Object streamID)
Deprecated. Use getInputStream() which now supports remote
input streams. |
com.sas.io.RemoteReaderInterface |
getRemoteReader(java.lang.Object readerID)
Deprecated. Use getReader() which now supports remote readers.
|
int |
getViewerType()
Returns the type of viewer, HTML or text. |
java.lang.Object |
hasInputStream()
Deprecated. this method no longer needed as getInputStream() will return an input stream that can be used in a remote environment |
java.lang.Object |
hasReader()
Deprecated. this method no longer needed as getReader() will return a reader that can be used in a remote environment |
void |
setEncoding(java.lang.String encoding)
Sets the viewer encoding. |
void |
setMIMEType(java.lang.String mimeType)
Sets the MIME associated with this file entry. |
Methods inherited from class com.sas.services.publish.AbstractEntry |
---|
getDescription, getEntityKey, getNameValuePairs, getURL, isClosed, isReadOnly, sameEntity, setClosed, setDescription, setEntityKey, setNameValuePairs, setRead, throwExceptionIfClosed |
Methods inherited from interface com.sas.services.publish.EntryInterface |
---|
getDescription, getNameValuePairs, getURL, isReadOnly, setDescription, setNameValuePairs |
Constructor Detail |
---|
public ViewerEntry() throws java.rmi.RemoteException
ViewerEntry(File file, int viewerType)
or
ViewerEntry(InputStream inputStream, String name, int viewerType)
instead.
java.rmi.RemoteException
- If a network anomaly is encountered.protected ViewerEntry(java.lang.Class theClass) throws java.rmi.RemoteException
theClass
- The class to use when determine which RMI socket factories
are to be used when exporting a remote object.
java.rmi.RemoteException
- If a network anomaly is encountered.public ViewerEntry(java.io.File file, int viewerType) throws java.lang.IllegalArgumentException, java.rmi.RemoteException
file
- The viewer file.viewerType
- The type of viewer. Valid types include
HTML_VIEWER
or
TEXT_VIEWER
.
There is no default MIME type. To set the MIME type for the
entry, use setMIMEType(java.lang.String)
.
java.lang.IllegalArgumentException
- If a null
file or an an
invalid viewer type is specified.
java.rmi.RemoteException
- If a network anomaly is encountered.public ViewerEntry(java.io.InputStream inputStream, java.lang.String name, int viewerType) throws java.lang.IllegalArgumentException, java.rmi.RemoteException
inputStream
- The input stream of the viewer file.name
- The name of the viewer entry. This name will be used as the
name of the entry when publishing the package.viewerType
- The type of viewer. Valid types include
HTML_VIEWER
or
TEXT_VIEWER
.
There is no default MIME type. To set the MIME type for the
entry, use setMIMEType(java.lang.String)
.
java.lang.IllegalArgumentException
- If a null
input stream, a
null
name, or an invalid viewer type is
specified.
java.rmi.RemoteException
- If a network anomaly is encountered.Method Detail |
---|
public java.lang.String getName() throws java.rmi.RemoteException, TransportException, java.lang.IllegalStateException
getName
in interface ViewerEntryInterface
String
The name of the file.
java.lang.IllegalStateException
- if the result package containing this entry
has already been closed.
TransportException
- If the transport encounters an error getting
the name of the file.
java.rmi.RemoteException
- If a network anomaly is encountered.public java.lang.String getMIMEType() throws java.rmi.RemoteException, TransportException, java.lang.IllegalStateException
getMIMEType
in interface ViewerEntryInterface
String
The MIME type associated with this file; can
be null
.
java.lang.IllegalStateException
- if the result package containing this entry
has already been closed.
TransportException
- If the transport encounters an error getting
the MIME type.
java.rmi.RemoteException
- If a network anomaly is encountered.public void setMIMEType(java.lang.String mimeType) throws java.lang.IllegalStateException, java.rmi.RemoteException
setMIMEType
in interface ViewerEntryInterface
mimeType
- The MIME type associated with this file entry.
java.lang.IllegalStateException
- If the entry is read only or if the package
containing this entry has already been closed.
java.rmi.RemoteException
- If a network anomaly is encountered.public int getViewerType() throws java.rmi.RemoteException, TransportException, java.lang.IllegalStateException
getViewerType
in interface ViewerEntryInterface
int
The type of viewer. Supported viewer types
include HTML_VIEWER
or
TEXT_VIEWER
.
java.lang.IllegalStateException
- if the result package containing this entry
has already been closed.
TransportException
- If the transport encounters an error getting
the viewer type.
java.rmi.RemoteException
- If a network anomaly is encounteredpublic java.lang.String getEncoding() throws java.rmi.RemoteException, java.lang.IllegalStateException
getEncoding
in interface ViewerEntryInterface
String
The encoding of the viewer; can be null.
java.lang.IllegalStateException
- if the result package containing this entry
has already been closed.
java.rmi.RemoteException
- If a network anomaly is encountered.public void setEncoding(java.lang.String encoding) throws java.lang.IllegalStateException, java.rmi.RemoteException
If this is a text viewer, the encoding is used when constructing the Reader that is returned by getReader and getRemoteReader, and it is used to publish the viewer.
If this is an HTML viewer, the encoding of the HTML viewer is published as metadata along with the viewer entry. When published, the HTML viewer is parsed. If the charset= attribute is specified in the META tag, this encoding value will be used. If not found, the value set using this method will be used. Otherwise, a default encoding will be determined.
setEncoding
in interface ViewerEntryInterface
encoding
- The encoding for this viewer.
java.lang.IllegalStateException
- If the entry is read only or if the result
package containing this entry has already been closed.
java.rmi.RemoteException
- If a network anomaly is encounteredpublic java.io.InputStream getInputStream() throws java.rmi.RemoteException, java.io.IOException, java.lang.IllegalStateException
getInputStream
in interface ViewerEntryInterface
java.lang.IllegalStateException
- if the result package containing this entry
has already been closed.
java.io.IOException
- If an error occurs constructing the input stream.
java.rmi.RemoteException
- If a network anomaly is encountered.public java.io.Reader getReader() throws java.lang.IllegalStateException, java.rmi.RemoteException, java.io.IOException
getReader
in interface ViewerEntryInterface
java.rmi.UnmarshalException
- If invoked on a remote object.
java.lang.IllegalStateException
- if the result package containing this entry
has already been closed.
java.io.IOException
- If an error occurs constructing the input stream.
java.rmi.RemoteException
- If a network anomaly is encountered.public java.io.InputStream getInputStream(java.lang.Object streamID) throws java.rmi.RemoteException, java.io.IOException, java.lang.IllegalStateException, java.rmi.UnmarshalException
getInputStream()
which now supports remote
input streams.
getRemoteInputStream(java.lang.Object)
in order to obtain the input stream.
getInputStream
in interface com.sas.io.InputStreamProviderInterface
getInputStream
in interface ViewerEntryInterface
streamID
- The stream description should be null
; it
will be ignored.
java.rmi.UnmarshalException
- If invoked on a remote object.
java.lang.IllegalStateException
- if the result package containing this entry
has already been closed.
java.io.IOException
- If an error occurs constructing the input stream.
java.rmi.RemoteException
- If a network anomaly is encountered.public com.sas.io.RemoteInputStreamInterface getRemoteInputStream(java.lang.Object streamID) throws java.lang.IllegalStateException, com.sas.io.ChainedIOException, java.rmi.RemoteException
getInputStream()
which now supports remote
input streams.
getRemoteInputStream
in interface com.sas.io.InputStreamProviderInterface
getRemoteInputStream
in interface ViewerEntryInterface
streamID
- The stream description should be null
;it
will be ignored.
RemoteInputStream
The file as a remote input
stream.
java.lang.IllegalStateException
- If the package has already been closed or if
this is a text viewer. Text viewers support readers. HTML
viewers support input streams.
com.sas.io.ChainedIOException
- If an I/O error occurs obtaining the input
stream.
java.rmi.RemoteException
- If a network anomaly is encountered.public java.io.Reader getReader(java.lang.Object readerID) throws java.lang.IllegalStateException, java.rmi.RemoteException, java.io.IOException
getReader()
which now supports remote readers.
getRemoteReader(java.lang.Object)
in order to obtain the reader.
getReader
in interface com.sas.io.ReaderProviderInterface
getReader
in interface ViewerEntryInterface
readerID
- The reader description should be null
; it
will be ignored.
java.rmi.UnmarshalException
- If invoked on a remote object.
java.lang.IllegalStateException
- if the result package containing this entry
has already been closed.
java.io.IOException
- If an error occurs constructing the input stream.
java.rmi.RemoteException
- If a network anomaly is encountered.public com.sas.io.RemoteReaderInterface getRemoteReader(java.lang.Object readerID) throws java.lang.IllegalStateException, com.sas.io.ChainedIOException, java.rmi.RemoteException
getReader()
which now supports remote readers.
getRemoteReader
in interface com.sas.io.ReaderProviderInterface
getRemoteReader
in interface ViewerEntryInterface
readerID
- The reader description should be null
;it
will be ignored.
RemoteReader
The file as a remote Reader.
java.lang.IllegalStateException
- If the result package has already been
closed or of this is an HTML viewer. Text viewers support
readers. HTML viewers support input streams.
com.sas.io.ChainedIOException
- If the transport encounters an I/O error
obtaining the reader.
java.rmi.RemoteException
- If a network anomaly is encountered.public java.lang.Object hasInputStream() throws java.rmi.UnmarshalException, java.rmi.RemoteException, java.lang.IllegalStateException
getInputStream(Object streamID)
will succeed. See
getInputStream(Object streamID)
to determine whether this method
should be used.
hasInputStream
in interface com.sas.io.InputStreamProviderInterface
hasInputStream
in interface ViewerEntryInterface
java.rmi.UnmarshalException
- if invoked on a remote object
java.lang.IllegalStateException
- if the result package containing this entry
has already been closed.
java.rmi.RemoteException
- if a network I/O error occurs.public java.lang.Object hasReader() throws java.rmi.UnmarshalException, java.rmi.RemoteException, java.lang.IllegalStateException
getReader(java.lang.Object)
will succeed. See
getReader(java.lang.Object)
to determine whether this method
should be used.
hasReader
in interface com.sas.io.ReaderProviderInterface
hasReader
in interface ViewerEntryInterface
java.rmi.UnmarshalException
- if invoked on a remote object
java.rmi.RemoteException
- if a network I/O error occurs.
java.lang.IllegalStateException
- if the result package containing this entry
has already been closed.public void consumeStream() throws java.io.IOException, java.rmi.RemoteException, java.lang.IllegalStateException
java.lang.IllegalStateException
- If the package containing this entry is
already closed.
java.io.IOException
- If an error occurs constructing the input stream.
java.rmi.RemoteException
- If a network anomaly is encountered.protected void closeEntry()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
|
Foundation |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |