protected boolean started = false; //default 5 seconds
- protected HashMap fileFactories = new HashMap();
+ protected HashMap<String, FileMessageFactory> fileFactories =
+ new HashMap<String, FileMessageFactory>();
protected String deployDir;
*/
public void messageReceived(ClusterMessage msg) {
try {
- if (msg instanceof FileMessage && msg != null) {
+ if (msg instanceof FileMessage) {
FileMessage fmsg = (FileMessage) msg;
if (log.isDebugEnabled())
log.debug("receive cluster deployment [ path: "
removeFactory(fmsg);
}
}
- } else if (msg instanceof UndeployMessage && msg != null) {
+ } else if (msg instanceof UndeployMessage) {
try {
UndeployMessage umsg = (UndeployMessage) msg;
String path = umsg.getContextPath();
throws java.io.FileNotFoundException, java.io.IOException {
File tmpFile = new File(msg.getFileName());
File writeToFile = new File(getTempDir(), tmpFile.getName());
- FileMessageFactory factory = (FileMessageFactory) fileFactories.get(msg
- .getFileName());
+ FileMessageFactory factory = fileFactories.get(msg.getFileName());
if (factory == null) {
factory = FileMessageFactory.getInstance(writeToFile, true);
fileFactories.put(msg.getFileName(), factory);
} catch (Exception x) {
log.error("No removal", x);
}
- install(contextName, deployWar.toURL());
+ install(contextName, deployWar.toURI().toURL());
} catch (Exception x) {
log.error("Unable to install WAR file", x);
}
/**
* Currently deployed files
*/
- protected Map currentStatus = new HashMap();
+ protected Map<String, WarInfo> currentStatus =
+ new HashMap<String, WarInfo>();
/*--Constructor---------------------------------------------*/
}
//check all the status codes and update the FarmDeployer
- for (Iterator i = currentStatus.entrySet().iterator(); i.hasNext();) {
- Map.Entry entry = (Map.Entry) i.next();
- WarInfo info = (WarInfo) entry.getValue();
+ for (Iterator<Map.Entry<String,WarInfo>> i =
+ currentStatus.entrySet().iterator(); i.hasNext();) {
+ Map.Entry<String,WarInfo> entry = i.next();
+ WarInfo info = entry.getValue();
int check = info.check();
if (check == 1) {
listener.fileModified(info.getWar());
* @param warfile
*/
protected void addWarInfo(File warfile) {
- WarInfo info = (WarInfo) currentStatus.get(warfile.getAbsolutePath());
+ WarInfo info = currentStatus.get(warfile.getAbsolutePath());
if (info == null) {
info = new WarInfo(warfile);
info.setLastState(-1); //assume file is non existent