*** This class provides Binary Compatibility only, not Source Compatibility ***
Class HTMLFile
- All Implemented Interfaces:
com.sas.entities.EntityKeyInterface,com.sas.io.InputStreamProviderInterface,HTMLFileInterface,Serializable,Remote
Files that implement HTMLFileInterface can be inserted into an HTML entry.
HTMLEntryInterfaceis a container for various files that implement
HTMLFileInterface. Within MVA SAS, the ODS HTML statement generates HTML
files. The body file contains the results from the procedure. The contents
file is a table of contents that links to the body file. The pages file is a
table of pages that links to the body file. The frame file is a frame that
displays the table of contents, the table of pages and the body file. The
HTML entry provides a way to identify each of these files, and encapsulate
them into one entry.
The HTML file is limited to just one role. One file should be designated as
the main file for the HTML entry. The main file identifies which file in the
HTML entry should be used as the starting point when browsing the HTML entry.
The main file will have a role of HTMLFileInterface.MAIN_BODY_FILEor
HTMLFileInterface.MAIN_FRAME_FILE. If a frame file exists, it should be designated as
the main file; otherwise, the body file should be designated as the main
file. All other files are considered companion files. The companion files are
any files other than the main HTML file. The companion files can include,
body, frame, contents and page files, as well as any miscellaneous files
(such as HTML, GIF, JPG) needed by the HTML entry. Supported companion roles
include HTMLFileInterface.FRAME_COMPANION,HTMLFileInterface.BODY_COMPANION,
HTMLFileInterface.PAGE_COMPANION,HTMLFileInterface.CONTENTS_COMPANION,
HTMLFileInterface.MISC_COMPANION.
- Since:
- 1.0
- See Also:
-
Field Summary
Fields inherited from class java.rmi.server.RemoteObject
refFields inherited from interface com.sas.services.publish.HTMLFileInterface
BODY_COMPANION, CONTENTS_COMPANION, FRAME_COMPANION, MAIN_BODY_FILE, MAIN_FRAME_FILE, MISC_COMPANION, PAGE_COMPANION -
Constructor Summary
ConstructorsModifierConstructorDescriptionHTMLFile()Constructs a default instance.HTMLFile(File file, int role) Creates an HTML file or companion file.HTMLFile(InputStream inputStream, String name, int role) Creates an HTML file or companion file.protectedHTMLFile(Class theClass) Constructs an instance using RMI socket factories appropriate for the specified class. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidRemove any temporary files needed for inputstream re-use.voidConsume and close the input stream provided on the constructor.protected voidfinalize()At finalize time, cleanup temporary files if necessary.StringReturns the encoding for this file.StringGet the unique identifier of this result package or entry.InputStreamGets the input stream for this file.InputStreamgetInputStream(Object streamID) Deprecated.StringReturns the MIME type of the file.StringgetName()Returns the name of the file.com.sas.io.RemoteInputStreamInterfacegetRemoteInputStream(Object streamID) Deprecated.UsegetInputStream()which now supports remote input streams.intgetRole()Returns the role of this file within the HTML entry.StringgetURL()Returns the URL for this file.ObjectDeprecated.this method no longer needed as getInputStream() will return an input stream that can be used in a remote environmentbooleanReturns true when the entry is read only.booleansameEntity(com.sas.entities.EntityKeyInterface entity) voidsetEncoding(String encoding) Sets the file encoding.voidsetEntityKey(String entityKey) Set the unique entity key.voidsetMIMEType(String mimeType) Sets the MIME type associated with this file; can be null.voidsetURL(String url) Sets the URL of the file.Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObjectMethods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLogMethods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStubMethods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
HTMLFile
public HTMLFile() throws RemoteExceptionConstructs a default instance. A public constructor is provided since the compiler has been previosly generating a default public constructor. UseHTMLFile(File file, int role)instead of this constructor.- Throws:
RemoteException- If a network anomaly is encountered.
-
HTMLFile
protected HTMLFile(Class theClass) throws RemoteException Constructs an instance 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:
RemoteException- if unable to export the remote object.
-
HTMLFile
public HTMLFile(File file, int role) throws IllegalArgumentException, RemoteException Creates an HTML file or companion file. When the 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.There is no default MIME type. To set the MIME type for the entry, use
setMIMEType(String).- Parameters:
file- The file.role- The role of the file. Valid roles includeHTMLFileInterface.MAIN_BODY_FILE,HTMLFileInterface.MAIN_FRAME_FILE,HTMLFileInterface.BODY_COMPANION,HTMLFileInterface.FRAME_COMPANION,HTMLFileInterface.CONTENTS_COMPANION,HTMLFileInterface.PAGE_COMPANIONorHTMLFileInterface.MISC_COMPANION.- Throws:
IllegalArgumentException- If anullfile or invalid file type is specified.RemoteException- If a network anomaly is encountered.
-
HTMLFile
public HTMLFile(InputStream inputStream, String name, int role) throws IllegalArgumentException, RemoteException Creates an HTML file or companion file. When the file is published, the input stream will be consumed until end-of-file.There is no default MIME type. To set the MIME type for the entry, use
setMIMEType(String).- Parameters:
inputStream- The input stream of the HTML or companion file.name- The name of the HTML or companion file. When an HTML file is published, the URL is used to publish the file, if it was specified. If the URL is not specified, this name will be used as the name of the file.role- The role of the file. Valid roles includeHTMLFileInterface.MAIN_BODY_FILE,HTMLFileInterface.MAIN_FRAME_FILE,HTMLFileInterface.BODY_COMPANION,HTMLFileInterface.FRAME_COMPANION,HTMLFileInterface.CONTENTS_COMPANION,HTMLFileInterface.PAGE_COMPANIONorHTMLFileInterface.MISC_COMPANION.- Throws:
IllegalArgumentException- If anullinput stream, anullname, or an invalid file type is specified.RemoteException- If a network anomaly is encountered.
-
-
Method Details
-
getURL
public String getURL() throws RemoteExceptionReturns the URL for this file.- Specified by:
getURLin interfaceHTMLFileInterface- Returns:
StringThe URL for the file.- Throws:
RemoteException- If a network anomaly is encountered.
-
setURL
public void setURL(String url) throws IllegalStateException, RemoteException Sets the URL of the file.- Specified by:
setURLin interfaceHTMLFileInterface- Parameters:
url- The URL for the file.- Throws:
IllegalStateException- If the entry is read only.RemoteException- If a network anomaly is encountered.
-
getEncoding
public String getEncoding() throws RemoteExceptionReturns the encoding for this file.- Specified by:
getEncodingin interfaceHTMLFileInterface- Returns:
StringThe encoding for this file.- Throws:
RemoteException- If a network anomaly is encountered.
-
setEncoding
public void setEncoding(String encoding) throws IllegalStateException, RemoteException Sets the file encoding.- Specified by:
setEncodingin interfaceHTMLFileInterface- Parameters:
encoding- The encoding of the file.- Throws:
IllegalStateException- If the entry is read only.RemoteException- If a network anomaly is encountered.
-
isReadOnly
public boolean isReadOnly() throws RemoteExceptionReturns true when the entry is read only. Entries are read only if they belong to an existing package that is being retrieved.- Returns:
booleanTrue if read only; otherwise if this is a new entry/package under construction, false is returned.- Throws:
RemoteException- If a network anomaly is encountered.
-
getName
public String getName() throws RemoteExceptionReturns the name of the file.- Specified by:
getNamein interfaceHTMLFileInterface- Returns:
StringThe name of the file.- Throws:
RemoteException- If a network anomaly is encountered.
-
getMIMEType
public String getMIMEType()Returns the MIME type of the file.- Specified by:
getMIMETypein interfaceHTMLFileInterface- Returns:
StringThe MIME type of the file.
-
setMIMEType
public void setMIMEType(String mimeType) throws IllegalStateException, RemoteException Sets the MIME type associated with this file; can be null.- Specified by:
setMIMETypein interfaceHTMLFileInterface- Parameters:
mimeType- The MIME type associated with this file.- Throws:
IllegalStateException- If the entry is read only.RemoteException- If a network anomaly is encountered.
-
getRole
public int getRole() throws RemoteExceptionReturns the role of this file within the HTML entry.- Specified by:
getRolein interfaceHTMLFileInterface- Returns:
intThe role of the file. Supported types includeBODY_COMPANION,FRAME_COMPANION,CONTENTS_COMPANION,PAGE_COMPANIONandMISC_COMPANION.- Throws:
RemoteException- If a network anomaly is encountered.
-
getInputStream
public InputStream getInputStream() throws IOException, RemoteExceptionGets the input stream for this file.- Specified by:
getInputStreamin interfaceHTMLFileInterface- Returns:
- The input stream that can be used for reading the contents of the binary file entry.
- Throws:
IOException- If an error occurs constructing the input stream.RemoteException- If a network anomaly is encountered.
-
getInputStream
public InputStream getInputStream(Object streamID) throws IOException, RemoteException, UnmarshalException Deprecated.UsegetInputStream()which now supports remote input streams.Gets the input stream for this file. Because input streams are not remotable, this method will throw a RemoteException if it is invoked on a remote object. Distributed applications should utilizegetRemoteInputStream(Object)in order to obtain the input stream.- Specified by:
getInputStreamin interfaceHTMLFileInterface- Specified by:
getInputStreamin interfacecom.sas.io.InputStreamProviderInterface- Parameters:
streamID- The stream description should benull; it will be ignored.- Returns:
- The input stream that can be used for reading the contents of the binary file entry.
- Throws:
UnmarshalException- If invoked on a remote object.IOException- If an error occurs constructing the input stream.RemoteException- If a network anomaly is encountered.
-
getRemoteInputStream
public com.sas.io.RemoteInputStreamInterface getRemoteInputStream(Object streamID) throws com.sas.io.ChainedIOException, RemoteException Deprecated.UsegetInputStream()which now supports remote input streams.Get the a remote input stream.- Specified by:
getRemoteInputStreamin interfaceHTMLFileInterface- Specified by:
getRemoteInputStreamin interfacecom.sas.io.InputStreamProviderInterface- Parameters:
streamID- The stream description should benull;it will be ignored.- Returns:
RemoteInputStreamThe file as a remote input stream.- Throws:
com.sas.io.ChainedIOException- If an I/O error occurs obtaining the remote input stream.RemoteException- If a network anomaly is encountered.
-
hasInputStream
public Object hasInputStream() throws UnmarshalException, RemoteExceptionDeprecated.this method no longer needed as getInputStream() will return an input stream that can be used in a remote environmentCheck ifgetInputStream(java.lang.Object)will succeed. SeegetInputStream(java.lang.Object)to determine whether this method should be used.- Specified by:
hasInputStreamin interfaceHTMLFileInterface- Specified by:
hasInputStreamin interfacecom.sas.io.InputStreamProviderInterface- Returns:
Objectnon-null if getInputStream(java.lang.Object) would succeed; throws UnmarshalException if it would fail- Throws:
UnmarshalException- if invoked on a remote obejctRemoteException- if a network anomaly is encountered.IllegalStateException- if this result package has already been closed.
-
consumeStream
public void consumeStream() throws IOException, RemoteException, IllegalStateExceptionConsume 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:
IllegalStateException- If the package containing this entry is already closed.IOException- If an error occurs constructing the input stream.RemoteException- If a network anomaly is encountered.
-
getEntityKey
public String getEntityKey() throws IllegalStateException, RemoteExceptionGet the unique identifier of this result package or entry.- Specified by:
getEntityKeyin interfacecom.sas.entities.EntityKeyInterface- Returns:
StringThe unique identifier.- Throws:
RemoteException- If a network anomaly is encountered.IllegalStateException
-
sameEntity
public boolean sameEntity(com.sas.entities.EntityKeyInterface entity) throws RemoteException - Specified by:
sameEntityin interfacecom.sas.entities.EntityKeyInterface- Throws:
RemoteException
-
setEntityKey
public void setEntityKey(String entityKey) throws RemoteException, IllegalStateException Set the unique entity key. The entity key for the result package or entry cannot be changed. This method will throw an IllegalStateException.- Specified by:
setEntityKeyin interfacecom.sas.entities.EntityKeyInterface- Parameters:
entityKey- Unique entity key.- Throws:
IllegalStateException- The unique entity key for a result package or entry cannot be changed.RemoteException
-
closeEntry
protected void closeEntry()Remove any temporary files needed for inputstream re-use. -
finalize
protected void finalize() throws ThrowableAt finalize time, cleanup temporary files if necessary.- Overrides:
finalizein classObject- Throws:
Throwable
-
getInputStream()which now supports remote input streams.