Revision 33538
Added by Eri Katsari over 9 years ago
StatsManager.java | ||
---|---|---|
19 | 19 |
|
20 | 20 |
private DataSource dataSource; |
21 | 21 |
|
22 |
private String portalUser; |
|
22 |
private CacheController prodCacheController; |
|
23 |
private CacheController testCacheController; |
|
23 | 24 |
|
24 |
private CacheController cacheController; |
|
25 |
|
|
26 | 25 |
private Logger log = Logger.getLogger(this.getClass()); |
27 | 26 |
|
28 | 27 |
public StatsManager() { |
29 |
|
|
28 |
|
|
30 | 29 |
} |
31 | 30 |
|
32 | 31 |
|
... | ... | |
56 | 55 |
public void executeCacheAction(BlackboardJob job) throws Exception { |
57 | 56 |
|
58 | 57 |
if (job.getAction().equals("refreshCache")) { |
59 |
log.info("Executing " + job.getAction() + "..."); |
|
60 |
cacheController.executeCommand(job.getParameters().get("cacheURL"), "refreshAll",job.getParameters().get("username"),job.getParameters().get("password"));
|
|
58 |
|
|
59 |
executeCommand("refreshAll", job.getParameters().get("cache"));
|
|
61 | 60 |
} else if (job.getAction().equals("refreshCharts")) { |
62 |
log.info("Executing " + job.getAction() + "..."); |
|
63 |
cacheController.executeCommand(job.getParameters().get("cacheURL"), job.getAction(),job.getParameters().get("username"),job.getParameters().get("password"));
|
|
61 |
|
|
62 |
executeCommand(job.getAction(), job.getParameters().get("cache"));
|
|
64 | 63 |
} else if (job.getAction().equals("refreshNums")) { |
65 |
log.info("Executing " + job.getAction() + "..."); |
|
66 |
cacheController.executeCommand(job.getParameters().get("cacheURL"), job.getAction(),job.getParameters().get("username"),job.getParameters().get("password"));
|
|
64 |
|
|
65 |
executeCommand(job.getAction(), job.getParameters().get("cache"));
|
|
67 | 66 |
} else if (job.getAction().equals("promoteShadow")) { |
68 |
log.info("Executing " + job.getAction() + "..."); |
|
69 |
cacheController.executeCommand(job.getParameters().get("cacheURL"), "promoteAll",job.getParameters().get("username"),job.getParameters().get("password"));
|
|
67 |
|
|
68 |
executeCommand("promoteAll", job.getParameters().get("cache"));
|
|
70 | 69 |
this.promoteShadowSchema(); |
70 |
|
|
71 | 71 |
} else if (job.getAction().equals("promoteNums")) { |
72 |
log.info("Executing " + job.getAction() + "..."); |
|
73 |
cacheController.executeCommand(job.getParameters().get("cacheURL"), job.getAction(),job.getParameters().get("username"),job.getParameters().get("password"));
|
|
72 |
|
|
73 |
executeCommand(job.getAction(), job.getParameters().get("cache"));
|
|
74 | 74 |
} else if (job.getAction().equals("promoteCharts")) { |
75 |
log.info("Executing " + job.getAction() + "..."); |
|
76 |
cacheController.executeCommand(job.getParameters().get("cacheURL"), job.getAction(),job.getParameters().get("username"),job.getParameters().get("password"));
|
|
75 |
|
|
76 |
executeCommand(job.getAction(), job.getParameters().get("cache"));
|
|
77 | 77 |
} else if (job.getAction().equals("promoteCache")) { |
78 |
log.info("Executing " + job.getAction() + "..."); |
|
79 |
cacheController.executeCommand(job.getParameters().get("cacheURL"), "promoteAll",job.getParameters().get("username"),job.getParameters().get("password"));
|
|
78 |
|
|
79 |
executeCommand("promoteAll", job.getParameters().get("cache"));
|
|
80 | 80 |
} else if (job.getAction().equals("restore")) { |
81 |
log.info("Executing " + job.getAction() + "..."); |
|
82 |
cacheController.executeCommand(job.getParameters().get("cacheURL"), job.getAction(),job.getParameters().get("username"),job.getParameters().get("password"));
|
|
81 |
|
|
82 |
executeCommand(job.getAction(), job.getParameters().get("cache"));
|
|
83 | 83 |
} else if (job.getAction().equals("migrate")) { |
84 |
log.info("Executing " + job.getAction() + "..."); |
|
85 |
cacheController.executeCommand(job.getParameters().get("cacheURL"), job.getAction(),job.getParameters().get("username"),job.getParameters().get("password"));
|
|
84 |
|
|
85 |
executeCommand(job.getAction(), job.getParameters().get("cache"));
|
|
86 | 86 |
} else if (job.getAction().equals("backup")) { |
87 |
log.info("Executing " + job.getAction() + "..."); |
|
88 |
cacheController.executeCommand(job.getParameters().get("cacheURL"), job.getAction(),job.getParameters().get("username"),job.getParameters().get("password")); |
|
89 | 87 |
|
88 |
executeCommand(job.getAction(), job.getParameters().get("cache")); |
|
89 |
|
|
90 | 90 |
} |
91 |
|
|
91 | 92 |
/* else if (job.getAction().equals("updateCacheURL")) |
92 | 93 |
{ |
93 | 94 |
log.info("Executing " + job.getAction() + "..."); |
94 | 95 |
cacheController.updateCacheURL(job.getParameters().get("cacheURL")); |
95 | 96 |
}*/ |
97 |
|
|
96 | 98 |
else { |
97 | 99 |
log.error("Wrong action given "); |
98 | 100 |
throw new Exception("Wrong action given "); |
99 | 101 |
} |
102 |
log.info("Done ! "); |
|
103 |
} |
|
100 | 104 |
|
105 |
private void executeCommand(String action, String cache) throws Exception { |
|
106 |
|
|
107 |
|
|
108 |
log.info("Executing action " + action + " in " + cache + "..."); |
|
109 |
if (cache == null || cache.contains("test")) { |
|
110 |
testCacheController.executeCommand(action); |
|
111 |
} else if (cache.contains("beta") || (cache.contains("production"))) { |
|
112 |
prodCacheController.executeCommand(action); |
|
113 |
} else { |
|
114 |
throw new Exception("Wrong cache id"); |
|
115 |
} |
|
101 | 116 |
} |
102 | 117 |
|
103 |
|
|
104 | 118 |
public DataSource getDataSource() { |
105 | 119 |
return dataSource; |
106 | 120 |
} |
... | ... | |
110 | 124 |
} |
111 | 125 |
|
112 | 126 |
|
113 |
public String getPortalUser() { |
|
114 |
return portalUser; |
|
115 |
} |
|
116 |
|
|
117 |
public void setPortalUser(String portalUser) { |
|
118 |
this.portalUser = portalUser; |
|
119 |
} |
|
120 |
|
|
121 |
|
|
122 |
public CacheController getCacheController() { |
|
123 |
return cacheController; |
|
124 |
} |
|
125 |
|
|
126 |
public void setCacheController(CacheController cacheController) { |
|
127 |
this.cacheController = cacheController; |
|
128 |
} |
|
129 |
|
|
130 | 127 |
public Validator getValidator() { |
131 | 128 |
return validator; |
132 | 129 |
} |
... | ... | |
142 | 139 |
public void setValidationReport(ValidationReport validationReport) { |
143 | 140 |
this.validationReport = validationReport; |
144 | 141 |
} |
142 |
|
|
143 |
public CacheController getProdCacheController() { |
|
144 |
return prodCacheController; |
|
145 |
} |
|
146 |
|
|
147 |
public void setProdCacheController(CacheController prodCacheController) { |
|
148 |
this.prodCacheController = prodCacheController; |
|
149 |
} |
|
150 |
|
|
151 |
public CacheController getTestCacheController() { |
|
152 |
return testCacheController; |
|
153 |
} |
|
154 |
|
|
155 |
public void setTestCacheController(CacheController testCacheController) { |
|
156 |
this.testCacheController = testCacheController; |
|
157 |
} |
|
145 | 158 |
} |
Also available in: Unified diff