3. Enterprise SaaS Application
최근 Economist Intelligence 에 의한 국제
적 조사 (293개 기업 CIO, 조사국가: 미
국 39%, 영국 31%, 호주 30%)에 의하면
5개 기업중 4개는 자신의 고객들이 제화
와 서비스를 제공받는 방식에 어떤 변화
를 원하고 있다고 답했다. 그리고 실제로
반이 넘는 기업들은 가격모델과 제공방
식을 변경하였거나 계획 중이라고 답했
다. 그러한 변화 중 가장 많은 40% 로 대
답한 것은 바로 ‘ 구독형 서비 스
(Subscription Service)’의 도입으로 조사
됐다.
5. 성공적 서비스로의 여정
운영자동화
• Business Continuity
• Zero-downtime
수익화
• Subscription Business
구현
• Mashups
• Multi-tenancy
• Self-Serviced
마이크로 서비스
• Separation of Concerns
Successful Ser
vice
6. 성공적 서비스로의 여정
운영자동화
• Business Continuity
• Zero-downtime
수익화
• Subscription Business
구현
• Mashups
• Multi-tenancy
• Self-Serviced
마이크로 서비스
• Separation of Concerns
7. Share more, More cheap offering, More C
ompetitive in the market !
Share less, More easy & Secure !
Creating Innovative Application
Multi-tenancy Support
9. 가입자A의 앱설정 가입자B의 앱설정
* 멀티태넌시 지원 기능은 금번 사업 범위에 비포함
* 향후 현재 R&D문서관리 등은 멀티태넌트 전환이 필요함
2. 도입기관별 입력 항목 변경
3. 도입기관별 판정로직 설정
1. 도입기관 브랜드 설정
Multi-tenancy Support
Metadata-based
15. Supporting Multi-tenancy
NoSQL databases
1. Inherent multi-tenancy - Schema Free
2. High Performance - Horizontally scalable and Memory cache
3. Web optimized – Query results are JSON - data can be
parsed by web browser directly and performantly.
Additionally -
4. Easy to implement Analytic services (MR) and Full Text Search
5. Event-driven Transaction - don't have to care about CQRS
something
6. Some NoSQL products (Couchbase, Cassandra) provides
pessimistic locking and ANSI SQL (Join Query) - easily
migrate to them.
16. Libraries and tools for Multi-tenancy
support
• Multi-tenancy Database Frameworks
– JPA @Discriminator annotation (Hibernate,
EclipseLink)
– Athena Framework
– Spring Cloud
– Corent-technology’s JDBC/ODBC proxy
• Metadata framework (SPOSAD)
– IBM J9 JVM - @TenantScope annotation
– Athena Framework
– Adaptive Object Model
– OCE multi-tenancy metadata framework
17. 성공적 서비스로의 여정
운영자동화
• Business Continuity
• Zero-downtime
수익화
• Subscription Business
구현
• Mashups
• Multi-tenancy
• Self-Serviced
마이크로 서비스
• Separation of Concerns
18. DevOps: Issues
Continuous Delivery
18
Company Deploy Frequency Deploy Lead Time Reliability Customer
Responsiveness
Amazon 23,000 / day Minutes High High
Google 5,500 / day Minutes High High
Netflix 500 / day Minutes High High
Facebook 1 / day Hours High High
Twitter 3 / week Hours High High
Typical enterprise Once every 9 months Months or quarters Low / Medium Low / Medium
출처: 도서 The Phoenix Project
Amazon,
34. avg등이옛날 코
드랑 새로운 코드랑 비교해서 어떻게다른 지 확인하는것)은 1000개 이상의metric을
비교해서 100점 만점에 점수를 주고 일정 점수일 경우만배포할 수 있음.
출처: http://techblog.netf lix.com/2013/08/dep loying -netf lix -ap i.ht ml
Supporting Continuous Delivery
Netflix
45. Micro Service Architecture
Contract based, Polyglot Programming
à Separation of Concerns, Parallel Development, Easy Outsourcing
Written in Java
Written in Node
Written in PHP
46. Micro Service Architecture
• 변경된 서비스만 재배포
à Side effect 최소화
• 자율성
à 각 서비스에 대한 자유로운 언어, 아키텍처, 아웃소싱 용이
• 병렬 개발, 타임 투 마켓, 린 개발
52. Design factors on developing cloud
applications
1. Don't code your application directly to a specific topology
2. Do not assume the local file system is permanent
3. Don't keep session state in your application
4. Don't log to the file system
5. Don't assume any specific infrastructure dependency
6. Don't use infrastructure APIs from within your application
7. Don't use obscure protocols
8. Don't rely on OS-specific features
9. Don't manually install your application
38
54. Front-end
Image
Server
(Python)
Business
Logic
Server
(Java)
Extended Role of Front-end in Cloud Applications
Aggregator for multiple (polyglot programmed) micro-services
Component
Service
(C)
AJAX, RESTful
Concurrent Cloud Applications are composed of multiple
Micro Services and front-end serves as an aggregator of the
services
55. Writing One Page Web App
Problems: One Page Web App à Low Cohesion and High Coupling
style
style for A
style for B
style for C
/style
html
element for A
element for B
element for C
/html
script
script for A
script for B
script for C
/script
56. Polymer: Web Component Framework
Polymer: W3C standard for Web Components
• Provides Cohesive Component Model
• Component Composition by HTML
markup
• Dynamic Data Binding
• Responsive Web by Material Design
• Standard
• Google maintains it
57. Polymer: Web Component Framework
Polymer: W3C standard for Web Components
style
style for A
style for B
style for C
/style
html
element for A
element for B
element for C
/html
script
script for A
script for B
script for C
/script
#A.html
style
style for A
/style
html
element for A
/html
script
script for A
/script
#B.html
style
style for B
/style
html
element for B
/html
script
script for B
/script
#C.html
style
style for C
/style
html
element for C
/html
script
script for C
/script
#index.html
A A
B B B
C
58. • UI Framework for MSA
– AngalarJS
– React
– Polymer
– VueJS
• API Gateway
– APIGee (Commercial)
– Kong
– OCE Gateway
– Amazon Cognito (Public)
– Spring Cloud
• IAM
– Amazon IAM (Public)
– Spring Cloud
– OCE IAM
• Metering / Billing
– Exem’s Metering Framework – BigData based
– OCE Billing
Micro Service Architecture
Platforms for MSA
60. Example: Proposed SaaS Ar
chitecture
프론트엔드 (Responsive,
Client-‐
side
Service
Aggregate)
확장가능한 글로벌
싱글 인스턴스 데이
터베이스
(NoSQL
-‐
Couchbase)
서비스
API
G/W
서비스
서비스
Scalable,
Client-‐driven,
Microservices
architecture
Tenant
Billin
g
(Machine)
써드파티 앱
들
Billing
IAM
token
provi
der
local
DB
(pouchDB)
CRUD
1.data
sync
2.REST
61. 성공적 서비스로의 여정
운영자동화
• Business Continuity
• Zero-downtime
수익화
• Subscription Business
구현
• Mashups
• Multi-tenancy
• Self-Serviced
마이크로 서비스
• Separation of Concerns
63. Leaders Mainstream Laggards
Pricing strategy • Pricing metrics are defined as p
erceived by the customers
• Pricing strategy is easy to under
stand, measure.
• Boundaries for usage,
features, time, conversion
from trial are clearly define
d
• Pricing is ad hoc
• Pricing is based on internal
ly-oriented metrics
• Difficult to convert trial an
d freemium to paid
• Leader 들은 고객 관점에서 가격을 책정, 시장상황에 빠르게 가격 및 정책
개선
• 후발기업들은 내부 비용에 초점, 변경하지 않음
77. DDD(Domain-Driven Design) - 도메인 주도 설계
• 마이크로서비스를 구현하기에 앞서 설계하기 위해 필요한 유용한 개념 DDD.
• 추천 도서 : “Eric Evans의 Domain Driven Design”, 도메인 주도 설계
• DDD에서 얻을 수 있는 해법(책에서 다루는 내용)
• 어떤 단위로 서비스를 구성할 것인가
• 서비스의 결합
• 변화에 강한 설계
• 레거시 시스템을 단계적 폐기
• 리팩터링 전략
• Domain Model 정제과정의 예
• http://agiledata.org/essays/agileDataModeling.html
63
79. MW4 개발 프로세스
생
성
생
성
• Full-fledged Responsive Web
Single Page Application
• With google-material design• POJO based Domain Model
• Add annotations (JAX-RS, JPA,
Jackson, metaworks)
• Domain Class Analysis
도메인
클래스
모델링
애노테이
션
UI 컴포넌
트 배치
81. Multi-tenant / Self service Support
Self service
Self service
portal
• Add new attribute
• Attributes can be String,
number, Data from referenced
class (table)
• Change the title, order of
attributes
• Hide/Show attribute
83. 활용 오픈소스 – for building app
Vue.js Vue MaterialFront
REST Service
Persistence
84. 활용 오픈소스 – 2 – for MSA
BackEnd 1
IAM
API GW
BackEnd 2
Billing/
Metering
Front
OCE-IAM
OCE-API-GW
OCE-Bill
www.opence.org
85. 개발환경 구축
• Apache Maven 3.x
– Will import following dependencies automatically:
• Spring Framework
• Tomcat Runtime
• Mysql Java Library
• ORM-related Libraries including JPA
• Integrated Development Environment:
Intelli-J CE 12 or higher
• Database-related tools:
Mysql Server, Mysql workbench
(Mysql Java Library will be automatically imported by maven)
71
86. URL for sample project
72
https://github.com/TheOpenCloudEngine/micro-service-
architecture-vuejs
87. Building Sample Application
73
Backend server (Runs on 8080)
mvn spring-boot:run
Front-end server (Runs on 8081 or any other port)
cd src/main/resources/static
npm install npm run dev
Go to http://localhost:8081/login.html
88. Dependencies
74
- MySQL DB and Couchbase Installation
- Setting the connection info to the WebConfig.java:
https://github.com/TheOpenCloudEngine/micro-service-architecture-
vuejs/wiki
89. Running Sample App - login
75
Default login id / pw is
jyjang@uengine.org / test
Login will be processed through the IAM server:
http://iam.uengine.io:8080
90. Running Sample App – Product - Master
76
• Main Screen is in a material-
design fashion
• You may reduce the screen
size to see it is responsive to
the device
103. The Size of Code
89
323Lines
For Developing Full-CRUD, RESTful, MSA-based,
Material-Designed, Responsive, Grid+Form, Multi-
tenant and Self-Served Application:
• Number of fields of the entity: 10
• Total lines of code per an entity:
92 for front-end,
215 for domain class,
16 lines for repository.
104. Anatomy of SaaS Platform:
Doman Driven Design and Metadata Oriented
Framework
90
106. Adaptive Object Model
92
http://adaptiveobjectmodel.com
• Class Definition model in
instance level
• Definition can be stored in a
XML file or database.
• Very Flexible to Extend
• Polymorphism for multi-
tenant
Drawbacks:
• Hard to read code
• Error-prone
107. Reflection + AOM
93
• Since Java 1.2
• Java Class definition can be
accessible with Reflection
APIs
• For the concrete part, Get
the Metadata from Class
Definition
• For the flexible part, use the
AOM
108. Annotation + Reflection + AOM
94
• Since Java 1.5
• Rather use separated XML
files, use @ for specifying
additional (user-defined)
metadata for class definition
109. Metaworks
1. Metadata Oriented Application Framework
2. Developed by Jinyoung Jang in 1998
3. Inspired from the Adaptive Object Models, OMG Reflection, and MDA
4. Application Component Generation on the fly from metadata
5. Metaworks1: Generates database query and action, Simple Web Forms
generation. written in ASP - 1998
6. Metaworks2: Generates Swing User interfaces written in Java, is adopted in
uEngine Process Designer – 2003
7. Metaworks3: Generates Dynamic Web Uis. Metadata definition by annotation,
is adopted in Process Codi SNS, Web based BPMN Modeler and the Cloud
IDE of OCE garuda – 2011
8. Metaworks4: Inherits concept of Metaworks 1 ~ 3. Get off from the inherent
MVV VueJS for front-end, Spring Hateoas and JPA for back-end.
110. Metaworks
So Metaworks3…
1. Is A POJO framework
2. Encourages the Domain-Driven Design
3. Especially for developing model-driven applications
111. Metaworks for early prototyping
• Metaworks generates Dynamic Web Applications on the fly from
your domain class model with minimal technical details.
• By reading the metadata declared by class model itself and the
additional annotations.
• Metaworks doesn’t generate any source codes so doesn’t requires
any round-trip job for source codes while MDA need such a job.
Metadata
Domain Model
Classes
User Interaction
Validation
Database Manipulation
Dynamic Web UIs
Swing Native UIs
Mobile Native UIs*
112. Metaworks for Multi-tenancy
Common Metadata
Domain Model
Classes
Class model for tenant1
ORM for tenant1
Common class model
Metadata of
Tenant1
Metadata of
Tenant2
Metadata of
Tenant3
Class model for tenant2
ORM for tenant2
Class model for tenant3
ORM for tenant3
Override by tenantID
113. Development Process
1. (Optional) UML을 이용한 설계
2. 도메인 자바 코드의 생성
3. 타 POJO Framework의 적용 - JPA를 통한 ORM 생성, JAX-RS를 통한 서비
스 공개
4. Metaworks3 Framework의 적용을 통한 Default Application 의 생성
5. UI 구체화 / 커스터마이징
6. 1~5 반복
114. Why JPA?
• The (almost-final) Java Standard
• Why not iBatis or hibernate ?
– JPA is a POJO Framework while the others not.
– Also Hibernate engine supports JPA as a interface.
• Why POJO framework is goooooood?
– To focus on the domain-driven design
– To yield the sophisticated Java class system to solve your Doman-
Specific problem.
– A POJO frameworks would not limits your domain models, they only
gives an ‘advice’ through @Annotation or Aspect-oriented manner.
– So, you can introduce one or more frameworks without changing the
domain classes.
100
115. Basic JPA annotations
• @Entity identifies this class is a ORM Class.
• @Id means this field is a primary key.
• @JoinColumn means a foreign value referenced by a foreign key.
• @OneToMany means this field is an accessor of related entity in
‘One-to-many’ relationship.
101
117. Data Insertion Test
103
public static void main(String[] args) throws PersistentException {
PersistentTransaction t = autoinsurance.AutoinsurancePersistentManager.instance().getSession().beginTransaction();
try{
Customer customer = new Customer();
customer.setCustomer_ID(“1”);
customer.setCustomer_first_name(“Jane Doe”);
customer.setVehicle(new ArrayList());
customer.getVehicle().add(new Vehicle());
autoinsurance.AutoinsurancePersistentManager.instance().getSession().save(customer);
t.commit();
}
catch (Exception e) {
t.rollback();
throw e;
}
118. Creating UIs
• Developing UI Applications is very complex and costly:
– Native UI: Swing
– Web UI: JSP, Struts
– N-Screen UI: AJAX / html5 / CSS
• Development Lifecycle is getting shorter and shorter:
– Lean Startup
– Early Prototyping
• So, we need something agile development approach such as:
– Model-Driven Development
– Application Frameworks
– SOA and Process Orchestration Architecture
104
119. History of OO Frameworks and
Methodologies
1. Smalltalk
2. STL (Standard Template Language) of C++
3. Adaptive Object Models – Ralf Johnson
4. Design Patterns – Gang of four
5. Object-Oriented Frameworks
6. OMG Reflection
7. Java – 1995
8. IBM’s San francisco Framework
9. Java 2 Enterprise Edition – EJB 2.1
10.EJB Patterns
• Bigger and Complex Super Classes
• Java doesn’t Support Multiple Inheritance
120. Domain Specific Application Frameworks
Example of Business Domain Specific Application Frameworks :
1. Car Simulation
2. Product Simulation
3. Or your Problem itself!!
à abstracts business problems
Example of System Domain Specific Application Frameworks :
1. EJB
2. Struts
3. Swing
4. Apache Mesos
à abstracts technical problems
But We Can’t Inherit Two Super Classes at the same
time!!!
Merging two
or more
frameworks??
121. Return to the “Pure Java”
- Aspect Oriented
Programming
- Java Annotation
- JPA
- JAX-RS
- EJB 3.1
122. EJB 2.1 vs EJB 3.1
출처: http://www-
01.ibm.com/support/knowledgecenter/SS8PJ7_9.1.0/com.ibm.javaee.doc/topics/
124. Anatomy of SaaS Platform:
Spring Data + Hateoas Framework
110
125. Microservices with Spring Boot + Spring Data
Using Spring Boot and Spring Data
to quick develop HATEOAS microse
rvices
Bernardo Silva
126. Terminology
• What is CRUD?
• What is REST?
• What is Spring?
• What is HATEOAS?
• What is Microservice?
• So… hands on!
127. What is CRUD?
• “In computer programming, create, read, update and delete (as a
n acronym CRUD or possibly a Backronym) (Sometimes called SC
RUD with an S for Search) are the four basic functions of persist
ent storage.”
Ø http://en.wikipedia.org/wiki/Create,_read,_update_and_delete
128. What is REST?
• “Representational state transfer (REST) is an abstraction of the ar
chitecture of the World Wide Web; more precisely, REST is an arch
itectural style consisting of a coordinated set of architectural const
raints applied to components, connectors, and data elements, wit
hin a distributed hypermedia system.”
• http://en.wikipedia.org/wiki/REST
129. Basic CRUD with REST
Operation HTTP / REST
Create PUT / POST
Read (Retrieve) GET
Update (Modify) PUT / PATCH
Delete (Destroy) DELETE
130. What is Spring?
• “The Spring Framework is an open source application framework a
nd inversion of control container for the Java platform.”
Ø http://en.wikipedia.org/wiki/Spring_Framework
§ Inversion of control container / dependency injection
§ Enrichment and proxying
131. Inversion of control container / dependenc
y injection:
class A {
B b = new Bimpl();
}
interface B {
(…)
}
class Bimpl implements B {
(…)
}
@Component
class A {
@Autowired
B b;
}
interface B {
(…)
}
@Component
class Bimpl implements B {
(…)
}
Spring
133. Using AOP for Metering / Billing – 1
@Metered(project.start)
public void executeProcess(String instanceId) throws Exception{
ProcessInstance instance = getInstance(instanceId);
instance.execute();
}
134. Using AOP for Metering / Billing – 2
@Aspect
public class MeteringAdvice {
@Before(@annotation(metered))
public void checkAvailable(Metered metered) throws
NoServiceAvailableException {
…..
//Check if the service is available for the requested
tenant
}
@AfterReturning(@annotation(metered))
public void meter(Metered metered) throws Exception {
….
//Add usage log
}
}
135. Essencia – Build Deploy Automation
Essencia On-Premise
Essencia On Amazon
Essencia On Bluemix
Overrides:
1. applicationContex.xml (to use AmazonS3Storage)
2. Uengine.properties (to change DB connection info)
Overrides:
1. applicationContex.xml (to use services)
2. pom.xml (Cf push command)
136. What is HATEOAS?
• “HATEOAS, an abbreviation for Hypermedia as the Engine of Appli
cation State, is a constraint of the REST application architecture th
at distinguishes it from most other network application architectur
es.”
Ø http://en.wikipedia.org/wiki/HATEOAS
138. What is Microservice?
• “The term Microservice Architecture has sprung up over the last
few years to describe a particular way of designing software applic
ations as suites of independently deployable services.”
Ø http://martinfowler.com/articles/microservices.html
139. Microservices Reference
• The “ID” on a HATEOAS system is mainly an URI
– Example: If you create a “teacher”, his “id” will be “http://localhost:80
80/teacher/1” instead of just “1”.
• Then, each Microservice can reference other services entities.
140. So… hands on!
1) Using Gradle, you create a simple Spring Boot
project:
Ø http://projects.spring.io/spring-boot/
2) You create a basic Spring Boot main class (it c
an be converted to a WAR later).
3) Then you boot doing:
Ø gradle bootRun
143. Adding Hibernate (ORM)
• build.gradle (dependencies):
Ø compile(org.springframework.boot:spring-boot-st
arter-data-jpa”)
Ø compile(com.h2database:h2:1.3.176)
Ø compile(org.projectlombok:lombok:1.14.4)
Just to make
Entities more
dumb
144. Adding Spring Data REST
• build.gradle (dependencies):
Ø compile(org.springframework.data:spring-data-r
est-webmvc)
• Application.java:
Ø @Import(RepositoryRestMvcConfiguration.class)
SUPER
Magic!
145. Teacher and Student DDL
TEACHER
ID
NAME
SUBJECT
STUDENT
ID
NAME
AGE
STUDENT_TEACHERS
STUDENT_ID
TEACHER_ID
148. Adding REST repositories
@RepositoryRestResource(
collectionResourceRel = student, path = student)
public interface StudentRepository extends
PagingAndSortingRepositoryStudent, Long {
}
@RepositoryRestResource(
collectionResourceRel = teacher, path = teacher)
public interface TeacherRepository extends
PagingAndSortingRepositoryTeacher, Long {
}
TeacherRepository.java
StudentRepository.java
149. Run and be amazed!
• Try to get the root service description:
Ø GET: http://localhost:8080/
• Try to create two students, two teachers and associate them!
Ø POST: http://localhost:8080/student
• Use “PATCH” with “text/uri-list” to link entities
• Get JSON Schema of the entity:
Ø GET: http://localhost:8080/student/schema
Ø Accept: application/schema+json
154. Why vue.js
Angular and React is not STANDARD
Polymer is heavy and needs Polyfill
Vue.js is
1. Fastest (compared with React and Angular)
2. Light (low dependencies)
3. Usable with jQuery or existing .js libraries,
155. Features of Vue.js
• Reactive data binding (Spreadsheet-like)
• Composable view components (Tag-based)
175. IntelliJ and VP integration
161
1. In Visual Paradigm, select Windows
Integration IDE Integration... from
the toolbar. (for some version, Tools
IDE Integration)
2. Select IntelliJ IDEA. You can run Visual
Paradigm in multiple IDEs. In other
words, if you need you can select
multiple IDEs here. Click Next.
3. Specify the folder path of IntelliJ IDEA.
Click Next to start copying files to
your IDE.
(Currently VP supports only IntelliJ 12 or
under)
180. Generate ERD and Entity Classes (ORM)
• Open the Class Diagram in the
Project Explorer Diagram Navigator
ClassDiagram
• Set the type of attributes
– String for most types
– boolean for gender
– int for options
– double for money
– java.util.Date for Dates, timestamp
• Modeling ORM Generate Code
• Database Code Generation Options:
– Framework: JPA
– Persistence API: POJO
• Be careful:
– All attributes must have its type
– All classes should be belong to any
package
166
182. Create a Class Diagram and Generate Java
Code in IntelliJ-VP integration
168
183. Navigating between Model and Code
Jumping from diagram to Code:
Right-click on the class Select in
Code
169
Jumping from Code to Diagram:
Right-click on the source file
Visual Paradigm EE Select in
Diagram
201. Introduction to REST
REST stands for Representational State Transfer
• It is an architectural pattern for developing w
eb services as opposed to a specification.
• REST web services communicate over the HT
TP specification, using HTTP vocabulary:
– Methods (GET, POST, etc.)
– HTTP URI syntax (paths, parameters, etc.)
– Media types (xml, json, html, plain text, etc)
– HTTP Response codes.
202. HTTP-REST Vocabulary
HTTP Methods supported by REST:
• GET – Requests a resource at the request URL
– Should not contain a request body, as it will be discarded.
– May be cached locally or on the server.
– May produce a resource, but should not modify on it.
• POST – Submits information to the service for processing
– Should typically return the new or modified resource.
• PUT – Add a new resource at the request URL
• DELETE – Removes the resource at the request URL
• OPTIONS – Indicates which methods are supported
• HEAD – Returns meta information about the request URL
203. HTTP-REST Vocabulary
A typical HTTP REST URL:
• The protocol identifies the transport scheme that will be used t
o process and respond to the request.
• The host name identifies the server address of the resource.
• The path and query string can be used to identify and customi
ze the accessed resource.
http://my.store.com/fruits/list?category=fruitlimit=20
protocol host name path to a resource query string
204. JAX-RS Basics
An example REST service class:
• At least one method must be annotated with an HTTP verb (e.g. @GET)
• The @Controller annotation makes the class discoverable by Spring
package org.lds.tech.training.lab.ws;
import javax.ws.rs.GET;
import org.springframework.stereotype.Controller;
@Controller
public class HelloWebServiceRest {
@GET
public String sayHello() {
return Hello, World!;
}
}
205. JAX-RS Basics
Example Spring configuration:
• Example location: WEB-INF/example-servlet.xml
• A reference to the JAX-RS annotated service bean is pass
ed to the Stack RS “produce” namespace handler.
• Multiple service beans may be supplied under the Stack R
S “interfaces” element.
• Each bean will be scanned by CXF for annotated resource
s that can be served up RESTfully.
stack-rs:produce
stack-rs:interfaces
ref bean=helloWebServiceRest/
/stack-rs:interfaces
/stack-rs:produce
207. JAX-RS Method Annotations
JAX-RS HTTP Method Annotations:
@GET @POST
@PUT @DELETE
@OPTIONS @HEAD
• Applied to a Java method to bind it to an HTTP meth
od.
• Only one HTTP annotation may be applied to a singl
e Java method.
• Multiple Java methods may be given the same HTTP
method annotation, assuming they are bound to diff
erent paths.
208. JAX-RS @Path Annotation
• @Path annotations may be supplied to customize the reques
t URI of resource.
• @Path on a class defines the base relative path for all resou
rces supplied by that class.
• @Path on a Java class method defines the relative path for t
he resource bound to that method.
• @Path on a method is relative to any @Path on the class.
• In the absence of @Path on the class or method, the resour
ce is defined to reside at the root of the service.
• A leading forward slash (/) is unecessary as the path is alwa
ys relative.
209. JAX-RS Annotations: Examples
@Path(example)
public class ExampleWebServiceRest {
@GET
public Item getItem(@QueryParam(itemId) Long id) {
// @QueryParam example
}
@POST
public Response editItem(@FormParam(itemId) Long id,
@FormParam(value) String value) {
// @FormParam example
}
@GET
@Path({category}/{subcategory:[^/]*})
public ListItem getItems(
@PathParam(category) String category) {
@PathParam(subcategory) String subcategory) {
// @Path and @PathParam example
}
}
210. JAX-RS Annotations
Examples of @Produces and @Consumes:
• The client submits JSON or XML content with the “C
ontent-Type” header.
• The client requests either JSON or XML content thro
ugh use of the HTTP “Accept” request header.
@Path(example)
public class ExampleRestService {
@POST
@Path(items)
@Produces({application/json, application/xml})
@Consumes({application/json, application/xml})
public ListItem editItems(ListItem items) {
// Does something and returns the modified list
}
}
211. Operations behind the scene
• JSON(XML) serialization / deserialization
• Networking between Requester and Provider
• Dynamic method invocation
197
212. Service Orchestration with BPM
• uEngine BPMS is an open source software supporting BPMN 2.0
• Pools for service definition
• Using data mapper, detailed message inter-change between pools
can be done
198
213. Export BPMN xml file from VP
• Exporting BPMN 2.0 xml
• File Visual Paradigm Export BPMN 2.0
199
214. Importing BPMN xml to Activiti BPM
• Activiti BPM is an another open source BPMS supporting BPMN 2.0
• Processes Model workspace Import
• Select the BPMN xml file
200
219. Design factors on developing cloud
applications
1. Don't code your application directly to a specific topology
2. Do not assume the local file system is permanent
3. Don't keep session state in your application
4. Don't log to the file system
5. Don't assume any specific infrastructure dependency
6. Don't use infrastructure APIs from within your application
7. Don't use obscure protocols
8. Don't rely on OS-specific features
9. Don't manually install your application
205
222. PaaS의 유형들
• Application PaaS: OSS서비스에 집중
e.g. 클라우드 파운드리, 오픈시프트
• Business PaaS: BSS on OSS (OSS+BSS)
e.g. 포스닷컴, IBM SmartCloud, GAE, OCE
• Monetization PaaS: BSS + 소비자분석
e.g. Zuora, Aria Systems
224. CF Features Architecture
FEATURES
• Application Development
• Development Spaces
• Log aggregation
• Application Hosting
• Infra hiding
• Business Continuity
• Scale in/out
228. OSGi for PaaS
• More modular, so share more (at library level)
• More dynamic, so easily automated
• Provides standard J2EE framework including JAX-RS, JPA and
Spring with whiteboard pattern.
229. Sharing Level
• Hypervisor-based vs. Container-based vs. OSGi-based PaaS
• In OSGi-based PaaS, multi-tenants can share at library
level
Share more, More cheap offering, More Co
mpetitive in the market !
Share less, More easy Secure !
236. Lessons Learned
• POJO based frameworks are key-enablers to make domain-driven
software development.
– JPA
– Metaworks
– JAX-RS
– Spring
• SOA based Application Design
– Modularity is enhanced
– Dynamically reconfigurable
• Model-based applications are also easy to be deployed to IaaS and
PaaS.
– Since application is more modular, applications are easy to migrated,
ported and provisioned to diverse cloud environment.
– Also easy to be scaled out and in.
222