170 likes | 346 Views
Ch 2 – Application Assembly and Deployment. COSC 617 Jeff Schmitt September 14, 2006. Assembly. Assembly of an application or component is the process of collecting all of the elements required (source code, datafiles, configuration files) into a structured format that can be
E N D
Ch 2 – Application Assembly and Deployment COSC 617 Jeff Schmitt September 14, 2006
Assembly Assembly of an application or component is the process of • collecting all of the elements required (source code, datafiles, configuration files) into a • structured format that can be • deployed to the server environment.
Deployment Deployment of a component or application is the process of • actually installing the runnable codethe runtime environment, which involves • making the code available to the server and • resolving resource references in the assembly with the resources actually on the server
Application Components J2EE supports various types of application components • Java Servlet API • JavaServer Pages API • JavaServer Faces API • Enterprise Java Beans API • Configuration Files – configure components and external resources needed • Deployment Descriptors – a configuration file for the application itself
J2EE Terminology Component – • a functional element of an application that runs within a container and makes use of runtime resources provided by the container (such as security mgmt, transation mgmt, etc) • One or more Java classes plus component-specific resources (properties, files, images) • 5 flavors: application clients, applets, web, EJB resource adapters
J2EE Terminology - 2 Module • Collections of components of the same type, to be run inside the corresponding container type • Contains component-specific classes plus any class libraries needed, and other cross-component resources such as datafiles, HTML documents and image files • Contains a standard XML deployment descriptor for external resource references and configuration details
Enterprise Application Archive • .ear file • A set of one or more modules, collectively containing all components of the app. • These modules contain • all of the components of the application • a deployment descriptor • Packaged into .jar files (java archive) • A particular layout
Assembling Applications • Getting all the application modules together in the right package structure • Deployment descriptor: application.xml – references all the modules which make up an application • Modules can be • EJB in an ejb-jar file • Web modules in a war file
JNDI Configuration Services • Assets are located at runtime using JNDI lookups in the namespace of the application server • Examples: • JMS message queues • JCA resource adapters • DataSource for MySql or Oracle database • Other J2EE components
JNDI Naming Conventions • Runtime assets are given names within the java:comp/env namespace in the JNDI service java:comp – J2EE components /env – component runtime environment • Coordination required among component code, deployment descriptors, application server • Example: java:comp/dev/jdbc/myDS • Referenced in source code • Configured in deployment descriptor • Actual asset is available in Container
Two-level Name Resolution • Assign an independent name when configuring within application server • Link this asset name to the name specified in the component deployment descriptor • Benefits • Allows flexibility • Allows sharing assets among components running on same server
Deploying Applications • After application assembly comes application deployment • Application server has an internal JNDI directory • Resource and component references are linked through JNDI • Classloading model – more than one JVM • Assign a separate classloader to each deployed application • Physical deployment – vendor specific details in special configuration files
Component Modules Component deployment descriptors specify • Module descriptive information, eg. name • Component elements (EJB web or resource connector) • Configuration data for component services (security services, lifecycle services, persistence services) • Resource and component dependencies (JDBC DataSources, JavaMail Sessions, session EJB, entity EJB)
Example • EJB Module descriptor • Component elements, configuration, resource component external resources needed • Web module descriptor • Servlet mapping – how to recognize certain file names, which refer to servlet instead of file. Example: *.do /viewprofile • Session timeouts • Resource declarations to be resolved by the applic server. Example: EJB’s
Application Assemblies • Application archive is just a .jar file with files stored in specific locations • Categories of information • Application descriptive information (name) • Module references – location of module .jar file in the application archive • Application security roles- control specific user’s access to components and their operations
Steps in Deploying J2EE Applications • Adjust deployment descriptors • Local environmental issues, default settings, maximum number of items, etc. • Perform server-specific configuration • Physical configuration of runtime assets not specified in J2EE since application servers implement services in many ways • Configure required assets in application server • Module deployment descriptor links to assets in app server
Deploying J2EE Apps (cont.) • Generate container-specific classes • Contaner-specific classes not specified in J2EE specification • Each server provides its own tools or processes for generating these classes • JBoss automatically generates EJB interface implementations • WebLogic povides command-line tool for generating container-specific classes