_localPluginInfos.clear();
_remotePluginInfos.clear();
monitor.beginTask("retrieving local resource states", IProgressMonitor.UNKNOWN);
IResource start = _runtime.getDesignRoot();
List<LocalFSDesignResourceState> localStates = buildFSDesignResourceStates(start, _runtime.getDesignRoot().getFullPath());
//print(localStates);
monitor.setTaskName("connecting to remote server '" + _server.getName() + "'.");
_server.connectToServer();
monitor.setTaskName("retrieving remote resouce states");
List<FSDesignResourceState> remoteStates = _server.getServices().retrieveFSDesignResourceState(_server.getSession(), computeRelativPathFromDesignRoot(start).toString());
// map states by path rooted to wga designroot
for (LocalFSDesignResourceState state : localStates) {
IPath path = new Path(state.getPath());
_localStates.put(path.makeRelative(), state);
}
for (FSDesignResourceState state : remoteStates) {
IPath path = new Path(state.getPath());
_remoteStates.put(path.makeRelative(), state);
}
// perform steps for plugin sync if runtime is started
if (TomcatUtils.getInstance().isRunning(_runtime)) {
monitor.beginTask("connecting to local WGA server", IProgressMonitor.UNKNOWN);
WGARemoteServer local = _runtime.createRemoteServer();
local.connectToServer();
Version localWGAVersion = null;
try {
monitor.beginTask("retrieving local WGA server version", IProgressMonitor.UNKNOWN);
localWGAVersion = local.getServices().getWGAVersion(local.getSession());
}
catch (Exception e) {
// this might happen if server version is < 5.3
}
try {
monitor.beginTask("retrieving remote WGA server version", IProgressMonitor.UNKNOWN);
_remoteWGAVersion = _server.getServices().getWGAVersion(_server.getSession());
}
catch (Exception e) {
// this might happen if server version is < 5.3
}
// check local and remote WGA version - plugin sync is available for WGA >= 5.3
if (localWGAVersion != null && localWGAVersion.isAtLeast(5, 3) && _remoteWGAVersion != null && _remoteWGAVersion.isAtLeast(5, 3)) {
monitor.beginTask("retrieving local plugin infos", IProgressMonitor.UNKNOWN);
List<PluginInfo> infos = local.getServices().getPluginInformation(local.getSession());
for (PluginInfo info : infos) {
// we will sync only active & valid plugins ... dev plugins & platform plugins are excluded
if (info.isActive() && info.isValid() && !info.isPlatformPlugin() && !info.isDeveloperPlugin()) {
IResource virtualPluginResource = buildVirtualPluginResource(_runtime, info);
_localPluginInfos.put(virtualPluginResource, info);
}
}
monitor.beginTask("retrieving remote plugin infos", IProgressMonitor.UNKNOWN);
infos = _server.getServices().getPluginInformation(_server.getSession());
for (PluginInfo info : infos) {
// we will sync only active & valid plugins ... dev plugins & platform plugins are excluded
if (info.isActive() && info.isValid() && !info.isPlatformPlugin() && !info.isDeveloperPlugin()) {
IResource virtualPluginResource = buildVirtualPluginResource(_runtime, info);
_remotePluginInfos.put(virtualPluginResource, info);
}
}
}
}