mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-27 19:05:38 +02:00
removing some compile warnings
This commit is contained in:
parent
e94377283d
commit
32d51439e3
51 changed files with 628 additions and 684 deletions
|
@ -137,7 +137,7 @@ public class LocalShellThread extends Thread
|
||||||
if (!_isWindows)
|
if (!_isWindows)
|
||||||
{
|
{
|
||||||
String[] envVars = getEnvironmentVariables(false);
|
String[] envVars = getEnvironmentVariables(false);
|
||||||
if (theShell == null)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
String property = "SHELL="; //$NON-NLS-1$
|
String property = "SHELL="; //$NON-NLS-1$
|
||||||
|
@ -191,41 +191,7 @@ public class LocalShellThread extends Thread
|
||||||
_theProcess = Runtime.getRuntime().exec(args[0], envVars, theDirectory);
|
_theProcess = Runtime.getRuntime().exec(args[0], envVars, theDirectory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (_isTTY)
|
|
||||||
{
|
|
||||||
if (_invocation.equals(">")) //$NON-NLS-1$
|
|
||||||
{
|
|
||||||
_invocation = theShell;
|
|
||||||
_isShell = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
String args[] = new String[4];
|
|
||||||
args[0] = PSEUDO_TERMINAL;
|
|
||||||
args[1] = theShell;
|
|
||||||
args[2] = "-c"; //$NON-NLS-1$
|
|
||||||
args[3] = _invocation;
|
|
||||||
|
|
||||||
_theProcess = Runtime.getRuntime().exec(args, envVars, theDirectory);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (_invocation.equals(">")) //$NON-NLS-1$
|
|
||||||
{
|
|
||||||
_invocation = theShell;
|
|
||||||
_isShell = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
String args[] = new String[3];
|
|
||||||
args[0] = theShell;
|
|
||||||
args[1] = "-c"; //$NON-NLS-1$
|
|
||||||
args[2] = _invocation;
|
|
||||||
|
|
||||||
_theProcess = Runtime.getRuntime().exec(args, envVars, theDirectory);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -353,7 +319,6 @@ public class LocalShellThread extends Thread
|
||||||
{
|
{
|
||||||
if (!_isDone)
|
if (!_isDone)
|
||||||
{
|
{
|
||||||
byte[] intoout = input.getBytes();
|
|
||||||
OutputStream output = _theProcess.getOutputStream();
|
OutputStream output = _theProcess.getOutputStream();
|
||||||
|
|
||||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output));
|
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output));
|
||||||
|
@ -464,7 +429,7 @@ public class LocalShellThread extends Thread
|
||||||
|
|
||||||
if (_theProcess != null)
|
if (_theProcess != null)
|
||||||
{
|
{
|
||||||
int exitcode;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_isCancelled)
|
if (_isCancelled)
|
||||||
|
@ -473,13 +438,12 @@ public class LocalShellThread extends Thread
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
exitcode = _theProcess.exitValue();
|
_theProcess.exitValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IllegalThreadStateException e)
|
catch (IllegalThreadStateException e)
|
||||||
{
|
{
|
||||||
//e.printStackTrace();
|
//e.printStackTrace();
|
||||||
exitcode = -1;
|
|
||||||
_theProcess.destroy();
|
_theProcess.destroy();
|
||||||
}
|
}
|
||||||
_theProcess = null;
|
_theProcess = null;
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class Activator extends Plugin {
|
||||||
public void logException(Throwable t) {
|
public void logException(Throwable t) {
|
||||||
ILog log = getLog();
|
ILog log = getLog();
|
||||||
String id = getBundle().getSymbolicName();
|
String id = getBundle().getSymbolicName();
|
||||||
IStatus status = new Status(IStatus.ERROR, id, 0, "Unexpected exception", t);
|
IStatus status = new Status(IStatus.ERROR, id, 0, "Unexpected exception", t); //$NON-NLS-1$
|
||||||
log.log(status);
|
log.log(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -64,7 +64,7 @@ public class LocalProcessService extends AbstractProcessService implements ILoca
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new SystemMessageException(getMessage("RSEPG1301"));
|
throw new SystemMessageException(getMessage("RSEPG1301")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return processes;
|
return processes;
|
||||||
}
|
}
|
||||||
|
@ -86,17 +86,17 @@ public class LocalProcessService extends AbstractProcessService implements ILoca
|
||||||
}
|
}
|
||||||
catch (InterruptedException e)
|
catch (InterruptedException e)
|
||||||
{
|
{
|
||||||
throw new SystemMessageException(getMessage("RSEG1067"));
|
throw new SystemMessageException(getMessage("RSEG1067")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
String name = "";
|
String name = ""; //$NON-NLS-1$
|
||||||
if (process != null) name += process.getName();
|
if (process != null) name += process.getName();
|
||||||
String pid = "";
|
String pid = ""; //$NON-NLS-1$
|
||||||
if (process != null) pid += process.getPid();
|
if (process != null) pid += process.getPid();
|
||||||
|
|
||||||
SystemMessage msg = getMessage("RSEPG1300");
|
SystemMessage msg = getMessage("RSEPG1300"); //$NON-NLS-1$
|
||||||
msg.makeSubstitution(name + " (" + pid + ")", e.getMessage());
|
msg.makeSubstitution(name + " (" + pid + ")", e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
throw new SystemMessageException(msg);
|
throw new SystemMessageException(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,22 +124,21 @@ public class LocalProcessService extends AbstractProcessService implements ILoca
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// use the kill command to find out the signal types
|
// use the kill command to find out the signal types
|
||||||
Process kill = Runtime.getRuntime().exec("kill -l");
|
Process kill = Runtime.getRuntime().exec("kill -l"); //$NON-NLS-1$
|
||||||
InputStreamReader isr = new InputStreamReader(kill.getInputStream());
|
InputStreamReader isr = new InputStreamReader(kill.getInputStream());
|
||||||
if (isr == null) return null;
|
|
||||||
BufferedReader reader = new BufferedReader(isr);
|
BufferedReader reader = new BufferedReader(isr);
|
||||||
if (reader == null) return null;
|
|
||||||
String nextLine = reader.readLine();
|
String nextLine = reader.readLine();
|
||||||
String output = "";
|
String output = ""; //$NON-NLS-1$
|
||||||
while (nextLine != null)
|
while (nextLine != null)
|
||||||
{
|
{
|
||||||
output = output + nextLine + "\n";
|
output = output + nextLine + "\n"; //$NON-NLS-1$
|
||||||
nextLine = reader.readLine();
|
nextLine = reader.readLine();
|
||||||
}
|
}
|
||||||
reader.close();
|
reader.close();
|
||||||
isr.close();
|
isr.close();
|
||||||
if (output.equals("")) throw new Exception();
|
if (output.equals("")) throw new Exception(); //$NON-NLS-1$
|
||||||
String[] lines = output.trim().split("\\s+");
|
String[] lines = output.trim().split("\\s+"); //$NON-NLS-1$
|
||||||
if (lines == null) throw new Exception();
|
if (lines == null) throw new Exception();
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,7 +235,7 @@ public class LocalSearchHandler implements ISearchHandler
|
||||||
|
|
||||||
// if it is not a file search, then call the handler search
|
// if it is not a file search, then call the handler search
|
||||||
// method
|
// method
|
||||||
if (!_isFileSearch)
|
if (!_isFileSearch && vc != null)
|
||||||
{
|
{
|
||||||
matches = vc.getHandler().search(vc.fullName, _stringMatcher);
|
matches = vc.getHandler().search(vc.fullName, _stringMatcher);
|
||||||
IHostSearchResult[] results = convert(file, matches);
|
IHostSearchResult[] results = convert(file, matches);
|
||||||
|
@ -469,7 +469,7 @@ public class LocalSearchHandler implements ISearchHandler
|
||||||
protected boolean doesClassificationMatch(String absolutePath)
|
protected boolean doesClassificationMatch(String absolutePath)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (_classificationString == null || _classificationString.equals(""))
|
if (_classificationString == null || _classificationString.equals("")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class LocalHostShell extends AbstractHostShell implements IHostShell
|
||||||
|
|
||||||
public void exit()
|
public void exit()
|
||||||
{
|
{
|
||||||
writeToShell("exit");
|
writeToShell("exit"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,14 +21,14 @@ public interface IServiceConstants
|
||||||
public static final String TOKEN_SEPARATOR = "|"; //$NON-NLS-1$
|
public static final String TOKEN_SEPARATOR = "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// Unexpected Error
|
// Unexpected Error
|
||||||
public static final String UNEXPECTED_ERROR = "unexpectedError";
|
public static final String UNEXPECTED_ERROR = "unexpectedError"; //$NON-NLS-1$
|
||||||
|
|
||||||
// Failure strings
|
// Failure strings
|
||||||
public static final String FAILED_WITH_EXIST = "failed with exist";
|
public static final String FAILED_WITH_EXIST = "failed with exist"; //$NON-NLS-1$
|
||||||
public static final String FAILED_WITH_DOES_NOT_EXIST = "failed with does not exist";
|
public static final String FAILED_WITH_DOES_NOT_EXIST = "failed with does not exist"; //$NON-NLS-1$
|
||||||
public static final String FAILED_WITH_EXCEPTION = "failed with exception";
|
public static final String FAILED_WITH_EXCEPTION = "failed with exception"; //$NON-NLS-1$
|
||||||
public static final String FAILED_WITH_SECURITY = "failed with security";
|
public static final String FAILED_WITH_SECURITY = "failed with security"; //$NON-NLS-1$
|
||||||
public static final String FAILED_TO_DELETE_DIR = "failed to delete directory";
|
public static final String FAILED_TO_DELETE_DIR = "failed to delete directory"; //$NON-NLS-1$
|
||||||
|
|
||||||
// Status strings for communication
|
// Status strings for communication
|
||||||
public static final String SUCCESS = "success"; //$NON-NLS-1$
|
public static final String SUCCESS = "success"; //$NON-NLS-1$
|
||||||
|
|
|
@ -178,7 +178,7 @@ public class NamePatternMatcher implements IMatcher
|
||||||
genericName = "*"; //$NON-NLS-1$
|
genericName = "*"; //$NON-NLS-1$
|
||||||
int len = 0;
|
int len = 0;
|
||||||
// determine if given a null name
|
// determine if given a null name
|
||||||
if ((genericName == null) || (genericName.length()==0))
|
if (genericName.length()==0)
|
||||||
validName = false;
|
validName = false;
|
||||||
else
|
else
|
||||||
validName = true; // for now
|
validName = true; // for now
|
||||||
|
|
|
@ -137,6 +137,7 @@ public class SystemEncodingUtil {
|
||||||
// determine which of UCS-4 or other supported 32-bit encodings applies.
|
// determine which of UCS-4 or other supported 32-bit encodings applies.
|
||||||
|
|
||||||
// UCS-4, big-endian order (1234 order)
|
// UCS-4, big-endian order (1234 order)
|
||||||
|
/* DKM - encodingGuess can only be null
|
||||||
else if (temp[0] == 0x00 && temp[1] == 0x00 && temp[2] == 0x00 && temp[3] == 0x3C) {
|
else if (temp[0] == 0x00 && temp[1] == 0x00 && temp[2] == 0x00 && temp[3] == 0x3C) {
|
||||||
encodingGuess = null;
|
encodingGuess = null;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +153,7 @@ public class SystemEncodingUtil {
|
||||||
else if (temp[0] == 0x00 && temp[1] == 0x3C && temp[2] == 0x00 && temp[3] == 0x00) {
|
else if (temp[0] == 0x00 && temp[1] == 0x3C && temp[2] == 0x00 && temp[3] == 0x00) {
|
||||||
encodingGuess = null;
|
encodingGuess = null;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// UTF-16BE or big-endian ISO-10646-UCS-2 or other encoding with a 16-bit code unit
|
// UTF-16BE or big-endian ISO-10646-UCS-2 or other encoding with a 16-bit code unit
|
||||||
// in big-endian order and ASCII characters encoded as ASCII values (the encoding
|
// in big-endian order and ASCII characters encoded as ASCII values (the encoding
|
||||||
|
@ -311,9 +312,7 @@ public class SystemEncodingUtil {
|
||||||
line = bufReader.readLine();
|
line = bufReader.readLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bufReader != null) {
|
bufReader.close();
|
||||||
bufReader.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the encoding declaration was not found
|
// if the encoding declaration was not found
|
||||||
if (encoding == null) {
|
if (encoding == null) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class AbsoluteVirtualPath
|
||||||
{
|
{
|
||||||
// no more nesting, this is the actual container archive.
|
// no more nesting, this is the actual container archive.
|
||||||
_absVirtualPath = absolutePath; // fix for defect 51898 and related defects
|
_absVirtualPath = absolutePath; // fix for defect 51898 and related defects
|
||||||
_virtualPart = "";
|
_virtualPart = ""; //$NON-NLS-1$
|
||||||
_realPartName = _absVirtualPath;
|
_realPartName = _absVirtualPath;
|
||||||
_realPart = this;
|
_realPart = this;
|
||||||
_isVirtual = false;
|
_isVirtual = false;
|
||||||
|
@ -112,7 +112,7 @@ public class AbsoluteVirtualPath
|
||||||
public void setVirtualPart(String newVirtualPart)
|
public void setVirtualPart(String newVirtualPart)
|
||||||
{
|
{
|
||||||
_virtualPart = newVirtualPart;
|
_virtualPart = newVirtualPart;
|
||||||
if (newVirtualPart == "")
|
if (newVirtualPart == "") //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
int i = _absVirtualPath.lastIndexOf(ArchiveHandlerManager.VIRTUAL_SEPARATOR);
|
int i = _absVirtualPath.lastIndexOf(ArchiveHandlerManager.VIRTUAL_SEPARATOR);
|
||||||
_absVirtualPath = _absVirtualPath.substring(0, i);
|
_absVirtualPath = _absVirtualPath.substring(0, i);
|
||||||
|
@ -126,12 +126,12 @@ public class AbsoluteVirtualPath
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return _absVirtualPath.substring(_absVirtualPath.lastIndexOf("/") + 1);
|
return _absVirtualPath.substring(_absVirtualPath.lastIndexOf("/") + 1); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPath()
|
public String getPath()
|
||||||
{
|
{
|
||||||
String path = _absVirtualPath.substring(0, _absVirtualPath.lastIndexOf("/"));
|
String path = _absVirtualPath.substring(0, _absVirtualPath.lastIndexOf("/")); //$NON-NLS-1$
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,8 @@ import java.util.HashMap;
|
||||||
public class ArchiveHandlerManager
|
public class ArchiveHandlerManager
|
||||||
{
|
{
|
||||||
// The string that separates the virtual part of an absolute path from the real part
|
// The string that separates the virtual part of an absolute path from the real part
|
||||||
public static final String VIRTUAL_SEPARATOR = "#virtual#/";
|
public static final String VIRTUAL_SEPARATOR = "#virtual#/"; //$NON-NLS-1$
|
||||||
public static final String VIRTUAL_CANONICAL_SEPARATOR = "#virtual#";
|
public static final String VIRTUAL_CANONICAL_SEPARATOR = "#virtual#"; //$NON-NLS-1$
|
||||||
|
|
||||||
// the singleton instance
|
// the singleton instance
|
||||||
protected static ArchiveHandlerManager _instance = new ArchiveHandlerManager();
|
protected static ArchiveHandlerManager _instance = new ArchiveHandlerManager();
|
||||||
|
@ -72,7 +72,7 @@ public class ArchiveHandlerManager
|
||||||
*/
|
*/
|
||||||
public VirtualChild[] getContents(File file, String virtualpath) throws IOException
|
public VirtualChild[] getContents(File file, String virtualpath) throws IOException
|
||||||
{
|
{
|
||||||
if (virtualpath == null) virtualpath = "";
|
if (virtualpath == null) virtualpath = ""; //$NON-NLS-1$
|
||||||
ISystemArchiveHandler handler = getRegisteredHandler(file);
|
ISystemArchiveHandler handler = getRegisteredHandler(file);
|
||||||
if (handler == null || !handler.exists()) throw new IOException();
|
if (handler == null || !handler.exists()) throw new IOException();
|
||||||
return handler.getVirtualChildren(virtualpath);
|
return handler.getVirtualChildren(virtualpath);
|
||||||
|
@ -90,7 +90,7 @@ public class ArchiveHandlerManager
|
||||||
*/
|
*/
|
||||||
public VirtualChild[] getFolderContents(File file, String virtualpath)
|
public VirtualChild[] getFolderContents(File file, String virtualpath)
|
||||||
{
|
{
|
||||||
if (virtualpath == null) virtualpath = "";
|
if (virtualpath == null) virtualpath = ""; //$NON-NLS-1$
|
||||||
ISystemArchiveHandler handler = getRegisteredHandler(file);
|
ISystemArchiveHandler handler = getRegisteredHandler(file);
|
||||||
if (handler == null) return null;
|
if (handler == null) return null;
|
||||||
return handler.getVirtualChildFolders(virtualpath);
|
return handler.getVirtualChildFolders(virtualpath);
|
||||||
|
@ -148,8 +148,8 @@ public class ArchiveHandlerManager
|
||||||
protected String getExtension(File file)
|
protected String getExtension(File file)
|
||||||
{
|
{
|
||||||
String filename = file.getName();
|
String filename = file.getName();
|
||||||
int i = filename.lastIndexOf(".");
|
int i = filename.lastIndexOf("."); //$NON-NLS-1$
|
||||||
if (i == -1) return "";
|
if (i == -1) return ""; //$NON-NLS-1$
|
||||||
return filename.substring(i+1).toLowerCase();
|
return filename.substring(i+1).toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,8 +161,8 @@ public class ArchiveHandlerManager
|
||||||
*/
|
*/
|
||||||
protected String getExtension(String filename)
|
protected String getExtension(String filename)
|
||||||
{
|
{
|
||||||
int i = filename.lastIndexOf(".");
|
int i = filename.lastIndexOf("."); //$NON-NLS-1$
|
||||||
if (i == -1) return "";
|
if (i == -1) return ""; //$NON-NLS-1$
|
||||||
return filename.substring(i+1).toLowerCase();
|
return filename.substring(i+1).toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ public class ArchiveHandlerManager
|
||||||
{
|
{
|
||||||
String cleanName = cleanUpVirtualPath(fullyQualifiedName);
|
String cleanName = cleanUpVirtualPath(fullyQualifiedName);
|
||||||
AbsoluteVirtualPath avp = new AbsoluteVirtualPath(cleanName);
|
AbsoluteVirtualPath avp = new AbsoluteVirtualPath(cleanName);
|
||||||
if (!avp.isVirtual()) return new VirtualChild("", new File(avp.getContainingArchiveString()));
|
if (!avp.isVirtual()) return new VirtualChild("", new File(avp.getContainingArchiveString())); //$NON-NLS-1$
|
||||||
String zipfile = avp.getContainingArchiveString();
|
String zipfile = avp.getContainingArchiveString();
|
||||||
File file = new File(zipfile);
|
File file = new File(zipfile);
|
||||||
ISystemArchiveHandler handler = getRegisteredHandler(file);
|
ISystemArchiveHandler handler = getRegisteredHandler(file);
|
||||||
|
@ -227,14 +227,14 @@ public class ArchiveHandlerManager
|
||||||
//Throwable target = e.getCause();
|
//Throwable target = e.getCause();
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.out.println("Could not instantiate handler for " + file.getName());
|
System.out.println("Could not instantiate handler for " + file.getName()); //$NON-NLS-1$
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
System.out.println("Could not instantiate handler for " + file.getName());
|
System.out.println("Could not instantiate handler for " + file.getName()); //$NON-NLS-1$
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
_handlers.put(file, handler);
|
_handlers.put(file, handler);
|
||||||
|
@ -272,8 +272,8 @@ public class ArchiveHandlerManager
|
||||||
{
|
{
|
||||||
if (!handlerHasProperConstructor(handlerType))
|
if (!handlerHasProperConstructor(handlerType))
|
||||||
{
|
{
|
||||||
System.out.println("Cannot register archive handler " + handlerType);
|
System.out.println("Cannot register archive handler " + handlerType); //$NON-NLS-1$
|
||||||
System.out.println(handlerType + " does not contain a constructor whose signature is 'Constructor(File file)'");
|
System.out.println(handlerType + " does not contain a constructor whose signature is 'Constructor(File file)'"); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (handlerImplementsISystemArchiveHandler(handlerType))
|
if (handlerImplementsISystemArchiveHandler(handlerType))
|
||||||
|
@ -284,8 +284,8 @@ public class ArchiveHandlerManager
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
System.out.println("Cannot register archive handler " + handlerType);
|
System.out.println("Cannot register archive handler " + handlerType); //$NON-NLS-1$
|
||||||
System.out.println("Neither " + handlerType + ", nor any of its superclasses implements ISystemArchiveHandler.");
|
System.out.println("Neither " + handlerType + ", nor any of its superclasses implements ISystemArchiveHandler."); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -361,8 +361,8 @@ public class ArchiveHandlerManager
|
||||||
public static String cleanUpVirtualPath(String fullVirtualName)
|
public static String cleanUpVirtualPath(String fullVirtualName)
|
||||||
{
|
{
|
||||||
int j = fullVirtualName.indexOf(VIRTUAL_CANONICAL_SEPARATOR);
|
int j = fullVirtualName.indexOf(VIRTUAL_CANONICAL_SEPARATOR);
|
||||||
if (j == -1 && fullVirtualName.indexOf(":") != -1) return fullVirtualName;
|
if (j == -1 && fullVirtualName.indexOf(":") != -1) return fullVirtualName; //$NON-NLS-1$
|
||||||
String realPart = "";
|
String realPart = ""; //$NON-NLS-1$
|
||||||
String newPath = fullVirtualName;
|
String newPath = fullVirtualName;
|
||||||
if (j != -1)
|
if (j != -1)
|
||||||
{
|
{
|
||||||
|
@ -373,16 +373,16 @@ public class ArchiveHandlerManager
|
||||||
newPath = newPath.replace('\\', '/');
|
newPath = newPath.replace('\\', '/');
|
||||||
|
|
||||||
//get rid of any double slashes
|
//get rid of any double slashes
|
||||||
int i = newPath.indexOf("//");
|
int i = newPath.indexOf("//"); //$NON-NLS-1$
|
||||||
while (i != -1)
|
while (i != -1)
|
||||||
{
|
{
|
||||||
newPath = newPath.substring(0,i) + newPath.substring(i+1);
|
newPath = newPath.substring(0,i) + newPath.substring(i+1);
|
||||||
i = newPath.indexOf("//");
|
i = newPath.indexOf("//"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
// get rid of any leading or trailing slashes
|
// get rid of any leading or trailing slashes
|
||||||
if (j != -1 && newPath.startsWith("/")) newPath = newPath.substring(1);
|
if (j != -1 && newPath.startsWith("/")) newPath = newPath.substring(1); //$NON-NLS-1$
|
||||||
if (newPath.endsWith("/")) newPath = newPath.substring(0, newPath.length() - 1);
|
if (newPath.endsWith("/")) newPath = newPath.substring(0, newPath.length() - 1); //$NON-NLS-1$
|
||||||
return realPart + newPath;
|
return realPart + newPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,8 +398,8 @@ public class ArchiveHandlerManager
|
||||||
{
|
{
|
||||||
if (!isRegisteredArchive(newFile.getName()))
|
if (!isRegisteredArchive(newFile.getName()))
|
||||||
{
|
{
|
||||||
System.out.println("Could not create new archive.");
|
System.out.println("Could not create new archive."); //$NON-NLS-1$
|
||||||
System.out.println(newFile + " is not a registered type of archive.");
|
System.out.println(newFile + " is not a registered type of archive."); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,14 +407,14 @@ public class ArchiveHandlerManager
|
||||||
{
|
{
|
||||||
if (!newFile.isFile())
|
if (!newFile.isFile())
|
||||||
{
|
{
|
||||||
System.out.println("Could not create new archive.");
|
System.out.println("Could not create new archive."); //$NON-NLS-1$
|
||||||
System.out.println(newFile + " is not a file.");
|
System.out.println(newFile + " is not a file."); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!newFile.delete())
|
if (!newFile.delete())
|
||||||
{
|
{
|
||||||
System.out.println("Could not create new archive.");
|
System.out.println("Could not create new archive."); //$NON-NLS-1$
|
||||||
System.out.println(newFile + " could not be deleted.");
|
System.out.println(newFile + " could not be deleted."); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -423,14 +423,14 @@ public class ArchiveHandlerManager
|
||||||
{
|
{
|
||||||
if (!newFile.createNewFile())
|
if (!newFile.createNewFile())
|
||||||
{
|
{
|
||||||
System.out.println("Could not create new archive.");
|
System.out.println("Could not create new archive."); //$NON-NLS-1$
|
||||||
System.out.println(newFile + " could not be created.");
|
System.out.println(newFile + " could not be created."); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
System.out.println("Could not create new archive.");
|
System.out.println("Could not create new archive."); //$NON-NLS-1$
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -457,7 +457,7 @@ public class ArchiveHandlerManager
|
||||||
public String getComment(File archive)
|
public String getComment(File archive)
|
||||||
{
|
{
|
||||||
ISystemArchiveHandler handler = getRegisteredHandler(archive);
|
ISystemArchiveHandler handler = getRegisteredHandler(archive);
|
||||||
if (handler == null || !handler.exists()) return "";
|
if (handler == null || !handler.exists()) return ""; //$NON-NLS-1$
|
||||||
return handler.getArchiveComment();
|
return handler.getArchiveComment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,15 +24,15 @@ public interface ISystemArchiveHandlerConstants {
|
||||||
/**
|
/**
|
||||||
* Zip archive extension, "zip".
|
* Zip archive extension, "zip".
|
||||||
*/
|
*/
|
||||||
public static final String ZIP_ARCHIVE_EXTENSION = "zip";
|
public static final String ZIP_ARCHIVE_EXTENSION = "zip"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Jar archive extension, "jar".
|
* Jar archive extension, "jar".
|
||||||
*/
|
*/
|
||||||
public static final String JAR_ARCHIVE_EXTENSION = "jar";
|
public static final String JAR_ARCHIVE_EXTENSION = "jar"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tar archive extension, "tar".
|
* Tar archive extension, "tar".
|
||||||
*/
|
*/
|
||||||
public static final String TAR_ARCHIVE_EXTENSION = "tar";
|
public static final String TAR_ARCHIVE_EXTENSION = "tar"; //$NON-NLS-1$
|
||||||
}
|
}
|
|
@ -91,17 +91,17 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
|
|
||||||
VirtualFileNode parentNode = rootNode;
|
VirtualFileNode parentNode = rootNode;
|
||||||
|
|
||||||
int idx = path.indexOf("/");
|
int idx = path.indexOf("/"); //$NON-NLS-1$
|
||||||
String name = path;
|
String name = path;
|
||||||
|
|
||||||
String segPath = "";
|
String segPath = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
// ensure each segment exists or is created if it does not exist
|
// ensure each segment exists or is created if it does not exist
|
||||||
while (idx > 0) {
|
while (idx > 0) {
|
||||||
name = path.substring(0, idx);
|
name = path.substring(0, idx);
|
||||||
path = path.substring(idx+1);
|
path = path.substring(idx+1);
|
||||||
|
|
||||||
segPath = segPath + name + "/";
|
segPath = segPath + name + "/"; //$NON-NLS-1$
|
||||||
|
|
||||||
boolean exists = parentNode.childExists(name);
|
boolean exists = parentNode.childExists(name);
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
// the new parent is the child (which may have been created)
|
// the new parent is the child (which may have been created)
|
||||||
parentNode = parentNode.getChild(name);
|
parentNode = parentNode.getChild(name);
|
||||||
|
|
||||||
idx = path.indexOf("/");
|
idx = path.indexOf("/"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
parentNode.addChild(path, new VirtualFileNode(entry), replace);
|
parentNode.addChild(path, new VirtualFileNode(entry), replace);
|
||||||
|
@ -291,7 +291,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
*/
|
*/
|
||||||
private VirtualFileNode getNode(String path) {
|
private VirtualFileNode getNode(String path) {
|
||||||
|
|
||||||
if (path.equals("")) {
|
if (path.equals("")) { //$NON-NLS-1$
|
||||||
return rootNode;
|
return rootNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -667,7 +667,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
// only add those entries that have names that begin with the parent name
|
// only add those entries that have names that begin with the parent name
|
||||||
// also check that the entry name isn't just the parent name + '/' (i.e. still the same
|
// also check that the entry name isn't just the parent name + '/' (i.e. still the same
|
||||||
// as the parent)
|
// as the parent)
|
||||||
if (entry.getName().startsWith(parent) && !entry.getName().equals(parent + "/")) {
|
if (entry.getName().startsWith(parent) && !entry.getName().equals(parent + "/")) { //$NON-NLS-1$
|
||||||
VirtualChild child = new VirtualChild(this, entry.getName());
|
VirtualChild child = new VirtualChild(this, entry.getName());
|
||||||
child.isDirectory = entry.isDirectory();
|
child.isDirectory = entry.isDirectory();
|
||||||
v.add(child);
|
v.add(child);
|
||||||
|
@ -726,7 +726,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
|
|
||||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||||
|
|
||||||
if (fullVirtualName == null || fullVirtualName.equals("")) {
|
if (fullVirtualName == null || fullVirtualName.equals("")) { //$NON-NLS-1$
|
||||||
return new VirtualChild(this);
|
return new VirtualChild(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -756,7 +756,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
|
|
||||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||||
|
|
||||||
if (fullVirtualName == null || fullVirtualName.equals("")) {
|
if (fullVirtualName == null || fullVirtualName.equals("")) { //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -949,7 +949,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
|
|
||||||
if (destination == null) {
|
if (destination == null) {
|
||||||
|
|
||||||
if (fullVirtualName.equals("")) {
|
if (fullVirtualName.equals("")) { //$NON-NLS-1$
|
||||||
destination = destinationParent;
|
destination = destinationParent;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1011,8 +1011,8 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
if (!file.isDirectory()) {
|
if (!file.isDirectory()) {
|
||||||
|
|
||||||
// if it exists, call replace
|
// if it exists, call replace
|
||||||
if (exists(virtualPath + "/" + name)) {
|
if (exists(virtualPath + "/" + name)) { //$NON-NLS-1$
|
||||||
return replace(virtualPath + "/" + name, file, name);
|
return replace(virtualPath + "/" + name, file, name); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
File[] files = new File[1];
|
File[] files = new File[1];
|
||||||
|
@ -1035,16 +1035,16 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
newNames[i] = sources[i].getAbsolutePath().substring(charsToTrim);
|
newNames[i] = sources[i].getAbsolutePath().substring(charsToTrim);
|
||||||
newNames[i] = newNames[i].replace('\\','/');
|
newNames[i] = newNames[i].replace('\\','/');
|
||||||
|
|
||||||
if (sources[i].isDirectory() && !newNames[i].endsWith("/")) {
|
if (sources[i].isDirectory() && !newNames[i].endsWith("/")) { //$NON-NLS-1$
|
||||||
newNames[i] = newNames[i] + "/";
|
newNames[i] = newNames[i] + "/"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sources[numOfChildren] = file;
|
sources[numOfChildren] = file;
|
||||||
newNames[numOfChildren] = name;
|
newNames[numOfChildren] = name;
|
||||||
|
|
||||||
if (!newNames[numOfChildren].endsWith("/")) {
|
if (!newNames[numOfChildren].endsWith("/")) { //$NON-NLS-1$
|
||||||
newNames[numOfChildren] = newNames[numOfChildren] + "/";
|
newNames[numOfChildren] = newNames[numOfChildren] + "/"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
return add(sources, virtualPath, newNames);
|
return add(sources, virtualPath, newNames);
|
||||||
|
@ -1097,15 +1097,15 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
// if the entry already exists, then we should do a replace
|
// if the entry already exists, then we should do a replace
|
||||||
// TODO (KM): should we simply replace and return?
|
// TODO (KM): should we simply replace and return?
|
||||||
// I think we should check each entry and replace or create for each one
|
// I think we should check each entry and replace or create for each one
|
||||||
if (exists(virtualPath + "/" + names[i])) {
|
if (exists(virtualPath + "/" + names[i])) { //$NON-NLS-1$
|
||||||
return replace(virtualPath + "/" + names[i], files[i], names[i]);
|
return replace(virtualPath + "/" + names[i], files[i], names[i]); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// open a new temp file which will be our destination for the new tar file
|
// open a new temp file which will be our destination for the new tar file
|
||||||
File outFile = new File(file.getAbsolutePath() + "temp");
|
File outFile = new File(file.getAbsolutePath() + "temp"); //$NON-NLS-1$
|
||||||
TarOutputStream outStream = new TarOutputStream(new FileOutputStream(outFile));
|
TarOutputStream outStream = new TarOutputStream(new FileOutputStream(outFile));
|
||||||
|
|
||||||
// get all the entries in the current tar
|
// get all the entries in the current tar
|
||||||
|
@ -1119,7 +1119,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
// for each new file to add
|
// for each new file to add
|
||||||
for (int i = 0; i < numFiles; i++) {
|
for (int i = 0; i < numFiles; i++) {
|
||||||
|
|
||||||
String childVirtualPath = virtualPath + "/" + names[i];
|
String childVirtualPath = virtualPath + "/" + names[i]; //$NON-NLS-1$
|
||||||
|
|
||||||
TarEntry newEntry = createTarEntry(files[i], childVirtualPath);
|
TarEntry newEntry = createTarEntry(files[i], childVirtualPath);
|
||||||
|
|
||||||
|
@ -1177,7 +1177,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
if (children[i].isDirectory) {
|
if (children[i].isDirectory) {
|
||||||
|
|
||||||
// include a '/' at the end, since it is a directory
|
// include a '/' at the end, since it is a directory
|
||||||
TarEntry nextEntry = tarFile.getEntry(children[i].fullName + "/");
|
TarEntry nextEntry = tarFile.getEntry(children[i].fullName + "/"); //$NON-NLS-1$
|
||||||
|
|
||||||
// put the entry
|
// put the entry
|
||||||
outStream.putNextEntry(nextEntry);
|
outStream.putNextEntry(nextEntry);
|
||||||
|
@ -1263,14 +1263,14 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
// if directory, end with a '/'
|
// if directory, end with a '/'
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
|
|
||||||
if (!fullName.endsWith("/")) {
|
if (!fullName.endsWith("/")) { //$NON-NLS-1$
|
||||||
fullName = fullName + "/";
|
fullName = fullName + "/"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// strip out leading '/'
|
// strip out leading '/'
|
||||||
// TODO (KM): Why?
|
// TODO (KM): Why?
|
||||||
if (fullName.startsWith("/")) {
|
if (fullName.startsWith("/")) { //$NON-NLS-1$
|
||||||
fullName = fullName.substring(1);
|
fullName = fullName.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1291,7 +1291,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
entry.setModificationTime(lastModified);
|
entry.setModificationTime(lastModified);
|
||||||
|
|
||||||
// set the user name
|
// set the user name
|
||||||
String userName = System.getProperty("user.name");
|
String userName = System.getProperty("user.name"); //$NON-NLS-1$
|
||||||
|
|
||||||
if (userName != null) {
|
if (userName != null) {
|
||||||
entry.setUserName(userName);
|
entry.setUserName(userName);
|
||||||
|
@ -1316,18 +1316,14 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// if security manager successfully created, check permission
|
// if security manager successfully created, check permission
|
||||||
if (sm != null) {
|
|
||||||
|
|
||||||
// create a file permission to check execute
|
// create a file permission to check execute
|
||||||
FilePermission permission = new FilePermission(file.getAbsolutePath(), "execute");
|
FilePermission permission = new FilePermission(file.getAbsolutePath(), "execute"); //$NON-NLS-1$
|
||||||
|
|
||||||
// this call will throw a SecurityException if permission does not exist
|
// this call will throw a SecurityException if permission does not exist
|
||||||
sm.checkPermission(permission);
|
sm.checkPermission(permission);
|
||||||
canExecute = true;
|
canExecute = true;
|
||||||
}
|
|
||||||
else {
|
|
||||||
canExecute = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch(SecurityException e) {
|
catch(SecurityException e) {
|
||||||
canExecute = false;
|
canExecute = false;
|
||||||
|
@ -1361,14 +1357,14 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
// if directory, end with a '/'
|
// if directory, end with a '/'
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
|
|
||||||
if (!fullName.endsWith("/")) {
|
if (!fullName.endsWith("/")) { //$NON-NLS-1$
|
||||||
fullName = fullName + "/";
|
fullName = fullName + "/"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// strip out leading '/'
|
// strip out leading '/'
|
||||||
// TODO (KM): Why?
|
// TODO (KM): Why?
|
||||||
if (fullName.startsWith("/")) {
|
if (fullName.startsWith("/")) { //$NON-NLS-1$
|
||||||
fullName = fullName.substring(1);
|
fullName = fullName.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1418,7 +1414,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
String name = file.getAbsolutePath();
|
String name = file.getAbsolutePath();
|
||||||
|
|
||||||
// create a temp file (in case something goes wrong)
|
// create a temp file (in case something goes wrong)
|
||||||
File tempFile = new File(name + ".old");
|
File tempFile = new File(name + ".old"); //$NON-NLS-1$
|
||||||
|
|
||||||
// rename current file to tempFile
|
// rename current file to tempFile
|
||||||
file.renameTo(tempFile);
|
file.renameTo(tempFile);
|
||||||
|
@ -1472,7 +1468,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// open a new temp file which will be our destination for the new tar file
|
// open a new temp file which will be our destination for the new tar file
|
||||||
File outFile = new File(getArchive().getAbsolutePath() + "temp");
|
File outFile = new File(getArchive().getAbsolutePath() + "temp"); //$NON-NLS-1$
|
||||||
|
|
||||||
TarOutputStream outStream = new TarOutputStream(new FileOutputStream(outFile));
|
TarOutputStream outStream = new TarOutputStream(new FileOutputStream(outFile));
|
||||||
|
|
||||||
|
@ -1491,19 +1487,19 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
// now append the new file to the tar
|
// now append the new file to the tar
|
||||||
String parentVirtualPath = null;
|
String parentVirtualPath = null;
|
||||||
|
|
||||||
int i = fullVirtualName.lastIndexOf("/");
|
int i = fullVirtualName.lastIndexOf("/"); //$NON-NLS-1$
|
||||||
|
|
||||||
// if the virtual name has no '/', then we will replace it with the
|
// if the virtual name has no '/', then we will replace it with the
|
||||||
// new name
|
// new name
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
parentVirtualPath = "";
|
parentVirtualPath = ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
// otherwise, we get the parent path to which the new name will be appended
|
// otherwise, we get the parent path to which the new name will be appended
|
||||||
else {
|
else {
|
||||||
parentVirtualPath = fullVirtualName.substring(0, i);
|
parentVirtualPath = fullVirtualName.substring(0, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
String virtualPath = parentVirtualPath + "/" + name;
|
String virtualPath = parentVirtualPath + "/" + name; //$NON-NLS-1$
|
||||||
|
|
||||||
// get the existing entry for the file
|
// get the existing entry for the file
|
||||||
TarFile tarFile = getTarFile();
|
TarFile tarFile = getTarFile();
|
||||||
|
@ -1568,7 +1564,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// open a new temp file which will be our destination for the new tar file
|
// open a new temp file which will be our destination for the new tar file
|
||||||
File outFile = new File(file.getAbsolutePath() + "temp");
|
File outFile = new File(file.getAbsolutePath() + "temp"); //$NON-NLS-1$
|
||||||
TarOutputStream outStream = new TarOutputStream(new FileOutputStream(outFile));
|
TarOutputStream outStream = new TarOutputStream(new FileOutputStream(outFile));
|
||||||
|
|
||||||
// get all the entries in the current tar
|
// get all the entries in the current tar
|
||||||
|
@ -1613,7 +1609,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
*/
|
*/
|
||||||
public boolean rename(String fullVirtualName, String newName) {
|
public boolean rename(String fullVirtualName, String newName) {
|
||||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||||
int i = fullVirtualName.lastIndexOf("/");
|
int i = fullVirtualName.lastIndexOf("/"); //$NON-NLS-1$
|
||||||
|
|
||||||
// if the original does not have any separator, simply rename it.
|
// if the original does not have any separator, simply rename it.
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
|
@ -1633,11 +1629,11 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||||
destinationVirtualPath = ArchiveHandlerManager.cleanUpVirtualPath(destinationVirtualPath);
|
destinationVirtualPath = ArchiveHandlerManager.cleanUpVirtualPath(destinationVirtualPath);
|
||||||
|
|
||||||
int i = fullVirtualName.lastIndexOf("/");
|
int i = fullVirtualName.lastIndexOf("/"); //$NON-NLS-1$
|
||||||
|
|
||||||
// if the original does not have any separator, simply append it to the destination path.
|
// if the original does not have any separator, simply append it to the destination path.
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
return fullRename(fullVirtualName, destinationVirtualPath + "/" + fullVirtualName);
|
return fullRename(fullVirtualName, destinationVirtualPath + "/" + fullVirtualName); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
// otherwise, get the last segment (the name) and append that to the destination path.
|
// otherwise, get the last segment (the name) and append that to the destination path.
|
||||||
else {
|
else {
|
||||||
|
@ -1672,7 +1668,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// open a new temp file which will be our destination for the new tar file
|
// open a new temp file which will be our destination for the new tar file
|
||||||
File outFile = new File(file.getAbsolutePath() + "temp");
|
File outFile = new File(file.getAbsolutePath() + "temp"); //$NON-NLS-1$
|
||||||
TarOutputStream outStream = new TarOutputStream(new FileOutputStream(outFile));
|
TarOutputStream outStream = new TarOutputStream(new FileOutputStream(outFile));
|
||||||
|
|
||||||
// get all the entries
|
// get all the entries
|
||||||
|
@ -1689,7 +1685,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
|
|
||||||
// add the entry itself to the rename list
|
// add the entry itself to the rename list
|
||||||
// include '/' in both the old name and the new name since it is a directory
|
// include '/' in both the old name and the new name since it is a directory
|
||||||
names.put(fullVirtualName + "/", newFullVirtualName + "/");
|
names.put(fullVirtualName + "/", newFullVirtualName + "/"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
// get all the children of the entry to be renamed
|
// get all the children of the entry to be renamed
|
||||||
VirtualChild[] childrenArray = getVirtualChildrenList(fullVirtualName);
|
VirtualChild[] childrenArray = getVirtualChildrenList(fullVirtualName);
|
||||||
|
@ -1709,7 +1705,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
// if a child is a directory, ensure that '/'s are added both for the old name
|
// if a child is a directory, ensure that '/'s are added both for the old name
|
||||||
// and the new name
|
// and the new name
|
||||||
if (childrenArray[i].isDirectory) {
|
if (childrenArray[i].isDirectory) {
|
||||||
names.put(childrenArray[i].fullName + "/", newName + "/");
|
names.put(childrenArray[i].fullName + "/", newName + "/"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
names.put(childrenArray[i].fullName, newName);
|
names.put(childrenArray[i].fullName, newName);
|
||||||
|
@ -1849,7 +1845,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
String name;
|
String name;
|
||||||
String fullName = fullNames[i];
|
String fullName = fullNames[i];
|
||||||
fullName = ArchiveHandlerManager.cleanUpVirtualPath(fullName);
|
fullName = ArchiveHandlerManager.cleanUpVirtualPath(fullName);
|
||||||
int j = fullName.lastIndexOf("/");
|
int j = fullName.lastIndexOf("/"); //$NON-NLS-1$
|
||||||
|
|
||||||
if (j == -1) {
|
if (j == -1) {
|
||||||
name = fullName;
|
name = fullName;
|
||||||
|
@ -1859,7 +1855,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
files[i] = File.createTempFile(name, "virtual");
|
files[i] = File.createTempFile(name, "virtual"); //$NON-NLS-1$
|
||||||
files[i].deleteOnExit();
|
files[i].deleteOnExit();
|
||||||
extractVirtualFile(fullNames[i], files[i]);
|
extractVirtualFile(fullNames[i], files[i]);
|
||||||
}
|
}
|
||||||
|
@ -1877,7 +1873,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
*/
|
*/
|
||||||
public boolean createFolder(String fullVirtualName) {
|
public boolean createFolder(String fullVirtualName) {
|
||||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||||
fullVirtualName = fullVirtualName + "/";
|
fullVirtualName = fullVirtualName + "/"; //$NON-NLS-1$
|
||||||
return createVirtualObject(fullVirtualName);
|
return createVirtualObject(fullVirtualName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1914,7 +1910,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// open a new temp file which will be our destination for the new tar file
|
// open a new temp file which will be our destination for the new tar file
|
||||||
File outFile = new File(file.getAbsolutePath() + "temp");
|
File outFile = new File(file.getAbsolutePath() + "temp"); //$NON-NLS-1$
|
||||||
TarOutputStream outStream = new TarOutputStream(new FileOutputStream(outFile));
|
TarOutputStream outStream = new TarOutputStream(new FileOutputStream(outFile));
|
||||||
|
|
||||||
// get all the entries
|
// get all the entries
|
||||||
|
@ -1962,7 +1958,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
newEntry.setModificationTime(System.currentTimeMillis());
|
newEntry.setModificationTime(System.currentTimeMillis());
|
||||||
|
|
||||||
// set the user name
|
// set the user name
|
||||||
String userName = System.getProperty("user.name");
|
String userName = System.getProperty("user.name"); //$NON-NLS-1$
|
||||||
|
|
||||||
if (userName != null) {
|
if (userName != null) {
|
||||||
newEntry.setUserName(userName);
|
newEntry.setUserName(userName);
|
||||||
|
@ -1987,18 +1983,14 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// if security manager successfully created, check permission
|
// if security manager successfully created, check permission
|
||||||
if (sm != null) {
|
|
||||||
|
|
||||||
// create a file permission to check execute
|
// create a file permission to check execute
|
||||||
FilePermission permission = new FilePermission(file.getAbsolutePath(), "execute");
|
FilePermission permission = new FilePermission(file.getAbsolutePath(), "execute"); //$NON-NLS-1$
|
||||||
|
|
||||||
// this call will throw a SecurityException if permission does not exist
|
// this call will throw a SecurityException if permission does not exist
|
||||||
sm.checkPermission(permission);
|
sm.checkPermission(permission);
|
||||||
canExecute = true;
|
canExecute = true;
|
||||||
}
|
|
||||||
else {
|
|
||||||
canExecute = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch(SecurityException e) {
|
catch(SecurityException e) {
|
||||||
canExecute = false;
|
canExecute = false;
|
||||||
|
@ -2024,7 +2016,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
public String getStandardName(VirtualChild vc) {
|
public String getStandardName(VirtualChild vc) {
|
||||||
|
|
||||||
if (vc.isDirectory) {
|
if (vc.isDirectory) {
|
||||||
return vc.fullName + "/";
|
return vc.fullName + "/"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
return vc.fullName;
|
return vc.fullName;
|
||||||
|
@ -2076,7 +2068,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
tarFile.getInputStream(entry);
|
is = tarFile.getInputStream(entry);
|
||||||
|
|
||||||
if (is == null) {
|
if (is == null) {
|
||||||
return new SystemSearchLineMatch[0];
|
return new SystemSearchLineMatch[0];
|
||||||
|
@ -2110,7 +2102,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
*/
|
*/
|
||||||
public String getCommentFor(String fullVirtualName)
|
public String getCommentFor(String fullVirtualName)
|
||||||
{
|
{
|
||||||
return "";
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -2126,7 +2118,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
*/
|
*/
|
||||||
public String getCompressionMethodFor(String fullVirtualName)
|
public String getCompressionMethodFor(String fullVirtualName)
|
||||||
{
|
{
|
||||||
return "";
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2135,7 +2127,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
*/
|
*/
|
||||||
public String getArchiveComment()
|
public String getArchiveComment()
|
||||||
{
|
{
|
||||||
return "";
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2144,7 +2136,7 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
* @param name
|
* @param name
|
||||||
* @param encoding
|
* @param encoding
|
||||||
* @param registry
|
* @param registry
|
||||||
* @return
|
* @return whether the add was successful
|
||||||
*/
|
*/
|
||||||
public boolean add(File file, String virtualPath, String name,
|
public boolean add(File file, String virtualPath, String name,
|
||||||
String encoding, ISystemFileTypes registry) {
|
String encoding, ISystemFileTypes registry) {
|
||||||
|
@ -2194,10 +2186,10 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||||
|
|
||||||
// default type
|
// default type
|
||||||
String type = "file";
|
String type = "file"; //$NON-NLS-1$
|
||||||
|
|
||||||
// if it's not a class file, we do not classify it
|
// if it's not a class file, we do not classify it
|
||||||
if (!fullVirtualName.endsWith(".class")) {
|
if (!fullVirtualName.endsWith(".class")) { //$NON-NLS-1$
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2230,16 +2222,16 @@ public class SystemTarHandler implements ISystemArchiveHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it is executable, then also get qualified class name
|
// if it is executable, then also get qualified class name
|
||||||
if (isExecutable) {
|
if (isExecutable && parser != null) {
|
||||||
type = "executable(java";
|
type = "executable(java"; //$NON-NLS-1$
|
||||||
|
|
||||||
String qualifiedClassName = parser.getQualifiedClassName();
|
String qualifiedClassName = parser.getQualifiedClassName();
|
||||||
|
|
||||||
if (qualifiedClassName != null) {
|
if (qualifiedClassName != null) {
|
||||||
type = type + ":" + qualifiedClassName;
|
type = type + ":" + qualifiedClassName; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
type = type + ")";
|
type = type + ")"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class SystemUniversalZipEntry
|
||||||
{
|
{
|
||||||
_entryFullName = _entry.getName();
|
_entryFullName = _entry.getName();
|
||||||
}
|
}
|
||||||
int endOfPathPosition = _entryFullName.lastIndexOf("/");
|
int endOfPathPosition = _entryFullName.lastIndexOf("/"); //$NON-NLS-1$
|
||||||
if (endOfPathPosition != -1)
|
if (endOfPathPosition != -1)
|
||||||
{
|
{
|
||||||
_entryFullPath = _entryFullName.substring(0,endOfPathPosition);
|
_entryFullPath = _entryFullName.substring(0,endOfPathPosition);
|
||||||
|
@ -76,15 +76,15 @@ public class SystemUniversalZipEntry
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_entryFullPath = "";
|
_entryFullPath = ""; //$NON-NLS-1$
|
||||||
_entryName = _entryFullName;
|
_entryName = _entryFullName;
|
||||||
}
|
}
|
||||||
int i = _entryFullName.lastIndexOf(".");
|
int i = _entryFullName.lastIndexOf("."); //$NON-NLS-1$
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
{
|
{
|
||||||
_extension = "";
|
_extension = ""; //$NON-NLS-1$
|
||||||
} else _extension = _entryFullName.substring(i + 1);
|
} else _extension = _entryFullName.substring(i + 1);
|
||||||
if (_entryFullName.indexOf("/") != -1) _nested = true;
|
if (_entryFullName.indexOf("/") != -1) _nested = true; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -138,7 +138,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
protected void fillBranch(ZipEntry next)
|
protected void fillBranch(ZipEntry next)
|
||||||
{
|
{
|
||||||
VirtualChild nextChild;
|
VirtualChild nextChild;
|
||||||
if (next.getName().equals("/")) return; // dummy entry
|
if (next.getName().equals("/")) return; // dummy entry //$NON-NLS-1$
|
||||||
if (!next.isDirectory())
|
if (!next.isDirectory())
|
||||||
{
|
{
|
||||||
SystemUniversalZipEntry nextEntry = new SystemUniversalZipEntry(next);
|
SystemUniversalZipEntry nextEntry = new SystemUniversalZipEntry(next);
|
||||||
|
@ -192,18 +192,18 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
_virtualFS.put(key, newValue);
|
_virtualFS.put(key, newValue);
|
||||||
|
|
||||||
// base case 2
|
// base case 2
|
||||||
if (key.equals(""))
|
if (key.equals("")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i = key.lastIndexOf("/");
|
int i = key.lastIndexOf("/"); //$NON-NLS-1$
|
||||||
if (i == -1) // recursive last step
|
if (i == -1) // recursive last step
|
||||||
{
|
{
|
||||||
VirtualChild nextValue = new VirtualChild(this, key);
|
VirtualChild nextValue = new VirtualChild(this, key);
|
||||||
nextValue.isDirectory = true;
|
nextValue.isDirectory = true;
|
||||||
recursivePopulate("", nextValue);
|
recursivePopulate("", nextValue); //$NON-NLS-1$
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else // recursive step
|
else // recursive step
|
||||||
|
@ -285,7 +285,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
{
|
{
|
||||||
ZipEntry next = (ZipEntry) entries.nextElement();
|
ZipEntry next = (ZipEntry) entries.nextElement();
|
||||||
String nextName = ArchiveHandlerManager.cleanUpVirtualPath(next.getName());
|
String nextName = ArchiveHandlerManager.cleanUpVirtualPath(next.getName());
|
||||||
if (nextName.startsWith(parent) && !nextName.equals(parent+"/"))
|
if (nextName.startsWith(parent) && !nextName.equals(parent+"/")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
SystemUniversalZipEntry nextEntry = new SystemUniversalZipEntry(next);
|
SystemUniversalZipEntry nextEntry = new SystemUniversalZipEntry(next);
|
||||||
VirtualChild nextChild = new VirtualChild(this, nextEntry.getFullName());
|
VirtualChild nextChild = new VirtualChild(this, nextEntry.getFullName());
|
||||||
|
@ -364,13 +364,13 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
if (!updateVirtualFSIfNecessary()) return new VirtualChild(this, fullVirtualName);
|
if (!updateVirtualFSIfNecessary()) return new VirtualChild(this, fullVirtualName);
|
||||||
|
|
||||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||||
if (fullVirtualName == "" || fullVirtualName == null) return new VirtualChild(this);
|
if (fullVirtualName == "" || fullVirtualName == null) return new VirtualChild(this); //$NON-NLS-1$
|
||||||
int i = fullVirtualName.lastIndexOf("/");
|
int i = fullVirtualName.lastIndexOf("/"); //$NON-NLS-1$
|
||||||
String path;
|
String path;
|
||||||
String name;
|
String name;
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
{
|
{
|
||||||
path = "";
|
path = ""; //$NON-NLS-1$
|
||||||
name = fullVirtualName;
|
name = fullVirtualName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -393,16 +393,16 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
if (!_exists) return false;
|
if (!_exists) return false;
|
||||||
|
|
||||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||||
if (fullVirtualName == "" || fullVirtualName == null) return false;
|
if (fullVirtualName == "" || fullVirtualName == null) return false; //$NON-NLS-1$
|
||||||
|
|
||||||
if (_vfsLastModified == _file.lastModified())
|
if (_vfsLastModified == _file.lastModified())
|
||||||
{
|
{
|
||||||
int i = fullVirtualName.lastIndexOf("/");
|
int i = fullVirtualName.lastIndexOf("/"); //$NON-NLS-1$
|
||||||
String path;
|
String path;
|
||||||
String name;
|
String name;
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
{
|
{
|
||||||
path = "";
|
path = ""; //$NON-NLS-1$
|
||||||
name = fullVirtualName;
|
name = fullVirtualName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -430,7 +430,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
safeGetEntry(fullVirtualName + "/");
|
safeGetEntry(fullVirtualName + "/"); //$NON-NLS-1$
|
||||||
retval = true;
|
retval = true;
|
||||||
}
|
}
|
||||||
catch (IOException f)
|
catch (IOException f)
|
||||||
|
@ -445,7 +445,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
System.out.println("Could not open the ZipFile " + _file.toString());
|
System.out.println("Could not open the ZipFile " + _file.toString()); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -659,7 +659,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
int charsToTrim;
|
int charsToTrim;
|
||||||
int j = dir.lastIndexOf("/");
|
int j = dir.lastIndexOf("/"); //$NON-NLS-1$
|
||||||
if (j == -1)
|
if (j == -1)
|
||||||
{
|
{
|
||||||
charsToTrim = 0;
|
charsToTrim = 0;
|
||||||
|
@ -673,7 +673,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
|
|
||||||
if (destination == null)
|
if (destination == null)
|
||||||
{
|
{
|
||||||
if (dir.equals(""))
|
if (dir.equals("")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
destination = destinationParent;
|
destination = destinationParent;
|
||||||
}
|
}
|
||||||
|
@ -689,8 +689,8 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
{
|
{
|
||||||
if (!SystemArchiveUtil.delete(destination))
|
if (!SystemArchiveUtil.delete(destination))
|
||||||
{
|
{
|
||||||
System.out.println("Could not overwrite directory " + destination);
|
System.out.println("Could not overwrite directory " + destination); //$NON-NLS-1$
|
||||||
System.out.println("(Could not delete old directory)");
|
System.out.println("(Could not delete old directory)"); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -699,8 +699,8 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
{
|
{
|
||||||
if (!destination.mkdirs())
|
if (!destination.mkdirs())
|
||||||
{
|
{
|
||||||
System.out.println("Could not overwrite directory " + destination);
|
System.out.println("Could not overwrite directory " + destination); //$NON-NLS-1$
|
||||||
System.out.println("(Could not create new directory)");
|
System.out.println("(Could not create new directory)"); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -741,7 +741,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
{
|
{
|
||||||
if (!nextFile.mkdirs())
|
if (!nextFile.mkdirs())
|
||||||
{
|
{
|
||||||
System.out.println("Could not create folder " + nextFile.toString());
|
System.out.println("Could not create folder " + nextFile.toString()); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -770,7 +770,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
{
|
{
|
||||||
if (!file.createNewFile())
|
if (!file.createNewFile())
|
||||||
{
|
{
|
||||||
System.out.println("File already exists: " + file.toString());
|
System.out.println("File already exists: " + file.toString()); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -786,7 +786,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
System.out.println("Could not create " + file.toString());
|
System.out.println("Could not create " + file.toString()); //$NON-NLS-1$
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -805,10 +805,10 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
if (!_exists) return false;
|
if (!_exists) return false;
|
||||||
virtualPath = ArchiveHandlerManager.cleanUpVirtualPath(virtualPath);
|
virtualPath = ArchiveHandlerManager.cleanUpVirtualPath(virtualPath);
|
||||||
|
|
||||||
if (exists(virtualPath + "/" + name))
|
if (exists(virtualPath + "/" + name)) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
// wrong method
|
// wrong method
|
||||||
return replace(virtualPath + "/" + name, stream, name, sourceEncoding, targetEncoding, isText);
|
return replace(virtualPath + "/" + name, stream, name, sourceEncoding, targetEncoding, isText); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -819,7 +819,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Open a new tempfile which will be our destination for the new zip
|
// Open a new tempfile which will be our destination for the new zip
|
||||||
outputTempFile = new File(_file.getAbsolutePath() + "temp");
|
outputTempFile = new File(_file.getAbsolutePath() + "temp"); //$NON-NLS-1$
|
||||||
ZipOutputStream dest = new ZipOutputStream(
|
ZipOutputStream dest = new ZipOutputStream(
|
||||||
new FileOutputStream(outputTempFile));
|
new FileOutputStream(outputTempFile));
|
||||||
|
|
||||||
|
@ -828,7 +828,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
VirtualChild[] vcList = getVirtualChildrenList(false);
|
VirtualChild[] vcList = getVirtualChildrenList(false);
|
||||||
|
|
||||||
// if it is an empty zip file, no need to recreate it
|
// if it is an empty zip file, no need to recreate it
|
||||||
if (!(vcList.length == 1) || !vcList[0].fullName.equals(""))
|
if (!(vcList.length == 1) || !vcList[0].fullName.equals("")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
recreateZipDeleteEntries(vcList, dest, null);
|
recreateZipDeleteEntries(vcList, dest, null);
|
||||||
}
|
}
|
||||||
|
@ -846,7 +846,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
System.out.println("Could not add a file.");
|
System.out.println("Could not add a file."); //$NON-NLS-1$
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
closeZipFile();
|
closeZipFile();
|
||||||
return false;
|
return false;
|
||||||
|
@ -893,17 +893,17 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
for (int i = 0; i < numFiles; i++)
|
for (int i = 0; i < numFiles; i++)
|
||||||
{
|
{
|
||||||
if (!files[i].exists() || !files[i].canRead()) return false;
|
if (!files[i].exists() || !files[i].canRead()) return false;
|
||||||
if (exists(virtualPath + "/" + names[i]))
|
if (exists(virtualPath + "/" + names[i])) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
// sorry, wrong method buddy
|
// sorry, wrong method buddy
|
||||||
return replace(virtualPath + "/" + names[i], files[i], names[i]);
|
return replace(virtualPath + "/" + names[i], files[i], names[i]); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File outputTempFile;
|
File outputTempFile;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Open a new tempfile which will be our destination for the new zip
|
// Open a new tempfile which will be our destination for the new zip
|
||||||
outputTempFile = new File(_file.getAbsolutePath() + "temp");
|
outputTempFile = new File(_file.getAbsolutePath() + "temp"); //$NON-NLS-1$
|
||||||
ZipOutputStream dest = new ZipOutputStream(
|
ZipOutputStream dest = new ZipOutputStream(
|
||||||
new FileOutputStream(outputTempFile));
|
new FileOutputStream(outputTempFile));
|
||||||
|
|
||||||
|
@ -912,7 +912,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
VirtualChild[] vcList = getVirtualChildrenList(false);
|
VirtualChild[] vcList = getVirtualChildrenList(false);
|
||||||
|
|
||||||
// if it is an empty zip file, no need to recreate it
|
// if it is an empty zip file, no need to recreate it
|
||||||
if (!(vcList.length == 1) || !vcList[0].fullName.equals(""))
|
if (!(vcList.length == 1) || !vcList[0].fullName.equals("")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
recreateZipDeleteEntries(vcList, dest, null);
|
recreateZipDeleteEntries(vcList, dest, null);
|
||||||
}
|
}
|
||||||
|
@ -933,7 +933,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
System.out.println("Could not add a file.");
|
System.out.println("Could not add a file."); //$NON-NLS-1$
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
if (closeZipFile) closeZipFile();
|
if (closeZipFile) closeZipFile();
|
||||||
return false;
|
return false;
|
||||||
|
@ -989,7 +989,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
{
|
{
|
||||||
// the zip file will be empty, but it must have at least one entry,
|
// the zip file will be empty, but it must have at least one entry,
|
||||||
// so we will put in a dummy entry.
|
// so we will put in a dummy entry.
|
||||||
ZipEntry entry = new ZipEntry("/");
|
ZipEntry entry = new ZipEntry("/"); //$NON-NLS-1$
|
||||||
dest.putNextEntry(entry);
|
dest.putNextEntry(entry);
|
||||||
dest.closeEntry();
|
dest.closeEntry();
|
||||||
return;
|
return;
|
||||||
|
@ -1002,7 +1002,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
if (omitChildren != null && omitChildren.contains(vcList[i].fullName)) continue;
|
if (omitChildren != null && omitChildren.contains(vcList[i].fullName)) continue;
|
||||||
if (vcList[i].isDirectory)
|
if (vcList[i].isDirectory)
|
||||||
{
|
{
|
||||||
ZipEntry nextEntry = safeGetEntry(vcList[i].fullName + "/");
|
ZipEntry nextEntry = safeGetEntry(vcList[i].fullName + "/"); //$NON-NLS-1$
|
||||||
dest.putNextEntry(nextEntry);
|
dest.putNextEntry(nextEntry);
|
||||||
dest.closeEntry();
|
dest.closeEntry();
|
||||||
continue;
|
continue;
|
||||||
|
@ -1096,13 +1096,13 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
ZipEntry newEntry;
|
ZipEntry newEntry;
|
||||||
if (file.isDirectory())
|
if (file.isDirectory())
|
||||||
{
|
{
|
||||||
String fullName = virtualPath + "/" + name;
|
String fullName = virtualPath + "/" + name; //$NON-NLS-1$
|
||||||
if (!fullName.endsWith("/")) fullName = fullName + "/";
|
if (!fullName.endsWith("/")) fullName = fullName + "/"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
newEntry = createSafeZipEntry(fullName);
|
newEntry = createSafeZipEntry(fullName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newEntry = createSafeZipEntry(virtualPath + "/" + name);
|
newEntry = createSafeZipEntry(virtualPath + "/" + name); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
newEntry.setTime(file.lastModified());
|
newEntry.setTime(file.lastModified());
|
||||||
dest.putNextEntry(newEntry);
|
dest.putNextEntry(newEntry);
|
||||||
|
@ -1161,7 +1161,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
protected ZipEntry appendBytes(InputStream stream, ZipOutputStream dest, String virtualPath, String name, String sourceEncoding, String targetEncoding, boolean isText) throws IOException
|
protected ZipEntry appendBytes(InputStream stream, ZipOutputStream dest, String virtualPath, String name, String sourceEncoding, String targetEncoding, boolean isText) throws IOException
|
||||||
{
|
{
|
||||||
ZipEntry newEntry;
|
ZipEntry newEntry;
|
||||||
newEntry = createSafeZipEntry(virtualPath + "/" + name);
|
newEntry = createSafeZipEntry(virtualPath + "/" + name); //$NON-NLS-1$
|
||||||
dest.putNextEntry(newEntry);
|
dest.putNextEntry(newEntry);
|
||||||
BufferedInputStream source = new BufferedInputStream(stream);
|
BufferedInputStream source = new BufferedInputStream(stream);
|
||||||
|
|
||||||
|
@ -1210,7 +1210,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
{
|
{
|
||||||
String oldName = _file.getAbsolutePath();
|
String oldName = _file.getAbsolutePath();
|
||||||
_zipfile.close();
|
_zipfile.close();
|
||||||
File oldFile = new File(oldName + "old");
|
File oldFile = new File(oldName + "old"); //$NON-NLS-1$
|
||||||
System.out.println(_file.renameTo(oldFile));
|
System.out.println(_file.renameTo(oldFile));
|
||||||
System.out.println(outputTempFile.renameTo(_file));
|
System.out.println(outputTempFile.renameTo(_file));
|
||||||
_vfsLastModified = _file.lastModified();
|
_vfsLastModified = _file.lastModified();
|
||||||
|
@ -1255,7 +1255,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Open a new tempfile which will be our destination for the new zip
|
// Open a new tempfile which will be our destination for the new zip
|
||||||
outputTempFile = new File(_file.getAbsolutePath() + "temp");
|
outputTempFile = new File(_file.getAbsolutePath() + "temp"); //$NON-NLS-1$
|
||||||
ZipOutputStream dest = new ZipOutputStream(
|
ZipOutputStream dest = new ZipOutputStream(
|
||||||
new FileOutputStream(outputTempFile));
|
new FileOutputStream(outputTempFile));
|
||||||
dest.setMethod(ZipOutputStream.DEFLATED);
|
dest.setMethod(ZipOutputStream.DEFLATED);
|
||||||
|
@ -1301,7 +1301,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
System.out.println("Could not delete " + fullVirtualName);
|
System.out.println("Could not delete " + fullVirtualName); //$NON-NLS-1$
|
||||||
if (!(outputTempFile == null)) outputTempFile.delete();
|
if (!(outputTempFile == null)) outputTempFile.delete();
|
||||||
if (closeZipFile) closeZipFile();
|
if (closeZipFile) closeZipFile();
|
||||||
return false;
|
return false;
|
||||||
|
@ -1360,7 +1360,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Open a new tempfile which will be our destination for the new zip
|
// Open a new tempfile which will be our destination for the new zip
|
||||||
outputTempFile = new File(_file.getAbsolutePath() + "temp");
|
outputTempFile = new File(_file.getAbsolutePath() + "temp"); //$NON-NLS-1$
|
||||||
ZipOutputStream dest = new ZipOutputStream(
|
ZipOutputStream dest = new ZipOutputStream(
|
||||||
new FileOutputStream(outputTempFile));
|
new FileOutputStream(outputTempFile));
|
||||||
dest.setMethod(ZipOutputStream.DEFLATED);
|
dest.setMethod(ZipOutputStream.DEFLATED);
|
||||||
|
@ -1371,17 +1371,17 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
recreateZipDeleteEntries(vcList, dest, omissions);
|
recreateZipDeleteEntries(vcList, dest, omissions);
|
||||||
|
|
||||||
// Now append the additional entry to the zip file.
|
// Now append the additional entry to the zip file.
|
||||||
int i = fullVirtualName.lastIndexOf("/");
|
int i = fullVirtualName.lastIndexOf("/"); //$NON-NLS-1$
|
||||||
String virtualPath;
|
String virtualPath;
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
{
|
{
|
||||||
virtualPath = "";
|
virtualPath = ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
virtualPath = fullVirtualName.substring(0,i);
|
virtualPath = fullVirtualName.substring(0,i);
|
||||||
}
|
}
|
||||||
ZipEntry newEntry = appendFile(file, dest, virtualPath, name, SystemEncodingUtil.ENCODING_UTF_8, SystemEncodingUtil.ENCODING_UTF_8, false);
|
appendFile(file, dest, virtualPath, name, SystemEncodingUtil.ENCODING_UTF_8, SystemEncodingUtil.ENCODING_UTF_8, false);
|
||||||
dest.close();
|
dest.close();
|
||||||
|
|
||||||
// Now replace the old zip file with the new one
|
// Now replace the old zip file with the new one
|
||||||
|
@ -1390,7 +1390,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
System.out.println("Could not replace " + file.getName());
|
System.out.println("Could not replace " + file.getName()); //$NON-NLS-1$
|
||||||
if (!(outputTempFile == null)) outputTempFile.delete();
|
if (!(outputTempFile == null)) outputTempFile.delete();
|
||||||
if (closeZipFile) closeZipFile();
|
if (closeZipFile) closeZipFile();
|
||||||
return false;
|
return false;
|
||||||
|
@ -1417,7 +1417,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Open a new tempfile which will be our destination for the new zip
|
// Open a new tempfile which will be our destination for the new zip
|
||||||
outputTempFile = new File(_file.getAbsolutePath() + "temp");
|
outputTempFile = new File(_file.getAbsolutePath() + "temp"); //$NON-NLS-1$
|
||||||
ZipOutputStream dest = new ZipOutputStream(
|
ZipOutputStream dest = new ZipOutputStream(
|
||||||
new FileOutputStream(outputTempFile));
|
new FileOutputStream(outputTempFile));
|
||||||
dest.setMethod(ZipOutputStream.DEFLATED);
|
dest.setMethod(ZipOutputStream.DEFLATED);
|
||||||
|
@ -1428,17 +1428,17 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
recreateZipDeleteEntries(vcList, dest, omissions);
|
recreateZipDeleteEntries(vcList, dest, omissions);
|
||||||
|
|
||||||
// Now append the additional entry to the zip file.
|
// Now append the additional entry to the zip file.
|
||||||
int i = fullVirtualName.lastIndexOf("/");
|
int i = fullVirtualName.lastIndexOf("/"); //$NON-NLS-1$
|
||||||
String virtualPath;
|
String virtualPath;
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
{
|
{
|
||||||
virtualPath = "";
|
virtualPath = ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
virtualPath = fullVirtualName.substring(0,i);
|
virtualPath = fullVirtualName.substring(0,i);
|
||||||
}
|
}
|
||||||
ZipEntry newEntry = appendBytes(stream, dest, virtualPath, name, sourceEncoding, targetEncoding, isText);
|
appendBytes(stream, dest, virtualPath, name, sourceEncoding, targetEncoding, isText);
|
||||||
dest.close();
|
dest.close();
|
||||||
|
|
||||||
// Now replace the old zip file with the new one
|
// Now replace the old zip file with the new one
|
||||||
|
@ -1447,7 +1447,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
System.out.println("Could not replace " + fullVirtualName);
|
System.out.println("Could not replace " + fullVirtualName); //$NON-NLS-1$
|
||||||
if (!(outputTempFile == null)) outputTempFile.delete();
|
if (!(outputTempFile == null)) outputTempFile.delete();
|
||||||
closeZipFile();
|
closeZipFile();
|
||||||
return false;
|
return false;
|
||||||
|
@ -1479,7 +1479,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
VirtualChild vc = getVirtualFile(fullVirtualName);
|
VirtualChild vc = getVirtualFile(fullVirtualName);
|
||||||
if (!vc.exists())
|
if (!vc.exists())
|
||||||
{
|
{
|
||||||
System.out.println("The virtual file " + fullVirtualName + " does not exist.");
|
System.out.println("The virtual file " + fullVirtualName + " does not exist."); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (openZipFile())
|
if (openZipFile())
|
||||||
|
@ -1488,7 +1488,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Open a new tempfile which will be our destination for the new zip
|
// Open a new tempfile which will be our destination for the new zip
|
||||||
outputTempFile = new File(_file.getAbsolutePath() + "temp");
|
outputTempFile = new File(_file.getAbsolutePath() + "temp"); //$NON-NLS-1$
|
||||||
ZipOutputStream dest = new ZipOutputStream(
|
ZipOutputStream dest = new ZipOutputStream(
|
||||||
new FileOutputStream(outputTempFile));
|
new FileOutputStream(outputTempFile));
|
||||||
dest.setMethod(ZipOutputStream.DEFLATED);
|
dest.setMethod(ZipOutputStream.DEFLATED);
|
||||||
|
@ -1508,8 +1508,8 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
String newName = newFullVirtualName + suffix;
|
String newName = newFullVirtualName + suffix;
|
||||||
if (renameList[i].isDirectory)
|
if (renameList[i].isDirectory)
|
||||||
{
|
{
|
||||||
newName = newName + "/";
|
newName = newName + "/"; //$NON-NLS-1$
|
||||||
names.put(renameList[i].fullName + "/", newName);
|
names.put(renameList[i].fullName + "/", newName); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1519,7 +1519,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
safeGetEntry(fullVirtualName);
|
safeGetEntry(fullVirtualName);
|
||||||
names.put(fullVirtualName + "/", newFullVirtualName + "/");
|
names.put(fullVirtualName + "/", newFullVirtualName + "/"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
catch (IOException e) {}
|
catch (IOException e) {}
|
||||||
}
|
}
|
||||||
|
@ -1540,7 +1540,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
System.out.println("Could not rename " + fullVirtualName);
|
System.out.println("Could not rename " + fullVirtualName); //$NON-NLS-1$
|
||||||
if (!(outputTempFile == null)) outputTempFile.delete();
|
if (!(outputTempFile == null)) outputTempFile.delete();
|
||||||
if (closeZipFile) closeZipFile();
|
if (closeZipFile) closeZipFile();
|
||||||
return false;
|
return false;
|
||||||
|
@ -1558,10 +1558,10 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
{
|
{
|
||||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||||
destinationVirtualPath = ArchiveHandlerManager.cleanUpVirtualPath(destinationVirtualPath);
|
destinationVirtualPath = ArchiveHandlerManager.cleanUpVirtualPath(destinationVirtualPath);
|
||||||
int i = fullVirtualName.lastIndexOf("/");
|
int i = fullVirtualName.lastIndexOf("/"); //$NON-NLS-1$
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
{
|
{
|
||||||
return fullRename(fullVirtualName, destinationVirtualPath + "/" + fullVirtualName);
|
return fullRename(fullVirtualName, destinationVirtualPath + "/" + fullVirtualName); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
String name = fullVirtualName.substring(i);
|
String name = fullVirtualName.substring(i);
|
||||||
return fullRename(fullVirtualName, destinationVirtualPath + name);
|
return fullRename(fullVirtualName, destinationVirtualPath + name);
|
||||||
|
@ -1573,7 +1573,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
public boolean rename(String fullVirtualName, String newName)
|
public boolean rename(String fullVirtualName, String newName)
|
||||||
{
|
{
|
||||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||||
int i = fullVirtualName.lastIndexOf("/");
|
int i = fullVirtualName.lastIndexOf("/"); //$NON-NLS-1$
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
{
|
{
|
||||||
return fullRename(fullVirtualName, newName);
|
return fullRename(fullVirtualName, newName);
|
||||||
|
@ -1595,7 +1595,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
String name;
|
String name;
|
||||||
String fullName = fullNames[i];
|
String fullName = fullNames[i];
|
||||||
fullName = ArchiveHandlerManager.cleanUpVirtualPath(fullName);
|
fullName = ArchiveHandlerManager.cleanUpVirtualPath(fullName);
|
||||||
int j = fullName.lastIndexOf("/");
|
int j = fullName.lastIndexOf("/"); //$NON-NLS-1$
|
||||||
if (j == -1)
|
if (j == -1)
|
||||||
{
|
{
|
||||||
name = fullName;
|
name = fullName;
|
||||||
|
@ -1606,14 +1606,14 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
files[i] = File.createTempFile(name, "virtual");
|
files[i] = File.createTempFile(name, "virtual"); //$NON-NLS-1$
|
||||||
files[i].deleteOnExit();
|
files[i].deleteOnExit();
|
||||||
extractVirtualFile(fullNames[i], files[i]);
|
extractVirtualFile(fullNames[i], files[i]);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
System.out.println("Could not extract virtual file: " + fullNames[i]);
|
System.out.println("Could not extract virtual file: " + fullNames[i]); //$NON-NLS-1$
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1626,7 +1626,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
public boolean createFolder(String name)
|
public boolean createFolder(String name)
|
||||||
{
|
{
|
||||||
name = ArchiveHandlerManager.cleanUpVirtualPath(name);
|
name = ArchiveHandlerManager.cleanUpVirtualPath(name);
|
||||||
name = name + "/";
|
name = name + "/"; //$NON-NLS-1$
|
||||||
return createVirtualObject(name, true);
|
return createVirtualObject(name, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1662,7 +1662,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Open a new tempfile which will be our destination for the new zip
|
// Open a new tempfile which will be our destination for the new zip
|
||||||
outputTempFile = new File(_file.getAbsolutePath() + "temp");
|
outputTempFile = new File(_file.getAbsolutePath() + "temp"); //$NON-NLS-1$
|
||||||
ZipOutputStream dest = new ZipOutputStream(
|
ZipOutputStream dest = new ZipOutputStream(
|
||||||
new FileOutputStream(outputTempFile));
|
new FileOutputStream(outputTempFile));
|
||||||
dest.setMethod(ZipOutputStream.DEFLATED);
|
dest.setMethod(ZipOutputStream.DEFLATED);
|
||||||
|
@ -1670,7 +1670,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
VirtualChild[] vcList = getVirtualChildrenList(false);
|
VirtualChild[] vcList = getVirtualChildrenList(false);
|
||||||
|
|
||||||
// if it is an empty zip file, no need to recreate it
|
// if it is an empty zip file, no need to recreate it
|
||||||
if (!(vcList.length == 1) || !vcList[0].fullName.equals(""))
|
if (!(vcList.length == 1) || !vcList[0].fullName.equals("")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
recreateZipDeleteEntries(vcList, dest, null);
|
recreateZipDeleteEntries(vcList, dest, null);
|
||||||
}
|
}
|
||||||
|
@ -1688,7 +1688,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
System.out.println("Could not add a file.");
|
System.out.println("Could not add a file."); //$NON-NLS-1$
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
if (closeZipFile) closeZipFile();
|
if (closeZipFile) closeZipFile();
|
||||||
return false;
|
return false;
|
||||||
|
@ -1710,7 +1710,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
*/
|
*/
|
||||||
protected ZipEntry appendEmptyFile(ZipOutputStream dest, String name) throws IOException
|
protected ZipEntry appendEmptyFile(ZipOutputStream dest, String name) throws IOException
|
||||||
{
|
{
|
||||||
boolean isDirectory = name.endsWith("/");
|
boolean isDirectory = name.endsWith("/"); //$NON-NLS-1$
|
||||||
ZipEntry newEntry;
|
ZipEntry newEntry;
|
||||||
newEntry = createSafeZipEntry(name);
|
newEntry = createSafeZipEntry(name);
|
||||||
dest.putNextEntry(newEntry);
|
dest.putNextEntry(newEntry);
|
||||||
|
@ -1731,13 +1731,13 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
*/
|
*/
|
||||||
protected ZipEntry createSafeZipEntry(String name)
|
protected ZipEntry createSafeZipEntry(String name)
|
||||||
{
|
{
|
||||||
if (name.startsWith("/")) name = name.substring(1);
|
if (name.startsWith("/")) name = name.substring(1); //$NON-NLS-1$
|
||||||
return new ZipEntry(name);
|
return new ZipEntry(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStandardName(VirtualChild vc)
|
public String getStandardName(VirtualChild vc)
|
||||||
{
|
{
|
||||||
if (vc.isDirectory) return vc.fullName + "/";
|
if (vc.isDirectory) return vc.fullName + "/"; //$NON-NLS-1$
|
||||||
return vc.fullName;
|
return vc.fullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1754,7 +1754,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
System.out.println("Could not open zipfile: " + _file);
|
System.out.println("Could not open zipfile: " + _file); //$NON-NLS-1$
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1769,7 +1769,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
System.out.println("Could not close zipfile: " + _file);
|
System.out.println("Could not close zipfile: " + _file); //$NON-NLS-1$
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1806,8 +1806,8 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
protected ZipEntry safeGetEntry(String name) throws IOException
|
protected ZipEntry safeGetEntry(String name) throws IOException
|
||||||
{
|
{
|
||||||
ZipEntry entry = _zipfile.getEntry(name);
|
ZipEntry entry = _zipfile.getEntry(name);
|
||||||
if (entry == null) entry = _zipfile.getEntry("/" + name);
|
if (entry == null) entry = _zipfile.getEntry("/" + name); //$NON-NLS-1$
|
||||||
if (entry == null) throw new IOException("SystemZipHandler.safeGetEntry(): The ZipEntry " + name + " cannot be found in " + _file.toString());
|
if (entry == null) throw new IOException("SystemZipHandler.safeGetEntry(): The ZipEntry " + name + " cannot be found in " + _file.toString()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1923,7 +1923,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
*/
|
*/
|
||||||
public String getCommentFor(String fullVirtualName, boolean closeZipFile)
|
public String getCommentFor(String fullVirtualName, boolean closeZipFile)
|
||||||
{
|
{
|
||||||
if (!_exists) return "";
|
if (!_exists) return ""; //$NON-NLS-1$
|
||||||
|
|
||||||
if (openZipFile())
|
if (openZipFile())
|
||||||
{
|
{
|
||||||
|
@ -1936,14 +1936,14 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
if (closeZipFile) closeZipFile();
|
if (closeZipFile) closeZipFile();
|
||||||
return "";
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
if (closeZipFile) closeZipFile();
|
if (closeZipFile) closeZipFile();
|
||||||
String comment = entry.getComment();
|
String comment = entry.getComment();
|
||||||
if (comment == null) return "";
|
if (comment == null) return ""; //$NON-NLS-1$
|
||||||
else return comment;
|
else return comment;
|
||||||
}
|
}
|
||||||
else return "";
|
else return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -1995,7 +1995,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
*/
|
*/
|
||||||
public String getCompressionMethodFor(String fullVirtualName, boolean closeZipFile)
|
public String getCompressionMethodFor(String fullVirtualName, boolean closeZipFile)
|
||||||
{
|
{
|
||||||
if (!_exists) return "";
|
if (!_exists) return ""; //$NON-NLS-1$
|
||||||
|
|
||||||
if (openZipFile())
|
if (openZipFile())
|
||||||
{
|
{
|
||||||
|
@ -2008,19 +2008,19 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
if (closeZipFile) closeZipFile();
|
if (closeZipFile) closeZipFile();
|
||||||
return "";
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
if (closeZipFile) closeZipFile();
|
if (closeZipFile) closeZipFile();
|
||||||
return (new Integer(entry.getMethod())).toString();
|
return (new Integer(entry.getMethod())).toString();
|
||||||
}
|
}
|
||||||
else return "";
|
else return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.core.archiveutils.ISystemArchiveHandler#getArchiveComment()
|
* @see org.eclipse.rse.core.archiveutils.ISystemArchiveHandler#getArchiveComment()
|
||||||
*/
|
*/
|
||||||
public String getArchiveComment()
|
public String getArchiveComment()
|
||||||
{
|
{
|
||||||
return "";
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2038,7 +2038,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
public String getClassification(String fullVirtualName, boolean closeZipFile) {
|
public String getClassification(String fullVirtualName, boolean closeZipFile) {
|
||||||
|
|
||||||
// default type
|
// default type
|
||||||
String type = "file";
|
String type = "file"; //$NON-NLS-1$
|
||||||
|
|
||||||
if (!_exists) {
|
if (!_exists) {
|
||||||
return type;
|
return type;
|
||||||
|
@ -2047,7 +2047,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName);
|
||||||
|
|
||||||
// if it's not a class file, we do not classify it
|
// if it's not a class file, we do not classify it
|
||||||
if (!fullVirtualName.endsWith(".class")) {
|
if (!fullVirtualName.endsWith(".class")) { //$NON-NLS-1$
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2087,16 +2087,16 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it is executable, then also get qualified class name
|
// if it is executable, then also get qualified class name
|
||||||
if (isExecutable) {
|
if (isExecutable && parser != null) {
|
||||||
type = "executable(java";
|
type = "executable(java"; //$NON-NLS-1$
|
||||||
|
|
||||||
String qualifiedClassName = parser.getQualifiedClassName();
|
String qualifiedClassName = parser.getQualifiedClassName();
|
||||||
|
|
||||||
if (qualifiedClassName != null) {
|
if (qualifiedClassName != null) {
|
||||||
type = type + ":" + qualifiedClassName;
|
type = type + ":" + qualifiedClassName; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
type = type + ")";
|
type = type + ")"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
|
@ -2108,10 +2108,10 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
virtualPath = ArchiveHandlerManager.cleanUpVirtualPath(virtualPath);
|
virtualPath = ArchiveHandlerManager.cleanUpVirtualPath(virtualPath);
|
||||||
if (!file.isDirectory())
|
if (!file.isDirectory())
|
||||||
{
|
{
|
||||||
if (exists(virtualPath + "/" + name))
|
if (exists(virtualPath + "/" + name)) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
// wrong method
|
// wrong method
|
||||||
return replace(virtualPath + "/" + name, file, name);
|
return replace(virtualPath + "/" + name, file, name); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2146,7 +2146,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
sources[i] = (File) kids[i];
|
sources[i] = (File) kids[i];
|
||||||
newNames[i] = sources[i].getAbsolutePath().substring(charsToTrim);
|
newNames[i] = sources[i].getAbsolutePath().substring(charsToTrim);
|
||||||
newNames[i] = newNames[i].replace('\\','/');
|
newNames[i] = newNames[i].replace('\\','/');
|
||||||
if (sources[i].isDirectory() && !newNames[i].endsWith("/")) newNames[i] = newNames[i] + "/";
|
if (sources[i].isDirectory() && !newNames[i].endsWith("/")) newNames[i] = newNames[i] + "/"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
// this part can be changed to allow different encodings for different files
|
// this part can be changed to allow different encodings for different files
|
||||||
sourceEncodings[i] = sourceEncoding;
|
sourceEncodings[i] = sourceEncoding;
|
||||||
|
@ -2159,7 +2159,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
targetEncodings[children.size()] = targetEncoding;
|
targetEncodings[children.size()] = targetEncoding;
|
||||||
|
|
||||||
isTexts[children.size()] = registry.isText(file);
|
isTexts[children.size()] = registry.isText(file);
|
||||||
if (!newNames[children.size()].endsWith("/")) newNames[children.size()] = newNames[children.size()] + "/";
|
if (!newNames[children.size()].endsWith("/")) newNames[children.size()] = newNames[children.size()] + "/"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
return add(sources, virtualPath, newNames, sourceEncodings, targetEncodings, isTexts);
|
return add(sources, virtualPath, newNames, sourceEncodings, targetEncodings, isTexts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2170,10 +2170,10 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
virtualPath = ArchiveHandlerManager.cleanUpVirtualPath(virtualPath);
|
virtualPath = ArchiveHandlerManager.cleanUpVirtualPath(virtualPath);
|
||||||
if (!file.isDirectory())
|
if (!file.isDirectory())
|
||||||
{
|
{
|
||||||
if (exists(virtualPath + "/" + name))
|
if (exists(virtualPath + "/" + name)) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
// wrong method
|
// wrong method
|
||||||
return replace(virtualPath + "/" + name, file, name);
|
return replace(virtualPath + "/" + name, file, name); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2192,7 +2192,6 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String sourceName = name;
|
|
||||||
HashSet children = new HashSet();
|
HashSet children = new HashSet();
|
||||||
listAllFiles(file, children);
|
listAllFiles(file, children);
|
||||||
File[] sources = new File[children.size() + 1];
|
File[] sources = new File[children.size() + 1];
|
||||||
|
@ -2208,7 +2207,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
sources[i] = (File) kids[i];
|
sources[i] = (File) kids[i];
|
||||||
newNames[i] = sources[i].getAbsolutePath().substring(charsToTrim);
|
newNames[i] = sources[i].getAbsolutePath().substring(charsToTrim);
|
||||||
newNames[i] = newNames[i].replace('\\','/');
|
newNames[i] = newNames[i].replace('\\','/');
|
||||||
if (sources[i].isDirectory() && !newNames[i].endsWith("/")) newNames[i] = newNames[i] + "/";
|
if (sources[i].isDirectory() && !newNames[i].endsWith("/")) newNames[i] = newNames[i] + "/"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
// this part can be changed to allow different encodings for different files
|
// this part can be changed to allow different encodings for different files
|
||||||
sourceEncodings[i] = sourceEncoding;
|
sourceEncodings[i] = sourceEncoding;
|
||||||
|
@ -2220,7 +2219,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
sourceEncodings[children.size()] = sourceEncoding;
|
sourceEncodings[children.size()] = sourceEncoding;
|
||||||
targetEncodings[children.size()] = targetEncoding;
|
targetEncodings[children.size()] = targetEncoding;
|
||||||
isTexts[children.size()] = isText;
|
isTexts[children.size()] = isText;
|
||||||
if (!newNames[children.size()].endsWith("/")) newNames[children.size()] = newNames[children.size()] + "/";
|
if (!newNames[children.size()].endsWith("/")) newNames[children.size()] = newNames[children.size()] + "/"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
return add(sources, virtualPath, newNames, sourceEncodings, targetEncodings, isTexts);
|
return add(sources, virtualPath, newNames, sourceEncodings, targetEncodings, isTexts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,9 +43,9 @@ public final class VirtualChild {
|
||||||
*/
|
*/
|
||||||
public VirtualChild(ISystemArchiveHandler handler)
|
public VirtualChild(ISystemArchiveHandler handler)
|
||||||
{
|
{
|
||||||
fullName = "";
|
fullName = ""; //$NON-NLS-1$
|
||||||
name = "";
|
name = ""; //$NON-NLS-1$
|
||||||
path = "";
|
path = ""; //$NON-NLS-1$
|
||||||
isDirectory = false;
|
isDirectory = false;
|
||||||
_handler = handler;
|
_handler = handler;
|
||||||
_extractedFile = null;
|
_extractedFile = null;
|
||||||
|
@ -112,7 +112,7 @@ public final class VirtualChild {
|
||||||
*/
|
*/
|
||||||
public String getComment()
|
public String getComment()
|
||||||
{
|
{
|
||||||
if (_handler == null) return "";
|
if (_handler == null) return ""; //$NON-NLS-1$
|
||||||
return _handler.getCommentFor(fullName);
|
return _handler.getCommentFor(fullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ public final class VirtualChild {
|
||||||
*/
|
*/
|
||||||
public String getCompressionMethod()
|
public String getCompressionMethod()
|
||||||
{
|
{
|
||||||
if (_handler == null) return "";
|
if (_handler == null) return ""; //$NON-NLS-1$
|
||||||
return _handler.getCompressionMethodFor(fullName);
|
return _handler.getCompressionMethodFor(fullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,16 +172,16 @@ public final class VirtualChild {
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int i = name.lastIndexOf(".");
|
int i = name.lastIndexOf("."); //$NON-NLS-1$
|
||||||
String ext = "";
|
String ext = ""; //$NON-NLS-1$
|
||||||
if (i != -1) ext = name.substring(i+1);
|
if (i != -1) ext = name.substring(i+1);
|
||||||
if (i < 3)
|
if (i < 3)
|
||||||
{
|
{
|
||||||
_extractedFile = File.createTempFile(name + "123", "virtual." + ext);
|
_extractedFile = File.createTempFile(name + "123", "virtual." + ext); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_extractedFile = File.createTempFile(name, "virtual." + ext);
|
_extractedFile = File.createTempFile(name, "virtual." + ext); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
_extractedFile.deleteOnExit();
|
_extractedFile.deleteOnExit();
|
||||||
if (_handler == null) return _extractedFile;
|
if (_handler == null) return _extractedFile;
|
||||||
|
@ -191,7 +191,7 @@ public final class VirtualChild {
|
||||||
{
|
{
|
||||||
if (!(_extractedFile.delete() && _extractedFile.mkdirs()))
|
if (!(_extractedFile.delete() && _extractedFile.mkdirs()))
|
||||||
{
|
{
|
||||||
System.out.println("VirtualChild.getExtractedFile(): Could not create temp dir.");
|
System.out.println("VirtualChild.getExtractedFile(): Could not create temp dir."); //$NON-NLS-1$
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ public final class VirtualChild {
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
System.out.println("VirtualChild.getExtractedFile(): ");
|
System.out.println("VirtualChild.getExtractedFile(): "); //$NON-NLS-1$
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -285,11 +285,11 @@ public final class VirtualChild {
|
||||||
{
|
{
|
||||||
newName = ArchiveHandlerManager.cleanUpVirtualPath(newName);
|
newName = ArchiveHandlerManager.cleanUpVirtualPath(newName);
|
||||||
fullName = newName;
|
fullName = newName;
|
||||||
int i = newName.lastIndexOf("/");
|
int i = newName.lastIndexOf("/"); //$NON-NLS-1$
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
{
|
{
|
||||||
name = newName;
|
name = newName;
|
||||||
path = "";
|
path = ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class BasicClassFileParser {
|
||||||
int nameIndex = info.getNameIndex();
|
int nameIndex = info.getNameIndex();
|
||||||
String name = getString(nameIndex);
|
String name = getString(nameIndex);
|
||||||
|
|
||||||
if (name.equals("main")) {
|
if (name.equals("main")) { //$NON-NLS-1$
|
||||||
|
|
||||||
// check access flags for public and static
|
// check access flags for public and static
|
||||||
int accessFlags = info.getAccessFlags();
|
int accessFlags = info.getAccessFlags();
|
||||||
|
@ -88,7 +88,7 @@ public class BasicClassFileParser {
|
||||||
int descriptorIndex = info.getDescriptorIndex();
|
int descriptorIndex = info.getDescriptorIndex();
|
||||||
String descriptor = getString(descriptorIndex);
|
String descriptor = getString(descriptorIndex);
|
||||||
|
|
||||||
if (descriptor.equals("([Ljava/lang/String;)V")) {
|
if (descriptor.equals("([Ljava/lang/String;)V")) { //$NON-NLS-1$
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class EnhancedClassLoader extends ClassLoader {
|
||||||
String parentPath = rootPath;
|
String parentPath = rootPath;
|
||||||
|
|
||||||
// system file separator
|
// system file separator
|
||||||
String fileSep = System.getProperty("file.separator");
|
String fileSep = System.getProperty("file.separator"); //$NON-NLS-1$
|
||||||
|
|
||||||
// add file separator to the parent path if it does not end with it
|
// add file separator to the parent path if it does not end with it
|
||||||
if (!parentPath.endsWith(fileSep)) {
|
if (!parentPath.endsWith(fileSep)) {
|
||||||
|
@ -99,7 +99,7 @@ public class EnhancedClassLoader extends ClassLoader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String filePath = buf.append(".class").toString();
|
String filePath = buf.append(".class").toString(); //$NON-NLS-1$
|
||||||
|
|
||||||
File file = new File(filePath);
|
File file = new File(filePath);
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class SystemMessage
|
||||||
public void setIndicator(char ind) throws IndicatorException {
|
public void setIndicator(char ind) throws IndicatorException {
|
||||||
// check that a valid indicator was specified
|
// check that a valid indicator was specified
|
||||||
if (ind != INQUIRY && ind != INFORMATION && ind != ERROR && ind != WARNING && ind != UNEXPECTED && ind != COMPLETION)
|
if (ind != INQUIRY && ind != INFORMATION && ind != ERROR && ind != WARNING && ind != UNEXPECTED && ind != COMPLETION)
|
||||||
throw (new IndicatorException("Indicator specified not valid. Unable to set Indicator."));
|
throw (new IndicatorException("Indicator specified not valid. Unable to set Indicator.")); //$NON-NLS-1$
|
||||||
indicator = ind;
|
indicator = ind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ public class SystemMessage
|
||||||
// otherwise we need to count the substitution variables.
|
// otherwise we need to count the substitution variables.
|
||||||
else {
|
else {
|
||||||
numSubs = 0; // initial value
|
numSubs = 0; // initial value
|
||||||
String allText = level1NS + " " + level2NS;
|
String allText = level1NS + " " + level2NS; //$NON-NLS-1$
|
||||||
String subVar = subPrefix + new Integer(numSubs + 1).toString();
|
String subVar = subPrefix + new Integer(numSubs + 1).toString();
|
||||||
int subLoc = allText.indexOf(subVar);
|
int subLoc = allText.indexOf(subVar);
|
||||||
while (subLoc >= 0) {
|
while (subLoc >= 0) {
|
||||||
|
@ -426,7 +426,7 @@ public class SystemMessage
|
||||||
* Returns string of the form: msgId + severity + ":" + first-level-text
|
* Returns string of the form: msgId + severity + ":" + first-level-text
|
||||||
*/
|
*/
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getFullMessageID() + ": " + getLevelOneText();
|
return getFullMessageID() + ": " + getLevelOneText(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -459,7 +459,7 @@ public class SystemMessage
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (sub == null) return "";
|
if (sub == null) return ""; //$NON-NLS-1$
|
||||||
|
|
||||||
if (sub instanceof Exception) {
|
if (sub instanceof Exception) {
|
||||||
Exception exc = (Exception) sub;
|
Exception exc = (Exception) sub;
|
||||||
|
@ -468,7 +468,7 @@ public class SystemMessage
|
||||||
String msg = exc.toString();
|
String msg = exc.toString();
|
||||||
//String msg = exc.getMessage();
|
//String msg = exc.getMessage();
|
||||||
if ((msg == null) || (exc instanceof ClassCastException)) msg = exc.getClass().getName();
|
if ((msg == null) || (exc instanceof ClassCastException)) msg = exc.getClass().getName();
|
||||||
return msg + "\n" + excWriter.toString();
|
return msg + "\n" + excWriter.toString(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
return sub.toString();
|
return sub.toString();
|
||||||
|
|
|
@ -57,16 +57,16 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
// caching SystemMessage objects for previously issued messages. Phil
|
// caching SystemMessage objects for previously issued messages. Phil
|
||||||
private Hashtable messages = new Hashtable();
|
private Hashtable messages = new Hashtable();
|
||||||
// XML TAG AND ELEMENT NAMES...
|
// XML TAG AND ELEMENT NAMES...
|
||||||
private static final String XML_TAG_COMPONENT = "Component";
|
private static final String XML_TAG_COMPONENT = "Component"; //$NON-NLS-1$
|
||||||
private static final String XML_TAG_SUBCOMPONENT = "Subcomponent";
|
private static final String XML_TAG_SUBCOMPONENT = "Subcomponent"; //$NON-NLS-1$
|
||||||
private static final String XML_TAG_MESSAGeList = "MessageList";
|
private static final String XML_TAG_MESSAGeList = "MessageList"; //$NON-NLS-1$
|
||||||
private static final String XML_TAG_MESSAGE = "Message";
|
private static final String XML_TAG_MESSAGE = "Message"; //$NON-NLS-1$
|
||||||
private static final String XML_TAG_LEVELONE = "LevelOne";
|
private static final String XML_TAG_LEVELONE = "LevelOne"; //$NON-NLS-1$
|
||||||
private static final String XML_TAG_LEVELTWO = "LevelTwo";
|
private static final String XML_TAG_LEVELTWO = "LevelTwo"; //$NON-NLS-1$
|
||||||
private static final String XML_ATTR_ABBR = "Abbr";
|
private static final String XML_ATTR_ABBR = "Abbr"; //$NON-NLS-1$
|
||||||
private static final String XML_ATTR_ID = "ID";
|
private static final String XML_ATTR_ID = "ID"; //$NON-NLS-1$
|
||||||
private static final String XML_ATTR_INDICATOR = "Indicator";
|
private static final String XML_ATTR_INDICATOR = "Indicator"; //$NON-NLS-1$
|
||||||
private static final String XML_ATTR_NAME = "Name";
|
private static final String XML_ATTR_NAME = "Name"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -163,13 +163,13 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
// DY Defect 42605
|
// DY Defect 42605
|
||||||
if (msgFile.getXMLDocument() == null)
|
if (msgFile.getXMLDocument() == null)
|
||||||
{
|
{
|
||||||
issueErrorMessage("No XML document for message file", echoErrorsToStandardOut);
|
issueErrorMessage("No XML document for message file", echoErrorsToStandardOut); //$NON-NLS-1$
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// caching added by Phil to increase performance, and not to leave a trail of SystemMessage objects for
|
// caching added by Phil to increase performance, and not to leave a trail of SystemMessage objects for
|
||||||
// the garbage collector. Hopefully, the extra memory for the cache does not defeat these benefits.
|
// the garbage collector. Hopefully, the extra memory for the cache does not defeat these benefits.
|
||||||
SystemMessage msg = (SystemMessage)messages.get(msgFile.getMessageShortFileName()+":"+msgId);
|
SystemMessage msg = (SystemMessage)messages.get(msgFile.getMessageShortFileName()+":"+msgId); //$NON-NLS-1$
|
||||||
if (msg != null)
|
if (msg != null)
|
||||||
{
|
{
|
||||||
//System.out.println("Reusing msg " + msgId);
|
//System.out.println("Reusing msg " + msgId);
|
||||||
|
@ -185,7 +185,7 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
NodeList componentElementList = msgFile.getXMLDocument().getElementsByTagName(XML_TAG_COMPONENT);
|
NodeList componentElementList = msgFile.getXMLDocument().getElementsByTagName(XML_TAG_COMPONENT);
|
||||||
if ((componentElementList == null) || (componentElementList.getLength() == 0))
|
if ((componentElementList == null) || (componentElementList.getLength() == 0))
|
||||||
{
|
{
|
||||||
issueErrorMessage("Unable to find any Component elements",echoErrorsToStandardOut);
|
issueErrorMessage("Unable to find any Component elements",echoErrorsToStandardOut); //$NON-NLS-1$
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
|
|
||||||
if ((subComponentList == null) || (subComponentList.getLength() == 0))
|
if ((subComponentList == null) || (subComponentList.getLength() == 0))
|
||||||
{
|
{
|
||||||
issueErrorMessage("Unable to find any Subcomponent elements",echoErrorsToStandardOut);
|
issueErrorMessage("Unable to find any Subcomponent elements",echoErrorsToStandardOut); //$NON-NLS-1$
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,8 +213,8 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
//String msgPrefix=componentAbbr+subComponentAbbr;
|
//String msgPrefix=componentAbbr+subComponentAbbr;
|
||||||
String msgPrefix = (componentAbbr + subComponentAbbr).toUpperCase();
|
String msgPrefix = (componentAbbr + subComponentAbbr).toUpperCase();
|
||||||
char msgIndicator=' ';
|
char msgIndicator=' ';
|
||||||
String msgL1="";
|
String msgL1=""; //$NON-NLS-1$
|
||||||
String msgL2="";
|
String msgL2=""; //$NON-NLS-1$
|
||||||
|
|
||||||
// if the message prefix matches, then try to find the message
|
// if the message prefix matches, then try to find the message
|
||||||
//if (msgPrefix.toUpperCase().equals(msgId.toUpperCase().substring(0,msgPrefix.length())) &&
|
//if (msgPrefix.toUpperCase().equals(msgId.toUpperCase().substring(0,msgPrefix.length())) &&
|
||||||
|
@ -242,7 +242,7 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
messageListNode = (Element)msgListNodes.item(0);
|
messageListNode = (Element)msgListNodes.item(0);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
issueWarningMessage("unable to find MessageList nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut);
|
issueWarningMessage("unable to find MessageList nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut); //$NON-NLS-1$
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
NodeList msgNodes = messageListNode.getElementsByTagName(XML_TAG_MESSAGE);
|
NodeList msgNodes = messageListNode.getElementsByTagName(XML_TAG_MESSAGE);
|
||||||
if ((msgNodes==null) || (msgNodes.getLength()==0))
|
if ((msgNodes==null) || (msgNodes.getLength()==0))
|
||||||
{
|
{
|
||||||
issueWarningMessage("unable to find Message nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut);
|
issueWarningMessage("unable to find Message nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut); //$NON-NLS-1$
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
boolean match = false; // I added this so we stop looping when we find what we are looking for!!! Phil.
|
boolean match = false; // I added this so we stop looping when we find what we are looking for!!! Phil.
|
||||||
|
@ -291,7 +291,7 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
msg = loadSystemMessage(componentAbbr, subComponentAbbr, msgNumber, msgIndicator, msgL1, msgL2);
|
msg = loadSystemMessage(componentAbbr, subComponentAbbr, msgNumber, msgIndicator, msgL1, msgL2);
|
||||||
messages.put(msgFile.getMessageShortFileName()+":"+msgId, msg); // add to cache so we find it immediately next time!!
|
messages.put(msgFile.getMessageShortFileName()+":"+msgId, msg); // add to cache so we find it immediately next time!! //$NON-NLS-1$
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
catch (IndicatorException e)
|
catch (IndicatorException e)
|
||||||
|
@ -329,7 +329,7 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
*/
|
*/
|
||||||
private String getNodeText(Node msgNode)
|
private String getNodeText(Node msgNode)
|
||||||
{
|
{
|
||||||
String nodeText = "";
|
String nodeText = ""; //$NON-NLS-1$
|
||||||
for (Node textNode=msgNode.getFirstChild();
|
for (Node textNode=msgNode.getFirstChild();
|
||||||
textNode!=null; textNode=textNode.getNextSibling())
|
textNode!=null; textNode=textNode.getNextSibling())
|
||||||
{
|
{
|
||||||
|
@ -349,12 +349,12 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
{
|
{
|
||||||
boolean echoErrorsToStandardOut = true;
|
boolean echoErrorsToStandardOut = true;
|
||||||
if (msgFile.getXMLDocument() == null)
|
if (msgFile.getXMLDocument() == null)
|
||||||
return issueErrorMessage("No XML document for message file", echoErrorsToStandardOut);
|
return issueErrorMessage("No XML document for message file", echoErrorsToStandardOut); //$NON-NLS-1$
|
||||||
|
|
||||||
// parse out the Abbr attr of the first Component element
|
// parse out the Abbr attr of the first Component element
|
||||||
NodeList componentElementList = msgFile.getXMLDocument().getElementsByTagName(XML_TAG_COMPONENT);
|
NodeList componentElementList = msgFile.getXMLDocument().getElementsByTagName(XML_TAG_COMPONENT);
|
||||||
if ((componentElementList == null) || (componentElementList.getLength() == 0))
|
if ((componentElementList == null) || (componentElementList.getLength() == 0))
|
||||||
return issueErrorMessage("Unable to find any Component elements",echoErrorsToStandardOut);
|
return issueErrorMessage("Unable to find any Component elements",echoErrorsToStandardOut); //$NON-NLS-1$
|
||||||
|
|
||||||
Element componentElement = (Element)componentElementList.item(0);
|
Element componentElement = (Element)componentElementList.item(0);
|
||||||
String componentAbbr = componentElement.getAttribute(XML_ATTR_ABBR);
|
String componentAbbr = componentElement.getAttribute(XML_ATTR_ABBR);
|
||||||
|
@ -363,7 +363,7 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
NodeList subComponentList=msgFile.getXMLDocument().getElementsByTagName(XML_TAG_SUBCOMPONENT);
|
NodeList subComponentList=msgFile.getXMLDocument().getElementsByTagName(XML_TAG_SUBCOMPONENT);
|
||||||
|
|
||||||
if ((subComponentList == null) || (subComponentList.getLength() == 0))
|
if ((subComponentList == null) || (subComponentList.getLength() == 0))
|
||||||
return issueErrorMessage("Unable to find any Subcomponent elements",echoErrorsToStandardOut);
|
return issueErrorMessage("Unable to find any Subcomponent elements",echoErrorsToStandardOut); //$NON-NLS-1$
|
||||||
|
|
||||||
// scan all subcomponents...
|
// scan all subcomponents...
|
||||||
boolean anyDupes = false;
|
boolean anyDupes = false;
|
||||||
|
@ -381,14 +381,14 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
messageListNode = (Element)msgListNodes.item(0);
|
messageListNode = (Element)msgListNodes.item(0);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
issueWarningMessage("unable to find MessageList nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut);
|
issueWarningMessage("unable to find MessageList nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut); //$NON-NLS-1$
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeList msgNodes = messageListNode.getElementsByTagName(XML_TAG_MESSAGE);
|
NodeList msgNodes = messageListNode.getElementsByTagName(XML_TAG_MESSAGE);
|
||||||
if ((msgNodes==null) || (msgNodes.getLength()==0))
|
if ((msgNodes==null) || (msgNodes.getLength()==0))
|
||||||
{
|
{
|
||||||
issueWarningMessage("unable to find Message nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut);
|
issueWarningMessage("unable to find Message nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut); //$NON-NLS-1$
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (int msgIdx = 0; (msgIdx < msgNodes.getLength()); msgIdx++)
|
for (int msgIdx = 0; (msgIdx < msgNodes.getLength()); msgIdx++)
|
||||||
|
@ -398,7 +398,7 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
if (msgsById.contains(msgId))
|
if (msgsById.contains(msgId))
|
||||||
{
|
{
|
||||||
anyDupes = true;
|
anyDupes = true;
|
||||||
issueWarningMessage("Warning: duplicate message " + msgId + " found", echoErrorsToStandardOut);
|
issueWarningMessage("Warning: duplicate message " + msgId + " found", echoErrorsToStandardOut); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
msgsById.addElement(msgId);
|
msgsById.addElement(msgId);
|
||||||
|
@ -417,12 +417,12 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
{
|
{
|
||||||
boolean echoErrorsToStandardOut = true;
|
boolean echoErrorsToStandardOut = true;
|
||||||
if (msgFile.getXMLDocument() == null)
|
if (msgFile.getXMLDocument() == null)
|
||||||
return issueErrorMessage("No XML document for message file", echoErrorsToStandardOut);
|
return issueErrorMessage("No XML document for message file", echoErrorsToStandardOut); //$NON-NLS-1$
|
||||||
|
|
||||||
// parse out the Abbr attr of the first Component element
|
// parse out the Abbr attr of the first Component element
|
||||||
NodeList componentElementList = msgFile.getXMLDocument().getElementsByTagName(XML_TAG_COMPONENT);
|
NodeList componentElementList = msgFile.getXMLDocument().getElementsByTagName(XML_TAG_COMPONENT);
|
||||||
if ((componentElementList == null) || (componentElementList.getLength() == 0))
|
if ((componentElementList == null) || (componentElementList.getLength() == 0))
|
||||||
return issueErrorMessage("Unable to find any Component elements",echoErrorsToStandardOut);
|
return issueErrorMessage("Unable to find any Component elements",echoErrorsToStandardOut); //$NON-NLS-1$
|
||||||
|
|
||||||
Element componentElement = (Element)componentElementList.item(0);
|
Element componentElement = (Element)componentElementList.item(0);
|
||||||
String componentAbbr = componentElement.getAttribute(XML_ATTR_ABBR);
|
String componentAbbr = componentElement.getAttribute(XML_ATTR_ABBR);
|
||||||
|
@ -431,29 +431,29 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
NodeList subComponentList=msgFile.getXMLDocument().getElementsByTagName(XML_TAG_SUBCOMPONENT);
|
NodeList subComponentList=msgFile.getXMLDocument().getElementsByTagName(XML_TAG_SUBCOMPONENT);
|
||||||
|
|
||||||
if ((subComponentList == null) || (subComponentList.getLength() == 0))
|
if ((subComponentList == null) || (subComponentList.getLength() == 0))
|
||||||
return issueErrorMessage("Unable to find any Subcomponent elements",echoErrorsToStandardOut);
|
return issueErrorMessage("Unable to find any Subcomponent elements",echoErrorsToStandardOut); //$NON-NLS-1$
|
||||||
|
|
||||||
File outFile = new File(fullFileName);
|
File outFile = new File(fullFileName);
|
||||||
PrintWriter outFileStream = null;
|
PrintWriter outFileStream = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
outFileStream = new PrintWriter(new FileOutputStream(outFile));
|
outFileStream = new PrintWriter(new FileOutputStream(outFile));
|
||||||
outFileStream.println("<HTML> <HEAD> <TITLE> Message File "+msgFile.getMessageShortFileName()+" </TITLE>");
|
outFileStream.println("<HTML> <HEAD> <TITLE> Message File "+msgFile.getMessageShortFileName()+" </TITLE>"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
outFileStream.println("<style type=\"text/css\">");
|
outFileStream.println("<style type=\"text/css\">"); //$NON-NLS-1$
|
||||||
outFileStream.println("h2 { background-color: #CCCCFF }");
|
outFileStream.println("h2 { background-color: #CCCCFF }"); //$NON-NLS-1$
|
||||||
outFileStream.println("</style>");
|
outFileStream.println("</style>"); //$NON-NLS-1$
|
||||||
outFileStream.println("</HEAD> <BODY>");
|
outFileStream.println("</HEAD> <BODY>"); //$NON-NLS-1$
|
||||||
outFileStream.println("<H1>"+componentElement.getAttribute(XML_ATTR_NAME)+" Messages</H1>");
|
outFileStream.println("<H1>"+componentElement.getAttribute(XML_ATTR_NAME)+" Messages</H1>"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
outFileStream.println("<br>");
|
outFileStream.println("<br>"); //$NON-NLS-1$
|
||||||
outFileStream.println("<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\" WIDTH=\"100%\">");
|
outFileStream.println("<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\" WIDTH=\"100%\">"); //$NON-NLS-1$
|
||||||
outFileStream.println("<TR BGCOLOR=\"#CCCCFF\">");
|
outFileStream.println("<TR BGCOLOR=\"#CCCCFF\">"); //$NON-NLS-1$
|
||||||
outFileStream.println("<TD COLSPAN=2><FONT SIZE=\"+2\">");
|
outFileStream.println("<TD COLSPAN=2><FONT SIZE=\"+2\">"); //$NON-NLS-1$
|
||||||
outFileStream.println("<B>Sub-Component Summary</B></FONT></TD>");
|
outFileStream.println("<B>Sub-Component Summary</B></FONT></TD>"); //$NON-NLS-1$
|
||||||
outFileStream.println("</TR>");
|
outFileStream.println("</TR>"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
catch (IOException exc)
|
catch (IOException exc)
|
||||||
{
|
{
|
||||||
return issueErrorMessage("Unable to open given html file in printHTML: " + exc.getMessage(), echoErrorsToStandardOut);
|
return issueErrorMessage("Unable to open given html file in printHTML: " + exc.getMessage(), echoErrorsToStandardOut); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
// pre-scan all subcomponents...
|
// pre-scan all subcomponents...
|
||||||
|
@ -464,12 +464,12 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
String msgPrefix = (componentAbbr + subComponentAbbr).toUpperCase();
|
String msgPrefix = (componentAbbr + subComponentAbbr).toUpperCase();
|
||||||
String scName = subComponentElement.getAttribute(XML_ATTR_NAME);
|
String scName = subComponentElement.getAttribute(XML_ATTR_NAME);
|
||||||
|
|
||||||
outFileStream.println("<TR BGCOLOR=\"white\">");
|
outFileStream.println("<TR BGCOLOR=\"white\">"); //$NON-NLS-1$
|
||||||
outFileStream.println("<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\">");
|
outFileStream.println("<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\">"); //$NON-NLS-1$
|
||||||
outFileStream.println("<A href=#"+scName+">"+scName+"</A></TD>");
|
outFileStream.println("<A href=#"+scName+">"+scName+"</A></TD>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
outFileStream.println("<TD><b>Message prefix</b>="+msgPrefix+"</TD></TR>");
|
outFileStream.println("<TD><b>Message prefix</b>="+msgPrefix+"</TD></TR>"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
outFileStream.println("</TABLE>");
|
outFileStream.println("</TABLE>"); //$NON-NLS-1$
|
||||||
|
|
||||||
// scan all subcomponents...
|
// scan all subcomponents...
|
||||||
for (int subComponentIdx=0; subComponentIdx<subComponentList.getLength(); subComponentIdx++)
|
for (int subComponentIdx=0; subComponentIdx<subComponentList.getLength(); subComponentIdx++)
|
||||||
|
@ -485,41 +485,41 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
messageListNode = (Element)msgListNodes.item(0);
|
messageListNode = (Element)msgListNodes.item(0);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
issueWarningMessage("unable to find MessageList nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut);
|
issueWarningMessage("unable to find MessageList nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut); //$NON-NLS-1$
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeList msgNodes = messageListNode.getElementsByTagName(XML_TAG_MESSAGE);
|
NodeList msgNodes = messageListNode.getElementsByTagName(XML_TAG_MESSAGE);
|
||||||
if ((msgNodes==null) || (msgNodes.getLength()==0))
|
if ((msgNodes==null) || (msgNodes.getLength()==0))
|
||||||
{
|
{
|
||||||
issueWarningMessage("unable to find Message nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut);
|
issueWarningMessage("unable to find Message nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut); //$NON-NLS-1$
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (subComponentIdx > 0)
|
if (subComponentIdx > 0)
|
||||||
outFileStream.println("<hr>");
|
outFileStream.println("<hr>"); //$NON-NLS-1$
|
||||||
String scName = subComponentElement.getAttribute(XML_ATTR_NAME);
|
String scName = subComponentElement.getAttribute(XML_ATTR_NAME);
|
||||||
outFileStream.println("<A NAME=\""+scName+"\"><!-- --></A><H2>"+scName+" Messages</H2>");
|
outFileStream.println("<A NAME=\""+scName+"\"><!-- --></A><H2>"+scName+" Messages</H2>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
for (int msgIdx = 0; (msgIdx < msgNodes.getLength()); msgIdx++)
|
for (int msgIdx = 0; (msgIdx < msgNodes.getLength()); msgIdx++)
|
||||||
{
|
{
|
||||||
Element node = (Element)msgNodes.item(msgIdx);
|
Element node = (Element)msgNodes.item(msgIdx);
|
||||||
String msgId = msgPrefix + node.getAttribute(XML_ATTR_ID);
|
String msgId = msgPrefix + node.getAttribute(XML_ATTR_ID);
|
||||||
char msgIndicator=node.getAttribute(XML_ATTR_INDICATOR).toUpperCase().charAt(0);
|
char msgIndicator=node.getAttribute(XML_ATTR_INDICATOR).toUpperCase().charAt(0);
|
||||||
String msgSeverity = "Unknown";
|
String msgSeverity = "Unknown"; //$NON-NLS-1$
|
||||||
if (msgIndicator == SystemMessage.ERROR)
|
if (msgIndicator == SystemMessage.ERROR)
|
||||||
msgSeverity = "Error";
|
msgSeverity = "Error"; //$NON-NLS-1$
|
||||||
else if (msgIndicator == SystemMessage.WARNING)
|
else if (msgIndicator == SystemMessage.WARNING)
|
||||||
msgSeverity = "Warning";
|
msgSeverity = "Warning"; //$NON-NLS-1$
|
||||||
else if (msgIndicator == SystemMessage.INQUIRY)
|
else if (msgIndicator == SystemMessage.INQUIRY)
|
||||||
msgSeverity = "Question";
|
msgSeverity = "Question"; //$NON-NLS-1$
|
||||||
else if (msgIndicator == SystemMessage.INFORMATION)
|
else if (msgIndicator == SystemMessage.INFORMATION)
|
||||||
msgSeverity = "Information";
|
msgSeverity = "Information"; //$NON-NLS-1$
|
||||||
else if (msgIndicator == SystemMessage.COMPLETION)
|
else if (msgIndicator == SystemMessage.COMPLETION)
|
||||||
msgSeverity = "Completion";
|
msgSeverity = "Completion"; //$NON-NLS-1$
|
||||||
else if (msgIndicator == SystemMessage.UNEXPECTED)
|
else if (msgIndicator == SystemMessage.UNEXPECTED)
|
||||||
msgSeverity = "Unexpected";
|
msgSeverity = "Unexpected"; //$NON-NLS-1$
|
||||||
|
|
||||||
String msgL1 = "";
|
String msgL1 = ""; //$NON-NLS-1$
|
||||||
String msgL2 = "";
|
String msgL2 = ""; //$NON-NLS-1$
|
||||||
// search for the l1 & l2 text
|
// search for the l1 & l2 text
|
||||||
for (Node msgNode=node.getFirstChild();
|
for (Node msgNode=node.getFirstChild();
|
||||||
msgNode!=null; msgNode=msgNode.getNextSibling())
|
msgNode!=null; msgNode=msgNode.getNextSibling())
|
||||||
|
@ -531,14 +531,14 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
else if (msgNode.getNodeName().equals(XML_TAG_LEVELTWO))
|
else if (msgNode.getNodeName().equals(XML_TAG_LEVELTWO))
|
||||||
msgL2 = getNodeText(msgNode);
|
msgL2 = getNodeText(msgNode);
|
||||||
}
|
}
|
||||||
outFileStream.println("<H3>"+msgId+"</H3>");
|
outFileStream.println("<H3>"+msgId+"</H3>"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
outFileStream.println("<b>Severity: </b>"+msgSeverity+"<br>");
|
outFileStream.println("<b>Severity: </b>"+msgSeverity+"<br>"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
outFileStream.println("<b>LevelOne: </b>"+msgL1+"<br>");
|
outFileStream.println("<b>LevelOne: </b>"+msgL1+"<br>"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
outFileStream.println("<b>LevelTwo: </b>"+msgL2+"<br>");
|
outFileStream.println("<b>LevelTwo: </b>"+msgL2+"<br>"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
outFileStream.println("<br>");
|
outFileStream.println("<br>"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
outFileStream.println("</BODY></HTML>");
|
outFileStream.println("</BODY></HTML>"); //$NON-NLS-1$
|
||||||
outFileStream.close();
|
outFileStream.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -554,7 +554,7 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
SystemBasePlugin.logError("MessageFile error for msg file " + msgFile.getMessageShortFileName() + ": " + errormsg);
|
SystemBasePlugin.logError("MessageFile error for msg file " + msgFile.getMessageShortFileName() + ": " + errormsg);
|
||||||
**/
|
**/
|
||||||
if (echoStandardOut)
|
if (echoStandardOut)
|
||||||
System.out.println("MessageFile error for msg file " + msgFile.getMessageShortFileName() + ": " + errormsg);
|
System.out.println("MessageFile error for msg file " + msgFile.getMessageShortFileName() + ": " + errormsg); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -566,7 +566,7 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
SystemBasePlugin.logError("MessageFile warning for msg file " + msgFile.getMessageShortFileName() + ": " + errormsg);
|
SystemBasePlugin.logError("MessageFile warning for msg file " + msgFile.getMessageShortFileName() + ": " + errormsg);
|
||||||
*/
|
*/
|
||||||
if (echoStandardOut)
|
if (echoStandardOut)
|
||||||
System.out.println("MessageFile warning for msg file " + msgFile.getMessageShortFileName() + ": " + errormsg);
|
System.out.println("MessageFile warning for msg file " + msgFile.getMessageShortFileName() + ": " + errormsg); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -674,7 +674,7 @@ public class SystemMessageFile implements ErrorHandler
|
||||||
// the current parser hits a fatal exception.
|
// the current parser hits a fatal exception.
|
||||||
// This hack prevents that exception so that the
|
// This hack prevents that exception so that the
|
||||||
// specified EntityResolver will get used.
|
// specified EntityResolver will get used.
|
||||||
in.setSystemId("foo");
|
in.setSystemId("foo"); //$NON-NLS-1$
|
||||||
Document document = parser.parse(in);
|
Document document = parser.parse(in);
|
||||||
|
|
||||||
//Document document = parser.parse(messageFile);
|
//Document document = parser.parse(messageFile);
|
||||||
|
|
|
@ -40,7 +40,7 @@ import org.eclipse.rse.services.clientserver.NamePatternMatcher;
|
||||||
public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISystemProcessRemoteConstants
|
public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISystemProcessRemoteConstants
|
||||||
{
|
{
|
||||||
|
|
||||||
public static final String ALL = "*";
|
public static final String ALL = "*"; //$NON-NLS-1$
|
||||||
|
|
||||||
protected static final char WILDCARD = '*';
|
protected static final char WILDCARD = '*';
|
||||||
|
|
||||||
|
@ -107,15 +107,15 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy
|
||||||
maxVM = -1;
|
maxVM = -1;
|
||||||
anystatus = true;
|
anystatus = true;
|
||||||
initStates();
|
initStates();
|
||||||
status = "";
|
status = ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initInput(String input)
|
protected void initInput(String input)
|
||||||
{
|
{
|
||||||
anystatus = true;
|
anystatus = true;
|
||||||
StringTokenizer tz = new StringTokenizer(input, "|");
|
StringTokenizer tz = new StringTokenizer(input, "|"); //$NON-NLS-1$
|
||||||
String strMinVM = "0";
|
String strMinVM = "0"; //$NON-NLS-1$
|
||||||
String strMaxVM = "-1";
|
String strMaxVM = "-1"; //$NON-NLS-1$
|
||||||
|
|
||||||
if (tz.hasMoreTokens())
|
if (tz.hasMoreTokens())
|
||||||
{
|
{
|
||||||
|
@ -154,9 +154,9 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy
|
||||||
|
|
||||||
if (!(status == null))
|
if (!(status == null))
|
||||||
{
|
{
|
||||||
if (!status.equals(""))
|
if (!status.equals("")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
String[] allStates = status.split(",");
|
String[] allStates = status.split(","); //$NON-NLS-1$
|
||||||
if (!(allStates == null))
|
if (!(allStates == null))
|
||||||
{
|
{
|
||||||
initStates();
|
initStates();
|
||||||
|
@ -169,19 +169,19 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == null || name.equals(""))
|
if (name == null || name.equals("")) //$NON-NLS-1$
|
||||||
name = ALL;
|
name = ALL;
|
||||||
|
|
||||||
if (username == null || username.equals(""))
|
if (username == null || username.equals("")) //$NON-NLS-1$
|
||||||
username = ALL;
|
username = ALL;
|
||||||
|
|
||||||
if (gid == null || gid.equals(""))
|
if (gid == null || gid.equals("")) //$NON-NLS-1$
|
||||||
gid = ALL;
|
gid = ALL;
|
||||||
|
|
||||||
if (ppid == null || ppid.equals(""))
|
if (ppid == null || ppid.equals("")) //$NON-NLS-1$
|
||||||
ppid = ALL;
|
ppid = ALL;
|
||||||
|
|
||||||
if (pid == null || pid.equals(""))
|
if (pid == null || pid.equals("")) //$NON-NLS-1$
|
||||||
pid = ALL;
|
pid = ALL;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -227,7 +227,7 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy
|
||||||
*/
|
*/
|
||||||
public String getUsername()
|
public String getUsername()
|
||||||
{
|
{
|
||||||
if (_resolveVariables && username.equals("${user.id}"))
|
if (_resolveVariables && username.equals("${user.id}")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
return ALL;
|
return ALL;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy
|
||||||
*/
|
*/
|
||||||
public String getMinVM()
|
public String getMinVM()
|
||||||
{
|
{
|
||||||
return "" + minVM;
|
return "" + minVM; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -280,7 +280,7 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy
|
||||||
*/
|
*/
|
||||||
public String getMaxVM()
|
public String getMaxVM()
|
||||||
{
|
{
|
||||||
return "" + maxVM;
|
return "" + maxVM; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -372,12 +372,12 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy
|
||||||
*/
|
*/
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return name + "|" + username + "|" + gid + "|" + toStateString() + "|" + ppid + "|" + pid + "|" + minVM + "|" + maxVM;
|
return name + "|" + username + "|" + gid + "|" + toStateString() + "|" + ppid + "|" + pid + "|" + minVM + "|" + maxVM; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String toStateString()
|
protected String toStateString()
|
||||||
{
|
{
|
||||||
String s = " ";
|
String s = " "; //$NON-NLS-1$
|
||||||
|
|
||||||
if (!anystatus)
|
if (!anystatus)
|
||||||
{
|
{
|
||||||
|
@ -385,10 +385,10 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy
|
||||||
{
|
{
|
||||||
Boolean currentState = (Boolean) states.get(ALL_STATES_STR[i]);
|
Boolean currentState = (Boolean) states.get(ALL_STATES_STR[i]);
|
||||||
if (currentState.booleanValue()) s = s + ALL_STATES_STR[i];
|
if (currentState.booleanValue()) s = s + ALL_STATES_STR[i];
|
||||||
if (currentState.booleanValue()) s = s + ",";
|
if (currentState.booleanValue()) s = s + ","; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
if (!s.trim().equals("")) s = s.trim();
|
if (!s.trim().equals("")) s = s.trim(); //$NON-NLS-1$
|
||||||
if (s.endsWith(",")) s = s.substring(0, s.length() - 1);
|
if (s.endsWith(",")) s = s.substring(0, s.length() - 1); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -405,7 +405,7 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy
|
||||||
public boolean allows(String status)
|
public boolean allows(String status)
|
||||||
{
|
{
|
||||||
NamePatternMatcher matcher = null;
|
NamePatternMatcher matcher = null;
|
||||||
String[] tokens = status.split("\\|");
|
String[] tokens = status.split("\\|"); //$NON-NLS-1$
|
||||||
if (tokens.length < (PROCESS_ATTRIBUTES_COUNT -1)) return false;
|
if (tokens.length < (PROCESS_ATTRIBUTES_COUNT -1)) return false;
|
||||||
|
|
||||||
matcher = new NamePatternMatcher(gid, true, false);
|
matcher = new NamePatternMatcher(gid, true, false);
|
||||||
|
@ -417,7 +417,7 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy
|
||||||
String state = tokens[PROCESS_ATTRIBUTES_INDEX_STATUS].trim();
|
String state = tokens[PROCESS_ATTRIBUTES_INDEX_STATUS].trim();
|
||||||
if (!satisfiesState(state)) return false;
|
if (!satisfiesState(state)) return false;
|
||||||
|
|
||||||
if (getUsername().equals("${user.id}"))
|
if (getUsername().equals("${user.id}")) //$NON-NLS-1$
|
||||||
matcher = new NamePatternMatcher(ALL, true, false);
|
matcher = new NamePatternMatcher(ALL, true, false);
|
||||||
else
|
else
|
||||||
matcher = new NamePatternMatcher(getUsername(), true, false);
|
matcher = new NamePatternMatcher(getUsername(), true, false);
|
||||||
|
@ -433,7 +433,7 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (tokens[PROCESS_ATTRIBUTES_INDEX_VMSIZE].trim().equals("")) vmSize = 0;
|
if (tokens[PROCESS_ATTRIBUTES_INDEX_VMSIZE].trim().equals("")) vmSize = 0; //$NON-NLS-1$
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
if (!(vmSize >= minVM)) return false;
|
if (!(vmSize >= minVM)) return false;
|
||||||
|
@ -459,7 +459,7 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy
|
||||||
{
|
{
|
||||||
if (!anystatus)
|
if (!anystatus)
|
||||||
{
|
{
|
||||||
String[] allStates = state.split(",");
|
String[] allStates = state.split(","); //$NON-NLS-1$
|
||||||
if (allStates == null) return false;
|
if (allStates == null) return false;
|
||||||
if (allStates.length == 0) return false;
|
if (allStates.length == 0) return false;
|
||||||
boolean satisfied = false;
|
boolean satisfied = false;
|
||||||
|
|
|
@ -150,45 +150,45 @@ public interface ISystemProcessRemoteConstants
|
||||||
|
|
||||||
public static final String[] ALL_STATES_STR =
|
public static final String[] ALL_STATES_STR =
|
||||||
{
|
{
|
||||||
"ASTATE_ACTIVE",
|
"ASTATE_ACTIVE", //$NON-NLS-1$
|
||||||
"ISTATE_IDLE",
|
"ISTATE_IDLE", //$NON-NLS-1$
|
||||||
"OSTATE_NONEXISTENT",
|
"OSTATE_NONEXISTENT", //$NON-NLS-1$
|
||||||
"WSTATE_PAGING",
|
"WSTATE_PAGING", //$NON-NLS-1$
|
||||||
"RSTATE_RUNNING",
|
"RSTATE_RUNNING", //$NON-NLS-1$
|
||||||
"SSTATE_SLEEPING",
|
"SSTATE_SLEEPING", //$NON-NLS-1$
|
||||||
"TSTATE_TRACED",
|
"TSTATE_TRACED", //$NON-NLS-1$
|
||||||
"DSTATE_WAITING",
|
"DSTATE_WAITING", //$NON-NLS-1$
|
||||||
"ZSTATE_ZOMBIE",
|
"ZSTATE_ZOMBIE", //$NON-NLS-1$
|
||||||
"1STATE_ZOS_SINGLE",
|
"1STATE_ZOS_SINGLE", //$NON-NLS-1$
|
||||||
"ASTATE_ZOS_MSGQRECEIVEWAIT",
|
"ASTATE_ZOS_MSGQRECEIVEWAIT", //$NON-NLS-1$
|
||||||
"BSTATE_ZOS_MSGQSENDWAIT",
|
"BSTATE_ZOS_MSGQSENDWAIT", //$NON-NLS-1$
|
||||||
"CSTATE_ZOS_COMSYSKERNELWAIT",
|
"CSTATE_ZOS_COMSYSKERNELWAIT", //$NON-NLS-1$
|
||||||
"DSTATE_ZOS_SEMAPHOREWAIT",
|
"DSTATE_ZOS_SEMAPHOREWAIT", //$NON-NLS-1$
|
||||||
"ESTATE_ZOS_QUIESCEFROZEN",
|
"ESTATE_ZOS_QUIESCEFROZEN", //$NON-NLS-1$
|
||||||
"FSTATE_ZOS_FILESYSKERNELWAIT",
|
"FSTATE_ZOS_FILESYSKERNELWAIT", //$NON-NLS-1$
|
||||||
"GSTATE_ZOS_MVSPAUSEWAIT",
|
"GSTATE_ZOS_MVSPAUSEWAIT", //$NON-NLS-1$
|
||||||
"HSTATE_ZOS_PTHREADCREATEDTASKS",
|
"HSTATE_ZOS_PTHREADCREATEDTASKS", //$NON-NLS-1$
|
||||||
"ISTATE_ZOS_SWAPPEDOUT",
|
"ISTATE_ZOS_SWAPPEDOUT", //$NON-NLS-1$
|
||||||
"JSTATE_ZOS_PTHREADCREATED",
|
"JSTATE_ZOS_PTHREADCREATED", //$NON-NLS-1$
|
||||||
"KSTATE_ZOS_OTHERKERNELWAIT",
|
"KSTATE_ZOS_OTHERKERNELWAIT", //$NON-NLS-1$
|
||||||
"LSTATE_ZOS_CANCELLED",
|
"LSTATE_ZOS_CANCELLED", //$NON-NLS-1$
|
||||||
"MSTATE_ZOS_MULTITHREAD",
|
"MSTATE_ZOS_MULTITHREAD", //$NON-NLS-1$
|
||||||
"NSTATE_ZOS_MEDIUMWEIGHTTHREAD",
|
"NSTATE_ZOS_MEDIUMWEIGHTTHREAD", //$NON-NLS-1$
|
||||||
"OSTATE_ZOS_ASYNCHRONOUSTHREAD",
|
"OSTATE_ZOS_ASYNCHRONOUSTHREAD", //$NON-NLS-1$
|
||||||
"PSTATE_ZOS_PTRACEKERNELWAIT",
|
"PSTATE_ZOS_PTRACEKERNELWAIT", //$NON-NLS-1$
|
||||||
"RSTATE_ZOS_RUNNING",
|
"RSTATE_ZOS_RUNNING", //$NON-NLS-1$
|
||||||
"SSTATE_ZOS_SLEEPING",
|
"SSTATE_ZOS_SLEEPING", //$NON-NLS-1$
|
||||||
"TSTATE_ZOS_STOPPED",
|
"TSTATE_ZOS_STOPPED", //$NON-NLS-1$
|
||||||
"USTATE_ZOS_INITIALPROCESSTHREAD",
|
"USTATE_ZOS_INITIALPROCESSTHREAD", //$NON-NLS-1$
|
||||||
"VSTATE_ZOS_DETACHED",
|
"VSTATE_ZOS_DETACHED", //$NON-NLS-1$
|
||||||
"WSTATE_ZOS_WAITINGFORCHILD",
|
"WSTATE_ZOS_WAITINGFORCHILD", //$NON-NLS-1$
|
||||||
"XSTATE_ZOS_FORKING",
|
"XSTATE_ZOS_FORKING", //$NON-NLS-1$
|
||||||
"YSTATE_ZOS_MVSWAIT",
|
"YSTATE_ZOS_MVSWAIT", //$NON-NLS-1$
|
||||||
"ZSTATE_ZOS_ZOMBIE"
|
"ZSTATE_ZOS_ZOMBIE" //$NON-NLS-1$
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final String PROCESS_MINER_ERROR_NO_HANDLER = "No handler for this system type";
|
public static final String PROCESS_MINER_ERROR_NO_HANDLER = "No handler for this system type"; //$NON-NLS-1$
|
||||||
public static final String PROCESS_MINER_SUCCESS = "SUCCESS";
|
public static final String PROCESS_MINER_SUCCESS = "SUCCESS"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final String PROCESS_SIGNAL_TYPE_DEFAULT = "default";
|
public static final String PROCESS_SIGNAL_TYPE_DEFAULT = "default"; //$NON-NLS-1$
|
||||||
}
|
}
|
|
@ -32,7 +32,7 @@ public interface ISystemProcessRemoteTypes
|
||||||
* There is only one type category for remote processes.
|
* There is only one type category for remote processes.
|
||||||
* It is "processes".
|
* It is "processes".
|
||||||
*/
|
*/
|
||||||
public static final String TYPECATEGORY = "processes";
|
public static final String TYPECATEGORY = "processes"; //$NON-NLS-1$
|
||||||
|
|
||||||
// -----------
|
// -----------
|
||||||
// TYPES...
|
// TYPES...
|
||||||
|
@ -41,11 +41,11 @@ public interface ISystemProcessRemoteTypes
|
||||||
/**
|
/**
|
||||||
* A process object
|
* A process object
|
||||||
*/
|
*/
|
||||||
public static final String TYPE_PROCESS = "process";
|
public static final String TYPE_PROCESS = "process"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A root process object
|
* A root process object
|
||||||
*/
|
*/
|
||||||
public static final String TYPE_ROOT = "rootprocess";
|
public static final String TYPE_ROOT = "rootprocess"; //$NON-NLS-1$
|
||||||
|
|
||||||
}
|
}
|
|
@ -38,11 +38,11 @@ public class ProcessHandlerManager
|
||||||
*/
|
*/
|
||||||
public ProcessHandler getNewProcessHandler()
|
public ProcessHandler getNewProcessHandler()
|
||||||
{
|
{
|
||||||
String osName = System.getProperty("os.name").toLowerCase();
|
String osName = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$
|
||||||
if (osName.startsWith("linux")) return new UniversalLinuxProcessHandler();
|
if (osName.startsWith("linux")) return new UniversalLinuxProcessHandler(); //$NON-NLS-1$
|
||||||
else if (osName.startsWith("aix")) return new UniversalAIXProcessHandler();
|
else if (osName.startsWith("aix")) return new UniversalAIXProcessHandler(); //$NON-NLS-1$
|
||||||
else if (osName.startsWith("z/os")) return new UniversalZOSProcessHandler();
|
else if (osName.startsWith("z/os")) return new UniversalZOSProcessHandler(); //$NON-NLS-1$
|
||||||
else if (osName.startsWith("mac os x")) return new UniversalMacOSXProcessHandler();
|
else if (osName.startsWith("mac os x")) return new UniversalMacOSXProcessHandler(); //$NON-NLS-1$
|
||||||
else return null;
|
else return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -30,8 +30,8 @@ import org.eclipse.rse.services.clientserver.processes.ISystemProcessRemoteConst
|
||||||
|
|
||||||
public class UniversalAIXProcessHandler implements ProcessHandler, ISystemProcessRemoteConstants
|
public class UniversalAIXProcessHandler implements ProcessHandler, ISystemProcessRemoteConstants
|
||||||
{
|
{
|
||||||
private static final String[] processAttributes = {"pid","ppid","comm","uid","user","gid","vsz","s","rss"};
|
private static final String[] processAttributes = {"pid","ppid","comm","uid","user","gid","vsz","s","rss"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
|
||||||
private static final String firstColumnHeader = "PID";
|
private static final String firstColumnHeader = "PID"; //$NON-NLS-1$
|
||||||
protected HashMap _usernamesByUid;
|
protected HashMap _usernamesByUid;
|
||||||
protected HashMap _uidsByUserName;
|
protected HashMap _uidsByUserName;
|
||||||
private HashMap stateMap;
|
private HashMap stateMap;
|
||||||
|
@ -57,23 +57,23 @@ public class UniversalAIXProcessHandler implements ProcessHandler, ISystemProces
|
||||||
SortedSet results = new TreeSet(new ProcessComparator());
|
SortedSet results = new TreeSet(new ProcessComparator());
|
||||||
|
|
||||||
// create the remote command with the AIX specific attributes
|
// create the remote command with the AIX specific attributes
|
||||||
String cmdLine = "/usr/sysv/bin/ps -Alf -o ";
|
String cmdLine = "/usr/sysv/bin/ps -Alf -o "; //$NON-NLS-1$
|
||||||
for (int i = 0; i < processAttributes.length; i++)
|
for (int i = 0; i < processAttributes.length; i++)
|
||||||
{
|
{
|
||||||
cmdLine = cmdLine + processAttributes[i];
|
cmdLine = cmdLine + processAttributes[i];
|
||||||
if ((processAttributes.length - i > 1)) cmdLine = cmdLine + ",";
|
if ((processAttributes.length - i > 1)) cmdLine = cmdLine + ","; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
// run the command and get output
|
// run the command and get output
|
||||||
Process ps = Runtime.getRuntime().exec(cmdLine);
|
Process ps = Runtime.getRuntime().exec(cmdLine);
|
||||||
InputStreamReader isr = new InputStreamReader(ps.getInputStream());
|
InputStreamReader isr = new InputStreamReader(ps.getInputStream());
|
||||||
if (isr == null) return null;
|
|
||||||
BufferedReader reader = new BufferedReader(isr);
|
BufferedReader reader = new BufferedReader(isr);
|
||||||
if (reader == null) return null;
|
|
||||||
String nextLine = reader.readLine();
|
String nextLine = reader.readLine();
|
||||||
if (nextLine != null && nextLine.trim().startsWith(firstColumnHeader)) nextLine = reader.readLine();
|
if (nextLine != null && nextLine.trim().startsWith(firstColumnHeader)) nextLine = reader.readLine();
|
||||||
while (nextLine != null)
|
while (nextLine != null)
|
||||||
{
|
{
|
||||||
String statusLine = "";
|
String statusLine = ""; //$NON-NLS-1$
|
||||||
// put the details of each process into a hashmap
|
// put the details of each process into a hashmap
|
||||||
HashMap psLineContents = getPSOutput(nextLine);
|
HashMap psLineContents = getPSOutput(nextLine);
|
||||||
if (psLineContents == null)
|
if (psLineContents == null)
|
||||||
|
@ -82,56 +82,56 @@ public class UniversalAIXProcessHandler implements ProcessHandler, ISystemProces
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String pid = (String) psLineContents.get("pid");
|
String pid = (String) psLineContents.get("pid"); //$NON-NLS-1$
|
||||||
statusLine = pid + "|";
|
statusLine = pid + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add the name to the status string
|
// add the name to the status string
|
||||||
String name = (String) psLineContents.get("comm");
|
String name = (String) psLineContents.get("comm"); //$NON-NLS-1$
|
||||||
if (name == null) name = " ";
|
if (name == null) name = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + name + "|";
|
statusLine = statusLine + name + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add the status letter to the status string
|
// add the status letter to the status string
|
||||||
String state = (String) psLineContents.get("s");
|
String state = (String) psLineContents.get("s"); //$NON-NLS-1$
|
||||||
if (state == null) state = " ";
|
if (state == null) state = " "; //$NON-NLS-1$
|
||||||
String stateCode = convertToStateCode(state);
|
String stateCode = convertToStateCode(state);
|
||||||
statusLine = statusLine + stateCode + "|";
|
statusLine = statusLine + stateCode + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add the Tgid
|
// add the Tgid
|
||||||
String tgid = (String) psLineContents.get("tgid");
|
String tgid = (String) psLineContents.get("tgid"); //$NON-NLS-1$
|
||||||
if (tgid == null) tgid = " ";
|
if (tgid == null) tgid = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + tgid + "|";
|
statusLine = statusLine + tgid + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add the Ppid
|
// add the Ppid
|
||||||
String pPid = (String) psLineContents.get("ppid");
|
String pPid = (String) psLineContents.get("ppid"); //$NON-NLS-1$
|
||||||
if (pPid == null) pPid = " ";
|
if (pPid == null) pPid = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + pPid + "|";
|
statusLine = statusLine + pPid + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add the TracerPid
|
// add the TracerPid
|
||||||
String tracerpid = (String) psLineContents.get("tracerpid");
|
String tracerpid = (String) psLineContents.get("tracerpid"); //$NON-NLS-1$
|
||||||
if (tracerpid == null) tracerpid = " ";
|
if (tracerpid == null) tracerpid = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + tracerpid + "|";
|
statusLine = statusLine + tracerpid + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
String uid = (String) psLineContents.get("uid");
|
String uid = (String) psLineContents.get("uid"); //$NON-NLS-1$
|
||||||
if (uid == null) uid = " ";
|
if (uid == null) uid = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + uid + "|"; // add the uid to the status string
|
statusLine = statusLine + uid + "|"; // add the uid to the status string //$NON-NLS-1$
|
||||||
|
|
||||||
String username = (String) psLineContents.get("user");
|
String username = (String) psLineContents.get("user"); //$NON-NLS-1$
|
||||||
if (username == null) username = " ";
|
if (username == null) username = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + username + "|"; // add the username to the status string
|
statusLine = statusLine + username + "|"; // add the username to the status string //$NON-NLS-1$
|
||||||
|
|
||||||
// add the gid to the status string
|
// add the gid to the status string
|
||||||
String gid = (String) psLineContents.get("gid");
|
String gid = (String) psLineContents.get("gid"); //$NON-NLS-1$
|
||||||
if (gid == null) gid = " ";
|
if (gid == null) gid = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + gid + "|";
|
statusLine = statusLine + gid + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add the VmSize to the status string
|
// add the VmSize to the status string
|
||||||
String vmsize = (String) psLineContents.get("vsz");
|
String vmsize = (String) psLineContents.get("vsz"); //$NON-NLS-1$
|
||||||
if (vmsize == null) vmsize = " ";
|
if (vmsize == null) vmsize = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + vmsize + "|";
|
statusLine = statusLine + vmsize + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add the VmRSS to the status string
|
// add the VmRSS to the status string
|
||||||
String vmrss = (String) psLineContents.get("rss");
|
String vmrss = (String) psLineContents.get("rss"); //$NON-NLS-1$
|
||||||
if (vmrss == null) vmrss = " ";
|
if (vmrss == null) vmrss = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + vmrss;
|
statusLine = statusLine + vmrss;
|
||||||
|
|
||||||
if (rpfs.allows(statusLine))
|
if (rpfs.allows(statusLine))
|
||||||
|
@ -157,7 +157,7 @@ public class UniversalAIXProcessHandler implements ProcessHandler, ISystemProces
|
||||||
protected HashMap getPSOutput(String nextLine)
|
protected HashMap getPSOutput(String nextLine)
|
||||||
{
|
{
|
||||||
HashMap contents = new HashMap();
|
HashMap contents = new HashMap();
|
||||||
String[] values = nextLine.trim().split("\\s+");
|
String[] values = nextLine.trim().split("\\s+"); //$NON-NLS-1$
|
||||||
if (values == null || values.length < processAttributes.length) return null;
|
if (values == null || values.length < processAttributes.length) return null;
|
||||||
for (int i = 0; i < processAttributes.length; i++)
|
for (int i = 0; i < processAttributes.length; i++)
|
||||||
{
|
{
|
||||||
|
@ -172,16 +172,16 @@ public class UniversalAIXProcessHandler implements ProcessHandler, ISystemProces
|
||||||
public IHostProcess kill(IHostProcess process, String type)
|
public IHostProcess kill(IHostProcess process, String type)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
if (type.equals(PROCESS_SIGNAL_TYPE_DEFAULT)) type = "";
|
if (type.equals(PROCESS_SIGNAL_TYPE_DEFAULT)) type = ""; //$NON-NLS-1$
|
||||||
else type = "-" + type;
|
else type = "-" + type; //$NON-NLS-1$
|
||||||
// formulate command to send kill signal
|
// formulate command to send kill signal
|
||||||
String cmdLine = "kill " + type + " " + process.getPid();
|
String cmdLine = "kill " + type + " " + process.getPid(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
Runtime.getRuntime().exec(cmdLine);
|
Runtime.getRuntime().exec(cmdLine);
|
||||||
|
|
||||||
// after the kill command is executed, the process might have changed
|
// after the kill command is executed, the process might have changed
|
||||||
// attributes, or might be gone, so requery
|
// attributes, or might be gone, so requery
|
||||||
HostProcessFilterImpl rpfs = new HostProcessFilterImpl();
|
HostProcessFilterImpl rpfs = new HostProcessFilterImpl();
|
||||||
rpfs.setPid("" + process.getPid());
|
rpfs.setPid("" + process.getPid()); //$NON-NLS-1$
|
||||||
SortedSet results = lookupProcesses(rpfs);
|
SortedSet results = lookupProcesses(rpfs);
|
||||||
if (results == null || results.size() == 0) return null;
|
if (results == null || results.size() == 0) return null;
|
||||||
else return (IHostProcess) results.first();
|
else return (IHostProcess) results.first();
|
||||||
|
@ -234,19 +234,19 @@ public class UniversalAIXProcessHandler implements ProcessHandler, ISystemProces
|
||||||
*/
|
*/
|
||||||
protected String convertToStateCode(String state)
|
protected String convertToStateCode(String state)
|
||||||
{
|
{
|
||||||
String stateCode = " ";
|
String stateCode = " "; //$NON-NLS-1$
|
||||||
if (state == null) return stateCode;
|
if (state == null) return stateCode;
|
||||||
if (state.trim().equals("")) return stateCode;
|
if (state.trim().equals("")) return stateCode; //$NON-NLS-1$
|
||||||
for (int i = 0; i < state.length(); i++)
|
for (int i = 0; i < state.length(); i++)
|
||||||
{
|
{
|
||||||
String nextState = (String) stateMap.get(new Character(state.charAt(i)));
|
String nextState = (String) stateMap.get(new Character(state.charAt(i)));
|
||||||
if (nextState != null)
|
if (nextState != null)
|
||||||
{
|
{
|
||||||
stateCode = stateCode + nextState;
|
stateCode = stateCode + nextState;
|
||||||
if (i < state.length() - 1) stateCode = stateCode + ",";
|
if (i < state.length() - 1) stateCode = stateCode + ","; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (stateCode.trim().equals("")) return " ";
|
if (stateCode.trim().equals("")) return " "; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
else return stateCode.trim();
|
else return stateCode.trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -56,16 +56,16 @@ public class UniversalLinuxProcessHandler implements ProcessHandler, IServiceCon
|
||||||
*/
|
*/
|
||||||
public IHostProcess kill(IHostProcess process, String type) throws Exception
|
public IHostProcess kill(IHostProcess process, String type) throws Exception
|
||||||
{
|
{
|
||||||
if (type.equals(PROCESS_SIGNAL_TYPE_DEFAULT)) type = "";
|
if (type.equals(PROCESS_SIGNAL_TYPE_DEFAULT)) type = ""; //$NON-NLS-1$
|
||||||
else type = "-" + type;
|
else type = "-" + type; //$NON-NLS-1$
|
||||||
// formulate command to send kill signal
|
// formulate command to send kill signal
|
||||||
String cmdLine = "kill " + type + " " + process.getPid();
|
String cmdLine = "kill " + type + " " + process.getPid(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
Runtime.getRuntime().exec(cmdLine);
|
Runtime.getRuntime().exec(cmdLine);
|
||||||
|
|
||||||
// after the kill command is executed, the process might have changed
|
// after the kill command is executed, the process might have changed
|
||||||
// attributes, or might be gone, so requery
|
// attributes, or might be gone, so requery
|
||||||
HostProcessFilterImpl rpfs = new HostProcessFilterImpl();
|
HostProcessFilterImpl rpfs = new HostProcessFilterImpl();
|
||||||
rpfs.setPid("" + process.getPid());
|
rpfs.setPid("" + process.getPid()); //$NON-NLS-1$
|
||||||
SortedSet results = lookupProcesses(rpfs);
|
SortedSet results = lookupProcesses(rpfs);
|
||||||
if (results == null || results.size() == 0) return null;
|
if (results == null || results.size() == 0) return null;
|
||||||
else return (IHostProcess) results.first();
|
else return (IHostProcess) results.first();
|
||||||
|
@ -76,7 +76,7 @@ public class UniversalLinuxProcessHandler implements ProcessHandler, IServiceCon
|
||||||
*/
|
*/
|
||||||
public SortedSet lookupProcesses(IHostProcessFilter rpfs) throws Exception
|
public SortedSet lookupProcesses(IHostProcessFilter rpfs) throws Exception
|
||||||
{
|
{
|
||||||
File procDir = new File("/proc");
|
File procDir = new File("/proc"); //$NON-NLS-1$
|
||||||
|
|
||||||
if (!procDir.exists())
|
if (!procDir.exists())
|
||||||
throw new Exception(FAILED_WITH_DOES_NOT_EXIST);
|
throw new Exception(FAILED_WITH_DOES_NOT_EXIST);
|
||||||
|
@ -86,7 +86,7 @@ public class UniversalLinuxProcessHandler implements ProcessHandler, IServiceCon
|
||||||
|
|
||||||
// list all subdirectories of /proc
|
// list all subdirectories of /proc
|
||||||
File[] processes;
|
File[] processes;
|
||||||
if (rpfs.getPid().indexOf("*") == -1)
|
if (rpfs.getPid().indexOf("*") == -1) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
processes = new File[1];
|
processes = new File[1];
|
||||||
processes[0] = new File(procDir, rpfs.getPid());
|
processes[0] = new File(procDir, rpfs.getPid());
|
||||||
|
@ -103,72 +103,71 @@ public class UniversalLinuxProcessHandler implements ProcessHandler, IServiceCon
|
||||||
catch (NumberFormatException e)
|
catch (NumberFormatException e)
|
||||||
{ continue; }
|
{ continue; }
|
||||||
|
|
||||||
String statusLine = "";
|
String statusLine = ""; //$NON-NLS-1$
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// open the file containing the human-readable status info for the process
|
// open the file containing the human-readable status info for the process
|
||||||
File statusFile = new File(processes[i], "status");
|
File statusFile = new File(processes[i], "status"); //$NON-NLS-1$
|
||||||
if (!statusFile.exists() || !statusFile.canRead())
|
if (!statusFile.exists() || !statusFile.canRead())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// read the status info from the stat file
|
// read the status info from the stat file
|
||||||
FileReader fr = new FileReader(statusFile);
|
FileReader fr = new FileReader(statusFile);
|
||||||
if (fr == null) continue;
|
|
||||||
BufferedReader reader = new BufferedReader(fr);
|
BufferedReader reader = new BufferedReader(fr);
|
||||||
if (reader == null) continue;
|
|
||||||
HashMap statusFileContents = getStatusFileContents(reader);
|
HashMap statusFileContents = getStatusFileContents(reader);
|
||||||
|
|
||||||
statusLine = processes[i].getName() + "|"; // add the pid to the status string
|
statusLine = processes[i].getName() + "|"; // add the pid to the status string //$NON-NLS-1$
|
||||||
|
|
||||||
// add the name to the status string
|
// add the name to the status string
|
||||||
String name = (String) statusFileContents.get("name");
|
String name = (String) statusFileContents.get("name"); //$NON-NLS-1$
|
||||||
if (name == null) name = " ";
|
if (name == null) name = " "; //$NON-NLS-1$
|
||||||
//if (!pexematcher.matches(name)) continue;
|
//if (!pexematcher.matches(name)) continue;
|
||||||
statusLine = statusLine + name + "|";
|
statusLine = statusLine + name + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add the status letter to the status string
|
// add the status letter to the status string
|
||||||
String state = (String) statusFileContents.get("state");
|
String state = (String) statusFileContents.get("state"); //$NON-NLS-1$
|
||||||
if (state == null) state = " ";
|
if (state == null) state = " "; //$NON-NLS-1$
|
||||||
String stateCode = convertToStateCode(state);
|
String stateCode = convertToStateCode(state);
|
||||||
statusLine = statusLine + stateCode + "|";
|
statusLine = statusLine + stateCode + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add the Tgid
|
// add the Tgid
|
||||||
String tgid = (String) statusFileContents.get("tgid");
|
String tgid = (String) statusFileContents.get("tgid"); //$NON-NLS-1$
|
||||||
if (tgid == null) tgid = " ";
|
if (tgid == null) tgid = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + tgid + "|";
|
statusLine = statusLine + tgid + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add the Ppid
|
// add the Ppid
|
||||||
String pPid = (String) statusFileContents.get("ppid");
|
String pPid = (String) statusFileContents.get("ppid"); //$NON-NLS-1$
|
||||||
if (pPid == null) pPid = " ";
|
if (pPid == null) pPid = " "; //$NON-NLS-1$
|
||||||
//if (!ppidmatcher.matches(pPid)) continue;
|
//if (!ppidmatcher.matches(pPid)) continue;
|
||||||
statusLine = statusLine + pPid + "|";
|
statusLine = statusLine + pPid + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add the TracerPid
|
// add the TracerPid
|
||||||
String tracerpid = (String) statusFileContents.get("tracerpid");
|
String tracerpid = (String) statusFileContents.get("tracerpid"); //$NON-NLS-1$
|
||||||
if (tracerpid == null) tracerpid = " ";
|
if (tracerpid == null) tracerpid = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + tracerpid + "|";
|
statusLine = statusLine + tracerpid + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
String uid = (String) statusFileContents.get("uid");
|
String uid = (String) statusFileContents.get("uid"); //$NON-NLS-1$
|
||||||
if (uid == null) uid = " ";
|
if (uid == null) uid = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + uid + "|"; // add the uid to the status string
|
statusLine = statusLine + uid + "|"; // add the uid to the status string //$NON-NLS-1$
|
||||||
|
|
||||||
String username = getUsername(uid);
|
String username = getUsername(uid);
|
||||||
if (username == null) username = " ";
|
if (username == null) username = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + username + "|"; // add the username to the status string
|
statusLine = statusLine + username + "|"; // add the username to the status string //$NON-NLS-1$
|
||||||
|
|
||||||
// add the gid to the status string
|
// add the gid to the status string
|
||||||
String gid = (String) statusFileContents.get("gid");
|
String gid = (String) statusFileContents.get("gid"); //$NON-NLS-1$
|
||||||
if (gid == null) gid = " ";
|
if (gid == null) gid = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + gid + "|";
|
statusLine = statusLine + gid + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add the VmSize to the status string
|
// add the VmSize to the status string
|
||||||
String vmsize = (String) statusFileContents.get("vmsize");
|
String vmsize = (String) statusFileContents.get("vmsize"); //$NON-NLS-1$
|
||||||
if (vmsize == null) vmsize = " ";
|
if (vmsize == null) vmsize = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + vmsize + "|";
|
statusLine = statusLine + vmsize + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add the VmRSS to the status string
|
// add the VmRSS to the status string
|
||||||
String vmrss = (String) statusFileContents.get("vmrss");
|
String vmrss = (String) statusFileContents.get("vmrss"); //$NON-NLS-1$
|
||||||
if (vmrss == null) vmrss = " ";
|
if (vmrss == null) vmrss = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + vmrss;
|
statusLine = statusLine + vmrss;
|
||||||
|
|
||||||
reader.close();
|
reader.close();
|
||||||
|
@ -221,8 +220,7 @@ public class UniversalLinuxProcessHandler implements ProcessHandler, IServiceCon
|
||||||
{
|
{
|
||||||
while ((nextLine = reader.readLine()) != null)
|
while ((nextLine = reader.readLine()) != null)
|
||||||
{
|
{
|
||||||
if (nextLine == null) break;
|
String key = nextLine.substring(0, nextLine.indexOf(":")).trim().toLowerCase(); //$NON-NLS-1$
|
||||||
String key = nextLine.substring(0, nextLine.indexOf(":")).trim().toLowerCase();
|
|
||||||
String theRest = processStatusLine(nextLine, -1);
|
String theRest = processStatusLine(nextLine, -1);
|
||||||
StringTokenizer tz = new StringTokenizer(theRest);
|
StringTokenizer tz = new StringTokenizer(theRest);
|
||||||
String value = null;
|
String value = null;
|
||||||
|
@ -245,10 +243,10 @@ public class UniversalLinuxProcessHandler implements ProcessHandler, IServiceCon
|
||||||
{
|
{
|
||||||
if (length == -1)
|
if (length == -1)
|
||||||
{
|
{
|
||||||
return line.substring(line.indexOf(":") + 1).trim();
|
return line.substring(line.indexOf(":") + 1).trim(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return line.substring(line.indexOf(":") + 1).trim().substring(0, length);
|
return line.substring(line.indexOf(":") + 1).trim().substring(0, length); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -262,17 +260,16 @@ public class UniversalLinuxProcessHandler implements ProcessHandler, IServiceCon
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// read the uid info using the getent command
|
// read the uid info using the getent command
|
||||||
Process ps = Runtime.getRuntime().exec("getent passwd");
|
Process ps = Runtime.getRuntime().exec("getent passwd"); //$NON-NLS-1$
|
||||||
InputStreamReader isr = new InputStreamReader(ps.getInputStream());
|
InputStreamReader isr = new InputStreamReader(ps.getInputStream());
|
||||||
if (isr == null) return;
|
|
||||||
BufferedReader reader = new BufferedReader(isr);
|
BufferedReader reader = new BufferedReader(isr);
|
||||||
if (reader == null) return;
|
|
||||||
|
|
||||||
String nextLine;
|
String nextLine;
|
||||||
|
|
||||||
while ((nextLine = reader.readLine()) != null)
|
while ((nextLine = reader.readLine()) != null)
|
||||||
{
|
{
|
||||||
String[] fields = nextLine.split(":");
|
String[] fields = nextLine.split(":"); //$NON-NLS-1$
|
||||||
int length = fields.length;
|
int length = fields.length;
|
||||||
if (length < 3) continue;
|
if (length < 3) continue;
|
||||||
String uid = fields[2];
|
String uid = fields[2];
|
||||||
|
@ -298,19 +295,19 @@ public class UniversalLinuxProcessHandler implements ProcessHandler, IServiceCon
|
||||||
*/
|
*/
|
||||||
protected String convertToStateCode(String state)
|
protected String convertToStateCode(String state)
|
||||||
{
|
{
|
||||||
String stateCode = " ";
|
String stateCode = " "; //$NON-NLS-1$
|
||||||
if (state == null) return stateCode;
|
if (state == null) return stateCode;
|
||||||
if (state.trim().equals("")) return stateCode;
|
if (state.trim().equals("")) return stateCode; //$NON-NLS-1$
|
||||||
for (int i = 0; i < state.length(); i++)
|
for (int i = 0; i < state.length(); i++)
|
||||||
{
|
{
|
||||||
String nextState = (String) stateMap.get(new Character(state.charAt(i)));
|
String nextState = (String) stateMap.get(new Character(state.charAt(i)));
|
||||||
if (nextState != null)
|
if (nextState != null)
|
||||||
{
|
{
|
||||||
stateCode = stateCode + nextState;
|
stateCode = stateCode + nextState;
|
||||||
if (i < state.length() - 1) stateCode = stateCode + ",";
|
if (i < state.length() - 1) stateCode = stateCode + ","; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (stateCode.trim().equals("")) return " ";
|
if (stateCode.trim().equals("")) return " "; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
else return stateCode.trim();
|
else return stateCode.trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -33,12 +33,12 @@ public class UniversalMacOSXProcessHandler implements ProcessHandler {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
String[] strings = ISystemProcessRemoteConstants.ALL_STATES_STR;
|
String[] strings = ISystemProcessRemoteConstants.ALL_STATES_STR;
|
||||||
stateMap.put("I", strings[ISystemProcessRemoteConstants.STATE_IDLE_INDEX]);
|
stateMap.put("I", strings[ISystemProcessRemoteConstants.STATE_IDLE_INDEX]); //$NON-NLS-1$
|
||||||
stateMap.put("R", strings[ISystemProcessRemoteConstants.STATE_RUNNING_INDEX]);
|
stateMap.put("R", strings[ISystemProcessRemoteConstants.STATE_RUNNING_INDEX]); //$NON-NLS-1$
|
||||||
stateMap.put("S", strings[ISystemProcessRemoteConstants.STATE_SLEEPING_INDEX]);
|
stateMap.put("S", strings[ISystemProcessRemoteConstants.STATE_SLEEPING_INDEX]); //$NON-NLS-1$
|
||||||
stateMap.put("T", strings[ISystemProcessRemoteConstants.STATE_NONEXISTENT_INDEX]);
|
stateMap.put("T", strings[ISystemProcessRemoteConstants.STATE_NONEXISTENT_INDEX]); //$NON-NLS-1$
|
||||||
stateMap.put("U", strings[ISystemProcessRemoteConstants.STATE_WAITING_INDEX]);
|
stateMap.put("U", strings[ISystemProcessRemoteConstants.STATE_WAITING_INDEX]); //$NON-NLS-1$
|
||||||
stateMap.put("Z", strings[ISystemProcessRemoteConstants.STATE_ZOMBIE_INDEX]);
|
stateMap.put("Z", strings[ISystemProcessRemoteConstants.STATE_ZOMBIE_INDEX]); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,7 +53,7 @@ public class UniversalMacOSXProcessHandler implements ProcessHandler {
|
||||||
public SortedSet lookupProcesses(IHostProcessFilter rpfs) throws Exception {
|
public SortedSet lookupProcesses(IHostProcessFilter rpfs) throws Exception {
|
||||||
SortedSet results = new TreeSet(new ProcessComparator());
|
SortedSet results = new TreeSet(new ProcessComparator());
|
||||||
// Using -A is problematic - the command never returns! Using -a for now.
|
// Using -A is problematic - the command never returns! Using -a for now.
|
||||||
String command = "/bin/ps -awwo pid,ucomm,state,ppid,uid,user,gid,vsz,rss";
|
String command = "/bin/ps -awwo pid,ucomm,state,ppid,uid,user,gid,vsz,rss"; //$NON-NLS-1$
|
||||||
Process ps = Runtime.getRuntime().exec(command);
|
Process ps = Runtime.getRuntime().exec(command);
|
||||||
InputStreamReader isr = new InputStreamReader(ps.getInputStream());
|
InputStreamReader isr = new InputStreamReader(ps.getInputStream());
|
||||||
BufferedReader reader = new BufferedReader(isr);
|
BufferedReader reader = new BufferedReader(isr);
|
||||||
|
@ -61,7 +61,7 @@ public class UniversalMacOSXProcessHandler implements ProcessHandler {
|
||||||
line = reader.readLine();
|
line = reader.readLine();
|
||||||
while (line != null) {
|
while (line != null) {
|
||||||
// Input line looks like "pid ucomm state ppid uid user gid vsz rss"
|
// Input line looks like "pid ucomm state ppid uid user gid vsz rss"
|
||||||
String[] words = line.trim().split("\\s+");
|
String[] words = line.trim().split("\\s+"); //$NON-NLS-1$
|
||||||
UniversalServerProcessImpl usp = new UniversalServerProcessImpl();
|
UniversalServerProcessImpl usp = new UniversalServerProcessImpl();
|
||||||
usp.setPid(words[0]);
|
usp.setPid(words[0]);
|
||||||
usp.setName(words[1]);
|
usp.setName(words[1]);
|
||||||
|
@ -72,8 +72,8 @@ public class UniversalMacOSXProcessHandler implements ProcessHandler {
|
||||||
usp.setGid(words[6]);
|
usp.setGid(words[6]);
|
||||||
usp.setVmSizeInKB(words[7]);
|
usp.setVmSizeInKB(words[7]);
|
||||||
usp.setVmRSSInKB(words[8]);
|
usp.setVmRSSInKB(words[8]);
|
||||||
usp.setTgid("");
|
usp.setTgid(""); //$NON-NLS-1$
|
||||||
usp.setTracerPid("");
|
usp.setTracerPid(""); //$NON-NLS-1$
|
||||||
if (rpfs.allows(usp.getAllProperties())) {
|
if (rpfs.allows(usp.getAllProperties())) {
|
||||||
results.add(usp);
|
results.add(usp);
|
||||||
}
|
}
|
||||||
|
@ -89,19 +89,19 @@ public class UniversalMacOSXProcessHandler implements ProcessHandler {
|
||||||
*/
|
*/
|
||||||
public IHostProcess kill(IHostProcess process, String type) throws Exception {
|
public IHostProcess kill(IHostProcess process, String type) throws Exception {
|
||||||
if (type.equals(ISystemProcessRemoteConstants.PROCESS_SIGNAL_TYPE_DEFAULT)) {
|
if (type.equals(ISystemProcessRemoteConstants.PROCESS_SIGNAL_TYPE_DEFAULT)) {
|
||||||
type = "";
|
type = ""; //$NON-NLS-1$
|
||||||
} else {
|
} else {
|
||||||
type = "-" + type;
|
type = "-" + type; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
// formulate command to send kill signal
|
// formulate command to send kill signal
|
||||||
String cmdLine = "kill " + type + " " + process.getPid();
|
String cmdLine = "kill " + type + " " + process.getPid(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
Runtime.getRuntime().exec(cmdLine);
|
Runtime.getRuntime().exec(cmdLine);
|
||||||
|
|
||||||
// after the kill command is executed, the process might have changed
|
// after the kill command is executed, the process might have changed
|
||||||
// attributes, or might be gone, so requery
|
// attributes, or might be gone, so requery
|
||||||
HostProcessFilterImpl rpfs = new HostProcessFilterImpl();
|
HostProcessFilterImpl rpfs = new HostProcessFilterImpl();
|
||||||
rpfs.setPid("" + process.getPid());
|
rpfs.setPid("" + process.getPid()); //$NON-NLS-1$
|
||||||
SortedSet results = lookupProcesses(rpfs);
|
SortedSet results = lookupProcesses(rpfs);
|
||||||
if (results == null || results.size() == 0) {
|
if (results == null || results.size() == 0) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -31,18 +31,18 @@ public class UniversalServerProcessImpl implements IRemoteServerProcess, IServic
|
||||||
*/
|
*/
|
||||||
public UniversalServerProcessImpl()
|
public UniversalServerProcessImpl()
|
||||||
{
|
{
|
||||||
_properties[PROCESS_ATTRIBUTES_INDEX_EXENAME] = " ";
|
_properties[PROCESS_ATTRIBUTES_INDEX_EXENAME] = " "; //$NON-NLS-1$
|
||||||
_properties[PROCESS_ATTRIBUTES_INDEX_GID] = new Long(-1);
|
_properties[PROCESS_ATTRIBUTES_INDEX_GID] = new Long(-1);
|
||||||
_properties[PROCESS_ATTRIBUTES_INDEX_PID] = new Long(-1);
|
_properties[PROCESS_ATTRIBUTES_INDEX_PID] = new Long(-1);
|
||||||
_properties[PROCESS_ATTRIBUTES_INDEX_PPID] = new Long(-1);
|
_properties[PROCESS_ATTRIBUTES_INDEX_PPID] = new Long(-1);
|
||||||
_properties[PROCESS_ATTRIBUTES_INDEX_STATUS] = new String(" ");
|
_properties[PROCESS_ATTRIBUTES_INDEX_STATUS] = new String(" "); //$NON-NLS-1$
|
||||||
_properties[PROCESS_ATTRIBUTES_INDEX_TGID] = new Long(-1);
|
_properties[PROCESS_ATTRIBUTES_INDEX_TGID] = new Long(-1);
|
||||||
_properties[PROCESS_ATTRIBUTES_INDEX_TRACERPID] = new Long(-1);
|
_properties[PROCESS_ATTRIBUTES_INDEX_TRACERPID] = new Long(-1);
|
||||||
_properties[PROCESS_ATTRIBUTES_INDEX_UID] = new Long(-1);
|
_properties[PROCESS_ATTRIBUTES_INDEX_UID] = new Long(-1);
|
||||||
_properties[PROCESS_ATTRIBUTES_INDEX_USERNAME] = " ";
|
_properties[PROCESS_ATTRIBUTES_INDEX_USERNAME] = " "; //$NON-NLS-1$
|
||||||
_properties[PROCESS_ATTRIBUTES_INDEX_VMSIZE] = new Long(-1);
|
_properties[PROCESS_ATTRIBUTES_INDEX_VMSIZE] = new Long(-1);
|
||||||
_properties[PROCESS_ATTRIBUTES_INDEX_VMRSS] = new Long(-1);
|
_properties[PROCESS_ATTRIBUTES_INDEX_VMRSS] = new Long(-1);
|
||||||
_properties[PROCESS_ATTRIBUTES_COUNT] = " "; //set the label
|
_properties[PROCESS_ATTRIBUTES_COUNT] = " "; //set the label //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -175,7 +175,7 @@ public class UniversalServerProcessImpl implements IRemoteServerProcess, IServic
|
||||||
|
|
||||||
if (s != null && s.length() > 0)
|
if (s != null && s.length() > 0)
|
||||||
{
|
{
|
||||||
String[] str = s.split("\\"+TOKEN_SEPARATOR);
|
String[] str = s.split("\\"+TOKEN_SEPARATOR); //$NON-NLS-1$
|
||||||
int numOfExpectedTokens = PROCESS_ATTRIBUTES_COUNT;
|
int numOfExpectedTokens = PROCESS_ATTRIBUTES_COUNT;
|
||||||
int tokens = str.length;
|
int tokens = str.length;
|
||||||
if (tokens == numOfExpectedTokens)
|
if (tokens == numOfExpectedTokens)
|
||||||
|
@ -281,7 +281,7 @@ public class UniversalServerProcessImpl implements IRemoteServerProcess, IServic
|
||||||
*/
|
*/
|
||||||
public String getAllProperties()
|
public String getAllProperties()
|
||||||
{
|
{
|
||||||
String properties = "";
|
String properties = ""; //$NON-NLS-1$
|
||||||
for (int i = 0; i < PROCESS_ATTRIBUTES_COUNT; i++)
|
for (int i = 0; i < PROCESS_ATTRIBUTES_COUNT; i++)
|
||||||
{
|
{
|
||||||
properties = properties + _properties[i].toString();
|
properties = properties + _properties[i].toString();
|
||||||
|
|
|
@ -27,8 +27,8 @@ import org.eclipse.rse.services.clientserver.processes.HostProcessFilterImpl;
|
||||||
|
|
||||||
public class UniversalZOSProcessHandler extends UniversalAIXProcessHandler
|
public class UniversalZOSProcessHandler extends UniversalAIXProcessHandler
|
||||||
{
|
{
|
||||||
private static final String[] processAttributes = {"pid","ppid","comm","uid","user","gid","vsz","state"};
|
private static final String[] processAttributes = {"pid","ppid","comm","uid","user","gid","vsz","state"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
|
||||||
private static final String firstColumnHeader = "PID";
|
private static final String firstColumnHeader = "PID"; //$NON-NLS-1$
|
||||||
private HashMap stateMap;
|
private HashMap stateMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,23 +53,23 @@ public class UniversalZOSProcessHandler extends UniversalAIXProcessHandler
|
||||||
SortedSet results = new TreeSet(new ProcessComparator());
|
SortedSet results = new TreeSet(new ProcessComparator());
|
||||||
|
|
||||||
// create the remote command with the AIX specific attributes
|
// create the remote command with the AIX specific attributes
|
||||||
String cmdLine = "ps -A -o ";
|
String cmdLine = "ps -A -o "; //$NON-NLS-1$
|
||||||
for (int i = 0; i < processAttributes.length; i++)
|
for (int i = 0; i < processAttributes.length; i++)
|
||||||
{
|
{
|
||||||
cmdLine = cmdLine + processAttributes[i];
|
cmdLine = cmdLine + processAttributes[i];
|
||||||
if ((processAttributes.length - i > 1)) cmdLine = cmdLine + ",";
|
if ((processAttributes.length - i > 1)) cmdLine = cmdLine + ","; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
// run the command and get output
|
// run the command and get output
|
||||||
Process ps = Runtime.getRuntime().exec(cmdLine);
|
Process ps = Runtime.getRuntime().exec(cmdLine);
|
||||||
InputStreamReader isr = new InputStreamReader(ps.getInputStream());
|
InputStreamReader isr = new InputStreamReader(ps.getInputStream());
|
||||||
if (isr == null) return null;
|
|
||||||
BufferedReader reader = new BufferedReader(isr);
|
BufferedReader reader = new BufferedReader(isr);
|
||||||
if (reader == null) return null;
|
|
||||||
String nextLine = reader.readLine();
|
String nextLine = reader.readLine();
|
||||||
if (nextLine != null && nextLine.trim().startsWith(firstColumnHeader)) nextLine = reader.readLine();
|
if (nextLine != null && nextLine.trim().startsWith(firstColumnHeader)) nextLine = reader.readLine();
|
||||||
while (nextLine != null)
|
while (nextLine != null)
|
||||||
{
|
{
|
||||||
String statusLine = "";
|
String statusLine = ""; //$NON-NLS-1$
|
||||||
// put the details of each process into a hashmap
|
// put the details of each process into a hashmap
|
||||||
HashMap psLineContents = getPSOutput(nextLine);
|
HashMap psLineContents = getPSOutput(nextLine);
|
||||||
if (psLineContents == null)
|
if (psLineContents == null)
|
||||||
|
@ -78,56 +78,56 @@ public class UniversalZOSProcessHandler extends UniversalAIXProcessHandler
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String pid = (String) psLineContents.get("pid");
|
String pid = (String) psLineContents.get("pid"); //$NON-NLS-1$
|
||||||
statusLine = pid + "|";
|
statusLine = pid + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add the name to the status string
|
// add the name to the status string
|
||||||
String name = (String) psLineContents.get("comm");
|
String name = (String) psLineContents.get("comm"); //$NON-NLS-1$
|
||||||
if (name == null) name = " ";
|
if (name == null) name = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + name + "|";
|
statusLine = statusLine + name + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add the status letter to the status string
|
// add the status letter to the status string
|
||||||
String state = (String) psLineContents.get("state");
|
String state = (String) psLineContents.get("state"); //$NON-NLS-1$
|
||||||
if (state == null) state = " ";
|
if (state == null) state = " "; //$NON-NLS-1$
|
||||||
String stateCode = convertToStateCode(state);
|
String stateCode = convertToStateCode(state);
|
||||||
statusLine = statusLine + stateCode + "|";
|
statusLine = statusLine + stateCode + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add the Tgid
|
// add the Tgid
|
||||||
String tgid = (String) psLineContents.get("tgid");
|
String tgid = (String) psLineContents.get("tgid"); //$NON-NLS-1$
|
||||||
if (tgid == null) tgid = " ";
|
if (tgid == null) tgid = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + tgid + "|";
|
statusLine = statusLine + tgid + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add the Ppid
|
// add the Ppid
|
||||||
String pPid = (String) psLineContents.get("ppid");
|
String pPid = (String) psLineContents.get("ppid"); //$NON-NLS-1$
|
||||||
if (pPid == null) pPid = " ";
|
if (pPid == null) pPid = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + pPid + "|";
|
statusLine = statusLine + pPid + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add the TracerPid
|
// add the TracerPid
|
||||||
String tracerpid = (String) psLineContents.get("tracerpid");
|
String tracerpid = (String) psLineContents.get("tracerpid"); //$NON-NLS-1$
|
||||||
if (tracerpid == null) tracerpid = " ";
|
if (tracerpid == null) tracerpid = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + tracerpid + "|";
|
statusLine = statusLine + tracerpid + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
String uid = (String) psLineContents.get("uid");
|
String uid = (String) psLineContents.get("uid"); //$NON-NLS-1$
|
||||||
if (uid == null) uid = " ";
|
if (uid == null) uid = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + uid + "|"; // add the uid to the status string
|
statusLine = statusLine + uid + "|"; // add the uid to the status string //$NON-NLS-1$
|
||||||
|
|
||||||
String username = (String) psLineContents.get("user");
|
String username = (String) psLineContents.get("user"); //$NON-NLS-1$
|
||||||
if (username == null) username = " ";
|
if (username == null) username = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + username + "|"; // add the username to the status string
|
statusLine = statusLine + username + "|"; // add the username to the status string //$NON-NLS-1$
|
||||||
|
|
||||||
// add the gid to the status string
|
// add the gid to the status string
|
||||||
String gid = (String) psLineContents.get("gid");
|
String gid = (String) psLineContents.get("gid"); //$NON-NLS-1$
|
||||||
if (gid == null) gid = " ";
|
if (gid == null) gid = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + gid + "|";
|
statusLine = statusLine + gid + "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add the VmSize to the status string
|
// add the VmSize to the status string
|
||||||
String vmsize = (String) psLineContents.get("vsz");
|
String vmsize = (String) psLineContents.get("vsz"); //$NON-NLS-1$
|
||||||
if (vmsize == null) vmsize = " ";
|
if (vmsize == null) vmsize = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + vmsize +"|";
|
statusLine = statusLine + vmsize +"|"; //$NON-NLS-1$
|
||||||
|
|
||||||
// add a dummy vmrss to the status string
|
// add a dummy vmrss to the status string
|
||||||
// vmRss is not available on ZOS
|
// vmRss is not available on ZOS
|
||||||
String vmrss = " ";
|
String vmrss = " "; //$NON-NLS-1$
|
||||||
statusLine = statusLine + vmrss;
|
statusLine = statusLine + vmrss;
|
||||||
|
|
||||||
if (rpfs.allows(statusLine))
|
if (rpfs.allows(statusLine))
|
||||||
|
@ -153,7 +153,7 @@ public class UniversalZOSProcessHandler extends UniversalAIXProcessHandler
|
||||||
protected HashMap getPSOutput(String nextLine)
|
protected HashMap getPSOutput(String nextLine)
|
||||||
{
|
{
|
||||||
HashMap contents = new HashMap();
|
HashMap contents = new HashMap();
|
||||||
String[] values = nextLine.trim().split("\\s+");
|
String[] values = nextLine.trim().split("\\s+"); //$NON-NLS-1$
|
||||||
if (values == null || values.length < processAttributes.length) return null;
|
if (values == null || values.length < processAttributes.length) return null;
|
||||||
for (int i = 0; i < processAttributes.length; i++)
|
for (int i = 0; i < processAttributes.length; i++)
|
||||||
{
|
{
|
||||||
|
@ -168,19 +168,19 @@ public class UniversalZOSProcessHandler extends UniversalAIXProcessHandler
|
||||||
*/
|
*/
|
||||||
protected String convertToStateCode(String state)
|
protected String convertToStateCode(String state)
|
||||||
{
|
{
|
||||||
String stateCode = " ";
|
String stateCode = " "; //$NON-NLS-1$
|
||||||
if (state == null) return stateCode;
|
if (state == null) return stateCode;
|
||||||
if (state.trim().equals("")) return stateCode;
|
if (state.trim().equals("")) return stateCode; //$NON-NLS-1$
|
||||||
for (int i = 0; i < state.length(); i++)
|
for (int i = 0; i < state.length(); i++)
|
||||||
{
|
{
|
||||||
String nextState = (String) stateMap.get(new Character(state.charAt(i)));
|
String nextState = (String) stateMap.get(new Character(state.charAt(i)));
|
||||||
if (nextState != null)
|
if (nextState != null)
|
||||||
{
|
{
|
||||||
stateCode = stateCode + nextState;
|
stateCode = stateCode + nextState;
|
||||||
if (i < state.length() - 1) stateCode = stateCode + ",";
|
if (i < state.length() - 1) stateCode = stateCode + ","; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (stateCode.trim().equals("")) return " ";
|
if (stateCode.trim().equals("")) return " "; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
else return stateCode.trim();
|
else return stateCode.trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -98,7 +98,7 @@ public class SystemSearchFileNameMatcher implements ISystemSearchMatcher {
|
||||||
* @return <code>true</code> if the file names string is "*", <code>false</code> otherwise.
|
* @return <code>true</code> if the file names string is "*", <code>false</code> otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean isFileNamesStringAsterisk() {
|
public boolean isFileNamesStringAsterisk() {
|
||||||
return fileNamesString.equals("*");
|
return fileNamesString.equals("*"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class SystemSearchStringMatcher implements ISystemSearchMatcher {
|
||||||
* @return <code>true</code> if the search string is "*", <code>false</code> otherwise.
|
* @return <code>true</code> if the search string is "*", <code>false</code> otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean isSearchStringAsterisk() {
|
public boolean isSearchStringAsterisk() {
|
||||||
return searchString.equals("*");
|
return searchString.equals("*"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class SystemSearchUtil {
|
||||||
|
|
||||||
private static SystemSearchUtil instance;
|
private static SystemSearchUtil instance;
|
||||||
|
|
||||||
public static String FILE_NAMES_SEP_STRING = ",";
|
public static String FILE_NAMES_SEP_STRING = ","; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for the utility class.
|
* Constructor for the utility class.
|
||||||
|
@ -84,7 +84,7 @@ public class SystemSearchUtil {
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileNamesString.equals("")) {
|
if (fileNamesString.equals("")) { //$NON-NLS-1$
|
||||||
return new HashSet();
|
return new HashSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ public class SystemSearchUtil {
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileNamesString.equals("")) {
|
if (fileNamesString.equals("")) { //$NON-NLS-1$
|
||||||
return new ArrayList();
|
return new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ public class SystemSearchUtil {
|
||||||
// if it's not the first entry, then precede with ',' followed by space, i.e. ' '
|
// if it's not the first entry, then precede with ',' followed by space, i.e. ' '
|
||||||
if (!first) {
|
if (!first) {
|
||||||
result.append(FILE_NAMES_SEP_STRING);
|
result.append(FILE_NAMES_SEP_STRING);
|
||||||
result.append(" ");
|
result.append(" "); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
// if first entry, don't do anything
|
// if first entry, don't do anything
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class TarEntry implements ITarConstants, Cloneable {
|
||||||
|
|
||||||
// if the name is an empty string, then don't fill in other fields,
|
// if the name is an empty string, then don't fill in other fields,
|
||||||
// since this indicates that we have reached end of file
|
// since this indicates that we have reached end of file
|
||||||
if (getName().equals("")) {
|
if (getName().equals("")) { //$NON-NLS-1$
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ public class TarEntry implements ITarConstants, Cloneable {
|
||||||
|
|
||||||
// append null characters to the name
|
// append null characters to the name
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
fileName = fileName + "\0";
|
fileName = fileName + "\0"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
name = fileName.getBytes();
|
name = fileName.getBytes();
|
||||||
|
@ -181,8 +181,8 @@ public class TarEntry implements ITarConstants, Cloneable {
|
||||||
mod += 01;
|
mod += 01;
|
||||||
}
|
}
|
||||||
|
|
||||||
String modString = "0100" + Integer.toString(mod, 8) + "44";
|
String modString = "0100" + Integer.toString(mod, 8) + "44"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
modString = modString + "\0";
|
modString = modString + "\0"; //$NON-NLS-1$
|
||||||
|
|
||||||
mode = modString.getBytes();
|
mode = modString.getBytes();
|
||||||
}
|
}
|
||||||
|
@ -227,11 +227,11 @@ public class TarEntry implements ITarConstants, Cloneable {
|
||||||
|
|
||||||
// prepend the string with 0s
|
// prepend the string with 0s
|
||||||
for (int i = 0; i < diff; i++) {
|
for (int i = 0; i < diff; i++) {
|
||||||
sizeString = "0" + sizeString;
|
sizeString = "0" + sizeString; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
// append a space at the end
|
// append a space at the end
|
||||||
sizeString = sizeString + " ";
|
sizeString = sizeString + " "; //$NON-NLS-1$
|
||||||
|
|
||||||
size = sizeString.getBytes();
|
size = sizeString.getBytes();
|
||||||
}
|
}
|
||||||
|
@ -260,11 +260,11 @@ public class TarEntry implements ITarConstants, Cloneable {
|
||||||
|
|
||||||
// prepend the string with 0s
|
// prepend the string with 0s
|
||||||
for (int i = 0; i < diff; i++) {
|
for (int i = 0; i < diff; i++) {
|
||||||
mtimeString = "0" + mtimeString;
|
mtimeString = "0" + mtimeString; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
// append a space at the end
|
// append a space at the end
|
||||||
mtimeString = mtimeString + " ";
|
mtimeString = mtimeString + " "; //$NON-NLS-1$
|
||||||
|
|
||||||
mtime = mtimeString.getBytes();
|
mtime = mtimeString.getBytes();
|
||||||
}
|
}
|
||||||
|
@ -330,7 +330,7 @@ public class TarEntry implements ITarConstants, Cloneable {
|
||||||
|
|
||||||
// append null characters to the user name
|
// append null characters to the user name
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
userName = userName + "\0";
|
userName = userName + "\0"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
uname = userName.getBytes();
|
uname = userName.getBytes();
|
||||||
|
@ -384,7 +384,7 @@ public class TarEntry implements ITarConstants, Cloneable {
|
||||||
|
|
||||||
String entryName = getName();
|
String entryName = getName();
|
||||||
|
|
||||||
if (entryName.endsWith("/")) {
|
if (entryName.endsWith("/")) { //$NON-NLS-1$
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -512,14 +512,14 @@ public class TarEntry implements ITarConstants, Cloneable {
|
||||||
|
|
||||||
// prepend the string with 0s
|
// prepend the string with 0s
|
||||||
for (int i = 0; i < diff; i++) {
|
for (int i = 0; i < diff; i++) {
|
||||||
sumString = "0" + sumString;
|
sumString = "0" + sumString; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
// append a null character
|
// append a null character
|
||||||
sumString = sumString + "\0";
|
sumString = sumString + "\0"; //$NON-NLS-1$
|
||||||
|
|
||||||
// append a space
|
// append a space
|
||||||
sumString = sumString + " ";
|
sumString = sumString + " "; //$NON-NLS-1$
|
||||||
|
|
||||||
// set the checksum
|
// set the checksum
|
||||||
chksum = sumString.getBytes();
|
chksum = sumString.getBytes();
|
||||||
|
|
|
@ -241,7 +241,7 @@ public class TarFile implements ITarConstants {
|
||||||
|
|
||||||
// if the name of the entry is an empty string, it means we have reached end of file
|
// if the name of the entry is an empty string, it means we have reached end of file
|
||||||
// so just return null
|
// so just return null
|
||||||
if (entry.getName().equals("")) {
|
if (entry.getName().equals("")) { //$NON-NLS-1$
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -283,7 +283,7 @@ public class TarFile implements ITarConstants {
|
||||||
String entryName = entry.getName();
|
String entryName = entry.getName();
|
||||||
|
|
||||||
// if name of entry matches the given name, then that is the entry we are looking for
|
// if name of entry matches the given name, then that is the entry we are looking for
|
||||||
if (entryName.equals(name) || entryName.equals(name + "/")) {
|
if (entryName.equals(name) || entryName.equals(name + "/")) { //$NON-NLS-1$
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class TarOutputStream extends OutputStream implements ITarConstants {
|
||||||
private void ensureOpen() throws IOException {
|
private void ensureOpen() throws IOException {
|
||||||
|
|
||||||
if (isClosed) {
|
if (isClosed) {
|
||||||
throw new IOException("Stream closed");
|
throw new IOException("Stream closed"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class Activator extends Plugin {
|
||||||
public void logException(Throwable t) {
|
public void logException(Throwable t) {
|
||||||
ILog log = getLog();
|
ILog log = getLog();
|
||||||
String id = getBundle().getSymbolicName();
|
String id = getBundle().getSymbolicName();
|
||||||
IStatus status = new Status(IStatus.ERROR, id, 0, "Unexpected exception", t);
|
IStatus status = new Status(IStatus.ERROR, id, 0, "Unexpected exception", t); //$NON-NLS-1$
|
||||||
log.log(status);
|
log.log(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,10 +54,10 @@ public class RemoteFileCancelledException extends RemoteFileIOException {
|
||||||
* </Message>
|
* </Message>
|
||||||
*/
|
*/
|
||||||
private static SystemMessage getMyMessage() {
|
private static SystemMessage getMyMessage() {
|
||||||
String l1 = "Operation cancelled.";
|
String l1 = "Operation cancelled."; //$NON-NLS-1$
|
||||||
String l2 = "";
|
String l2 = ""; //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
myMessage = new SystemMessage("RSE", "G", "1067", SystemMessage.ERROR, l1, l2);
|
myMessage = new SystemMessage("RSE", "G", "1067", SystemMessage.ERROR, l1, l2); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
} catch (IndicatorException e) {
|
} catch (IndicatorException e) {
|
||||||
}
|
}
|
||||||
return myMessage;
|
return myMessage;
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class RemoteFileException extends SystemMessageException
|
||||||
String msg = null;
|
String msg = null;
|
||||||
try { msg = bundle.getString(key); } catch (Exception exc) {}
|
try { msg = bundle.getString(key); } catch (Exception exc) {}
|
||||||
if (msg == null)
|
if (msg == null)
|
||||||
msg = "Message with key " + key + " not found";
|
msg = "Message with key " + key + " not found"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,10 +59,10 @@ public class RemoteFileIOException extends RemoteFileException {
|
||||||
* </Message>
|
* </Message>
|
||||||
*/
|
*/
|
||||||
private static SystemMessage getMyMessage() {
|
private static SystemMessage getMyMessage() {
|
||||||
String l1 = "Operation failed. File system input or output error";
|
String l1 = "Operation failed. File system input or output error"; //$NON-NLS-1$
|
||||||
String l2 = "Message reported from file system: %1";
|
String l2 = "Message reported from file system: %1"; //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
myMessage = new SystemMessage("RSE", "F", "1002", SystemMessage.ERROR, l1, l2);
|
myMessage = new SystemMessage("RSE", "F", "1002", SystemMessage.ERROR, l1, l2); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
} catch (IndicatorException e) {
|
} catch (IndicatorException e) {
|
||||||
}
|
}
|
||||||
return myMessage;
|
return myMessage;
|
||||||
|
|
|
@ -58,10 +58,10 @@ public class RemoteFileSecurityException extends RemoteFileException {
|
||||||
*/
|
*/
|
||||||
private static SystemMessage getMyMessage() {
|
private static SystemMessage getMyMessage() {
|
||||||
if (myMessage == null) {
|
if (myMessage == null) {
|
||||||
String l1 = "Operation failed. Security violation";
|
String l1 = "Operation failed. Security violation"; //$NON-NLS-1$
|
||||||
String l2 = "Message reported from file system: %1";
|
String l2 = "Message reported from file system: %1"; //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
myMessage = new SystemMessage("RSE", "F", "1001", SystemMessage.ERROR, l1, l2);
|
myMessage = new SystemMessage("RSE", "F", "1001", SystemMessage.ERROR, l1, l2); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
} catch (IndicatorException e) {
|
} catch (IndicatorException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,10 +58,10 @@ public class RemoteFolderNotEmptyException extends RemoteFileException {
|
||||||
*/
|
*/
|
||||||
private static SystemMessage getMyMessage() {
|
private static SystemMessage getMyMessage() {
|
||||||
if (myMessage == null) {
|
if (myMessage == null) {
|
||||||
String l1 = "Folder is not empty. Cannot delete";
|
String l1 = "Folder is not empty. Cannot delete"; //$NON-NLS-1$
|
||||||
String l2 = "The operation failed. One possible reason is that the folder is not empty";
|
String l2 = "The operation failed. One possible reason is that the folder is not empty"; //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
myMessage = new SystemMessage("RSE", "F", "1003", SystemMessage.ERROR, l1, l2);
|
myMessage = new SystemMessage("RSE", "F", "1003", SystemMessage.ERROR, l1, l2); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
} catch (IndicatorException e) {
|
} catch (IndicatorException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,10 @@ import org.eclipse.rse.services.clientserver.SystemSearchString;
|
||||||
|
|
||||||
public interface IHostSearchResult
|
public interface IHostSearchResult
|
||||||
{
|
{
|
||||||
public static final String SEARCH_RESULT_DELIMITER = ":SEARCH";
|
public static final String SEARCH_RESULT_DELIMITER = ":SEARCH"; //$NON-NLS-1$
|
||||||
public static final String SEARCH_RESULT_OPEN_DELIMITER = "<";
|
public static final String SEARCH_RESULT_OPEN_DELIMITER = "<"; //$NON-NLS-1$
|
||||||
public static final String SEARCH_RESULT_CLOSE_DELIMITER = ">";
|
public static final String SEARCH_RESULT_CLOSE_DELIMITER = ">"; //$NON-NLS-1$
|
||||||
public static final String SEARCH_RESULT_INDEX_DELIMITER = ":";
|
public static final String SEARCH_RESULT_INDEX_DELIMITER = ":"; //$NON-NLS-1$
|
||||||
|
|
||||||
public void setParent(Object parent);
|
public void setParent(Object parent);
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ public interface IHostSearchResultConfiguration extends IHostSearchConstants {
|
||||||
/**
|
/**
|
||||||
* Gets the results contained within the resultContainer
|
* Gets the results contained within the resultContainer
|
||||||
* @param resultContainer
|
* @param resultContainer
|
||||||
* @return
|
* @return the results
|
||||||
*/
|
*/
|
||||||
public IHostSearchResult[] getContainedResults(Object resultContainer);
|
public IHostSearchResult[] getContainedResults(Object resultContainer);
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class FileTransferStatusListener extends StatusChangeListener
|
||||||
_log = uploadLog;
|
_log = uploadLog;
|
||||||
if (_log == null)
|
if (_log == null)
|
||||||
{
|
{
|
||||||
throw new Exception("Could not find log in DataStore.");
|
throw new Exception("Could not find log in DataStore."); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
setStatus(findOrCreateUploadStatus(ds));
|
setStatus(findOrCreateUploadStatus(ds));
|
||||||
}
|
}
|
||||||
|
@ -59,13 +59,13 @@ public class FileTransferStatusListener extends StatusChangeListener
|
||||||
// but also need to handle case where it's been uploaded before in the sessoin (i.e. for reseting values)
|
// but also need to handle case where it's been uploaded before in the sessoin (i.e. for reseting values)
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
result = _log.getDataStore().createObject(_log, "uploadstatus", _remotePath);
|
result = _log.getDataStore().createObject(_log, "uploadstatus", _remotePath); //$NON-NLS-1$
|
||||||
result.setAttribute(DE.A_SOURCE, "running");
|
result.setAttribute(DE.A_SOURCE, "running"); //$NON-NLS-1$
|
||||||
result.setAttribute(DE.A_VALUE, "");
|
result.setAttribute(DE.A_VALUE, ""); //$NON-NLS-1$
|
||||||
|
|
||||||
DataElement cmd = ds.findCommandDescriptor(DataStoreSchema.C_SET);
|
DataElement cmd = ds.findCommandDescriptor(DataStoreSchema.C_SET);
|
||||||
|
|
||||||
DataElement setstatus = ds.command(cmd, _log, true);
|
ds.command(cmd, _log, true);
|
||||||
/*
|
/*
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -83,8 +83,8 @@ public class FileTransferStatusListener extends StatusChangeListener
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
result.setAttribute(DE.A_SOURCE, "running");
|
result.setAttribute(DE.A_SOURCE, "running"); //$NON-NLS-1$
|
||||||
result.setAttribute(DE.A_VALUE, "");
|
result.setAttribute(DE.A_VALUE, ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
_statusElement = result;
|
_statusElement = result;
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -24,7 +24,6 @@ import org.eclipse.dstore.core.model.DataElement;
|
||||||
import org.eclipse.dstore.core.model.DataStore;
|
import org.eclipse.dstore.core.model.DataStore;
|
||||||
import org.eclipse.dstore.extra.internal.extra.DomainEvent;
|
import org.eclipse.dstore.extra.internal.extra.DomainEvent;
|
||||||
import org.eclipse.dstore.extra.internal.extra.IDomainListener;
|
import org.eclipse.dstore.extra.internal.extra.IDomainListener;
|
||||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
|
||||||
import org.eclipse.rse.core.subsystems.CommunicationsEvent;
|
import org.eclipse.rse.core.subsystems.CommunicationsEvent;
|
||||||
import org.eclipse.rse.core.subsystems.ICommunicationsListener;
|
import org.eclipse.rse.core.subsystems.ICommunicationsListener;
|
||||||
import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants;
|
import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants;
|
||||||
|
@ -83,14 +82,12 @@ public class SearchResultsChangeListener implements IDomainListener, ICommunicat
|
||||||
|
|
||||||
_lastUpdateTime = 0;
|
_lastUpdateTime = 0;
|
||||||
|
|
||||||
ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
|
|
||||||
|
|
||||||
//_factory = ((FileServiceSubSystem)_subsys).getRemoteFileFactory();
|
//_factory = ((FileServiceSubSystem)_subsys).getRemoteFileFactory();
|
||||||
|
|
||||||
if (_status.getValue().equals("done")) {
|
if (_status.getValue().equals("done")) { //$NON-NLS-1$
|
||||||
setDone();
|
setDone();
|
||||||
}
|
}
|
||||||
else if (_status.getValue().equals("cancelled")) {
|
else if (_status.getValue().equals("cancelled")) { //$NON-NLS-1$
|
||||||
_cancelled = true;
|
_cancelled = true;
|
||||||
setDone();
|
setDone();
|
||||||
}
|
}
|
||||||
|
@ -137,10 +134,10 @@ public class SearchResultsChangeListener implements IDomainListener, ICommunicat
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_status.getValue().equals("done")) {
|
if (_status.getValue().equals("done")) { //$NON-NLS-1$
|
||||||
setDone();
|
setDone();
|
||||||
}
|
}
|
||||||
else if (_status.getValue().equals("cancelled")) {
|
else if (_status.getValue().equals("cancelled")) { //$NON-NLS-1$
|
||||||
_cancelled = true;
|
_cancelled = true;
|
||||||
setDone();
|
setDone();
|
||||||
}
|
}
|
||||||
|
@ -180,7 +177,7 @@ public class SearchResultsChangeListener implements IDomainListener, ICommunicat
|
||||||
// for defect 47414, this code changes the context used for creating IRemoteFiles
|
// for defect 47414, this code changes the context used for creating IRemoteFiles
|
||||||
char slash = '/';
|
char slash = '/';
|
||||||
|
|
||||||
if (_subsys.getHost().getSystemType().equals("Windows")) {
|
if (_subsys.getHost().getSystemType().equals("Windows")) { //$NON-NLS-1$
|
||||||
slash = '\\';
|
slash = '\\';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +264,7 @@ public class SearchResultsChangeListener implements IDomainListener, ICommunicat
|
||||||
|
|
||||||
if (result.getNestedSize() > 0) {
|
if (result.getNestedSize() > 0) {
|
||||||
|
|
||||||
boolean isWindows = _subsys.getHost().getSystemType().equals("Windows");
|
boolean isWindows = _subsys.getHost().getSystemType().equals("Windows"); //$NON-NLS-1$
|
||||||
char separator = isWindows ? '\\' : '/';
|
char separator = isWindows ? '\\' : '/';
|
||||||
List contents = new ArrayList();
|
List contents = new ArrayList();
|
||||||
|
|
||||||
|
@ -283,12 +280,11 @@ public class SearchResultsChangeListener implements IDomainListener, ICommunicat
|
||||||
searchResult.setText(resultElement.getName());
|
searchResult.setText(resultElement.getName());
|
||||||
|
|
||||||
String source = resultElement.getSource().replace('\\', separator).replace('/', separator);
|
String source = resultElement.getSource().replace('\\', separator).replace('/', separator);
|
||||||
String path = source;
|
|
||||||
String lineNumStr = null;
|
String lineNumStr = null;
|
||||||
int colonIndex = source.indexOf(":");
|
int colonIndex = source.indexOf(":"); //$NON-NLS-1$
|
||||||
if (colonIndex > 2)
|
if (colonIndex > 2)
|
||||||
{
|
{
|
||||||
path = source.substring(0, colonIndex);
|
|
||||||
lineNumStr = source.substring(colonIndex);
|
lineNumStr = source.substring(colonIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class StatusChangeListener implements IDomainListener, ICommunicationsLis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SystemBasePlugin.logError("StatusChangeListener.FindShell exception: ", e);
|
SystemBasePlugin.logError("StatusChangeListener.FindShell exception: ", e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -311,7 +311,7 @@ public class StatusChangeListener implements IDomainListener, ICommunicationsLis
|
||||||
|
|
||||||
if (ICommunicationsDiagnostic.CANCEL_WAIT_REQUESTED == diagnostic.diagnosticStatus()) {
|
if (ICommunicationsDiagnostic.CANCEL_WAIT_REQUESTED == diagnostic.diagnosticStatus()) {
|
||||||
cancelled = true;
|
cancelled = true;
|
||||||
SystemBasePlugin.logError("StatusChangeListener.waitForUpdate cancelled by user.");
|
SystemBasePlugin.logError("StatusChangeListener.waitForUpdate cancelled by user."); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,7 @@ public class StatusChangeListener implements IDomainListener, ICommunicationsLis
|
||||||
if (ICommunicationsDiagnostic.CANCEL_WAIT_REQUESTED == diagnostic.diagnosticStatus())
|
if (ICommunicationsDiagnostic.CANCEL_WAIT_REQUESTED == diagnostic.diagnosticStatus())
|
||||||
{
|
{
|
||||||
cancelled = true;
|
cancelled = true;
|
||||||
SystemBasePlugin.logError("StatusChangeListener.waitForUpdate cancelled by user.");
|
SystemBasePlugin.logError("StatusChangeListener.waitForUpdate cancelled by user."); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,7 @@ public class StatusChangeListener implements IDomainListener, ICommunicationsLis
|
||||||
* @return <code>true</code> if status done, <code>false</code> otherwise.
|
* @return <code>true</code> if status done, <code>false</code> otherwise.
|
||||||
*/
|
*/
|
||||||
protected boolean determineStatusDone() {
|
protected boolean determineStatusDone() {
|
||||||
return getStatus().getAttribute(DE.A_VALUE).equals("done") || getStatus().getAttribute(DE.A_NAME).equals("done");
|
return getStatus().getAttribute(DE.A_VALUE).equals("done") || getStatus().getAttribute(DE.A_NAME).equals("done"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -423,15 +423,15 @@ public class StatusChangeListener implements IDomainListener, ICommunicationsLis
|
||||||
try {
|
try {
|
||||||
String name = getStatus().getName(); /* Get the current element status name: started/working/done */
|
String name = getStatus().getName(); /* Get the current element status name: started/working/done */
|
||||||
/* Log the current status */
|
/* Log the current status */
|
||||||
SystemBasePlugin.logError("StatusChangeListener."+name+": " + "Communications Diagnostic started");
|
SystemBasePlugin.logError("StatusChangeListener."+name+": " + "Communications Diagnostic started"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
SystemBasePlugin.logError("StatusChangeListener."+name +
|
SystemBasePlugin.logError("StatusChangeListener."+name + //$NON-NLS-1$
|
||||||
": done = " + done +
|
": done = " + done + //$NON-NLS-1$
|
||||||
"; cancelled = " + cancelled +
|
"; cancelled = " + cancelled + //$NON-NLS-1$
|
||||||
"; _networkDown = " + _networkDown );
|
"; _networkDown = " + _networkDown ); //$NON-NLS-1$
|
||||||
|
|
||||||
ds = target.getDataStore();
|
ds = target.getDataStore();
|
||||||
/* Log the status in DataStore */
|
/* Log the status in DataStore */
|
||||||
SystemBasePlugin.logError("StatusChangeListener."+name+"(DataStore): " + " isConnected = " + ds.isConnected() + "; isWaiting = " + ds.isWaiting(target));
|
SystemBasePlugin.logError("StatusChangeListener."+name+"(DataStore): " + " isConnected = " + ds.isConnected() + "; isWaiting = " + ds.isWaiting(target)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
|
|
||||||
/*Log all nested DataElement's in target's parent*/
|
/*Log all nested DataElement's in target's parent*/
|
||||||
List deList = target.getParent().getNestedData();
|
List deList = target.getParent().getNestedData();
|
||||||
|
@ -441,10 +441,10 @@ public class StatusChangeListener implements IDomainListener, ICommunicationsLis
|
||||||
{
|
{
|
||||||
DataElement child = (DataElement) deList.get(i);
|
DataElement child = (DataElement) deList.get(i);
|
||||||
if (child != null) {
|
if (child != null) {
|
||||||
SystemBasePlugin.logError("StatusChangeListener."+name+".child"+i+"(DataElement): " + child.toString());
|
SystemBasePlugin.logError("StatusChangeListener."+name+".child"+i+"(DataElement): " + child.toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
DataElement descriptor = child.getDescriptor();
|
DataElement descriptor = child.getDescriptor();
|
||||||
if (descriptor != null)
|
if (descriptor != null)
|
||||||
SystemBasePlugin.logError("StatusChangeListener."+name+".child"+i+"(Descriptor): " + descriptor.toString());
|
SystemBasePlugin.logError("StatusChangeListener."+name+".child"+i+"(Descriptor): " + descriptor.toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -462,7 +462,7 @@ public class StatusChangeListener implements IDomainListener, ICommunicationsLis
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
SystemBasePlugin.logError("StatusChangeListener.ICommunicationsDiagnostic exception: ", e);
|
SystemBasePlugin.logError("StatusChangeListener.ICommunicationsDiagnostic exception: ", e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
return d; // return the created diagnostic class instance
|
return d; // return the created diagnostic class instance
|
||||||
|
|
|
@ -129,7 +129,7 @@ public class DStoreFileSubSystemSearchResultConfiguration extends DStoreSearchRe
|
||||||
|
|
||||||
public void domainChanged(DomainEvent e)
|
public void domainChanged(DomainEvent e)
|
||||||
{
|
{
|
||||||
if (_status.getValue().equals("done"))
|
if (_status.getValue().equals("done")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
setStatus(FINISHED);
|
setStatus(FINISHED);
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,7 @@ public class DStoreJavaLanguageUtility extends AbstractJavaLanguageUtility imple
|
||||||
else {
|
else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String remotePath = remoteFile.getAbsolutePath();
|
|
||||||
DataElement deObj = ((DStoreHostFile)univFile.getHostFile()).getDataElement();
|
DataElement deObj = ((DStoreHostFile)univFile.getHostFile()).getDataElement();
|
||||||
|
|
||||||
DataStore ds = deObj.getDataStore();
|
DataStore ds = deObj.getDataStore();
|
||||||
|
@ -66,11 +65,11 @@ public class DStoreJavaLanguageUtility extends AbstractJavaLanguageUtility imple
|
||||||
DataElement status = ds.synchronizedCommand(queryCmd, deObj, true);
|
DataElement status = ds.synchronizedCommand(queryCmd, deObj, true);
|
||||||
DataElement className = ds.find(status, DE.A_TYPE, TYPE_QUALIFIED_CLASSNAME, 1);
|
DataElement className = ds.find(status, DE.A_TYPE, TYPE_QUALIFIED_CLASSNAME, 1);
|
||||||
|
|
||||||
if (className != null && !className.equals("null")) {
|
if (className != null && !className.equals("null")) { //$NON-NLS-1$
|
||||||
return className.getName();
|
return className.getName();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SystemBasePlugin.logWarning("Qualified class name for " + remoteFile.getAbsolutePath() + " is null");
|
SystemBasePlugin.logWarning("Qualified class name for " + remoteFile.getAbsolutePath() + " is null"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class DStoreWindowsFileSubSystemConfiguration extends DStoreFileSubSystem
|
||||||
pool = mgr.createSystemFilterPool(getDefaultFilterPoolName(mgr.getName(), getId()), true); // true=>is deletable by user
|
pool = mgr.createSystemFilterPool(getDefaultFilterPoolName(mgr.getName(), getId()), true); // true=>is deletable by user
|
||||||
if (pool == null) // hmmm, why would this happen?
|
if (pool == null) // hmmm, why would this happen?
|
||||||
{
|
{
|
||||||
SystemBasePlugin.logError("Creating default filter pool "+getDefaultFilterPoolName(mgr.getName(), getId())+" for mgr "+mgr.getName()+" failed.",null);
|
SystemBasePlugin.logError("Creating default filter pool "+getDefaultFilterPoolName(mgr.getName(), getId())+" for mgr "+mgr.getName()+" failed.",null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (isUserPrivateProfile(mgr))
|
if (isUserPrivateProfile(mgr))
|
||||||
|
@ -50,7 +50,7 @@ public class DStoreWindowsFileSubSystemConfiguration extends DStoreFileSubSystem
|
||||||
Vector filterStrings = new Vector();
|
Vector filterStrings = new Vector();
|
||||||
RemoteFileFilterString myHomeFilterString = new RemoteFileFilterString(this);
|
RemoteFileFilterString myHomeFilterString = new RemoteFileFilterString(this);
|
||||||
myHomeFilterString.setPath(getSeparator());
|
myHomeFilterString.setPath(getSeparator());
|
||||||
filterStrings.add(".\\*");
|
filterStrings.add(".\\*"); //$NON-NLS-1$
|
||||||
ISystemFilter filter = mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_MYHOME,filterStrings);
|
ISystemFilter filter = mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_MYHOME,filterStrings);
|
||||||
filter.setNonChangable(true);
|
filter.setNonChangable(true);
|
||||||
filter.setSingleFilterStringOnly(true);
|
filter.setSingleFilterStringOnly(true);
|
||||||
|
@ -65,14 +65,14 @@ public class DStoreWindowsFileSubSystemConfiguration extends DStoreFileSubSystem
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
catch (Exception exc)
|
||||||
{
|
{
|
||||||
SystemBasePlugin.logError("Error creating default filter pool",exc);
|
SystemBasePlugin.logError("Error creating default filter pool",exc); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return pool;
|
return pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSeparator()
|
public String getSeparator()
|
||||||
{
|
{
|
||||||
return "\\";
|
return "\\"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public char getSeparatorChar()
|
public char getSeparatorChar()
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class RemoteFilePropertyChangeListener implements IDomainListener,
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
SystemBasePlugin.logError(
|
SystemBasePlugin.logError(
|
||||||
"StatusChangeListener.FindShell exception: ", e);
|
"StatusChangeListener.FindShell exception: ", e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class ServiceCommandShell extends RemoteCommandShell implements IServiceC
|
||||||
{
|
{
|
||||||
SimpleHostOutput line = (SimpleHostOutput)lineObj;
|
SimpleHostOutput line = (SimpleHostOutput)lineObj;
|
||||||
|
|
||||||
String type = event.isError() ? "stderr" : "stdout";
|
String type = event.isError() ? "stderr" : "stdout"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
if (event.isError())
|
if (event.isError())
|
||||||
{
|
{
|
||||||
output = new RemoteError(this, type);
|
output = new RemoteError(this, type);
|
||||||
|
|
|
@ -22,7 +22,6 @@ import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.rse.core.IRSESystemType;
|
import org.eclipse.rse.core.IRSESystemType;
|
||||||
import org.eclipse.rse.core.SystemBasePlugin;
|
|
||||||
import org.eclipse.rse.core.model.IHost;
|
import org.eclipse.rse.core.model.IHost;
|
||||||
import org.eclipse.rse.core.subsystems.IConnectorService;
|
import org.eclipse.rse.core.subsystems.IConnectorService;
|
||||||
import org.eclipse.rse.core.subsystems.IServiceSubSystemConfiguration;
|
import org.eclipse.rse.core.subsystems.IServiceSubSystemConfiguration;
|
||||||
|
|
Loading…
Add table
Reference in a new issue