public interface DepDAO {
public void create(String userId,String name);
}
public class F1Factory {
private F1Factory(){
}
public static DepDAO getDepDAO(){
//根据用户在配置文件中指定的类型来选择具体的某个实现类
//type:类似我们学号指定的信息: 14+ 06+ 601+ 01
// 本例如: 1(type1机器类型)+ 2(type2存储类型)+ 2(type3供应商) + 1(type4访问方式)
int type1=1;//第1层工厂的选择类型,按理应该从用户的配置信息中获取,这里直接模拟了
if(type1==1){
return F2AFactory.getDepDAO();
}else if(type1==2){
return F2BFactory.getDepDAO();
}
return null;
}
}
public class F2AFactory {
private F2AFactory(){
}
public static DepDAO getDepDAO(){
int type2=2;//第2层工厂的选择类型,按理应该从用户的配置信息中获取,这里直接模拟了
if(type2==1){
// return F3A_ODB_Factory.getDepDAO();
}else if(type2==2){
return F3_A_RDB_Factory.getDepDAO();
}else if(type2==3){
//return F3_A_XML_Factory.getDepDAO();
}else if(type2==4){
//return F3_A_FileFactory.getDepDAO();
}
return null;
}
}
public class DepEJB_Impl implements DepDAO{
@Override
public void create(String userId, String name) {
System.out.println("利用JPA_Impl向数据库写入:"+userId+","+name);
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有