|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.gestalt.scribe.Connector
Connector class provides the API to the Scribe server. With the help of Connector an application can request generation of a report from the server, and either display the report in its own graphical interface, or save it in a file.
Connector's constructor logs the calling application in the server, turning it into a client. Once the connection to the server is established, the client can use the methods of Connector instance to request execution of reports. The client application can display the report in a window automatically created by Connector, or use ReportPrintView class to place the report in a custom-made AWT Container. Alternatively, the client application can use getReportAsPDF method to receive a byte array that represents the report in PDF format, or getReportAsHTML methods to receive an HTMLData object with the HTML-formatted report. The following code sample shows how the application can use Connector to create reports:
import java.io.*; import com.gestalt.scribe.*;
public class Controller implements DrillDownReportListener { public static void main(String args[]) { new Controller(); } public Controller() { try // The Scribe server runs on host 192.168.1.12, listening on port 6541 { // The calling app logs in as user "heidi", with password "hello" Connector conn = new Connector("192.168.1.12", 6541, "heidi", "hello"); String reportName = "Customer"; Vector parameterList = conn.getReportParameters(reportName); ParameterPacket packet = (ParameterPacket) parameterList.elementAt(0); packet.setValue("VINET"); byte[] data = conn.getReportAsPDF(reportName, parameterList); try // Save the report in a file { String fileName = "C:\\temp\\Customer.pdf"; FileOutputStream f = new FileOutputStream(fileName); f.write(data); f.flush(); f.close(); } catch (IOException e) { System.out.println(e); } } catch (ServerConnectionException e) { System.out.println(e); } } }
- See Also:
DrillDownReportListener
| Constructor Summary | |
Connector(java.lang.String serverIPAddress,
int serverPort,
java.lang.String userName,
java.lang.String password)
Returns a Connector object. |
|
| Method Summary | |
void |
disconnect()
Logs the client application off the Scribe server and breaks the connection. |
void |
displayReport(java.lang.String reportName,
java.util.Vector parameters)
Displays the report in a new window. |
void |
displayReport(java.lang.String reportName,
java.util.Vector parameters,
java.awt.Image img)
Displays the report in a new window. |
java.util.Vector |
getReport(java.lang.String reportName,
java.util.Vector parameters)
Returns a Vector of objects that can be forwarded to ReportPanel object for display. |
HTMLData |
getReportAsHTML(java.lang.String reportName,
java.util.Vector parameters) Returns an HTMLData object carrying the HTML-formatted report. |
HTMLData |
getReportAsHTML(java.lang.String reportName,
java.util.Vector parameters, String imageDir)
Returns an HTMLData object carrying the HTML-formatted report with images |
byte[] |
getReportAsPDF(java.lang.String reportName,
java.util.Vector parameters)
Returns a byte array representing the PDF-formatted report. |
java.util.Vector |
getReportParameters(java.lang.String reportName)
Returns a Vector of Parameter objects that describe the report input parameters. |
void |
setCompression(boolean compress)
Sets a compression option at the server side. |
void |
setDelegate(DrillDownReportListener delegate)
Sets a reference to a DrillDownReportListener object that will be called by Connector if a drill-down field is clicked on in the report. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Connector(java.lang.String serverIPAddress,
int serverPort,
java.lang.String userName,
java.lang.String password)
throws ServerConnectionException
serverIPAddress - Scribe server IP addressserverPort - Scribe server portuserName - Login ID of the user that is entitled to connect to Scribe serverpassword - User login password in clear text
ServerConnectionException - if the connection cannot be established| Method Detail |
public void setCompression(boolean compress)
throws java.rmi.RemoteException
compress - true to turn the compression on, false otherwise
java.rmi.RemoteException - if the server could not be contactedpublic void setDelegate(DrillDownReportListener delegate)
delegate - an object that implements DrillDownReportListener interfaceDrillDownReportListener
public java.util.Vector getReportParameters(java.lang.String reportName)
throws java.rmi.RemoteException
reportName - name of the report. If the report name is hierarchical, then the full name
with all qualifiers and slash (/) separators must be specified.
java.rmi.RemoteException - if the server could not be contactedgetReport(), getReportAsPDF(), getReportAsHTML() and displayReport()
public java.util.Vector getReport(java.lang.String reportName,
java.util.Vector parameters)
throws java.rmi.RemoteException
reportName - name of the report. If the report name is hierarchical, then the full name
with all qualifiers and slash (/) separators must be specified.parameters - a Vector of Parameter objects as returned by getReportParameters
method, with values of Parameter objects set by the client application according to the requirements
of the report
java.rmi.RemoteException - if the server could not be contactedgetReportParameters()
public byte[] getReportAsPDF(java.lang.String reportName,
java.util.Vector parameters)
throws java.rmi.RemoteException
reportName - name of the report. If the report name is hierarchical, then the full name
with all qualifiers and slash (/) separators must be specified.parameters - a Vector of Parameter objects as returned by getReportParameters
method, with values of Parameter objects set by the client application according to the requirements
of the report.
java.rmi.RemoteException - if the server could not be contactedgetReportParameters()
public HTMLData getReportAsHTML(java.lang.String reportName,
java.util.Vector parameters)
throws java.rmi.RemoteException
reportName - name of the report. If the report name is hierarchical, then the full name
with all qualifiers and slash (/) separators must be specified.parameters - a Vector of Parameter objects as returned by getReportParameters
method, with values of Parameter objects set by the client application according to the requirements
of the report.
java.rmi.RemoteException - if the server could not be contactedgetReportParameters()
public HTMLData getReportAsHTML(java.lang.String reportName,
java.util.Vector parameters,
java.lang.String imageDir)
throws java.rmi.RemoteException
imageDir parameter.
reportName - name of the report. If the report name
is hierarchical, then the full name with all qualifiers and slash (/)
separators must be specified.
parameters - a Vector of Parameter objects as returned
by getReportParameters method, with values of Parameter objects
set by the client application according to the requirements of the
report.
imageDir - location of the images embedded in the HTML
code as "imageDir"/imgN. The images are located in "imageDir" relative
to the location of the saved HTML file.
java.rmi.RemoteException - if the server could not be
contacted
getReportParameters(java.lang.String)
public void displayReport(java.lang.String reportName,
java.util.Vector parameters)
throws java.rmi.RemoteException
reportName - name of the report. If the report name is hierarchical, then the full name
with all qualifiers and slash (/) separators must be specified.parameters - a Vector of Parameter objects as returned by getReportParameters
method, with values of Parameter objects set by the client application according to the requirements
of the report.
java.rmi.RemoteException - if the server could not be contactedgetReportParameters()
public void displayReport(java.lang.String reportName,
java.util.Vector parameters,
java.awt.Image img)
throws java.rmi.RemoteException
reportName - name of the report. If the report name is hierarchical, then the full name
with all qualifiers and slash (/) separators must be specified.parameters - a Vector of Parameter objects as returned by getReportParameters
method, with values of Parameter objects set by the client application according to the requirements
of the report.
img - image to be displayed in the window's title bar.
java.rmi.RemoteException - if the server could not be contactedgetReportParameters()
public void disconnect()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||