DBMgrProxy.java 5.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. package com.shkpr.service.aimodelpower.dbdao;
  2. import com.shkpr.service.aimodelpower.SpringContextUtil;
  3. import com.shkpr.service.aimodelpower.dbdao.shizilaishuiDataSource.service.intef.WaterCollecationService;
  4. import com.shkpr.service.aimodelpower.dbdao.shizilaishuiDataSource.service.intef.WaterTapWaterService;
  5. import com.shkpr.service.aimodelpower.dbdao.services.intef.*;
  6. public class DBMgrProxy {
  7. private volatile RolePowerDBService rolePowerDBService = null;
  8. private volatile PartitionInfoDBService partitionInfoDBService = null;
  9. private volatile RoleInfoDBService roleInfoDBService = null;
  10. private volatile UserDBService userDBService = null;
  11. private volatile FileAttachmentDBService fileAttachmentDBService = null;
  12. private volatile TypeDefineDBService typeDefineDBService = null;
  13. private volatile TestGeomInfoDBService testGeomInfoDBService = null;
  14. private volatile WODispatchPlanDBService woDispatchPlanDBService = null;
  15. private volatile WODispatchCmdBatchItemDBService woDispatchCmdBatchItemDBService = null;
  16. private volatile WODispatchCmdInfoDBService woDispatchCmdInfoDBService = null;
  17. private volatile WODispatchDatabaseDBService woDispatchDatabaseDBService = null;
  18. private volatile WODispatchDatabaseDisposalDBService woDispatchDatabaseDisposalDBService= null;
  19. //TODO 其他数据源
  20. private volatile WaterTapWaterService waterTapWaterService = null;
  21. private volatile WaterCollecationService waterCollecationService = null;
  22. private static volatile DBMgrProxy msInstance = null;
  23. public static DBMgrProxy getInstance(){
  24. if (msInstance == null){
  25. synchronized (DBMgrProxy.class){
  26. if (msInstance == null)
  27. msInstance = new DBMgrProxy();
  28. }
  29. }
  30. return msInstance;
  31. }
  32. private DBMgrProxy() {
  33. }
  34. public void init(){
  35. if (rolePowerDBService == null)
  36. rolePowerDBService = (RolePowerDBService)SpringContextUtil.getBean(RolePowerDBService.class);
  37. if (partitionInfoDBService == null)
  38. partitionInfoDBService = (PartitionInfoDBService)SpringContextUtil.getBean(PartitionInfoDBService.class);
  39. if (roleInfoDBService == null)
  40. roleInfoDBService = (RoleInfoDBService)SpringContextUtil.getBean(RoleInfoDBService.class);
  41. if (userDBService == null)
  42. userDBService = (UserDBService)SpringContextUtil.getBean(UserDBService.class);
  43. if (fileAttachmentDBService == null)
  44. fileAttachmentDBService = (FileAttachmentDBService)SpringContextUtil.getBean(FileAttachmentDBService.class);
  45. if (typeDefineDBService == null)
  46. typeDefineDBService = (TypeDefineDBService)SpringContextUtil.getBean(TypeDefineDBService.class);
  47. if (waterTapWaterService == null)
  48. waterTapWaterService = (WaterTapWaterService)SpringContextUtil.getBean(WaterTapWaterService.class);
  49. if (waterCollecationService == null)
  50. waterCollecationService = (WaterCollecationService)SpringContextUtil.getBean(WaterCollecationService.class);
  51. if (woDispatchPlanDBService == null)
  52. woDispatchPlanDBService = (WODispatchPlanDBService)SpringContextUtil.getBean(WODispatchPlanDBService.class);
  53. if (woDispatchCmdBatchItemDBService == null)
  54. woDispatchCmdBatchItemDBService = (WODispatchCmdBatchItemDBService) SpringContextUtil.getBean(WODispatchCmdBatchItemDBService.class);
  55. if (woDispatchCmdInfoDBService == null)
  56. woDispatchCmdInfoDBService = (WODispatchCmdInfoDBService) SpringContextUtil.getBean(WODispatchCmdInfoDBService.class);
  57. if (woDispatchDatabaseDBService == null)
  58. woDispatchDatabaseDBService = (WODispatchDatabaseDBService) SpringContextUtil.getBean(WODispatchDatabaseDBService.class);
  59. if (woDispatchDatabaseDisposalDBService == null)
  60. woDispatchDatabaseDisposalDBService = (WODispatchDatabaseDisposalDBService) SpringContextUtil.getBean(WODispatchDatabaseDisposalDBService.class);
  61. }
  62. public RolePowerDBService applyRolePowerApi() {return rolePowerDBService;}
  63. public PartitionInfoDBService applyPartitionApi() {return partitionInfoDBService;}
  64. public RoleInfoDBService applyRoleInfoApi() {return roleInfoDBService;}
  65. public UserDBService applyUserInfoApi() {return userDBService;}
  66. public FileAttachmentDBService applyFileAttachmentApi() {return fileAttachmentDBService;}
  67. public TypeDefineDBService applyTypeDefineApi() { return typeDefineDBService; }
  68. public TestGeomInfoDBService applyTestGeomApi() {return testGeomInfoDBService;}
  69. public WaterTapWaterService applyWaterTapWaterService() {return waterTapWaterService;}
  70. public WaterCollecationService applyWaterCollecationService() {return waterCollecationService;}
  71. public WODispatchPlanDBService applyWODispatchPlanApi() {return woDispatchPlanDBService;}
  72. public WODispatchCmdBatchItemDBService applyWODispatchItemApi() {return woDispatchCmdBatchItemDBService;}
  73. public WODispatchCmdInfoDBService applyWODispatchCmdApi() {return woDispatchCmdInfoDBService;}
  74. public WODispatchDatabaseDBService applyWODispatchDatabaseApi() {return woDispatchDatabaseDBService;}
  75. public WODispatchDatabaseDisposalDBService applyWODispatchDatabaseDisposalApi() {return woDispatchDatabaseDisposalDBService;}
  76. }