cmp-field - School of Computing and Engineering

Download Report

Transcript cmp-field - School of Computing and Engineering

Chemical Toxicity and Safety
Information System
Shuanghui Luo
Ying Li
Jin Xu
Outline
 Introduction
 Goals and system functionalities
 Technologies and tools
 System architecture
 Reference
 Acknowledgement
 Implementation Demo
Cheminfomatics
Cheminformatics is an exciting and rapidly developing
field, and focuses on solving problems arising from
chemistry using methodology from computer science.
The practice not only to leverage the accumulated knowledge in
various forms but also to derive new understanding based on
the available knowledge using information technologies and
tools.
Introduction
Significance:
ChemInformatics system is a useful tool for different users
such as scientists, students and so on to raise the awareness
of chemical hazards & to improve chemical safety management.
 To show the selected chemical toxicity, risky and safety
information.
 To compare the toxicity data, risky and safety phrases with
the analogue chemicals.
 To indicate the risky phrases and safety guidelines, for
example, some chemicals are high toxic and need to keep away
from human being and living entities.
Goals
 Establish a distributed
chemical toxicity and safety
information service system
using a multi-tier
architecture
 Follow the process of
software development
 Learn and apply middleware
technologies (EJB and XML)
 Understand component
based programming
approach
Browser
Client Tier
Representation
Tier
Servlet
Business
Tier
EJB
Integration
Tier
JDBC
Resource Tier
DataBase
System Functionalities
 online search application
 presents users chemical toxicity, risky, and safety
information and services
 manages user logins for security
 processes the queried data and does some analysis and
returns the corresponding data table and view in graph.
Technology and Tools (1/3)
Browser
HTML
EIS
resources
Web
container
Servlets
EJB
container
Enterprise Beans,
JDBC (or connectors)
RMI, SQL
Technology and Tools (2/3)
EJB ( Enterprise Java Beans)
 Server-side architecture for distributed, transactional components.
 Framework for easily creating business objects.(e.g. transaction,
naming, persistence services)
 Relive developers from managing
•
•
•
•
Low-level transaction and state management
Multithreading and resource pooling
Security
Persistence and other complex APIs.
 Provide standard Java component architecture.
•
•
•
Allow combining components developed using different tools.
Compatible with existing server platforms, existing Java APIs and CORBA.
Write once, and run anywhere.
Technology and Tools (3/3)
•Java: programming language
•Servlet: web presentation
•XML: used to write deployment descriptor
•JDBC-ODBC: connection to DB
•MS-Access: DB
•Jboss-Jetty
•Ant - Build Tool
System architecture
Tier 1
Tier 2
Tier 3
EJB container
UserDBBean
(Entity Bean)
ChemDBBean
Entity Bean
AdminBean
Sesssion Bean
Web
Browser
SafeDBBean
Entity Bean
RiskDBBean
Entity Bean
Database
LoginBean
Sesssion Bean
Servlet
Web container
QueryBean
Sesssion Bean
EJB Beans
Four Entity Beans
• UserDBBean: store user information for user management.
• ChemDBBean: store chemical toxicity, and chemical properties.
• RiskDBBean: store chemical information about risky phrases.
• SafeDBBean: store chemical information about safety phrases
Three Session Beans
• LoginBean: handle user verification (uses UserDBBean check
the user ID and password)
• AdminBean: for administrator to manage user accounts
• QueryBean: handle client request retrieve chemical information
Servlets
 LoginServlet: User verification.
 FormulaServlet: Query by chemical formula.
 QueryServlet: Query for chemical information including
toxicity, risky and safety phrases.
 Compareservlet: Compare chemical information by
category.
File structure (1)
Root=/cheminfo
Ant Project scripts:= /build
chem
risk
safe
user
Package com.cheminfo:
=/com/cheminfo
query login admin servlet html
File structure (2)
Container-managed
Persistence(CMP)
Container automatically manages
persistence. (Developer does not write
database calls.)
The CMP-field element describe a
container managed field. The field
element includes an optional description
of the field, and the name of the field.
Container-managed
Persistence(CMP) cont’d
 Since the container is accessing the database on
behalf of the bean, the container need to know:
a) the fields that are to be persisted by the container
b) the type of persistence, connection to database
c) the table name, the mapping between table columns
d) field names in the beans
e) the semantics of the finder methods and so on.
 This information is specified in the deployment
descriptors: ejb-jar.xml; jboss-web.xml, web.xml,
jaws.xml
ejb-jar.xml
This file tells the EJB server which
classes make up bean implementation,
the home interface and the remote
interface. Also called deployment
descriptor.
ejb-jar.xml example
<?xml version="1.0" ?>
<!DOCTYPE ejb-jar (View Source for full doctype...)>
- <ejb-jar> <display-name>Chemical Toxicity and Safety</display-name>
- <enterprise-beans>
- <entity>
<description>User database</description>
<ejb-name>UserDBBean</ejbname>
<home>com.cheminfo.user.UserDBHome</home>
<remote>com.cheminfo.user.UserDB</remote>
<ejb-class>com.cheminfo.user.UserDBBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-keyclass>
<reentrant>False</reentrant>
-<cmp-field> <field-name>UserName</field-name> </cmp-field>
- <cmp-field> <field-name>PassWord</field-name> </cmp-field>
- <cmp-field> <field-name>Email</field-name> </cmp-field>
-<cmp-field> <field-name>Address</field-name> </cmp-field>
-<primkey-field>UserName</primkey-field>
</entity>
jboss-web.xml file
Specify servlets & beans about their setup to
deploy the web application.
Example:
A servlet wants to call methods on a bean B
B bean = home.create(pk);
the servlet must declare a reference to the ejb in
its deployment descriptor.
This is done by an <ejb-ref> tag in the web.xml file.
jboss-web.xml example
<?xml version="1.0" encoding="UTF-8" ?>
- <jboss-web>
- <ejb-ref>
<ejb-ref-name>ejb/Admin</ejb-ref-name>
<jndi-name>cheminfo/Admin</jndi-name>
</ejb-ref>
- <ejb-ref>
<ejb-ref-name>ejb/Login</ejb-ref-name>
<jndi-name>cheminfo/Login</jndi-name>
</ejb-ref>
- <ejb-ref>
<ejb-ref-name>ejb/Query</ejb-ref-name>
<jndi-name>cheminfo/Query</jndi-name>
</ejb-ref>
- <ejb-ref>
<ejb-ref-name>ejb/ChemDB</ejb-ref-name>
<jndi-name>cheminfo/ChemDB</jndi-name>
</ejb-ref>
- <ejb-ref>
<ejb-ref-name>ejb/RiskDB</ejb-ref-name>
<jndi-name>cheminfo/RiskDB</jndi-name>
</ejb-ref>
- <ejb-ref>
<ejb-ref-name>ejb/SafeDB</ejb-ref-name>
<jndi-name>cheminfo/SafeDB</jndi-name>
</ejb-ref>
</jboss-web>
jaws.xml file
JAWS is the mapper used by JBoss to manage
CMP entity beans.
 Specify a datasource and the type-mappings to
use with it
 Set a bunch of options concerning jaws behavior
 Specify how JAWS should build/use your tables
 Define finders to access you entity beans
 Define a type mapping
jaws.xml example
<jaws>
<datasource>ChemInfoDB</datasource>
<type-mapping>MS SQLSERVER</type-mapping>
<enterprise-beans>
<entity>
<ejb-name>UserDBBean</ejb-name>
<table-name>user</table-name>
<create-table>false</create-table>
<cmp-field><field-name>UserName</field-name>
<column-name>UserName</column-name></cmp-field>
<cmp-field><field-name>PassWord</field-name><columnname>PassWord</column-name></cmp-field>
<cmp-field><field-name>Email</field-name><columnname>Email</column-name></cmp-field>
<cmp-field><field-name>Address</field-name><columnname>Address</column-name></cmp-field>
</entity>name>
<create-table>false</create-table>
<cmp-field> <field-name>UserName</field-name>
<column-name>UserName</column-name> </cmp-field>
……..
EJB security
 Integrate application security into the
EJB.(authentication, access control, portability, ease
of use).
 Allow security policies to be set by the application
deployer rather than hard-coded at development
time.
 Work with existing security system.
 Fit into the overall J2EE environment.
Person, Work and Time
Person
Work
Time
Shuanghui
Luo
In charge of system architecture and
deployment, EJB entity and session
beans, package the source files, and
documentation
200 hours
Ying Li
Focus on EJB entity beans and
database setup and connection, and
documentation
200 hours
Jin Xu
Focus on web server including web
page interfaces and servlets and
system deployment, and
documentation
200 hours
Reference
http://www.genomicglossaries.com/cheminformatics_gloss.asp “Genomics Glossaries &
Taxonomies”
2. http://www.borland.com/visibroker/papers/ejb/ “Enterprise JavaBeans Simplifying
Development of Distributed Multi-tier Applications”
3.
http://macedonia.nrcps.ariadne-t.gr/ “The Information retrieval in chemistry- www server”
4.
http://tis.eh.doe.gov/web/chem_safety/Roadmap.html “Chemical Safety Requirements
Roadmap”
5.
Budde, T., Haude, M., Hopp.H.W., Keber, S., Caspari, G., Fabbender, G., Fingerhut, M.,
Novopashenny, I., Berithardt, G., Erbel, R., Erdmann, E., and Wischnewsky, M.B., “A
prognostic computer model to predict individual outcome in interventional cardiology”. Eur.
Heart J. 18: 1611-9, 1997
6.
Roman, E., Oberg, R., The Business Benefits of EJB and J2EE Technologies over COM+and
Windows DNA. 1999
7.
Zona research, Inc. Enterprise JavaBeansTM Technology. 1999
8.
Ennerich, W. Engineering Distributed Objects. John Wiley & Sons, Ltd. 15-20, 2000
9.
Will Howerry, Enterprise Application Development Using UML, Java Technology and XML,
JavaOne, Sun’s 2000 Worldwide Java Developer Conference, San Francisco
10. http://www.jboss.org
1.
Acknowledgement
Thank you!!
Implementation Demo
This Demo is available at:
Server:
http://kc-sice460-15:8080/cheminfo/
register as a new user
i.e. Username: xu password: 123
Formula: C2H6O, C7H8, C3H3O, etc