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

com.sas.services.publish
Class ResultPackage

com.sas.services.publish.ResultPackage
All Implemented Interfaces:
com.sas.entities.EntityKeyInterface, com.sas.io.InputStreamProviderInterface, EntryInterface, ResultPackageInterface, java.io.Serializable, java.rmi.Remote

public class ResultPackage
implements ResultPackageInterface

Represents a result package that can then be published using one of the supported delivery transports. See Constructing a Result Package to Publish for an example of how this class is used. A result package is a collection of information, such as a collection of reports, tables and documents. A package can contain text files, binary files (such as GIF or JPG), HTML files, references, and viewer files.

Package metadata can be defined to provide more information about the result package:

Since:
1.0
See Also:
TransportFactory, 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, VIEWER_COMPAT_VERSION
 
Constructor Summary
ResultPackage()
          Creates a result package.
 
Method Summary
 void addEntry(EntryInterface entry)
          Adds a new entry to the result package.
 void close()
          Close the result package.
 void delete()
          Delete the result package.
 java.lang.String getAbstract()
          Returns the abstract of the result package.
 long getCreationDateTime()
          Returns the creation datetime stamp.
 EntryInterface[] getEntries()
          Returns an array of all entries in this package.
 EntryInterface getEntry(int index)
          Returns a particular result package entry as indicated by the specified index.
 EntryInterface getEntry(java.lang.String uniqueId)
          Returns the result package entry identified by the entity key.
 EventDataInterface getEventData()
          Returns the event data.
 long getExpirationDateTime()
          Returns the expiration datetime stamp.
 java.io.InputStream getInputStream()
          Gets the input stream for this result package.
 java.io.InputStream getInputStream(java.lang.Object streamID)
          Deprecated. Use getInputStream() which now supports remote input streams.
 java.lang.String getName()
          Returns the name for this result package.
 com.sas.io.RemoteInputStreamInterface getRemoteInputStream(java.lang.Object streamID)
          Deprecated. Use getInputStream() which now supports remote input streams.
 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
 boolean isNested()
          Returns true when the result package is a nested package.
 void setAbstract(java.lang.String pkgAbstract)
          Set the abstract for the result package.
 void setExpirationDateTime(long expiration)
          Set the expiration datetime stamp for the package
 void setName(java.lang.String name)
          Set the name for the result package.
 
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

ResultPackage

public ResultPackage()
              throws java.rmi.RemoteException
Creates a result package.

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

hasInputStream

public java.lang.Object hasInputStream()
                                throws 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(java.lang.Object) will succeed. This method will always return null.

Specified by:
hasInputStream in interface com.sas.io.InputStreamProviderInterface
Specified by:
hasInputStream in interface ResultPackageInterface
Returns:
Object null
Throws:
java.lang.IllegalStateException - if this result package has already been closed.

getInputStream

public java.io.InputStream getInputStream(java.lang.Object streamID)
                                   throws java.lang.IllegalStateException
Deprecated. Use getInputStream() which now supports remote input streams.

Gets the input stream for this result package. This method will always return null and is only present becuase this class implements ResultPackageInterface which extends RemoteInputStreamInterface which defines it.

Specified by:
getInputStream in interface com.sas.io.InputStreamProviderInterface
Specified by:
getInputStream in interface ResultPackageInterface
Parameters:
streamID - The stream description should be null; it will be ignored.
Returns:
null
Throws:
java.lang.IllegalStateException - if this result package has already been closed.

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.lang.IllegalStateException
Gets the input stream for this result package. This method will always return null and is only present because this class implements ResultPackageInterface which extends RemoteInputStreamInterface which defines it.

Specified by:
getInputStream in interface ResultPackageInterface
Returns:
null
Throws:
java.lang.IllegalStateException - if this result package has already been closed.

getRemoteInputStream

public com.sas.io.RemoteInputStreamInterface getRemoteInputStream(java.lang.Object streamID)
                                                           throws java.io.IOException,
                                                                  java.rmi.RemoteException,
                                                                  java.lang.IllegalStateException
Deprecated. Use getInputStream() which now supports remote input streams.

Gets the remote input stream for this result package. This method will always return null and is only present becuase this class implements ResultPackageInterface which extends RemoteInputStreamInterface which defines it.

Specified by:
getRemoteInputStream in interface com.sas.io.InputStreamProviderInterface
Specified by:
getRemoteInputStream in interface ResultPackageInterface
Parameters:
streamID - The stream description should be null; it will be ignored.
Returns:
null
Throws:
java.lang.IllegalStateException - if this result package has already been closed.
java.io.IOException - If an error occurs constructing the remote input stream.
java.rmi.RemoteException - If a network anomaly is encountered.

getAbstract

public java.lang.String getAbstract()
                             throws java.rmi.RemoteException,
                                    java.lang.IllegalStateException
Returns the abstract of the result package.

Specified by:
getAbstract in interface ResultPackageInterface
Returns:
Object The abstract of the result package; can be null.
Throws:
java.rmi.RemoteException - If a network anomaly is encountered.
java.lang.IllegalStateException - if this result package has already been closed.

setAbstract

public void setAbstract(java.lang.String pkgAbstract)
                 throws java.rmi.RemoteException,
                        java.lang.IllegalStateException
Set the abstract for the result package.

Specified by:
setAbstract in interface ResultPackageInterface
Parameters:
pkgAbstract - Plain text that is the abstract for this result package.
Throws:
java.lang.IllegalStateException - If the result package is read only or if the result package is already closed.
java.rmi.RemoteException - If a network anomaly is encountered.

getExpirationDateTime

public long getExpirationDateTime()
                           throws java.rmi.RemoteException,
                                  java.lang.IllegalStateException
Returns the expiration datetime stamp.

Specified by:
getExpirationDateTime in interface ResultPackageInterface
Returns:
long The expiration datetime stamp for this result package.
Throws:
java.rmi.RemoteException - If a network anomaly is encountered.
java.lang.IllegalStateException - if this result package has already been closed.

setExpirationDateTime

public void setExpirationDateTime(long expiration)
                           throws java.rmi.RemoteException,
                                  java.lang.IllegalStateException
Set the expiration datetime stamp for the package

Specified by:
setExpirationDateTime in interface ResultPackageInterface
Parameters:
expiration - The expiration datetime.
Throws:
java.lang.IllegalStateException - If the result package is read only or if the result package is already closed.
java.rmi.RemoteException - If a network anomaly is encountered.

getCreationDateTime

public long getCreationDateTime()
                         throws java.lang.IllegalStateException,
                                java.rmi.RemoteException
Returns the creation datetime stamp. Because ResultPackage is used to construct new result packages, this method will cause an IllegalStateException.

Specified by:
getCreationDateTime in interface ResultPackageInterface
Returns:
long The creation datetime stamp for this result package.
Throws:
java.lang.IllegalStateException - if this result package has already been closed.
java.rmi.RemoteException - If a network anomaly is encountered.

getName

public java.lang.String getName()
                         throws java.lang.IllegalStateException,
                                TransportException,
                                java.rmi.RemoteException
Returns the name for this result package.

Specified by:
getName in interface ResultPackageInterface
Returns:
String The name of the result package; can be null.
Throws:
java.lang.IllegalStateException - if this result package has already been closed.
TransportException - If the transport encounters an error getting the nested name.
java.rmi.RemoteException - If a network anomaly is encountered.

setName

public void setName(java.lang.String name)
             throws java.lang.IllegalStateException,
                    java.rmi.RemoteException
Set the name for the result package. This name will only be used if the result package is published as a nested package. A result package can be nested by adding it as an entry to another result package. When the nested package is published, a unique nested package name is generated by the transports. This can be overridden by providing the nested name to use.

Specified by:
setName in interface ResultPackageInterface
Parameters:
name - The name for this result package; can be null.
Throws:
java.lang.IllegalStateException - If the result package is read only or the result package is already closed.
java.rmi.RemoteException - If a network anomaly is encountered.

getEntry

public EntryInterface getEntry(int index)
                        throws java.rmi.RemoteException,
                               java.lang.IllegalStateException
Returns a particular result package entry as indicated by the specified index. Distributed applications should use {#link getEntries} to obtain the array of entries. It is more efficient to obtain the entire entry array in one request, instead of invoking this method to obtain each entry separately.

Specified by:
getEntry in interface ResultPackageInterface
Parameters:
index - The zero-based index of the desired result package entry.
Returns:
ResultPackageEntryInterface The result package entry.
Throws:
java.rmi.RemoteException - If a network anomaly is encountered.
java.lang.IllegalStateException - if this result package has already been closed.

getEntries

public EntryInterface[] getEntries()
                            throws java.rmi.RemoteException,
                                   java.lang.IllegalStateException
Returns an array of all entries in this package. Distributed applications should use this method to obtain the package entries because it is more efficient to get all the entries in one request.

Specified by:
getEntries in interface ResultPackageInterface
Returns:
List An array of EntryInterface objects.
Throws:
java.rmi.RemoteException - If a network anomaly is encountered.
java.lang.IllegalStateException - if this result package has already been closed.

addEntry

public void addEntry(EntryInterface entry)
              throws java.rmi.RemoteException,
                     java.lang.IllegalStateException,
                     java.lang.IllegalArgumentException
Adds a new entry to the result package. The entry will be added to the end of the array of entries. This method will fail if the result package is read only.

Specified by:
addEntry in interface ResultPackageInterface
Parameters:
entry - The entry to add to the result package.
Throws:
java.lang.IllegalStateException - If the result package is read only or if the result package has already been closed.
java.lang.IllegalArgumentException - If a library member entry is added to the package. Library member entries cannot be published.
java.rmi.RemoteException - If a network anomaly is encountered.

isNested

public boolean isNested()
                 throws java.rmi.RemoteException,
                        java.lang.IllegalStateException
Returns true when the result package is a nested package.

Specified by:
isNested in interface ResultPackageInterface
Returns:
boolean True if the result package is a nested package; otherwise if this is the main package, false is returned.
Throws:
java.rmi.RemoteException - If a network anomaly is encountered.
java.lang.IllegalStateException - if this result package has already been closed.

close

public void close()
           throws java.rmi.RemoteException,
                  java.lang.IllegalStateException,
                  TransportException
Close the result package.

Specified by:
close in interface ResultPackageInterface
Throws:
java.lang.IllegalStateException - If the result package has already been closed or if this is a nested package.
TransportException - If the transport encounters an error getting the entry.
java.rmi.RemoteException - If a network anomaly is encountered.

delete

public void delete()
            throws TransportException,
                   java.rmi.RemoteException,
                   java.lang.IllegalStateException
Delete the result package. This method is not supported for nested packages. Because ResultPackage is used to construct new result packages, this method will cause an IllegalStateException.

Specified by:
delete in interface ResultPackageInterface
Throws:
java.lang.UnsupportedOperationException - If the operation is not supported by the trasnport.
java.lang.IllegalStateException - If the result package is read only, if this is a nested package, or if this result package has already been closed.
TransportException - If the transport encounters an error deleting the package.
java.rmi.RemoteException - If a network anomaly is encountered.

getEventData

public EventDataInterface getEventData()
                                throws TransportException,
                                       java.rmi.RemoteException,
                                       java.lang.IllegalStateException
Returns the event data. This includes the SASPackage XML event that describes this result package, as well as the event persistence information. See SASPackage Event Usage for more details.

Specified by:
getEventData in interface ResultPackageInterface
Returns:
EventDataInterface The event data which includes the SASPackage event body, and the event persistence information.
Throws:
TransportException - If the transport encounters an error getting the nested name.
java.rmi.RemoteException - If a network anomaly is encountered.
java.lang.IllegalStateException - if this result package has already been closed.

getEntry

public EntryInterface getEntry(java.lang.String uniqueId)
                        throws java.lang.IllegalStateException,
                               java.rmi.RemoteException,
                               TransportException
Returns the result package entry identified by the entity key.

Specified by:
getEntry in interface ResultPackageInterface
Parameters:
uniqueId - The unique identifier of the desired result package entry.
Returns:
EntryInterface The result package entry. This may be null if no entry is found with the specified identifier.
Throws:
java.lang.IllegalStateException - if this result package has already been closed.
TransportException - If the transport encounters an error getting the entry.
java.rmi.RemoteException - If a network anomaly is encountered.

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




Copyright © 2009 SAS Institute Inc. All Rights Reserved.