10.3. Interaction with EspressManager

EspressChart is generally used in conjunction with EspressManager. The chart component connects to EspressManager in order to read and write files, to access databases, and to perform data pre-processing required for certain advanced features (such as aggregation). However, the chart component can also be used in a stand-alone mode, in which it performs file I/O and database access directly, without the use of EspressManager.

Both approaches have their own advantages. If the chart is contained within an applet, security restrictions prevent it from directly performing file input/output. Database access is also difficult without the presence of a JDBC driver on the client. In such cases, EspressManager provides the above services to the chart. On the other hand, if the chart is used in an application, there are no such restrictions, and performance can be improved by direct access. The application can be run without the necessity of having EspressManager running at a well-known location.

For instance, the JNLP(More about Applets in JNLP: Section 2.6 - Run Applets As JNLP) or application may be running on machine Client and may require data from a database on machine DbMachine. However, the machine DbMachine may be behind a firewall or a direct connection and may not be allowed to machine DbMachine from machine Client due to security restrictions. EspressManager can be run on machine Server and the JNLP(More about Applets in JNLP: Section 2.6 - Run Applets As JNLP)/application can connect to EspressManager on the machine Server. JDBC can then be used to connect to machine DbMachine from machine Server and get the data. The data is then delivered to machine Client and the chart is generated. This is useful when you want to keep the data secure and non-accessible from your client machines and make all connections come through a server machine (a machine running EspressManager). You can also utilize this option to keep a log of all the clients accessing the data through EspressChart (you can have a log file created when starting EspressManager. The log file is called espressmanager.log ). Note that this functionality comes at a cost. You will face a slight performance overhead because your code is connecting to the data through EspressManager (i.e., another layer has been added).

By default, a chart component requires the presence of EspressManager. To change the mode, use the QbChart class static method at the beginning of your JNLP(More about Applets in JNLP: Section 2.6 - Run Applets As JNLP)/application (before any QbChart objects are created):

static public void setEspressManagerUsed(boolean b)

Both applications and JNLP(More about Applets in JNLP: Section 2.6 - Run Applets As JNLP) can be run with or without accessing EspressManager. Communication is done by using http protocol. The location of the server is determined by an IP address and port number passed in the API code. Below are instructions on how to connect to the EspressManager: