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

推荐订阅源

T
The Blog of Author Tim Ferriss
S
Securelist
D
Docker
The Register - Security
The Register - Security
GbyAI
GbyAI
Recorded Future
Recorded Future
Engineering at Meta
Engineering at Meta
Stack Overflow Blog
Stack Overflow Blog
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
罗磊的独立博客
博客园 - 【当耐特】
F
Full Disclosure
WordPress大学
WordPress大学
腾讯CDC
小众软件
小众软件
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
SecWiki News
SecWiki News
L
Lohrmann on Cybersecurity
I
InfoQ
MyScale Blog
MyScale Blog
量子位
Cyberwarzone
Cyberwarzone
博客园 - 三生石上(FineUI控件)
The Hacker News
The Hacker News
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
博客园_首页
H
Help Net Security
K
Kaspersky official blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Webroot Blog
Webroot Blog
Blog — PlanetScale
Blog — PlanetScale
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
The Cloudflare Blog
P
Proofpoint News Feed
V
Visual Studio Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tailwind CSS Blog
爱范儿
爱范儿
P
Privacy International News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
B
Blog RSS Feed

博客园 - 飘扬的笨蛋

忘记了这个地方 想起了父亲 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这个函数。