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
 */

 

 

 

 

번호 제목 글쓴이 날짜 조회 수
공지 (확인전) [2021.03.12] Eclipse에서 Spring Boot로 JSP사용하기(Gradle) 황제낙엽 2023.12.23 0
공지 [작성중/인프런] 스프링부트 시큐리티 & JWT 강의 황제낙엽 2023.12.20 6
23 Spring프레임워크 소개문서 (2) 황제낙엽 2007.03.22 123
22 Spring프레임워크 소개문서 (1) 황제낙엽 2007.03.22 107
21 Cugain의 샘플프로젝트 jpetstore 분석기 - (1) jpetstore 설치 file 황제낙엽 2007.02.22 123
» Cugain의 샘플프로젝트 jpetstore 분석기 - (7) PetStoreImpl.java 황제낙엽 2007.05.24 51
19 Cugain의 샘플프로젝트 jpetstore 분석기 - (6) petstore-servlet.xml 분석 황제낙엽 2007.04.27 19
18 Cugain의 샘플프로젝트 jpetstore 분석기 - (5) applicationContext.xml 분석 황제낙엽 2007.04.21 232
17 Cugain의 샘플프로젝트 jpetstore 분석기 - (4) dataAccessContext-jta.xml 분석 황제낙엽 2007.04.21 27
16 Cugain의 샘플프로젝트 jpetstore 분석기 - (3) dataAccessContext-local.xml 분석 황제낙엽 2007.04.21 40
15 Cugain의 샘플프로젝트 jpetstore 분석기 - (2) web.xml 분석 황제낙엽 2007.03.20 92
14 IoC (Inversion of Control) 컨테이너에 대한 정리 황제낙엽 2007.02.21 50
13 자바지기 1차 오픈 소스 스터디 문서모음 file 황제낙엽 2007.01.30 46
12 Spring 프레임워크를 이용한 효율적인 개발 전략 1차 황제낙엽 2007.01.30 47
11 Spring framework jpetstore 샘플 분석기 - (6) jpetstore 예제로 살펴보는 Spring MVC와 iBatis 연동 황제낙엽 2007.01.18 48
10 Spring framework jpetstore 샘플 분석기 - (5) jpetstore 에서의 InternalResourceViewResolver 황제낙엽 2007.01.18 17
9 Spring framework jpetstore 샘플 분석기 - (4) jpetstore 에서의 HandlerMapping 황제낙엽 2007.01.18 36
8 Spring framework jpetstore 샘플 분석기 - (3) jpetstore 에서의 Spring MVC 설정 황제낙엽 2007.01.18 13
7 Spring framework jpetstore 샘플 분석기 - (2) jpetstore 에서의 Spring 초기 설정과 IoC 황제낙엽 2007.01.18 18
6 Spring framework jpetstore 샘플 분석기 - (1) jpetstore 설치하기 황제낙엽 2007.01.18 30
5 Spring WebFlow Introduction (웹개발을 직관적으로) 황제낙엽 2006.12.09 555
4 IoC(Inversion of Control)란 무엇인가? 황제낙엽 2006.12.09 93