Содержание
-
Java Enterprise Edition
Владимир Сергеевич Бегларян http://www.reksoft.com http://www.oracle.com/technetwork/java/javaee
-
Пример готовогопростого приложения как старт для работы на Java EE.
https://netbeans.org/kb/docs/javaee/javaee-entapp-ejb_ru.html Веб-уровень. Веб-уровень содержит логику представления приложения и запускается на сервере Java EE. В приложении NewsApp веб-уровень представлен веб-модулем и содержит сервлеты, через которые осуществляется доступ к бизнес-логике в модуле EJB. Бизнес-уровень. Приложения бизнес-уровня также выполняются на сервереJava EE и содержат бизнес-логику приложения. В приложении NewsApp бизнес-уровень представлен модулем EJB. Модуль EJB содержит код для обработки запросов от клиентов веб-уровня и для управления транзакциями и способами сохранения объектов в базе данных. EIS-уровень. EIS-уровень - это надежный уровень хранения приложения. В приложении NewsApp этот уровень представлен базой данных для сохранения сообщений.
-
-
Зачем нужна Java EE?
Бизнес - логика Безопасность Производительность масштабируемость Поддержка Web БД, транзакции, синхронизация Интеграция с другими сервисами Скорость разработки и развития Поддержка развёртывания, конфигурирования, мониторинга
-
Java Platform, Enterprise Edition
Java Platform, Enterprise Edition or Java EE is Oracle's enterprise Java computing platform. The platform provides an API and runtime environment for developing and running enterprise software, including network and web services, and other large-scale, multi-tiered, scalable, reliable, and secure network applications. Java EE extends the Java Platform, Standard Edition (Java SE),providing an API for object-relational mapping, distributed and multi-tier architectures, and web services. The platform incorporates a design based largely on modular components running on an application server. Software for Java EE is primarily developed in the Java programming language. The platform emphasizes convention over configuration and annotations for configuration.
-
Декларативность: annotation
import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public class Address implements Serializable { @Id protected long id; String street1; String street2; String city; String province; … }
-
Декларативность: configuration
package logic;import java.util.Set;import java.util.HashSet;public class Bus { private Long id;private String number;public Bus() { } public void setId(Long id) {this.id = id;} public void setNumber(String number) {this.number= number;}public Long getId() {return id;}public String getNumber() {return number;}}
-
-
Декларативность: dependency injection
http://www.ashep.org/2013/chto-takoe-dependency-injection/ public interface IOnlineBrokerageService{ String[] getStockSymbols(); double getAskingPrice(String stockSymbol); double getOfferPrice(String stockSymbol); void putBuyOrder(String stockSymbol, int shares, double bidPrice); void putSellOrder(String stockSymbol, int shares, double offerPrice); } public interface IStockAnalysisService{ double getEstimatedValue(String stockSymbol); } public interface IAutomatedStockTrader{ void executeTrades(); }
-
public class VerySimpleStockTraderImpl implements IAutomatedStockTrader{ private IStockAnalysisServiceanalysisService = new StockAnalysisServiceImpl(); private IOnlineBrokerageServicebrokerageService = new NewYorkStockExchangeBrokerageServiceImpl(); public void executeTrades() { … } } public class MyApplication{ public static void main(String[] args) { IAutomatedStockTraderstockTrader = new VerySimpleStockTraderImpl(); stockTrader.executeTrades(); } }
-
VerySimpleStockTraderImpl StockAnalysisServiceImpl NewYorkStockExchangeBrokerageServiceImpl -
public class VerySimpleStockTraderImpl implements IAutomatedStockTrader{ private IStockAnalysisServiceanalysisService; private IOnlineBrokerageServicebrokerageService; public VerySimpleStockTraderImpl( IStockAnalysisServiceanalysisService, IOnlineBrokerageServicebrokerageService) { this.analysisService= analysisService; this.brokerageService= brokerageService; } public void executeTrades() { … } } public class MyApplication{ public static void main(String[] args) { IAutomatedStockTraderstockTrader = (IAutomatedStockTrader) DependencyManager.create(IAutomatedStockTrader.class); stockTrader.executeTrades(); } }
-
Многоуровневая архитектура приложений (Multitiered Applications)
-
Основные компоненты в архитектуре JEE приложения
-
JEE Server и контейнеры (containers)
-
Container сервис
■ The Java EE security model lets you configure a web component or enterprise bean so thatsystem resources are accessed only by authorized users. ■ The Java EE transaction model lets you specify relationships among methods that make up asingle transaction so that all methods in one transaction are treated as a single unit. ■ JNDI lookup services provide a unified interface to multiple naming and directory servicesin the enterprise so that application components can access these services. ■ The Java EE remote connectivity model manages low-level communications between clientsand enterprise beans. After an enterprise bean is created, a client invokes methods on it as ifit were in the same virtual machine.
-
Java App Server, сертифицированные для Java EE 6
GlassFish server Open Source Edition Oracle GlassFish Server Oracle WebLogic Server JBoss Application Server Joss Enterprise Application Platform OW2 JOnAS IBM WebSphereApplication Server IBM WebSphereApplication Server Community Edition Apache Geronimo Fujitsu Interstage Application Server[16] TmaxSoft JEUS
-
Структура EAR файла
-
Типы Java EE модулей
■ EJB modules, which contain class files for enterprise beans and, optionally, an EJBdeployment descriptor. EJB modules are packaged as JAR files with a .jar extension. ■ Web modules, which contain servlet class files, web files, supporting class files, image and HTML files, and, optionally, a web application deployment descriptor. Web modules are packaged as JAR files with a .war (web archive) extension. ■ Application client modules, which contain class files and, optionally, an application client deployment descriptor. Application client modules are packaged as JAR files with a .jar extension. ■ Resource adapter modules, which contain all Java interfaces, classes, native libraries, and, optionally, a resource adapter deployment descriptor. Together, these implement the Connector architecture for a particular EIS. Resource adapter modules are packaged as JAR files with an .rar (resource adapter archive) extension.
-
Java EE API для Web Container
-
Java EE API для EJB Container
-
Java EE API для Application Client Container
-
Основные Java EE интерфейсы
JavaServer Faces Servlet, включая JavaServer Pages contexts and Dependency Injection Enterprise JavaBean Java Persistence Java Transaction (X/Open XA) Java Message Service Java Connector Architecture (лучше ESB)
-
Web Tier
A web application is a dynamic extension of a web or application server. Web applications are of the following types: ■ Presentation-oriented: A presentation-oriented web application generates interactive web pages containing various types of markup language (HTML, XHTML, XML, and so on) and dynamic content in response to requests. ■ Service-oriented: A service-oriented web application implements the endpoint of a web service. Presentation-oriented applications are often clients of service-oriented web applications.
-
Обработка HTTP запросов
Web components: Java servlets, web pages implemented with JavaServer Faces technology, JSP pages, web service (WS) endpoints. Web Services: SOAP – based WS, RESTful WS
-
Enterprise Bean
Что даёт EJB: Разработчик концентрируется на бизнес – логике. Разработка клиентской части (Web) отделена от разработки бизнес – логики и работой с БД. Это особенно важно для малых устройств (смартфоны, планшеты). Повторное использование кода.
-
Когда особенно следует использовать EJB: Масштабирование. Транзакционность. Разнообразие типов клиентов.
-
Session Bean: stateful, stateless, singleton (синхронный вызов). Message-driven Bean (асинхронный вызов) Entity Bean (Persistence классы) Statefull: ■ The bean’s state represents the interaction between the bean and a specific client. ■ The bean needs to hold information about the client across method invocations. ■ The bean mediates between the client and the other components of the application, presenting a simplified view to the client. Stateless: ■ The bean’s state has no data for a specific client. ■ In a single method invocation, the bean performs a generic task for all clients. For example,youmight use a stateless session bean to send an email that confirms an online order. ■ The bean implements a web service. Singletone: ■ State needs to be shared across the application. ■ A single enterprise bean needs to be accessed by multiple threads concurrently. ■ The application needs an enterprise bean to perform tasks upon application startup and shutdown. ■ The bean implements a web service. Message-driven (like stateless): ■ To avoid tying up server resources, do not to use blocking synchronous; receives in a server-side component
-
Session Bean Message-Driven Bean
-
Бизнес – архитектура одной системы online бронирования билетов
-
-
Спасибо за внимание !
Нет комментариев для данной презентации
Помогите другим пользователям — будьте первым, кто поделится своим мнением об этой презентации.