|
The Resources tool is used to add resources in the chosen development server. These resources are used by EJB components to obtain connections. Four types of resources can be added to the Container
The master list of resources for the active Desk can be viewed in the Resources panel, where they are listed sorted by their type and JNDI names. Clicking on any resource moves the tabbed pane to the appropriate type of resource and show relevant details.
This chapter describes how to test, add, modify, and delete the four types of resources that Studio recognizes.
The Resources tool can be started using the Tools > Resources from the main menu. This brings up the Resources tool where the resources can be added. The resources defined are applicable per Desk.
To add resources, select the type by clicking on the specific tab and then fill in the details.
The first tab called Data Source is used to add both Data and XA Data resources.
XA is an X/Open protocol. It allows two-phase commit in transactions and forms a part of the JDBC 2.0 Standard Extension. Database vendors are now beginning to provide XA drivers.
These resources are both identified by their unique "data resource name". Fill the following information in this tab:
JNDI Name The Data resource name is mandatory and is used as a reference for getting all the information about the resources.
Driver This information is mandatory and is used to access the database. Select the drivers from the available list in the combo box. To add a new driver click on the button adjacent to the combo box. This brings up the Configure Drivers dialog, where new drivers can be added. Refer the subsequent sections for detailed information on configuring database drivers.
For XA Data resources, the database vendor provides the class and the class implements javax.sql.XADataSource interface. JDBC drivers which support distributed transactions must implement these interfaces.
URL This field is enabled when the driver is a non XA driver and is mandatory. It refers to the location of the database. If the database is Cloudscape, choose URL as jdbc:rmi:jdbc:cloudscape:samples/sample_db.
Description The description is given at the time of creation of the resource. However, this is optional. If no description is given, the label "No Description" is stored as the description.
DB Authorization Provides the authentication to get connected to the database. Either the Application or the Container can provide the information.
User Name and Password Enter the user name that allows the user to connect to the database. Enter the password required to authenticate the user name.
XA Datasource Properties This field is enabled when the type chosen is XA Data Resource. There are nine standard properties to choose from for every XA data resource. These are available in a dropdown combo box. Once a property is selected, its Java Type is set in the third column. This cannot be modified. The username and password are two properties that must be provided if the author is marked as CONTAINER.
Certain vendor specific properties may also need to be specified. These must be entered in the 'Property' column and a suitable Java type for that property must be selected from the available options.
To know about the OracleDataSource class that provides a set of properties that can be used to specify a database to connect to, visit the following URL http://technet.oracle.com/doc/oracle8i_816/java.816/a81354/connpoc1.htm. These properties follow the JavaBeans design pattern.
Once the information is all provided, the Test button connects you to the database and displays the result in the Status column.
Use the Add button to add the resource to the Container. Supply the data resource name, URL, and database driver name fields for a new data resource. Some URL patterns are included in the combo boxes for quick reference.
Supply the XA Data resource name, class, properties, and author fields for a new XA Data resource. Some standard properties are included in the combo boxes for quick reference.
Select the resource from the Resources panel and click on the Delete button. This deletes the resource from the Container.
The URL, database driver name, user name, password, and pool size can be modified for an existing data resource. The class, author, properties, and pool size can be modified for an existing XA Data resource.
The tool manages the necessary validations. Do not create an occurrence of a driver and register it with the Driver Manager. The Resources tool does it while defining the data resource.
To configure database drivers in Studio, click on Tools > Configure JDBC Driver from the main menu, or from the Data Source tab in the Resource Too, Panel. This brings up the Configure Drivers panel. Resources can be added, modified, and deleted in this panel. To modify an existing driver, click on Modify button, and then make the required changes in the Modify Driver panel that comes up.
To add a new driver, click on Add and enter the following information:
Driver Name Enter a name by which the driver will be referred. The name must be unique among all the drivers in Studio.
Classpath Add a set of the JARs or zip files required by the driver, by clicking on the + button. To delete the JAR, use the - button. Sort the classes using the up and down arrow buttons.
Driver Class Name Adding JARs in the classpath field, auto populates the driver class names in this field. Select the fully qualified driver class name from the list in the combo box. For example, com.cloudscape.core.RmiJdbcDriver. The list also mentions whether the driver is XA or non XA.
Click OK to add the new driver to the list. All the drivers configured get added to the server's classpath when the server is started. Therefore, the user does not need to add the driver JARs to the server classpath specifically.
When a server is started, all the valid resources in the current desk will automatically be added to that server.
Resources can be added, deleted or modified only on the currently running server. This information is persisted in the resource.xml file, only when the operation succeeds. These operation are performed on all other running servers too.
Any invalid driver or invalid resource will be shown in red after adding it to the Resource Tool. A driver is marked invalid when any or all of its files (JAR or directory) provided in path list are missing from the file system. A resource will be marked invalid if the driver is invalid or the connection to that resource is failing (example, when the data base driver is down).
Every time a Desk is opened, it checks for the validity of the resources in the Desk. When an invalid resource is found, the user is informed about it.
When the current server is running, then resources can be imported from that server using the Import button in Resource Tool. If some of the required details of the imported resources are not available, the resource still gets added but is marked invalid. The user in such a case, has to provide these details in the Resource Tool. The Import button is enabled only when the current server is running.
Mail is used to send mails from the code using the mail session object. It holds information on:
JNDI Name The Mail name is mandatory and is used as a reference for getting all the information about the resources.
Host Provides the IP address of where the host is located.
From ID The E-mail id of where the mail needs to be sent and tested is written here. The E-mail ID needs to be of the sender as only then can it be tested.
User Name and Password Enter the user name that allows the user to connect to the database. Enter the password required to authenticate the user name.
There is no Resource Pool Information for mail resources, because they are not pooled. When Test or Add is clicked to add a new mail resource, the console sends out a test mail from From ID to From ID using the user name and password for authentication. If a mail is sent successfully, an appropriate message is displayed. (If the test was performed as a part of the add operation, the resource is added automatically).
FROM ID is required only for testing purposes.
Supply the JNDI Name, Host, user name and password for a new mail to be sent.
Deletes the mail created.
The JNDI Name and the Host Name can be modified for an existing Mail source.
Once the information is all provided, the Test button connects you to the database, sends the mail and displays the result in the Status column.
For testing whether the mail reaches or not, From ID section needs to be of the sender's as only then can it be tested whether it reaches or not.
JMS provides a common way for Java programs to create, send, receive, and read an enterprise messaging system's messages. A JMS application is made up of a set of application-defined messages and a set of clients that exchange them.
Pramati JMS Server is in-built with Studio to test deploy JMS applications and message driven beans. The JMS Server is started by default with the in-built Pramati Server.
Click the JMS tab and fill in the following information to add the JMS resources to be used by the JMS applications:
JNDI Name The JNDI Name entered here is the name of the resource in the JMS server's name space. The JMS resources are bound in the naming service with the JNDI name. This field is mandatory and is used as a reference for getting complete information about the resources.
Type There are six types of JMS resources to be selected from the combo box. The six types are Queue, Topic, QueueConnectionFactory, TopicConnectionFactory, XAQueueConnectionFactory, and XATopicConnectionFactorySelect. This field describe the type of message to be sent and received in this field.
Description The description is given at the time of creation of the resource. However, this is optional. If no description is given, the label "No Description" is stored as the description.
Provide the JNDI Name, Connection factory, destination, and type for sending and receiving messages, and then click Add. This adds the JMS resource to the message server JMS Resources are stored per Desk in the resource.xml file, and are added to the JMS Server after it starts. If the JMS Server has already been started, it is added immediately.
The JMS Server can be started in Studio only if the in-built Pramati Server is started with Start JMS option. This can be configured in the Server Configure dialog, which can be brought up using Tools > Server Config from the main menu.
Click on the Delete button to delete the resource created.
| Pramati Technologies © Copyright |
|