All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Foundation |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

*** This class provides Binary Compatibility only, not Source Compatibility ***

## com.sas.services.publish
Class ViewerEntry

    com.sas.services.publish.ViewerEntry

All Implemented Interfaces:
  com.sas.entities.EntityKeyInterface, com.sas.io.InputStreamProviderInterface, com.sas.io.ReaderProviderInterface, EntryInterface, ViewerEntryInterface, java.io.Serializable, java.rmi.Remote

    public class ViewerEntry

implements ViewerEntryInterface

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.

Since:
  1.0
See Also:
  Serialized Form

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, VERSION_94_EXTENDED_ATTRIBUTES, 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

### ViewerEntry

    public ViewerEntry()
                throws java.rmi.RemoteException

  Creates a default instance. This constructor should not be used and is only provided since the compiler was previously providing a default public constructor. Use `ViewerEntry(File file, int viewerType)`or `ViewerEntry(InputStream inputStream, String name, int viewerType)` instead.

  Throws:
    `java.rmi.RemoteException` - If a network anomaly is encountered.

### ViewerEntry

    protected ViewerEntry(java.lang.Class theClass)
                   throws java.rmi.RemoteException

  Creates a new text file entry exporting a remote object using RMI socket factories appropriate for the specified class.

  Parameters:
    `theClass` - The class to use when determine which RMI socket factories are to be used when exporting a remote object.
  Throws:
    `java.rmi.RemoteException` - If a network anomaly is encountered.

### ViewerEntry

    public ViewerEntry(java.io.File file,
                       int viewerType)
                throws java.lang.IllegalArgumentException,
                       java.rmi.RemoteException

  Creates a viewer entry. When the viewer file is published, the file name is used as the name. If a different name is preferred, use the constructor that takes the input stream and the name of the entry.

  Parameters:
    `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)`.

  Throws:
    `java.lang.IllegalArgumentException` - If a `null` file or an an invalid viewer type is specified.
    `java.rmi.RemoteException` - If a network anomaly is encountered.

### ViewerEntry

    public ViewerEntry(java.io.InputStream inputStream,
                       java.lang.String name,
                       int viewerType)
                throws java.lang.IllegalArgumentException,
                       java.rmi.RemoteException

  Creates a viewer entry. When the viewer file is published, the input stream will be consumed until end-of-file.

  Parameters:
    `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)`.

  Throws:
    `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

### getName

    public java.lang.String getName()
                             throws java.rmi.RemoteException,
                                    TransportException,
                                    java.lang.IllegalStateException

  Returns the name of the file.

  Specified by:
    `getName` in interface `ViewerEntryInterface`
  Returns:
    `String` The name of the file.
  Throws:
    `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.

### getMIMEType

    public java.lang.String getMIMEType()
                                 throws java.rmi.RemoteException,
                                        TransportException,
                                        java.lang.IllegalStateException

  Returns the MIME type associated with this viewer entry. The user-specified MIME type is assigned when the viewer entry is published.

  Specified by:
    `getMIMEType` in interface `ViewerEntryInterface`
  Returns:
    `String` The MIME type associated with this file; can be `null`.
  Throws:
    `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.

### setMIMEType

    public void setMIMEType(java.lang.String mimeType)
                     throws java.lang.IllegalStateException,
                            java.rmi.RemoteException

  Sets the MIME associated with this file entry.

  Specified by:
    `setMIMEType` in interface `ViewerEntryInterface`
  Parameters:
    `mimeType` - The MIME type associated with this file entry.
  Throws:
    `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.

### getViewerType

    public int getViewerType()
                      throws java.rmi.RemoteException,
                             TransportException,
                             java.lang.IllegalStateException

  Returns the type of viewer, HTML or text.

  Specified by:
    `getViewerType` in interface `ViewerEntryInterface`
  Returns:
    `int` The type of viewer. Supported viewer types include `HTML_VIEWER`or `TEXT_VIEWER`.
  Throws:
    `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 encountered

### getEncoding

    public java.lang.String getEncoding()
                                 throws java.rmi.RemoteException,
                                        java.lang.IllegalStateException

  Returns the encoding of the viewer. If this is a text viewer, the text viewer may be in a different encoding. This method provides the text encoding, so that it can be used when creating readers to read the text viewer. If this is an HTML viewer, this identifies the encoding of the HTML file.

  Specified by:
    `getEncoding` in interface `ViewerEntryInterface`
  Returns:
    `String` The encoding of the viewer; can be null.
  Throws:
    `java.lang.IllegalStateException` - if the result package containing this entry has already been closed.
    `java.rmi.RemoteException` - If a network anomaly is encountered.

### setEncoding

    public void setEncoding(java.lang.String encoding)
                     throws java.lang.IllegalStateException,
                            java.rmi.RemoteException

  Sets the viewer encoding.

  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.

  Specified by:
    `setEncoding` in interface `ViewerEntryInterface`
  Parameters:
    `encoding` - The encoding for this viewer.
  Throws:
    `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 encountered

### getInputStream

    public java.io.InputStream getInputStream()
                                       throws java.rmi.RemoteException,
                                              java.io.IOException,
                                              java.lang.IllegalStateException

  Gets the input stream for this binary file entry.

  Specified by:
    `getInputStream` in interface `ViewerEntryInterface`
  Returns:
    The input stream that can be used for reading the contents of the binary file entry.
  Throws:
    `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.

### getReader

    public java.io.Reader getReader()
                             throws java.lang.IllegalStateException,
                                    java.rmi.RemoteException,
                                    java.io.IOException

  Gets reader for the text file entry.

  Specified by:
    `getReader` in interface `ViewerEntryInterface`
  Returns:
    The reader that can be used for reading the contents of the text file entry.
  Throws:
    `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.

### getInputStream

    public java.io.InputStream getInputStream(java.lang.Object streamID)
                                       throws java.rmi.RemoteException,
                                              java.io.IOException,
                                              java.lang.IllegalStateException,
                                              java.rmi.UnmarshalException

  Deprecated. Use `getInputStream()`which now supports remote input streams.

  Gets the input stream for this binary file entry. Because input streams are not remotable, this method will throw a RemoteException if it is invoked on a remote object. Distributed applications should utilize `getRemoteInputStream(java.lang.Object)`in order to obtain the input stream.

  Specified by:
    `getInputStream` in interface `com.sas.io.InputStreamProviderInterface`
  Specified by:
    `getInputStream` in interface `ViewerEntryInterface`
  Parameters:
    `streamID` - The stream description should be `null`; it will be ignored.
  Returns:
    The input stream that can be used for reading the contents of the binary file entry.
  Throws:
    `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.

### getRemoteInputStream

    public com.sas.io.RemoteInputStreamInterface getRemoteInputStream(java.lang.Object streamID)
                                                               throws java.lang.IllegalStateException,
                                                                      com.sas.io.ChainedIOException,
                                                                      java.rmi.RemoteException

  Deprecated. Use `getInputStream()`which now supports remote input streams.

  Get the HTML viewer as a remote input stream. If your application runs in a distributed environment, it is suggested that you use RemoteInputStream. InputStreams are not remote objects.

  Specified by:
    `getRemoteInputStream` in interface `com.sas.io.InputStreamProviderInterface`
  Specified by:
    `getRemoteInputStream` in interface `ViewerEntryInterface`
  Parameters:
    `streamID` - The stream description should be `null` ;it will be ignored.
  Returns:
    `RemoteInputStream` The file as a remote input stream.
  Throws:
    `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.

### getReader

    public java.io.Reader getReader(java.lang.Object readerID)
                             throws java.lang.IllegalStateException,
                                    java.rmi.RemoteException,
                                    java.io.IOException

  Deprecated. Use `getReader()`which now supports remote readers.

  Gets reader for the text file entry. Because readers are not remotable, this method will throw a RemoteException if it is invoked on a remote object. Distributed applications should utilize `getRemoteReader(java.lang.Object)` in order to obtain the reader.

  Specified by:
    `getReader` in interface `com.sas.io.ReaderProviderInterface`
  Specified by:
    `getReader` in interface `ViewerEntryInterface`
  Parameters:
    `readerID` - The reader description should be `null`; it will be ignored.
  Returns:
    The reader that can be used for reading the contents of the text file entry.
  Throws:
    `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.

### getRemoteReader

    public com.sas.io.RemoteReaderInterface getRemoteReader(java.lang.Object readerID)
                                                     throws java.lang.IllegalStateException,
                                                            com.sas.io.ChainedIOException,
                                                            java.rmi.RemoteException

  Deprecated. Use `getReader()`which now supports remote readers.

  Get the a remote reader. Because the Reader class is not a remotable, distributed applications should use a RemoteReader.

  Specified by:
    `getRemoteReader` in interface `com.sas.io.ReaderProviderInterface`
  Specified by:
    `getRemoteReader` in interface `ViewerEntryInterface`
  Parameters:
    `readerID` - The reader description should be `null` ;it will be ignored.
  Returns:
    `RemoteReader` The file as a remote Reader.
  Throws:
    `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.

### hasInputStream

    public java.lang.Object hasInputStream()
                                    throws java.rmi.UnmarshalException,
                                           java.rmi.RemoteException,
                                           java.lang.IllegalStateException

  Deprecated. this method no longer needed as getInputStream() will return an input stream that can be used in a remote environment

  Check if `getInputStream(Object streamID)`will succeed. See `getInputStream(Object streamID)`to determine whether this method should be used.

  Specified by:
    `hasInputStream` in interface `com.sas.io.InputStreamProviderInterface`
  Specified by:
    `hasInputStream` in interface `ViewerEntryInterface`
  Returns:
    non-null if getInputStream(java.lang.Object) would succeed; throws UnmarshalException if it would fail
  Throws:
    `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.

### hasReader

    public java.lang.Object hasReader()
                               throws java.rmi.UnmarshalException,
                                      java.rmi.RemoteException,
                                      java.lang.IllegalStateException

  Deprecated. this method no longer needed as getReader() will return a reader that can be used in a remote environment

  Check if `getReader(java.lang.Object)`will succeed. See `getReader(java.lang.Object)`to determine whether this method should be used.

  Specified by:
    `hasReader` in interface `com.sas.io.ReaderProviderInterface`
  Specified by:
    `hasReader` in interface `ViewerEntryInterface`
  Returns:
    non-null if getReader(java.lang.Object) would succeed; throws UnmarshalException if it would fail
  Throws:
    `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.

### consumeStream

    public void consumeStream()
                       throws java.io.IOException,
                              java.rmi.RemoteException,
                              java.lang.IllegalStateException

  Consume and close the input stream provided on the constructor. If an input stream is provided on the entry's constructor, then it does not get consumed until the package is published. This method may be invoked to force the stream to get consumed and closed immediately instead of waiting until the publish occurs.

  Throws:
    `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.

### closeEntry

    protected void closeEntry()

  Remove any temporary files needed for inputstream re-use and mark this entry as closed.

### finalize

    protected void finalize()
                     throws java.lang.Throwable

  At finalize time, cleanup temporary files if necessary.

  Overrides:
    `finalize` in class `java.lang.Object`
  Throws:
    `java.lang.Throwable`

*** This class provides Binary Compatibility only, not Source Compatibility ***

All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Foundation |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 SAS Institute Inc. All Rights Reserved.