惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
SegmentFault 最新的问题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Attack and Defense Labs
Attack and Defense Labs
F
Full Disclosure
Vercel News
Vercel News
N
News | PayPal Newsroom
The GitHub Blog
The GitHub Blog
H
Hacker News: Front Page
H
Heimdal Security Blog
P
Privacy International News Feed
博客园 - 司徒正美
Google DeepMind News
Google DeepMind News
N
Netflix TechBlog - Medium
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cisco Blogs
L
Lohrmann on Cybersecurity
D
Docker
Recent Announcements
Recent Announcements
Security Archives - TechRepublic
Security Archives - TechRepublic
人人都是产品经理
人人都是产品经理
C
CXSECURITY Database RSS Feed - CXSecurity.com
P
Proofpoint News Feed
T
Tailwind CSS Blog
C
Check Point Blog
博客园 - 叶小钗
Google Online Security Blog
Google Online Security Blog
Martin Fowler
Martin Fowler
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
S
Secure Thoughts
博客园 - Franky
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
P
Palo Alto Networks Blog
Latest news
Latest news
量子位
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 三生石上(FineUI控件)
The Cloudflare Blog
Last Week in AI
Last Week in AI
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Cyberwarzone
Cyberwarzone
小众软件
小众软件
Cisco Talos Blog
Cisco Talos Blog
Hacker News: Ask HN
Hacker News: Ask HN
T
Threatpost
T
Tenable Blog
P
Privacy & Cybersecurity Law Blog
WordPress大学
WordPress大学

博客园 - 飘扬的笨蛋

忘记了这个地方 想起了父亲 singleton 很就没来了 oracle 10G在fedora2上的安装 vi 使用 spring and webwork (ref from webwork wiki) oracle 想起了以前 无题 avalon 无题 - 一次建模 Avalon简介 重回Avalon JMS 学习 jpetstore学习第4章 jpetstore学习第3章 OrderService.java 开始学习springframework带的jpetsore picocontainer & ioc 最简单的例子
jpetstore学习第2章 关于PetStoreFacade.java
飘扬的笨蛋 · 2004-08-16 · via 博客园 - 飘扬的笨蛋

如下是PetStoreFacade.java的代码,正如其自己所说 JPetStore primary business interface ,这确实是jpetstore的实现的核心之一。

PetSoreFacade.java
package org.springframework.samples.jpetstore.domain.logic;

import java.util.List;

import org.springframework.samples.jpetstore.domain.Account;
import org.springframework.samples.jpetstore.domain.Category;
import org.springframework.samples.jpetstore.domain.Item;
import org.springframework.samples.jpetstore.domain.Order;
import org.springframework.samples.jpetstore.domain.Product;

/**
 * JPetStore primary business interface.
 * @author Juergen Hoeller
 * @since 30.11.2003
 */
public interface PetStoreFacade {

 Account getAccount(String username);

 Account getAccount(String username, String password);

 void insertAccount(Account account);

 void updateAccount(Account account);

 List getUsernameList();


 List getCategoryList();

 Category getCategory(String categoryId);
 

 List getProductListByCategory(String categoryId);

 List searchProductList(String keywords);

 Product getProduct(String productId);


 List getItemListByProduct(String productId);

 Item getItem(String itemId);

 boolean isItemInStock(String itemId);


 void insertOrder(Order order);

 Order getOrder(int orderId);

 List getOrdersByUsername(String username);

}

PetStore主要的系统对象有Account / Product / Item /Category/Order ,所以PetStoreFacade也基本上封装了对这几个对象的操作,根据Facade模式的用途,松散客户端和服务器端的耦合,提供了一个统一的界面来给客户端,去spring包下看所有的Controller类会发现,基本上所有的Controller类中都定义了PetStoreFacade的实例。而struts的实现干脆就是直接在所有Action的父类BaseAction中定义了PetStoreFacade的实例并在setServlet中将其初始化了
WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);

现在还没有搞清楚在什么时候调用setServlet这个函数。