sitelink1  
sitelink2  
sitelink3  
extra_vars6  

1. 소속패키지 : org.springframework.samples.jpetstore.domain.logic
2. 상속받는 인터페이스 : PetStoreFacade.java, OrderService.java
3. 잡담

 

PetStoreFacade와 PetStoreImpl의 관계는 Facade패턴의 관계이다.
이는 PetStoreImpl에 정의된 다음의 메소드로 무엇을 하려는 인터페이스인지 짐작이 가능하다.
·미리보기 | 소스복사·
 
  1. public void insertOrder(Order order) {   
  2.     this.orderDao.insertOrder(order);   
  3.     this.itemDao.updateQuantity(order);   
  4. }  
서로 다른 Dao객체를 통해 Order정보를 저장하는 메소드이다.
이 메소드를 호출하는 클래스에서는 단지 Order객체를 저장하라는 명령만 내리면 된다.
나머지 어떤 테이블에 어떻게 저장하는지는 이 메소드에서 알아서 처리한다는 내용이다.
클래스를 만든 사람이 할 말이 더 많을테니 PetStoreImpl에 주석으로 달려있는 내용을 읽어보자.
/**
 * JPetStore primary business object.
 *
 * <p>This object makes use of five DAO objects, decoupling it
 * from the details of working with persistence APIs. Thus
 * although this application uses iBATIS for data access,
 * another persistence tool could be dropped in without
 * breaking this class.
 *
 * <p>The DAOs are made available to the instance of this object
 * using Dependency Injection. (The DAOs are in turn configured
 * using Dependency Injection.) We use Setter Injection here,
 * exposing JavaBean setter methods for each DAO. This means there is
 * a JavaBean "property" for each DAO. In this case the properties
 * are write-only: there is no getter method to accompany the
 * setter methods. Getter methods are optional: implement them
 * only if you want to expose access to the properties in your
 * business object.
 *
 * <p>There is one instance of this class in the JPetStore application.
 * In Spring terminology, it is a "singleton". This means a
 * per-Application Context singleton. The factory creates a single
 * instance; there is no need for a private constructor, static
 * factory method etc as in the traditional implementation of
 * the Singleton Design Pattern.
 *
 * <p>This is a POJO. It does not depend on any Spring APIs.
 * It's usable outside a Spring container, and can be instantiated
 * using new in a JUnit test. However, we can still apply declarative
 * transaction management to it using Spring AOP.
 *
 * <p>This class defines a default transaction attribute for all methods.
 * Note that this attribute definition is only necessary if using Commons
 * Attributes auto-proxying (see the "attributes" directory under the root of
 * JPetStore). No attributes are required with a TransactionFactoryProxyBean,
 * as in the default applicationContext.xml in the war/WEB-INF directory.
 *
 * <p>The following attribute definition uses Commons Attributes attribute syntax.
 * @@org.springframework.transaction.interceptor.DefaultTransactionAttribute()
 *
 * @author Juergen Hoeller
 * @since 30.11.2003
 */
OrderService라는 인터페이스는 리모트 서비스를 위해 정의했다고 한다.
주석에 나와 있듯이 org.springframework.samples.jpetstore.service.JaxRpcOrderService 클래스를 보면 장문의 내용이 기재되어 있다.
/**
 * JAX-RPC OrderService endpoint that simply delegates to the OrderService
 * implementation in the root web application context. Implements the plain
 * OrderService interface as service interface, just like the target bean does.
 *
 * <p>This proxy class is necessary because JAX-RPC/Axis requires a dedicated
 * endpoint class to instantiate. If an existing service needs to be exported,
 * a wrapper that extends ServletEndpointSupport for simple application context
 * access is the simplest JAX-RPC compliant way.
 *
 * <p>This is the class registered with the server-side JAX-RPC implementation.
 * In the case of Axis, this happens in "server-config.wsdd" respectively via
 * deployment calls. The Web Service tool manages the lifecycle of instances
 * of this class: A Spring application context can just be accessed here.
 *
 * <p>Note that this class does <i>not</i> implement an RMI port interface,
 * despite the JAX-RPC spec requiring this for service endpoints. Axis and
 * other JAX-RPC implementations are known to accept non-RMI endpoint classes
 * too, so there's no need to maintain an RMI port interface in addition to
 * the existing non-RMI service interface (OrderService).
 *
 * <p>If your JAX-RPC implementation imposes a strict requirement on a service
 * endpoint class to implement an RMI port interface, then let your endpoint
 * class implement both the non-RMI service interface and the RMI port interface.
 * This will work as long as the methods in both interfaces just differ in the
 * declared RemoteException. Of course, this unfortunately involves double
 * maintenance: one interface for your business logic, one for JAX-RPC.
 * Therefore, it is usually preferable to avoid this if not absolutely necessary.
 *
 * @author Juergen Hoeller
 * @since 26.12.2003
 */

 

 

 

 

번호 제목 글쓴이 날짜 조회 수
37 Spring MVC 어플리케이션 개발 <11> 간단한 조회 구현 방안 비교 황제낙엽 2007.05.27 383
36 Spring MVC 어플리케이션 개발 <10> 도메인 객체 수정시 변경 사항 황제낙엽 2007.05.27 224
35 Spring MVC 어플리케이션 개발 <9> JSP 화면 작성 황제낙엽 2007.05.27 234
34 Spring MVC 어플리케이션 개발 <8> Spring기반 iBatis DAO 작성 황제낙엽 2007.05.27 230
33 Spring MVC 어플리케이션 개발 <7> Spring과 iBatis 연동을 위한 준비 황제낙엽 2007.05.26 209
32 Spring MVC 어플리케이션 개발 <5> MVC 컨트롤러 작성 황제낙엽 2007.05.26 212
31 Spring MVC 어플리케이션 개발 <4> 화면 요구 작성 황제낙엽 2007.05.26 224
30 Spring MVC 어플리케이션 개발 <3> Web Application Context 파일 작성 황제낙엽 2007.05.26 279
29 Spring MVC 어플리케이션 개발 <2> Spring MVC 구동을 위한 web.xml 작성 황제낙엽 2007.05.26 220
28 Spring MVC 어플리케이션 개발 <1> 프로젝트 디렉토리 생성 황제낙엽 2007.05.26 233
27 Struts에서 Spring으로의 이주 가이드 - Spring (java/j2ee Application Framework) 황제낙엽 2006.02.27 213
26 실습 STEP1 - 기초편 (Hello Spring 출력) file 황제낙엽 2007.04.27 258
25 Bean 생명주기 관리 황제낙엽 2007.03.23 211
24 Spring프레임워크 소개문서 (3) 황제낙엽 2007.03.22 225
23 Spring프레임워크 소개문서 (2) 황제낙엽 2007.03.22 286
22 Spring프레임워크 소개문서 (1) 황제낙엽 2007.03.22 279
21 Cugain의 샘플프로젝트 jpetstore 분석기 - (1) jpetstore 설치 file 황제낙엽 2007.02.22 352
» Cugain의 샘플프로젝트 jpetstore 분석기 - (7) PetStoreImpl.java 황제낙엽 2007.05.24 232
19 Cugain의 샘플프로젝트 jpetstore 분석기 - (6) petstore-servlet.xml 분석 황제낙엽 2007.04.27 203
18 Cugain의 샘플프로젝트 jpetstore 분석기 - (5) applicationContext.xml 분석 황제낙엽 2007.04.21 438