From 92318576063c45aee694d05dc528e594e5dd2ca3 Mon Sep 17 00:00:00 2001 From: David McKnight Date: Tue, 28 Nov 2006 17:12:01 +0000 Subject: [PATCH] removing dstore compiler warnings --- .../dstore/core/client/ClientAttributes.java | 8 +- .../core/client/ClientCommandHandler.java | 98 ++++----- .../dstore/core/client/ClientConnection.java | 80 ++++---- .../dstore/core/client/ClientReceiver.java | 2 +- .../core/client/ClientUpdateHandler.java | 1 - .../core/java/ClassByteStreamHandler.java | 2 +- .../dstore/core/java/RemoteClassLoader.java | 19 +- .../dstore/core/miners/miner/Miner.java | 23 ++- .../dstore/core/model/ByteStreamHandler.java | 12 +- .../dstore/core/model/CommandHandler.java | 2 +- .../src/org/eclipse/dstore/core/model/DE.java | 60 +++--- .../dstore/core/model/DataElement.java | 43 ++-- .../eclipse/dstore/core/model/DataStore.java | 139 ++++++------- .../core/model/DataStoreAttributes.java | 20 +- .../dstore/core/model/DataStoreResources.java | 186 +++++++++--------- .../dstore/core/model/DataStoreSchema.java | 74 +++---- .../core/model/DefaultByteConverter.java | 2 +- .../core/model/IDataStoreConstants.java | 20 +- .../dstore/core/model/UpdateHandler.java | 2 +- .../core/server/ConnectionEstablisher.java | 16 +- .../dstore/core/server/MinerLoader.java | 16 +- .../eclipse/dstore/core/server/Server.java | 4 +- .../dstore/core/server/ServerAttributes.java | 8 +- .../core/server/ServerCommandHandler.java | 16 +- .../dstore/core/server/ServerLauncher.java | 43 ++-- .../dstore/core/server/ServerReceiver.java | 4 +- .../dstore/core/server/ServerReturnCodes.java | 16 +- .../core/server/ServerSSLProperties.java | 28 +-- .../core/server/ServerUpdateHandler.java | 98 ++++----- .../dstore/core/util/CommandGenerator.java | 40 ++-- .../dstore/core/util/DataElementRemover.java | 42 ++-- .../org/eclipse/dstore/core/util/Pattern.java | 6 +- .../eclipse/dstore/core/util/Receiver.java | 4 +- .../org/eclipse/dstore/core/util/Sender.java | 8 +- .../dstore/core/util/StringCompare.java | 2 - .../dstore/core/util/XMLgenerator.java | 26 +-- .../eclipse/dstore/core/util/XMLparser.java | 141 ++++++------- .../dstore/core/util/ssl/DStoreKeyStore.java | 6 +- .../core/util/ssl/DStoreSSLContext.java | 4 +- .../extra/internal/extra/PropertySource.java | 32 +-- 40 files changed, 662 insertions(+), 691 deletions(-) diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/client/ClientAttributes.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/client/ClientAttributes.java index 0a50c0c8d06..41992fd6b3e 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/client/ClientAttributes.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/client/ClientAttributes.java @@ -38,16 +38,16 @@ public class ClientAttributes extends DataStoreAttributes try { - String pluginPath = System.getProperty("A_PLUGIN_PATH"); + String pluginPath = System.getProperty("A_PLUGIN_PATH"); //$NON-NLS-1$ if ((pluginPath != null) && (pluginPath.length() > 0)) { setAttribute(A_PLUGIN_PATH, pluginPath + File.separator); } setAttribute(A_LOCAL_NAME, InetAddress.getLocalHost().getHostName()); - setAttribute(A_LOCAL_PATH, "/tmp/"); - setAttribute(A_HOST_NAME, "local"); - setAttribute(A_HOST_PATH, "/"); + setAttribute(A_LOCAL_PATH, "/tmp/"); //$NON-NLS-1$ + setAttribute(A_HOST_NAME, "local"); //$NON-NLS-1$ + setAttribute(A_HOST_PATH, "/"); //$NON-NLS-1$ } catch (UnknownHostException e) diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/client/ClientCommandHandler.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/client/ClientCommandHandler.java index f62c1c65ce6..9b0a627d255 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/client/ClientCommandHandler.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/client/ClientCommandHandler.java @@ -42,73 +42,73 @@ public class ClientCommandHandler extends CommandHandler private static String[] _docAttributes = { DataStoreResources.DOCUMENT_TYPE, - "client.doc.root.id", - "client.document", - "doc", - "", - "", + "client.doc.root.id", //$NON-NLS-1$ + "client.document", //$NON-NLS-1$ + "doc", //$NON-NLS-1$ + "", //$NON-NLS-1$ + "", //$NON-NLS-1$ DataStoreResources.FALSE, - "2"}; + "2"}; //$NON-NLS-1$ private static String[] _fileAttributes = { DataStoreResources.FILE_TYPE, - "client.file.root.id", - "client.file", - "doc", - "", - "", + "client.file.root.id", //$NON-NLS-1$ + "client.file", //$NON-NLS-1$ + "doc", //$NON-NLS-1$ + "", //$NON-NLS-1$ + "", //$NON-NLS-1$ DataStoreResources.FALSE, - "2"}; + "2"}; //$NON-NLS-1$ private static String[] _classAttributes = { DataStoreResources.CLASS_TYPE, - "client.class.root.id", - "client.class", - "doc", - "", - "", + "client.class.root.id", //$NON-NLS-1$ + "client.class", //$NON-NLS-1$ + "doc", //$NON-NLS-1$ + "", //$NON-NLS-1$ + "", //$NON-NLS-1$ DataStoreResources.FALSE, - "2"}; + "2"}; //$NON-NLS-1$ private static String[] _serializeAttributes = { DataStoreResources.SERIALIZED_TYPE, - "client.serialized.root.id", - "client.serialized", - "doc", - "", - "", + "client.serialized.root.id", //$NON-NLS-1$ + "client.serialized", //$NON-NLS-1$ + "doc", //$NON-NLS-1$ + "", //$NON-NLS-1$ + "", //$NON-NLS-1$ DataStoreResources.FALSE, - "2"}; + "2"}; //$NON-NLS-1$ private static String[] _requestClassAttributes = { DataStoreResources.REQUEST_CLASS_TYPE, - "client.requestclass.root.id", - "client.requestclass", - "doc", - "", - "", + "client.requestclass.root.id", //$NON-NLS-1$ + "client.requestclass", //$NON-NLS-1$ + "doc", //$NON-NLS-1$ + "", //$NON-NLS-1$ + "", //$NON-NLS-1$ DataStoreResources.FALSE, - "2"}; + "2"}; //$NON-NLS-1$ private static String[] _keepAliveAttributes = { DataStoreResources.KEEPALIVE_TYPE, - "client.keepalive.root.id", - "server.keepalive", - "doc", - "", - "", + "client.keepalive.root.id", //$NON-NLS-1$ + "server.keepalive", //$NON-NLS-1$ + "doc", //$NON-NLS-1$ + "", //$NON-NLS-1$ + "", //$NON-NLS-1$ DataStoreResources.FALSE, - "2"}; + "2"}; //$NON-NLS-1$ private static String[] _confirmKeepAliveAttributes = { DataStoreResources.KEEPALIVECONFIRM_TYPE, - "client.keepalive.confirm.root.id", - "server.confirmkeepalive", - "doc", - "", - "", + "client.keepalive.confirm.root.id", //$NON-NLS-1$ + "server.confirmkeepalive", //$NON-NLS-1$ + "doc", //$NON-NLS-1$ + "", //$NON-NLS-1$ + "", //$NON-NLS-1$ DataStoreResources.FALSE, - "2"}; + "2"}; //$NON-NLS-1$ protected DataElement _fileDocumentElement; @@ -170,7 +170,7 @@ public class ClientCommandHandler extends CommandHandler */ public synchronized void sendFile(String fileName, byte[] bytes, int size, boolean binary) { - sendFile(fileName, bytes, size, binary, "default"); + sendFile(fileName, bytes, size, binary, "default"); //$NON-NLS-1$ } /** @@ -206,7 +206,7 @@ public class ClientCommandHandler extends CommandHandler */ public synchronized void sendAppendFile(String fileName, byte[] bytes, int size, boolean binary) { - sendAppendFile(fileName, bytes, size, binary, "default"); + sendAppendFile(fileName, bytes, size, binary, "default"); //$NON-NLS-1$ } /** @@ -295,7 +295,7 @@ public class ClientCommandHandler extends CommandHandler */ public synchronized void sendClass(String className) { - sendClass(className, "default"); + sendClass(className, "default"); //$NON-NLS-1$ } /** @@ -353,8 +353,8 @@ public class ClientCommandHandler extends CommandHandler { DataElement document = _confirmKeepAliveDocumentElement; document.setPendingTransfer(true); - document.setAttribute(DE.A_NAME, "confirm"); - document.setAttribute(DE.A_VALUE, "confirm"); + document.setAttribute(DE.A_NAME, "confirm"); //$NON-NLS-1$ + document.setAttribute(DE.A_VALUE, "confirm"); //$NON-NLS-1$ document.setParent(null); _pendingKeepAliveConfirmation = document; notifyInput(); @@ -364,8 +364,8 @@ public class ClientCommandHandler extends CommandHandler { DataElement document = _keepAliveDocumentElement; document.setPendingTransfer(true); - document.setAttribute(DE.A_NAME, "request"); - document.setAttribute(DE.A_VALUE, "request"); + document.setAttribute(DE.A_NAME, "request"); //$NON-NLS-1$ + document.setAttribute(DE.A_VALUE, "request"); //$NON-NLS-1$ document.setParent(null); _pendingKeepAliveRequest = document; notifyInput(); diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/client/ClientConnection.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/client/ClientConnection.java index bf85d6939bd..3e16676cf9e 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/client/ClientConnection.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/client/ClientConnection.java @@ -111,12 +111,12 @@ public class ClientConnection implements IDataStoreConstants private static final int VERSION_INDEX_PROTOCOL = 0; private static final int VERSION_INDEX_VERSION = 1; private static final int VERSION_INDEX_MINOR = 2; - public static String INCOMPATIBLE_SERVER_UPDATE = "Incompatible DataStore."; - public static String INCOMPATIBLE_CLIENT_UPDATE = "Incompatible DataStore."; - public static String SERVER_OLDER = "Older DataStore Server."; - public static String CLIENT_OLDER = "Older DataStore Client."; - public static String INCOMPATIBLE_PROTOCOL = "Incompatible Protocol."; - public static String CANNOT_CONNECT = "Cannot connect to server."; + public static String INCOMPATIBLE_SERVER_UPDATE = "Incompatible DataStore."; //$NON-NLS-1$ + public static String INCOMPATIBLE_CLIENT_UPDATE = "Incompatible DataStore."; //$NON-NLS-1$ + public static String SERVER_OLDER = "Older DataStore Server."; //$NON-NLS-1$ + public static String CLIENT_OLDER = "Older DataStore Client."; //$NON-NLS-1$ + public static String INCOMPATIBLE_PROTOCOL = "Incompatible Protocol."; //$NON-NLS-1$ + public static String CANNOT_CONNECT = "Cannot connect to server."; //$NON-NLS-1$ /** * Creates a new ClientConnection instance @@ -242,7 +242,7 @@ public class ClientConnection implements IDataStoreConstants { if (port == null || port.length() == 0) { - port = "0"; + port = "0"; //$NON-NLS-1$ } _port = port; @@ -317,7 +317,7 @@ public class ClientConnection implements IDataStoreConstants if (_isRemote) { _commandHandler.command( - _dataStore.find(_dataStore.getRoot(), DE.A_NAME, "Exit"), + _dataStore.find(_dataStore.getRoot(), DE.A_NAME, "Exit"), //$NON-NLS-1$ _dataStore.getHostRoot(), false); _receiver.finish(); @@ -354,7 +354,7 @@ public class ClientConnection implements IDataStoreConstants if (_loaders == null) { _loaders = new ArrayList(); - _loaders.add(new ExternalLoader(getClass().getClassLoader(), "*")); + _loaders.add(new ExternalLoader(getClass().getClassLoader(), "*")); //$NON-NLS-1$ } _commandHandler = new ServerCommandHandler(_loaders); @@ -380,7 +380,7 @@ public class ClientConnection implements IDataStoreConstants _isConnected = true; DataElement ticket = _dataStore.getTicket(); - ticket.setAttribute(DE.A_NAME, "null"); + ticket.setAttribute(DE.A_NAME, "null"); //$NON-NLS-1$ ConnectionStatus result = new ConnectionStatus(_isConnected); result.setTicket(ticket.getName()); @@ -411,7 +411,7 @@ public class ClientConnection implements IDataStoreConstants else { launchStatus = new ConnectionStatus(true); - launchStatus.setTicket("null"); + launchStatus.setTicket("null"); //$NON-NLS-1$ } return connect(launchStatus.getTicket()); @@ -472,7 +472,7 @@ public class ClientConnection implements IDataStoreConstants { ((SSLSocket) _theSocket).startHandshake(); - SSLSession session = ((SSLSocket) _theSocket).getSession(); + ((SSLSocket) _theSocket).getSession(); } catch (SSLHandshakeException e) @@ -507,44 +507,44 @@ public class ClientConnection implements IDataStoreConstants case HANDSHAKE_SERVER_NEWER: { msg = INCOMPATIBLE_CLIENT_UPDATE; - msg += "\nThe server running on " + msg += "\nThe server running on " //$NON-NLS-1$ + _host - + " under port " + + " under port " //$NON-NLS-1$ + _port - + " is a newer DataStore server."; + + " is a newer DataStore server."; //$NON-NLS-1$ break; } case HANDSHAKE_SERVER_OLDER: { msg = INCOMPATIBLE_SERVER_UPDATE; - msg += "\nThe server running on " + msg += "\nThe server running on " //$NON-NLS-1$ + _host - + " under port " + + " under port " //$NON-NLS-1$ + _port - + " is an older DataStore server."; + + " is an older DataStore server."; //$NON-NLS-1$ break; } case HANDSHAKE_INCORRECT: { msg = CANNOT_CONNECT; msg += INCOMPATIBLE_PROTOCOL; - msg += "\nThe server running on " + msg += "\nThe server running on " //$NON-NLS-1$ + _host - + " under port " + + " under port " //$NON-NLS-1$ + _port - + " is not a valid DataStore server."; + + " is not a valid DataStore server."; //$NON-NLS-1$ break; } case HANDSHAKE_UNEXPECTED: { msg = CANNOT_CONNECT; - msg += "Unexpected exception."; + msg += "Unexpected exception."; //$NON-NLS-1$ break; } case HANDSHAKE_TIMEOUT: { msg = CANNOT_CONNECT; - msg += "Timeout waiting for socket activity."; + msg += "Timeout waiting for socket activity."; //$NON-NLS-1$ break; } default: @@ -560,8 +560,8 @@ public class ClientConnection implements IDataStoreConstants } catch (java.net.ConnectException e) { - String msg = "Connection Refused."; - msg += "\nMake sure that the DataStore server is running on " + _host + " under port " + _port + "."; + String msg = "Connection Refused."; //$NON-NLS-1$ + msg += "\nMake sure that the DataStore server is running on " + _host + " under port " + _port + "."; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ result = new ConnectionStatus(false, msg); } catch (UnknownHostException uhe) @@ -673,7 +673,7 @@ public class ClientConnection implements IDataStoreConstants } else if (status == null) { - Exception e = new Exception("no status returned"); + Exception e = new Exception("no status returned"); //$NON-NLS-1$ result = new ConnectionStatus(false, e); } else @@ -771,8 +771,8 @@ public class ClientConnection implements IDataStoreConstants } catch (java.net.ConnectException e) { - String msg = "Connection Refused."; - msg += "\nMake sure that the DataStore daemon is running on " + _host + "."; + String msg = "Connection Refused."; //$NON-NLS-1$ + msg += "\nMake sure that the DataStore daemon is running on " + _host + "."; //$NON-NLS-1$ //$NON-NLS-2$ result = new ConnectionStatus(false, msg); } catch (UnknownHostException uhe) @@ -825,18 +825,6 @@ public class ClientConnection implements IDataStoreConstants _port = _clientAttributes.getAttribute(DataStoreAttributes.A_HOST_PORT); } - private void flush(DataElement object) - { - _dataStore.flush(object); - } - - private void flush() - { - _dataStore.flush(_dataStore.getHostRoot()); - _dataStore.flush(_dataStore.getLogRoot()); - _dataStore.flush(_dataStore.getDescriptorRoot()); - _dataStore.createRoot(); - } private int doHandShake() { @@ -844,9 +832,9 @@ public class ClientConnection implements IDataStoreConstants { BufferedReader reader = new BufferedReader(new InputStreamReader(_theSocket.getInputStream(), DE.ENCODING_UTF_8)); PrintWriter writer = new PrintWriter(new OutputStreamWriter(_theSocket.getOutputStream(), DE.ENCODING_UTF_8)); - writer.println(""); - writer.println(""); - writer.println(""); + writer.println(""); //$NON-NLS-1$ + writer.println(""); //$NON-NLS-1$ + writer.println(""); //$NON-NLS-1$ writer.flush(); String handshake = null; @@ -860,8 +848,8 @@ public class ClientConnection implements IDataStoreConstants } _theSocket.setSoTimeout(0); - String[] clientVersionStr = DataStoreAttributes.DATASTORE_VERSION.split("\\."); - String[] serverVersionStr = handshake.split("\\."); + String[] clientVersionStr = DataStoreAttributes.DATASTORE_VERSION.split("\\."); //$NON-NLS-1$ + String[] serverVersionStr = handshake.split("\\."); //$NON-NLS-1$ _dataStore.setServerVersion(Integer.parseInt(serverVersionStr[VERSION_INDEX_VERSION])); _dataStore.setServerMinor(Integer.parseInt(serverVersionStr[VERSION_INDEX_MINOR])); @@ -873,7 +861,7 @@ public class ClientConnection implements IDataStoreConstants } else { - if (handshake.startsWith(" 0) { DataElement object = null; diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/java/ClassByteStreamHandler.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/java/ClassByteStreamHandler.java index 7c98eb7cb6e..0d55a70c475 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/java/ClassByteStreamHandler.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/java/ClassByteStreamHandler.java @@ -43,7 +43,7 @@ public class ClassByteStreamHandler implements IClassByteStreamHandler protected DataStore _dataStore; protected DataElement _log; - protected static final String FILEMSG_REMOTE_SAVE_FAILED = "RSEF5006"; + protected static final String FILEMSG_REMOTE_SAVE_FAILED = "RSEF5006"; //$NON-NLS-1$ /** * Contructor diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/java/RemoteClassLoader.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/java/RemoteClassLoader.java index fc8b4d8e9ca..6806367dca6 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/java/RemoteClassLoader.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/java/RemoteClassLoader.java @@ -93,7 +93,7 @@ import org.eclipse.dstore.core.model.DataStore; */ public class RemoteClassLoader extends ClassLoader { - public static String CACHING_PREFERENCE = "Class.Caching"; + public static String CACHING_PREFERENCE = "Class.Caching"; //$NON-NLS-1$ private DataStore _dataStore; private boolean _useCaching = false; private CacheClassLoader _urlClassLoader; @@ -128,7 +128,7 @@ public class RemoteClassLoader extends ClassLoader { boolean useCaching = false; String pref = _dataStore.getPreference(CACHING_PREFERENCE); - if (pref != null && pref.equals("true")) + if (pref != null && pref.equals("true")) //$NON-NLS-1$ { useCaching = true; } @@ -287,7 +287,8 @@ public class RemoteClassLoader extends ClassLoader // this is the signal that the class could not be found on the client // System.out.println("Empty class/class not found: "+className); // System.out.println("notifying requester"); - request.notifyResponse(); // wake up the threads waiting for the class + if (request != null) + request.notifyResponse(); // wake up the threads waiting for the class return; } Class receivedClass = null; @@ -308,7 +309,8 @@ public class RemoteClassLoader extends ClassLoader // (even after requesting it from the client). We must fail, // but wake up the threads waiting for this class. e.printStackTrace(); - request.notifyResponse(); + if (request != null) + request.notifyResponse(); return; } catch (LinkageError e) @@ -327,13 +329,15 @@ public class RemoteClassLoader extends ClassLoader // so we might as well just fail here and notify threads waiting // for this class to load. err.printStackTrace(); - request.notifyResponse(); + if (request != null) + request.notifyResponse(); return; } catch (ClassNotFoundException ee) { // we definitely shouldnt get here - request.notifyResponse(); + if (request != null) + request.notifyResponse(); return; } @@ -341,7 +345,8 @@ public class RemoteClassLoader extends ClassLoader // we still dont have it, notify the threads and fail. if (receivedClass == null) { - request.notifyResponse(); + if (request != null) + request.notifyResponse(); return; } } diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/miners/miner/Miner.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/miners/miner/Miner.java index 92e5c07b028..d9020a8f224 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/miners/miner/Miner.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/miners/miner/Miner.java @@ -190,7 +190,7 @@ implements ISchemaExtender if (_value == null) { String name = getMinerName(); - int indexOfValue = name.lastIndexOf("."); + int indexOfValue = name.lastIndexOf("."); //$NON-NLS-1$ _value = name.substring(indexOfValue + 1, name.length()); } return _value; @@ -256,17 +256,16 @@ implements ISchemaExtender { String name = getCommandName(command); DataElement status = getCommandStatus(command); - long startTime = System.currentTimeMillis(); if (status == null) { - _dataStore.trace("bad command: "); - _dataStore.trace("\tcmd=" + command); - _dataStore.trace("\tparent=" + command.getParent()); + _dataStore.trace("bad command: "); //$NON-NLS-1$ + _dataStore.trace("\tcmd=" + command); //$NON-NLS-1$ + _dataStore.trace("\tparent=" + command.getParent()); //$NON-NLS-1$ return null; } - if (status.getAttribute(DE.A_NAME).equals("start")) + if (status.getAttribute(DE.A_NAME).equals("start")) //$NON-NLS-1$ { status.setAttribute(DE.A_NAME, DataStoreResources.model_working); } @@ -285,7 +284,7 @@ implements ISchemaExtender { //e.printStackTrace(); _dataStore.trace(e); - status.setAttribute(DE.A_VALUE, "Failed with Exception:"+getStack(e)); + status.setAttribute(DE.A_VALUE, "Failed with Exception:"+getStack(e)); //$NON-NLS-1$ status.setAttribute(DE.A_NAME, DataStoreResources.model_done); //status.setAttribute(DE.A_SOURCE, getStack(e)); _dataStore.refresh(status); @@ -294,8 +293,8 @@ implements ISchemaExtender if (e.getMessage() != null) exc = e.getMessage(); else - exc = "Exception"; - DataElement exception = _dataStore.createObject(status, DataStoreResources.model_error, exc); + exc = "Exception"; //$NON-NLS-1$ + _dataStore.createObject(status, DataStoreResources.model_error, exc); } catch (Error er) { @@ -316,8 +315,8 @@ implements ISchemaExtender StackTraceElement[] stack = e.getStackTrace(); for (int i = 0; i < stack.length; i++) { - buf.append(stack[i].getClassName() + ":" + stack[i].getMethodName() + ":" + stack[i].getLineNumber()); - buf.append(","); + buf.append(stack[i].getClassName() + ":" + stack[i].getMethodName() + ":" + stack[i].getLineNumber()); //$NON-NLS-1$ //$NON-NLS-2$ + buf.append(","); //$NON-NLS-1$ } return buf.toString(); } @@ -501,7 +500,7 @@ implements ISchemaExtender */ public final DataElement createAbstractRelationship(DataElement from, DataElement to) { - return _dataStore.createReference(from, to, "abstracts", "abstracted by"); + return _dataStore.createReference(from, to, "abstracts", "abstracted by"); //$NON-NLS-1$ //$NON-NLS-2$ } /** diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/ByteStreamHandler.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/ByteStreamHandler.java index ab0e2d6d250..26199e18e08 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/ByteStreamHandler.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/ByteStreamHandler.java @@ -38,7 +38,7 @@ public class ByteStreamHandler implements IByteStreamHandler protected DataStore _dataStore; protected DataElement _log; - protected static final String FILEMSG_REMOTE_SAVE_FAILED = "RSEF5006"; + protected static final String FILEMSG_REMOTE_SAVE_FAILED = "RSEF5006"; //$NON-NLS-1$ /** * Contructor @@ -118,7 +118,7 @@ public class ByteStreamHandler implements IByteStreamHandler fileStream.close(); if (status == null) return; - status.setAttribute(DE.A_SOURCE, "success"); + status.setAttribute(DE.A_SOURCE, "success"); //$NON-NLS-1$ _dataStore.refresh(status.getParent()); } catch (IOException e) @@ -127,7 +127,7 @@ public class ByteStreamHandler implements IByteStreamHandler if (status == null) return; status.setAttribute(DE.A_VALUE, FILEMSG_REMOTE_SAVE_FAILED); - status.setAttribute(DE.A_SOURCE, "failed"); + status.setAttribute(DE.A_SOURCE, "failed"); //$NON-NLS-1$ _dataStore.refresh(status.getParent()); } catch (Exception e) @@ -136,7 +136,7 @@ public class ByteStreamHandler implements IByteStreamHandler if (status == null) return; status.setAttribute(DE.A_VALUE, FILEMSG_REMOTE_SAVE_FAILED); - status.setAttribute(DE.A_SOURCE, "failed"); + status.setAttribute(DE.A_SOURCE, "failed"); //$NON-NLS-1$ _dataStore.refresh(status.getParent()); } } @@ -214,7 +214,7 @@ public class ByteStreamHandler implements IByteStreamHandler } if (status == null) return; - status.setAttribute(DE.A_SOURCE, "success"); + status.setAttribute(DE.A_SOURCE, "success"); //$NON-NLS-1$ _dataStore.refresh(status.getParent()); } catch (IOException e) @@ -223,7 +223,7 @@ public class ByteStreamHandler implements IByteStreamHandler if (status == null) return; status.setAttribute(DE.A_VALUE, FILEMSG_REMOTE_SAVE_FAILED); - status.setAttribute(DE.A_SOURCE, "failed"); + status.setAttribute(DE.A_SOURCE, "failed"); //$NON-NLS-1$ _dataStore.refresh(status.getParent()); } } diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/CommandHandler.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/CommandHandler.java index 1bbf54a93c2..77ecd562019 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/CommandHandler.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/CommandHandler.java @@ -47,7 +47,7 @@ public abstract class CommandHandler extends Handler public CommandHandler() { super(); - setName("DStore CommandHandler"+getName()); + setName("DStore CommandHandler"+getName()); //$NON-NLS-1$ _commands = new ArrayList(); _classesToSend = new ArrayList(); _commandGenerator = new CommandGenerator(); diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DE.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DE.java index 31238091a33..292106d2790 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DE.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DE.java @@ -38,146 +38,146 @@ public class DE /* * The nested data (children) property identifier of a DataElement. */ - public static final String P_CHILDREN = "children"; + public static final String P_CHILDREN = "children"; //$NON-NLS-1$ /* * The image property identifier of a DataElement. This is the same * as the value property identifier */ - public static final String P_LABEL = "label"; + public static final String P_LABEL = "label"; //$NON-NLS-1$ /* * The notifier property identifier of a DataElement. */ - public static final String P_NOTIFIER = "notifier"; + public static final String P_NOTIFIER = "notifier"; //$NON-NLS-1$ /* * The DataStore property identifier of a DataElement. */ - public static final String P_DATASTORE = "dataStore"; + public static final String P_DATASTORE = "dataStore"; //$NON-NLS-1$ /* * The source name property identifier of a DataElement. This is the * name of a source location if one exists. */ - public static final String P_SOURCE_NAME = "source"; + public static final String P_SOURCE_NAME = "source"; //$NON-NLS-1$ /* * The source file property identifier of a DataElement. */ - public static final String P_SOURCE = "sourcefile"; + public static final String P_SOURCE = "sourcefile"; //$NON-NLS-1$ /* * The source location property identifier of a DataElement. */ - public static final String P_SOURCE_LOCATION = "sourcelocation"; + public static final String P_SOURCE_LOCATION = "sourcelocation"; //$NON-NLS-1$ - public static final String P_SOURCE_LOCATION_COLUMN = "sourcelocationcolumn"; + public static final String P_SOURCE_LOCATION_COLUMN = "sourcelocationcolumn"; //$NON-NLS-1$ /* * The nested data (children) property identifier of a DataElement. Same as P_CHILDREN. */ - public static final String P_NESTED = "nested"; + public static final String P_NESTED = "nested"; //$NON-NLS-1$ /* * The buffer property identifier of a DataElement. */ - public static final String P_BUFFER = "buffer"; + public static final String P_BUFFER = "buffer"; //$NON-NLS-1$ /* * The type property identifier of a DataElement. */ - public static final String P_TYPE = "type"; + public static final String P_TYPE = "type"; //$NON-NLS-1$ /* * The id property identifier of a DataElement. */ - public static final String P_ID = "id"; + public static final String P_ID = "id"; //$NON-NLS-1$ /* * The name property identifier of a DataElement. */ - public static final String P_NAME = "name"; + public static final String P_NAME = "name"; //$NON-NLS-1$ /* * The value property identifier of a DataElement. */ - public static final String P_VALUE = "value"; + public static final String P_VALUE = "value"; //$NON-NLS-1$ /* * The is reference? property identifier of a DataElement. Deprecated. Use P_REF_TYPE. */ - public static final String P_ISREF = "isRef"; + public static final String P_ISREF = "isRef"; //$NON-NLS-1$ /* * The is reference? property identifier of a DataElement. */ - public static final String P_REF_TYPE = "refType"; + public static final String P_REF_TYPE = "refType"; //$NON-NLS-1$ /* * The visibility property identifier of a DataElement. */ - public static final String P_DEPTH = "depth"; + public static final String P_DEPTH = "depth"; //$NON-NLS-1$ /* * The attributes property identifier of a DataElement. */ - public static final String P_ATTRIBUTES = "attribute"; + public static final String P_ATTRIBUTES = "attribute"; //$NON-NLS-1$ /* * The file property identifier of a DataElement. */ - public static final String P_FILE = "file"; + public static final String P_FILE = "file"; //$NON-NLS-1$ /* * The file property identifier of a DataElement. */ - public static final String P_DESCRIPTOR = "descriptor"; + public static final String P_DESCRIPTOR = "descriptor"; //$NON-NLS-1$ /* * Reference type. */ - public static final String T_REFERENCE = "reference"; + public static final String T_REFERENCE = "reference"; //$NON-NLS-1$ /* * Command type. */ - public static final String T_COMMAND = "command"; + public static final String T_COMMAND = "command"; //$NON-NLS-1$ /* * UI Command Descriptor type. */ - public static final String T_UI_COMMAND_DESCRIPTOR = "ui_commanddescriptor"; + public static final String T_UI_COMMAND_DESCRIPTOR = "ui_commanddescriptor"; //$NON-NLS-1$ /* * Object Descriptor type. */ - public static final String T_OBJECT_DESCRIPTOR = "objectdescriptor"; + public static final String T_OBJECT_DESCRIPTOR = "objectdescriptor"; //$NON-NLS-1$ /* * Command Descriptor type. */ - public static final String T_COMMAND_DESCRIPTOR = "commanddescriptor"; + public static final String T_COMMAND_DESCRIPTOR = "commanddescriptor"; //$NON-NLS-1$ /* * Relation Descriptor type. */ - public static final String T_RELATION_DESCRIPTOR = "relationdescriptor"; + public static final String T_RELATION_DESCRIPTOR = "relationdescriptor"; //$NON-NLS-1$ /* * Abstract Object Descriptor type. */ - public static final String T_ABSTRACT_OBJECT_DESCRIPTOR = "abstractobjectdescriptor"; + public static final String T_ABSTRACT_OBJECT_DESCRIPTOR = "abstractobjectdescriptor"; //$NON-NLS-1$ /* * Abstract Command Descriptor type. */ - public static final String T_ABSTRACT_COMMAND_DESCRIPTOR = "abstractcommanddescriptor"; + public static final String T_ABSTRACT_COMMAND_DESCRIPTOR = "abstractcommanddescriptor"; //$NON-NLS-1$ /* * Abstract Relation Descriptor type. */ - public static final String T_ABSTRACT_RELATION_DESCRIPTOR = "abstractrelationdescriptor"; + public static final String T_ABSTRACT_RELATION_DESCRIPTOR = "abstractrelationdescriptor"; //$NON-NLS-1$ /* @@ -231,5 +231,5 @@ public class DE */ public static final int A_SIZE = 8; - public static final String ENCODING_UTF_8 = "UTF-8"; + public static final String ENCODING_UTF_8 = "UTF-8"; //$NON-NLS-1$ } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataElement.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataElement.java index 1a25f9466fe..dbe8e422a07 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataElement.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataElement.java @@ -302,7 +302,7 @@ public final class DataElement implements IDataElement String depthStr = getAttribute(DE.A_DEPTH); if (depthStr != null && depthStr.length() > 0) { - if (!depthStr.equals("2")) + if (!depthStr.equals("2")) //$NON-NLS-1$ { try { @@ -902,7 +902,7 @@ public final class DataElement implements IDataElement public void setDepth(int depth) { _depth = depth; - setAttribute(DE.A_DEPTH, "" + _depth); + setAttribute(DE.A_DEPTH, "" + _depth); //$NON-NLS-1$ _isUpdated = false; //_dataStore.refresh(this); } @@ -975,7 +975,7 @@ public final class DataElement implements IDataElement String typeName = type.getName(); if (typeType.equals(DE.T_OBJECT_DESCRIPTOR) || typeType.equals(DE.T_ABSTRACT_OBJECT_DESCRIPTOR)) { - if (descriptor.getName().equals(typeName) || (typeName.equals("all"))) + if (descriptor.getName().equals(typeName) || (typeName.equals("all"))) //$NON-NLS-1$ { result = true; return result; @@ -989,12 +989,13 @@ public final class DataElement implements IDataElement { abstracted = descriptor.getAssociated(relationship); } - - for (int i = 0;(i < abstracted.size()) && !result; i++) + if (abstracted != null) { - DataElement superDescriptor = (DataElement) abstracted.get(i); - - result = superDescriptor.isOfType(type, true); + for (int i = 0;(i < abstracted.size()) && !result; i++) + { + DataElement superDescriptor = (DataElement) abstracted.get(i); + result = superDescriptor.isOfType(type, true); + } } } @@ -1120,7 +1121,7 @@ public final class DataElement implements IDataElement } } } - else if (type.equals("contents")) + else if (type.equals("contents")) //$NON-NLS-1$ { if (nestedObject == object) { @@ -1415,23 +1416,23 @@ public final class DataElement implements IDataElement */ public String toString() { - return "DataElement " - + (_isReference ? "reference" : "") - + "\n{\n\tType:\t" + return "DataElement " //$NON-NLS-1$ + + (_isReference ? "reference" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + "\n{\n\tType:\t" //$NON-NLS-1$ + getType() - + "\n\tName:\t" + + "\n\tName:\t" //$NON-NLS-1$ + getName() - + "\n\tValue:\t" + + "\n\tValue:\t" //$NON-NLS-1$ + getValue() - + "\n\tID:\t" + + "\n\tID:\t" //$NON-NLS-1$ + getId() - + "\n\tSource:\t" + + "\n\tSource:\t" //$NON-NLS-1$ + getSource() - + "\n\tDepth:\t" + + "\n\tDepth:\t" //$NON-NLS-1$ + _depth - + "\n\tDataStore:\t" + + "\n\tDataStore:\t" //$NON-NLS-1$ + _dataStore.getName() - + "\n}\n"; + + "\n}\n"; //$NON-NLS-1$ } /** @@ -1501,7 +1502,7 @@ public final class DataElement implements IDataElement else if (DE.P_SOURCE_NAME.equals(name)) { String source = getAttribute(DE.A_SOURCE); - int locationIndex = source.lastIndexOf(":"); + int locationIndex = source.lastIndexOf(":"); //$NON-NLS-1$ if (locationIndex > 3) { return source.substring(0, locationIndex); @@ -1556,7 +1557,7 @@ public final class DataElement implements IDataElement String depthStr = getAttribute(DE.A_DEPTH); if (depthStr != null && depthStr.length() > 0) { - if (!depthStr.equals("2")) + if (!depthStr.equals("2")) //$NON-NLS-1$ { try { diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataStore.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataStore.java index fdb3b83bfad..de65708753d 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataStore.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataStore.java @@ -134,8 +134,8 @@ public final class DataStore private HashMap _classReqRepository; private File _cacheJar; - public static final String REMOTE_CLASS_CACHE_JARFILE_NAME = "rmt_classloader_cache"; - public static final String JARFILE_EXTENSION = ".jar"; + public static final String REMOTE_CLASS_CACHE_JARFILE_NAME = "rmt_classloader_cache"; //$NON-NLS-1$ + public static final String JARFILE_EXTENSION = ".jar"; //$NON-NLS-1$ private DataElementRemover _deRemover; public static final int SPIRIT_ON_INITIAL_SIZE = 1000; private String referenceTag = null; @@ -232,8 +232,8 @@ public final class DataStore if (isVirtual()) _spiritModeOn = true; else { - String doSpirit = System.getProperty("DSTORE_SPIRIT_ON"); - _spiritModeOn = (doSpirit != null && doSpirit.equals("true")); + String doSpirit = System.getProperty("DSTORE_SPIRIT_ON"); //$NON-NLS-1$ + _spiritModeOn = (doSpirit != null && doSpirit.equals("true")); //$NON-NLS-1$ } } @@ -357,7 +357,7 @@ public final class DataStore if (isVirtual()) { - DataElement location = createObject(_tempRoot, "location", minersLocation); + DataElement location = createObject(_tempRoot, "location", minersLocation); //$NON-NLS-1$ DataElement cmd = findCommandDescriptor(DataStoreSchema.C_ADD_MINERS);//localDescriptorQuery(_root.getDescriptor(), DataStoreSchema.C_ADD_MINERS, 1); ArrayList args = new ArrayList(); args.add(location); @@ -807,12 +807,12 @@ public final class DataStore DataStoreResources.model_root, _dataStoreAttributes.getAttribute(DataStoreAttributes.A_ROOT_NAME), _dataStoreAttributes.getAttribute(DataStoreAttributes.A_ROOT_PATH), - "rootID"); + "rootID"); //$NON-NLS-1$ - _descriptorRoot = createObject(_root, DE.T_OBJECT_DESCRIPTOR, DataStoreResources.model_descriptors, "", "schemaID"); + _descriptorRoot = createObject(_root, DE.T_OBJECT_DESCRIPTOR, DataStoreResources.model_descriptors, "", "schemaID"); //$NON-NLS-1$ //$NON-NLS-2$ - _ticket = createObject(_root, DataStoreResources.model_ticket, "null", "", "ticketID"); + _ticket = createObject(_root, DataStoreResources.model_ticket, "null", "", "ticketID"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ createRoots(); initializeDescriptors(); @@ -1114,7 +1114,7 @@ public final class DataStore */ public DataElement createObject(DataElement parent, DataElement type, String name) { - return createObject(parent, type, name, ""); + return createObject(parent, type, name, ""); //$NON-NLS-1$ } /** @@ -1127,7 +1127,7 @@ public final class DataStore */ public DataElement createObject(DataElement parent, String type, String name) { - return createObject(parent, type, name, ""); + return createObject(parent, type, name, ""); //$NON-NLS-1$ } /** @@ -1333,7 +1333,7 @@ public final class DataStore */ public DataElement createAbstractObjectDescriptor(DataElement parent, String name) { - DataElement descriptor = createObject(parent, DE.T_ABSTRACT_OBJECT_DESCRIPTOR, name, "org.eclipse.rse.dstore.core", name); + DataElement descriptor = createObject(parent, DE.T_ABSTRACT_OBJECT_DESCRIPTOR, name, "org.eclipse.rse.dstore.core", name); //$NON-NLS-1$ _objDescriptorMap.put(name, descriptor); return descriptor; } @@ -1366,11 +1366,11 @@ public final class DataStore DataElement descriptor = null; if (parentDescriptor != null) { - descriptor = createObject(parent, parentDescriptor, name, "org.eclipse.rse.dstore.core", name); + descriptor = createObject(parent, parentDescriptor, name, "org.eclipse.rse.dstore.core", name); //$NON-NLS-1$ } else { - descriptor = createObject(parent, DE.T_OBJECT_DESCRIPTOR, name, "org.eclipse.rse.dstore.core", name); + descriptor = createObject(parent, DE.T_OBJECT_DESCRIPTOR, name, "org.eclipse.rse.dstore.core", name); //$NON-NLS-1$ } _objDescriptorMap.put(name, descriptor); return descriptor; @@ -1409,7 +1409,7 @@ public final class DataStore */ public DataElement createAbstractRelationDescriptor(DataElement parent, String name) { - DataElement descriptor = createObject(parent, DE.T_ABSTRACT_RELATION_DESCRIPTOR, name, "org.eclipse.rse.dstore.core", name); + DataElement descriptor = createObject(parent, DE.T_ABSTRACT_RELATION_DESCRIPTOR, name, "org.eclipse.rse.dstore.core", name); //$NON-NLS-1$ _relDescriptorMap.put(name, descriptor); return descriptor; } @@ -1438,7 +1438,7 @@ public final class DataStore */ public DataElement createRelationDescriptor(DataElement parent, String name) { - DataElement descriptor = createObject(parent, DE.T_RELATION_DESCRIPTOR, name, "org.eclipse.rse.dstore.core", name); + DataElement descriptor = createObject(parent, DE.T_RELATION_DESCRIPTOR, name, "org.eclipse.rse.dstore.core", name); //$NON-NLS-1$ _relDescriptorMap.put(name, descriptor); return descriptor; } @@ -1482,7 +1482,7 @@ public final class DataStore */ public DataElement createAbstractCommandDescriptor(DataElement parent, String name, String value) { - DataElement cmd = createObject(parent, DE.T_ABSTRACT_COMMAND_DESCRIPTOR, name, "org.eclipse.rse.dstore.core", name); + DataElement cmd = createObject(parent, DE.T_ABSTRACT_COMMAND_DESCRIPTOR, name, "org.eclipse.rse.dstore.core", name); //$NON-NLS-1$ cmd.setAttribute(DE.A_VALUE, value); _cmdDescriptorMap.put(value, cmd); return cmd; @@ -1533,11 +1533,11 @@ public final class DataStore DataElement cmd = null; if (parentDescriptor != null) { - cmd = createObject(parent, parentDescriptor, name, "org.eclipse.rse.dstore.core", name); + cmd = createObject(parent, parentDescriptor, name, "org.eclipse.rse.dstore.core", name); //$NON-NLS-1$ } else { - cmd = createObject(parent, DE.T_COMMAND_DESCRIPTOR, name, "org.eclipse.rse.dstore.core", name); + cmd = createObject(parent, DE.T_COMMAND_DESCRIPTOR, name, "org.eclipse.rse.dstore.core", name); //$NON-NLS-1$ } cmd.setAttribute(DE.A_VALUE, value); _cmdDescriptorMap.put(value, cmd); @@ -2049,7 +2049,7 @@ public final class DataStore DataElement cmd = findCommandDescriptor(DataStoreSchema.C_SET_PREFERENCE); if (cmd != null) { - DataElement prefObj = createObject(null, "preference", property); + DataElement prefObj = createObject(null, "preference", property); //$NON-NLS-1$ prefObj.setAttribute(DE.A_VALUE, value); command(cmd, prefObj, true); } @@ -2169,7 +2169,7 @@ public final class DataStore { if (ticketStr == null) { - ticketStr = "null"; + ticketStr = "null"; //$NON-NLS-1$ } return createObject(_tempRoot, DataStoreResources.model_ticket, ticketStr); } @@ -2179,7 +2179,7 @@ public final class DataStore DataElement cmd = findCommandDescriptor(DataStoreSchema.C_VALIDATE_TICKET); DataElement status = _commandHandler.command(cmd, ticket, false); - if (ticket.getName().equals("null")) + if (ticket.getName().equals("null")) //$NON-NLS-1$ { return null; } @@ -2240,7 +2240,7 @@ public final class DataStore startWaiting(status); while ((status != null) - && (_status == null || _status.getName().equals("okay")) + && (_status == null || _status.getName().equals("okay")) //$NON-NLS-1$ && !status.getName().equals(state) && !status.getValue().equals(state) && !status.getName().equals(DataStoreResources.model_incomplete) @@ -2268,7 +2268,8 @@ public final class DataStore if (timedOut) { - status.setAttribute(DE.A_NAME, DataStoreResources.model_timeout); + if (status != null) + status.setAttribute(DE.A_NAME, DataStoreResources.model_timeout); } } @@ -3402,12 +3403,12 @@ public final class DataStore { if (_userPreferencesDirectory == null) { - _userPreferencesDirectory = System.getProperty("user.home"); + _userPreferencesDirectory = System.getProperty("user.home"); //$NON-NLS-1$ - String clientUserID = System.getProperty("client.username"); - if (clientUserID == null || clientUserID.equals("")) + String clientUserID = System.getProperty("client.username"); //$NON-NLS-1$ + if (clientUserID == null || clientUserID.equals("")) //$NON-NLS-1$ { - clientUserID = ""; + clientUserID = ""; //$NON-NLS-1$ } else { @@ -3421,8 +3422,8 @@ public final class DataStore _userPreferencesDirectory = _userPreferencesDirectory + File.separator; } - _userPreferencesDirectory = _userPreferencesDirectory + ".eclipse" + File.separator + - "RSE" + File.separator + clientUserID; + _userPreferencesDirectory = _userPreferencesDirectory + ".eclipse" + File.separator + //$NON-NLS-1$ + "RSE" + File.separator + clientUserID; //$NON-NLS-1$ File dirFile = new File(_userPreferencesDirectory); if (!dirFile.exists()) { dirFile.mkdirs(); @@ -3453,8 +3454,8 @@ public final class DataStore _dataStoreSchema = new DataStoreSchema(this); - String tracingProperty = System.getProperty("DSTORE_TRACING_ON"); - if (tracingProperty != null && tracingProperty.equals("true")) + String tracingProperty = System.getProperty("DSTORE_TRACING_ON"); //$NON-NLS-1$ + if (tracingProperty != null && tracingProperty.equals("true")) //$NON-NLS-1$ { _tracingOn = true; } @@ -3465,11 +3466,11 @@ public final class DataStore if (_tracingOn) { String logDir = getUserPreferencesDirectory(); - _traceFileHandle = new File(logDir, ".dstoreTrace"); + _traceFileHandle = new File(logDir, ".dstoreTrace"); //$NON-NLS-1$ try { - _traceFile = new RandomAccessFile(_traceFileHandle, "rw"); + _traceFile = new RandomAccessFile(_traceFileHandle, "rw"); //$NON-NLS-1$ startTracing(); } catch (IOException e) @@ -3496,17 +3497,17 @@ public final class DataStore { if (!isVirtual() && _deRemover == null) { - String memLogging = System.getProperty("DSTORE_MEMLOGGING_ON"); - _memLoggingOn = (memLogging != null && memLogging.equals("true")); + String memLogging = System.getProperty("DSTORE_MEMLOGGING_ON"); //$NON-NLS-1$ + _memLoggingOn = (memLogging != null && memLogging.equals("true")); //$NON-NLS-1$ if (_memLoggingOn) { String logDir = getUserPreferencesDirectory(); - _memLoggingFileHandle = new File(logDir, ".dstoreMemLogging"); + _memLoggingFileHandle = new File(logDir, ".dstoreMemLogging"); //$NON-NLS-1$ try { - _memLogFile = new RandomAccessFile(_memLoggingFileHandle, "rw"); + _memLogFile = new RandomAccessFile(_memLoggingFileHandle, "rw"); //$NON-NLS-1$ startMemLogging(); } catch (IOException e) @@ -3722,13 +3723,13 @@ public final class DataStore private void createRoots() { - _externalRoot = createObject(_root, DataStoreResources.model_host, "External DataStores", "", "extID"); + _externalRoot = createObject(_root, DataStoreResources.model_host, "External DataStores", "", "extID"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - _tempRoot = createObject(_root, "temp", "Temp Root", "", "tempID"); - _dummy = createObject(_root, "temp", "dummy"); - _logRoot = createObject(_root, DataStoreResources.model_log, DataStoreResources.model_Log_Root, "", "logID"); + _tempRoot = createObject(_root, "temp", "Temp Root", "", "tempID"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + _dummy = createObject(_root, "temp", "dummy"); //$NON-NLS-1$ //$NON-NLS-2$ + _logRoot = createObject(_root, DataStoreResources.model_log, DataStoreResources.model_Log_Root, "", "logID"); //$NON-NLS-1$ //$NON-NLS-2$ - _minerRoot = createObject(_root, DataStoreResources.model_miners, DataStoreResources.model_Tool_Root, "", "minersID"); + _minerRoot = createObject(_root, DataStoreResources.model_miners, DataStoreResources.model_Tool_Root, "", "minersID"); //$NON-NLS-1$ //$NON-NLS-2$ _hostRoot = createObject( @@ -3736,9 +3737,9 @@ public final class DataStore DataStoreResources.model_host, _dataStoreAttributes.getAttribute(DataStoreAttributes.A_HOST_NAME), _dataStoreAttributes.getAttribute(DataStoreAttributes.A_HOST_PATH), - "hostID"); + "hostID"); //$NON-NLS-1$ - _status = createObject(_root, DataStoreResources.model_status, "okay", "", "statusID"); + _status = createObject(_root, DataStoreResources.model_status, "okay", "", "statusID"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } private void deleteObjectHelper(DataElement from, DataElement toDelete, int depth) @@ -3841,8 +3842,8 @@ public final class DataStore { } - trace("-----------------------------------------"); - trace("Start Tracing at " + System.currentTimeMillis()); + trace("-----------------------------------------"); //$NON-NLS-1$ + trace("Start Tracing at " + System.currentTimeMillis()); //$NON-NLS-1$ } } @@ -3858,8 +3859,8 @@ public final class DataStore { } - memLog("-----------------------------------------"); - memLog("Start Memory Logging at " + System.currentTimeMillis()); + memLog("-----------------------------------------"); //$NON-NLS-1$ + memLog("Start Memory Logging at " + System.currentTimeMillis()); //$NON-NLS-1$ } } @@ -3889,9 +3890,9 @@ public final class DataStore for (int i = 0;i 5)) + if (!name.startsWith("#") && (name.length() > 5)) //$NON-NLS-1$ { Miner miner = loadMiner(name); if (miner != null) @@ -254,7 +254,7 @@ public class MinerLoader implements ISchemaRegistry unconnectedMiners.remove(miner); if (connectMiner(miner)) { - _dataStore.trace("connected " + miner.getMinerName()); + _dataStore.trace("connected " + miner.getMinerName()); //$NON-NLS-1$ } else { @@ -317,7 +317,7 @@ public class MinerLoader implements ISchemaRegistry { if (_externalRemoteLoader == null) { - _externalRemoteLoader = new ExternalLoader(getRemoteLoader(), "*"); + _externalRemoteLoader = new ExternalLoader(getRemoteLoader(), "*"); //$NON-NLS-1$ } return _externalRemoteLoader; } diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/Server.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/Server.java index 50bcbcd56b4..a522f62face 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/Server.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/Server.java @@ -40,9 +40,9 @@ public class Server //Tell the Launcher that we are starting System.err.println(ServerReturnCodes.RC_DSTORE_SERVER_MAGIC); - String jversion = System.getProperty("java.version"); + String jversion = System.getProperty("java.version"); //$NON-NLS-1$ - StringTokenizer tokenizer = new StringTokenizer(jversion, "."); + StringTokenizer tokenizer = new StringTokenizer(jversion, "."); //$NON-NLS-1$ try { String[] vers = new String[3]; diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerAttributes.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerAttributes.java index 84af717ca5c..301aa9f273c 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerAttributes.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerAttributes.java @@ -38,7 +38,7 @@ public class ServerAttributes extends DataStoreAttributes try { - String pluginPath = System.getProperty("A_PLUGIN_PATH"); + String pluginPath = System.getProperty("A_PLUGIN_PATH"); //$NON-NLS-1$ if (pluginPath != null) pluginPath = pluginPath.trim(); if ((pluginPath != null) && (pluginPath.length() > 0)) { @@ -56,13 +56,13 @@ public class ServerAttributes extends DataStoreAttributes } else { - setAttribute(A_PLUGIN_PATH, "/home/"); + setAttribute(A_PLUGIN_PATH, "/home/"); //$NON-NLS-1$ } setAttribute(A_LOCAL_NAME, InetAddress.getLocalHost().getHostName()); - setAttribute(A_HOST_NAME, "server_host"); - setAttribute(A_HOST_PATH, "/home/"); + setAttribute(A_HOST_NAME, "server_host"); //$NON-NLS-1$ + setAttribute(A_HOST_PATH, "/home/"); //$NON-NLS-1$ } catch (UnknownHostException e) { diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerCommandHandler.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerCommandHandler.java index 77d28c49e84..27c25afb271 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerCommandHandler.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerCommandHandler.java @@ -213,7 +213,7 @@ public class ServerCommandHandler extends CommandHandler DataElement host = _dataStore.getHostRoot(); _dataStore.getHashMap().remove(host.getId()); - host.setAttribute(DE.A_ID, "host." + serverTicket.getName()); + host.setAttribute(DE.A_ID, "host." + serverTicket.getName()); //$NON-NLS-1$ _dataStore.getHashMap().put(host.getId(), host); _dataStore.update(host); @@ -312,9 +312,9 @@ public class ServerCommandHandler extends CommandHandler { DataElement element = (DataElement)lastCreated.get(i); statsBuffer.append(element.getName()); - statsBuffer.append(":"); - statsBuffer.append("id="+element.getId()); - statsBuffer.append(";"); + statsBuffer.append(":"); //$NON-NLS-1$ + statsBuffer.append("id="+element.getId()); //$NON-NLS-1$ + statsBuffer.append(";"); //$NON-NLS-1$ } @@ -346,7 +346,7 @@ public class ServerCommandHandler extends CommandHandler { Miner miner = (Miner) miners.get(j); - if (commandSource.equals("*") || commandSource.equals(miner.getClass().getName())) + if (commandSource.equals("*") || commandSource.equals(miner.getClass().getName())) //$NON-NLS-1$ { if (_dataStore.isAutoRefreshOn()) { @@ -404,7 +404,7 @@ public class ServerCommandHandler extends CommandHandler */ public void sendFile(String fileName, byte[] bytes, int size, boolean binary) { - sendFile(fileName, bytes, size, binary, "default"); + sendFile(fileName, bytes, size, binary, "default"); //$NON-NLS-1$ } /** @@ -429,7 +429,7 @@ public class ServerCommandHandler extends CommandHandler */ public void sendAppendFile(String fileName, byte[] bytes, int size, boolean binary) { - sendAppendFile(fileName, bytes, size, binary, "default"); + sendAppendFile(fileName, bytes, size, binary, "default"); //$NON-NLS-1$ } /** @@ -452,7 +452,7 @@ public class ServerCommandHandler extends CommandHandler */ public synchronized void sendClass(String className) { - sendClass(className, "default"); + sendClass(className, "default"); //$NON-NLS-1$ } /** diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerLauncher.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerLauncher.java index 5e3cb91dc95..0011900c781 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerLauncher.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerLauncher.java @@ -303,6 +303,7 @@ public class ServerLauncher extends Thread { { "java", //$NON-NLS-1$ "-DA_PLUGIN_PATH=" + _path, //$NON-NLS-1$ + "-DDSTORE_SPIRIT_ON=true", //$NON-NLS-1$ "org.eclipse.dstore.core.server.Server", //$NON-NLS-1$ _port, timeout, @@ -415,12 +416,14 @@ public class ServerLauncher extends Thread { System.out.println("A_PLUGIN_PATH is not defined"); //$NON-NLS-1$ System.exit(-1); } + else + { + _path = pluginPath.trim(); - _path = pluginPath.trim(); + _connections = new ArrayList(); - _connections = new ArrayList(); - - init(DEFAULT_DAEMON_PORT + ""); //$NON-NLS-1$ + init(DEFAULT_DAEMON_PORT + ""); //$NON-NLS-1$ + } } /** @@ -435,11 +438,13 @@ public class ServerLauncher extends Thread { System.out.println("A_PLUGIN_PATH is not defined"); //$NON-NLS-1$ System.exit(-1); } + else + { + _path = pluginPath.trim(); - _path = pluginPath.trim(); - - _connections = new ArrayList(); - init(portStr); + _connections = new ArrayList(); + init(portStr); + } } /** @@ -456,12 +461,14 @@ public class ServerLauncher extends Thread { System.out.println("A_PLUGIN_PATH is not defined"); //$NON-NLS-1$ System.exit(-1); } + else + { + _path = pluginPath.trim(); - _path = pluginPath.trim(); - - _serverPortRange = serverPortRange; - _connections = new ArrayList(); - init(portStr); + _serverPortRange = serverPortRange; + _connections = new ArrayList(); + init(portStr); + } } private String getKeyStoreLocation() { @@ -522,14 +529,14 @@ public class ServerLauncher extends Thread { } } catch (UnknownHostException e) { System.err - .println("Networking problem, can't resolve local host"); + .println("Networking problem, can't resolve local host"); //$NON-NLS-1$ e.printStackTrace(); System.exit(-1); } catch (BindException e) { System.err.println("socket taken on " + i); //$NON-NLS-1$ // keep going } catch (IOException e) { - System.err.println("Failure to create ServerSocket"); + System.err.println("Failure to create ServerSocket"); //$NON-NLS-1$ e.printStackTrace(); System.exit(-1); } @@ -560,11 +567,11 @@ public class ServerLauncher extends Thread { + port); } catch (UnknownHostException e) { System.err - .println("Networking problem, can't resolve local host"); + .println("Networking problem, can't resolve local host"); //$NON-NLS-1$ e.printStackTrace(); System.exit(-1); } catch (IOException e) { - System.err.println("Failure to create ServerSocket"); + System.err.println("Failure to create ServerSocket"); //$NON-NLS-1$ e.printStackTrace(); System.exit(-1); } @@ -625,7 +632,7 @@ public class ServerLauncher extends Thread { _connections.add(listener); } } catch (IOException ioe) { - System.err.println("Server: error initializing socket: " + ioe); + System.err.println("Server: error initializing socket: " + ioe); //$NON-NLS-1$ System.exit(-1); } } diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerReceiver.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerReceiver.java index 0cae6440f37..9cd802c1a3d 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerReceiver.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerReceiver.java @@ -59,7 +59,7 @@ public class ServerReceiver extends Receiver DataElement log = _dataStore.getLogRoot(); log.addNestedData(rootOutput, false); - if (rootOutput.getName().equals("C_EXIT")) + if (rootOutput.getName().equals("C_EXIT")) //$NON-NLS-1$ { finish(); @@ -82,7 +82,7 @@ public class ServerReceiver extends Receiver */ public void handleError(Throwable e) { - System.out.println("RECEIVER ERROR"); + System.out.println("RECEIVER ERROR"); //$NON-NLS-1$ // e.printStackTrace(); System.out.println(e); _connection.finished(this); diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerReturnCodes.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerReturnCodes.java index 8b4b6c4bcde..854928732cb 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerReturnCodes.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerReturnCodes.java @@ -24,16 +24,16 @@ public class ServerReturnCodes { public static final String RC_DSTORE_SERVER_MAGIC = "Dstore Server Starting..."; //$NON-NLS-1$ - public static final String RC_SUCCESS = "Server Started Successfully"; + public static final String RC_SUCCESS = "Server Started Successfully"; //$NON-NLS-1$ - public static final String RC_UNKNOWN_HOST_ERROR = "Unknown host error"; - public static final String RC_BIND_ERROR = "Error binding socket"; - public static final String RC_GENERAL_IO_ERROR = "General IO error creating socket"; - public static final String RC_CONNECTION_ERROR = "Connection error"; + public static final String RC_UNKNOWN_HOST_ERROR = "Unknown host error"; //$NON-NLS-1$ + public static final String RC_BIND_ERROR = "Error binding socket"; //$NON-NLS-1$ + public static final String RC_GENERAL_IO_ERROR = "General IO error creating socket"; //$NON-NLS-1$ + public static final String RC_CONNECTION_ERROR = "Connection error"; //$NON-NLS-1$ - public static final String RC_SECURITY_ERROR = "Security error creating socket"; + public static final String RC_SECURITY_ERROR = "Security error creating socket"; //$NON-NLS-1$ - public static final String RC_FINISHED = "Server Finished"; + public static final String RC_FINISHED = "Server Finished"; //$NON-NLS-1$ - public static final String RC_JRE_VERSION_ERROR = "JRE 1.4 or higher required"; + public static final String RC_JRE_VERSION_ERROR = "JRE 1.4 or higher required"; //$NON-NLS-1$ } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerSSLProperties.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerSSLProperties.java index c05f20a411a..29bf607b1f6 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerSSLProperties.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerSSLProperties.java @@ -33,27 +33,27 @@ public class ServerSSLProperties implements ISSLProperties private String _serverKeyStorePassword; - private static final String ENABLE_SSL = "enable_ssl"; - private static final String DISABLE_SERVER_SSL = "disable_server_ssl"; + private static final String ENABLE_SSL = "enable_ssl"; //$NON-NLS-1$ + private static final String DISABLE_SERVER_SSL = "disable_server_ssl"; //$NON-NLS-1$ - private static final String DAEMON_KEYSTORE_FILE = "daemon_keystore_file"; - private static final String DAEMON_KEYSTORE_PASSWORD = "daemon_keystore_password"; + private static final String DAEMON_KEYSTORE_FILE = "daemon_keystore_file"; //$NON-NLS-1$ + private static final String DAEMON_KEYSTORE_PASSWORD = "daemon_keystore_password"; //$NON-NLS-1$ - private static final String SERVER_KEYSTORE_FILE = "server_keystore_file"; - private static final String SERVER_KEYSTORE_PASSWORD = "server_keystore_password"; + private static final String SERVER_KEYSTORE_FILE = "server_keystore_file"; //$NON-NLS-1$ + private static final String SERVER_KEYSTORE_PASSWORD = "server_keystore_password"; //$NON-NLS-1$ public ServerSSLProperties() { try { - ResourceBundle properties = ResourceBundle.getBundle("ssl"); - _enableSSL = properties.getString(ENABLE_SSL).trim().equals("true"); + ResourceBundle properties = ResourceBundle.getBundle("ssl"); //$NON-NLS-1$ + _enableSSL = properties.getString(ENABLE_SSL).trim().equals("true"); //$NON-NLS-1$ if (_enableSSL) { try { - _disableServerSSL = properties.getString(DISABLE_SERVER_SSL).trim().equals("true"); + _disableServerSSL = properties.getString(DISABLE_SERVER_SSL).trim().equals("true"); //$NON-NLS-1$ } catch (Exception e) { @@ -96,13 +96,13 @@ public class ServerSSLProperties implements ISSLProperties if (_enableSSL) { - System.out.println("SSL Settings"); - System.out.println("[daemon keystore:\t"+_daemonKeyStorePath+"]"); - System.out.println("[daemon keystore pw:\t"+_daemonKeyStorePassword+"]"); + System.out.println("SSL Settings"); //$NON-NLS-1$ + System.out.println("[daemon keystore:\t"+_daemonKeyStorePath+"]"); //$NON-NLS-1$ //$NON-NLS-2$ + System.out.println("[daemon keystore pw:\t"+_daemonKeyStorePassword+"]"); //$NON-NLS-1$ //$NON-NLS-2$ if (!_disableServerSSL) { - System.out.println("[server keystore:\t"+_serverKeyStorePath+"]"); - System.out.println("[server keystore pw:\t"+_serverKeyStorePassword+"]"); + System.out.println("[server keystore:\t"+_serverKeyStorePath+"]"); //$NON-NLS-1$ //$NON-NLS-2$ + System.out.println("[server keystore pw:\t"+_serverKeyStorePassword+"]"); //$NON-NLS-1$ //$NON-NLS-2$ } } } diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerUpdateHandler.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerUpdateHandler.java index 8ec2a8246c0..9d563ce77f1 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerUpdateHandler.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerUpdateHandler.java @@ -46,73 +46,73 @@ public class ServerUpdateHandler extends UpdateHandler private static String[] _keepAliveAttributes = { DataStoreResources.KEEPALIVE_TYPE, - "server.keepalive.root.id", - "server.keepalive", - "doc", - "", - "", + "server.keepalive.root.id", //$NON-NLS-1$ + "server.keepalive", //$NON-NLS-1$ + "doc", //$NON-NLS-1$ + "", //$NON-NLS-1$ + "", //$NON-NLS-1$ DataStoreResources.FALSE, - "2"}; + "2"}; //$NON-NLS-1$ private static String[] _confirmKeepAliveAttributes = { DataStoreResources.KEEPALIVECONFIRM_TYPE, - "server.keepalive.confirm.root.id", - "server.confirmkeepalive", - "doc", - "", - "", + "server.keepalive.confirm.root.id", //$NON-NLS-1$ + "server.confirmkeepalive", //$NON-NLS-1$ + "doc", //$NON-NLS-1$ + "", //$NON-NLS-1$ + "", //$NON-NLS-1$ DataStoreResources.FALSE, - "2"}; + "2"}; //$NON-NLS-1$ private static String[] _docAttributes = { DataStoreResources.DOCUMENT_TYPE, - "server.doc.root.id", - "server.document", - "doc", - "", - "", + "server.doc.root.id", //$NON-NLS-1$ + "server.document", //$NON-NLS-1$ + "doc", //$NON-NLS-1$ + "", //$NON-NLS-1$ + "", //$NON-NLS-1$ DataStoreResources.FALSE, - "2"}; + "2"}; //$NON-NLS-1$ private static String[] _fileAttributes = { DataStoreResources.FILE_TYPE, - "server.file.root.id", - "server.file", - "doc", - "", - "", + "server.file.root.id", //$NON-NLS-1$ + "server.file", //$NON-NLS-1$ + "doc", //$NON-NLS-1$ + "", //$NON-NLS-1$ + "", //$NON-NLS-1$ DataStoreResources.FALSE, - "2"}; + "2"}; //$NON-NLS-1$ private static String[] _classAttributes = { DataStoreResources.CLASS_TYPE, - "server.class.root.id", - "server.class", - "doc", - "", - "", + "server.class.root.id", //$NON-NLS-1$ + "server.class", //$NON-NLS-1$ + "doc", //$NON-NLS-1$ + "", //$NON-NLS-1$ + "", //$NON-NLS-1$ DataStoreResources.FALSE, - "2"}; + "2"}; //$NON-NLS-1$ private static String[] _requestClassAttributes = { DataStoreResources.REQUEST_CLASS_TYPE, - "server.requestclass.root.id", - "server.requestclass", - "doc", - "", - "", + "server.requestclass.root.id", //$NON-NLS-1$ + "server.requestclass", //$NON-NLS-1$ + "doc", //$NON-NLS-1$ + "", //$NON-NLS-1$ + "", //$NON-NLS-1$ DataStoreResources.FALSE, - "2"}; + "2"}; //$NON-NLS-1$ private static String[] _serializeAttributes = { DataStoreResources.SERIALIZED_TYPE, - "server.serialized.root.id", - "server.serialized", - "doc", - "", - "", + "server.serialized.root.id", //$NON-NLS-1$ + "server.serialized", //$NON-NLS-1$ + "doc", //$NON-NLS-1$ + "", //$NON-NLS-1$ + "", //$NON-NLS-1$ DataStoreResources.FALSE, - "2"}; + "2"}; //$NON-NLS-1$ protected DataElement _fileDocumentElement; protected DataElement _docDocumentElement; @@ -276,7 +276,7 @@ public class ServerUpdateHandler extends UpdateHandler document.setUpdated(true); document.setParent(null); - DataElement response = _commandGenerator.generateResponse(document, _dataObjects); + _commandGenerator.generateResponse(document, _dataObjects); for (int j = 0; j < _senders.size(); j++) { @@ -337,7 +337,7 @@ public class ServerUpdateHandler extends UpdateHandler if (sender.socket() == socket) { // sender sends last ack before death - DataElement document = _dataStore.createObject(null, DataStoreResources.DOCUMENT_TYPE, "exit", "exit"); + DataElement document = _dataStore.createObject(null, DataStoreResources.DOCUMENT_TYPE, "exit", "exit"); //$NON-NLS-1$ //$NON-NLS-2$ sender.sendDocument(document, 2); removeSender(sender); } @@ -427,15 +427,15 @@ public class ServerUpdateHandler extends UpdateHandler */ public synchronized void sendClass(String className) { - sendClass(className, "default"); + sendClass(className, "default"); //$NON-NLS-1$ } public void sendKeepAliveRequest() { DataElement document = _keepAliveDocumentElement; document.setPendingTransfer(true); - document.setAttribute(DE.A_NAME, "request"); - document.setAttribute(DE.A_VALUE, "request"); + document.setAttribute(DE.A_NAME, "request"); //$NON-NLS-1$ + document.setAttribute(DE.A_VALUE, "request"); //$NON-NLS-1$ document.setParent(null); _pendingKeepAliveRequest = document; notifyInput(); @@ -445,8 +445,8 @@ public class ServerUpdateHandler extends UpdateHandler { DataElement document = _confirmKeepAliveDocumentElement; document.setPendingTransfer(true); - document.setAttribute(DE.A_NAME, "confirm"); - document.setAttribute(DE.A_VALUE, "confirm"); + document.setAttribute(DE.A_NAME, "confirm"); //$NON-NLS-1$ + document.setAttribute(DE.A_VALUE, "confirm"); //$NON-NLS-1$ document.setParent(null); _pendingKeepAliveConfirmation = document; notifyInput(); diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/CommandGenerator.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/CommandGenerator.java index 73cb06809f4..9d29f351194 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/CommandGenerator.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/CommandGenerator.java @@ -62,25 +62,17 @@ public class CommandGenerator public DataElement logCommand(DataElement commandObject) { try - { - // prevent duplicate queries - String name = commandObject.getAttribute(DE.A_NAME); - + { // create time and status objects - DataElement status = null; - - if (status == null) - { - StringBuffer id = new StringBuffer(commandObject.getId()); - id.append(DataStoreResources.model_status); - status = - _dataStore.createObject( - commandObject, - DataStoreResources.model_status, - DataStoreResources.model_start, - "", - id.toString()); - } + StringBuffer id = new StringBuffer(commandObject.getId()); + id.append(DataStoreResources.model_status); + _dataStore.createObject( + commandObject, + DataStoreResources.model_status, + DataStoreResources.model_start, + "", //$NON-NLS-1$ + id.toString()); + _log.addNestedData(commandObject, false); } @@ -109,7 +101,7 @@ public class CommandGenerator } else { - System.out.println("not cd -> " + commandDescriptor); + System.out.println("not cd -> " + commandDescriptor); //$NON-NLS-1$ return null; } } @@ -147,7 +139,6 @@ public class CommandGenerator if (commandObject != null) { clearDeleted(dataObject); - DataElement tempRoot = _dataStore.getTempRoot(); commandObject.setAttribute(DE.A_VALUE, commandDescriptor.getName()); @@ -174,7 +165,7 @@ public class CommandGenerator } else { - _dataStore.createReference(commandObject, arg, "argument"); + _dataStore.createReference(commandObject, arg, "argument"); //$NON-NLS-1$ } } } @@ -205,7 +196,6 @@ public class CommandGenerator DataElement commandObject = createCommand(commandDescriptor); if (commandObject != null) { - DataElement tempRoot = _dataStore.getTempRoot(); commandObject.setAttribute(DE.A_VALUE, commandDescriptor.getName()); clearDeleted(dataObject); if ((refArg || dataObject.isUpdated()) && !dataObject.isSpirit()) @@ -224,7 +214,7 @@ public class CommandGenerator } else { - _dataStore.createReference(commandObject, arg, "argument"); + _dataStore.createReference(commandObject, arg, "argument"); //$NON-NLS-1$ } @@ -296,7 +286,7 @@ public class CommandGenerator { if (dataObject != null) { - DataElement commandObject = _dataStore.createObject(null, "RESPONSE", responseType); + DataElement commandObject = _dataStore.createObject(null, "RESPONSE", responseType); //$NON-NLS-1$ commandObject.addNestedData(dataObject, true); return commandObject; } @@ -314,7 +304,7 @@ public class CommandGenerator */ public DataElement generateResponse(String responseType) { - DataElement commandObject = _dataStore.createObject(null, "RESPONSE", responseType); + DataElement commandObject = _dataStore.createObject(null, "RESPONSE", responseType); //$NON-NLS-1$ return commandObject; } } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/DataElementRemover.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/DataElementRemover.java index 2b45af6a542..23d0e65678b 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/DataElementRemover.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/DataElementRemover.java @@ -39,8 +39,8 @@ public class DataElementRemover extends Handler public static final int DEFAULT_INTERVAL_TIME = 60; // in seconds private int _intervalTime = DEFAULT_INTERVAL_TIME * 1000; private int _expiryTime = DEFAULT_EXPIRY_TIME * 1000; - public static final String EXPIRY_TIME_PROPERTY_NAME = "SPIRIT_EXPIRY_TIME"; - public static final String INTERVAL_TIME_PROPERTY_NAME = "SPIRIT_INTERVAL_TIME"; + public static final String EXPIRY_TIME_PROPERTY_NAME = "SPIRIT_EXPIRY_TIME"; //$NON-NLS-1$ + public static final String INTERVAL_TIME_PROPERTY_NAME = "SPIRIT_INTERVAL_TIME"; //$NON-NLS-1$ public DataElementRemover(DataStore dataStore) { @@ -50,7 +50,7 @@ public class DataElementRemover extends Handler getTimes(); setWaitTime(_intervalTime); DataElement spiritnode = _dataStore.createObjectDescriptor(_dataStore.getDescriptorRoot(), IDataStoreConstants.DATASTORE_SPIRIT_DESCRIPTOR); - _dataStore.createCommandDescriptor(spiritnode, "StartSpirit", "DataElementRemover", IDataStoreConstants.C_START_SPIRIT); + _dataStore.createCommandDescriptor(spiritnode, "StartSpirit", "DataElementRemover", IDataStoreConstants.C_START_SPIRIT); //$NON-NLS-1$ //$NON-NLS-2$ _dataStore.refresh(_dataStore.getDescriptorRoot()); } @@ -59,21 +59,21 @@ public class DataElementRemover extends Handler try { String expiryTime = System.getProperty(EXPIRY_TIME_PROPERTY_NAME); - if (expiryTime != null && !expiryTime.equals("")) _expiryTime = Integer.parseInt(expiryTime) * 1000; + if (expiryTime != null && !expiryTime.equals("")) _expiryTime = Integer.parseInt(expiryTime) * 1000; //$NON-NLS-1$ } catch (Exception e) { - System.out.println("Invalid spirit expiry time property, using default."); + System.out.println("Invalid spirit expiry time property, using default."); //$NON-NLS-1$ _expiryTime = DEFAULT_EXPIRY_TIME; } try { String intervalTime = System.getProperty(INTERVAL_TIME_PROPERTY_NAME); - if (intervalTime != null && !intervalTime.equals("")) _intervalTime = Integer.parseInt(intervalTime) * 1000; + if (intervalTime != null && !intervalTime.equals("")) _intervalTime = Integer.parseInt(intervalTime) * 1000; //$NON-NLS-1$ } catch (Exception e) { - System.out.println("Invalid spirit interval time property, using default."); + System.out.println("Invalid spirit interval time property, using default."); //$NON-NLS-1$ _intervalTime = DEFAULT_INTERVAL_TIME; } } @@ -114,25 +114,25 @@ public class DataElementRemover extends Handler { synchronized (_queue) { - _dataStore.memLog(" "); + _dataStore.memLog(" "); //$NON-NLS-1$ int disconnected = 0; if (!_dataStore.isDoSpirit()) { if (_queue.size() > 0) { - _dataStore.memLog("Clearing queue of size " + _queue.size() + ". DSTORE_SPIRIT_ON not set or set to false."); + _dataStore.memLog("Clearing queue of size " + _queue.size() + ". DSTORE_SPIRIT_ON not set or set to false."); //$NON-NLS-1$ //$NON-NLS-2$ _queue.clear(); } - _dataStore.memLog("Total heap size: " + Runtime.getRuntime().totalMemory()); - _dataStore.memLog("Elements created so far: " + numCreated); - _dataStore.memLog("Elements disconnected so far: " + numDisconnected); - _dataStore.memLog("Spirit elements cleaned so far: " + numRemoved); - _dataStore.memLog("DataElements GCed so far: " + numGCed); + _dataStore.memLog("Total heap size: " + Runtime.getRuntime().totalMemory()); //$NON-NLS-1$ + _dataStore.memLog("Elements created so far: " + numCreated); //$NON-NLS-1$ + _dataStore.memLog("Elements disconnected so far: " + numDisconnected); //$NON-NLS-1$ + _dataStore.memLog("Spirit elements cleaned so far: " + numRemoved); //$NON-NLS-1$ + _dataStore.memLog("DataElements GCed so far: " + numGCed); //$NON-NLS-1$ return; } - _dataStore.memLog("Total heap size before disconnection: " + Runtime.getRuntime().totalMemory()); + _dataStore.memLog("Total heap size before disconnection: " + Runtime.getRuntime().totalMemory()); //$NON-NLS-1$ - _dataStore.memLog("Size of queue: " + _queue.size()); + _dataStore.memLog("Size of queue: " + _queue.size()); //$NON-NLS-1$ while (_queue.size() > 0 && System.currentTimeMillis() - ((QueueItem) _queue.getFirst()).timeStamp > _expiryTime) { @@ -150,11 +150,11 @@ public class DataElementRemover extends Handler } _dataStore.getHashMap().remove(toBeDisconnected.getId()); } - _dataStore.memLog("Disconnected " + disconnected + " DataElements."); - _dataStore.memLog("Elements created so far: " + numCreated); - _dataStore.memLog("Elements disconnected so far: " + numDisconnected); - _dataStore.memLog("Spirit elements cleaned so far: " + numRemoved); - _dataStore.memLog("DataElements GCed so far: " + numGCed); + _dataStore.memLog("Disconnected " + disconnected + " DataElements."); //$NON-NLS-1$ //$NON-NLS-2$ + _dataStore.memLog("Elements created so far: " + numCreated); //$NON-NLS-1$ + _dataStore.memLog("Elements disconnected so far: " + numDisconnected); //$NON-NLS-1$ + _dataStore.memLog("Spirit elements cleaned so far: " + numRemoved); //$NON-NLS-1$ + _dataStore.memLog("DataElements GCed so far: " + numGCed); //$NON-NLS-1$ } } diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/Pattern.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/Pattern.java index 0e5b38ae00c..d963f0e351f 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/Pattern.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/Pattern.java @@ -67,7 +67,7 @@ public class Pattern } else { - return new String("null"); + return new String("null"); //$NON-NLS-1$ } } @@ -78,7 +78,7 @@ public class Pattern */ public boolean matches(String compareStr) { - String currentMatch = new String(""); + String currentMatch = new String(""); //$NON-NLS-1$ _subMatches = new ArrayList(); int iText = 0; @@ -97,7 +97,7 @@ public class Pattern { _subMatches.add(new String(currentMatch)); } - currentMatch = new String(""); + currentMatch = new String(""); //$NON-NLS-1$ if (iPattern >= patternLen) { diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/Receiver.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/Receiver.java index f4120a6083e..0acf47b5a27 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/Receiver.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/Receiver.java @@ -48,7 +48,7 @@ public abstract class Receiver extends Thread */ public Receiver(Socket socket, DataStore dataStore) { - setName("DStore Receiver"+getName()); + setName("DStore Receiver"+getName()); //$NON-NLS-1$ _socket = socket; _dataStore = dataStore; _canExit = false; @@ -118,7 +118,7 @@ public abstract class Receiver extends Thread if (rootObject != null) { String type = rootObject.getType(); - if (!type.equals("FILE")) + if (!type.equals("FILE")) //$NON-NLS-1$ { handleDocument(rootObject); diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/Sender.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/Sender.java index 87b4287a54c..3229c9114c0 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/Sender.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/Sender.java @@ -170,7 +170,7 @@ public class Sender implements ISender InputStream classInStream = null; className = className.replace('.', '/'); - className = className + ".class"; + className = className + ".class"; //$NON-NLS-1$ URL classLocation = null; for (int i = 0; i < loaders.size(); i++) { @@ -189,11 +189,7 @@ public class Sender implements ISender // got a stream to read the classfile. Now read the class into a buffer. BufferedInputStream bufInputStream = new BufferedInputStream(classInStream); - if (bufInputStream == null) - { - generateEmptyClass(classElement); - return; // throw new IOException("BufferedInputStream could not be instantiated on " + className); - } + try { int classSize = bufInputStream.available(); diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/StringCompare.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/StringCompare.java index 25f9b5e6050..0a6876d4bfb 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/StringCompare.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/StringCompare.java @@ -48,8 +48,6 @@ public class StringCompare compareStr = compareStr.toUpperCase(); } - String currentMatch = new String(""); - int iText = 0; int iPattern = 0; int lastStar = 0; diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/XMLgenerator.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/XMLgenerator.java index da59e1e8bea..6e240c99063 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/XMLgenerator.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/XMLgenerator.java @@ -234,7 +234,7 @@ public class XMLgenerator { if (top == name) { - append("/>"); + append("/>"); //$NON-NLS-1$ if (_tagStack.empty()) { _state = CLOSE; @@ -252,7 +252,7 @@ public class XMLgenerator nextLine(); _indent--; indent(); - append("'); if (_tagStack.empty()) @@ -276,7 +276,7 @@ public class XMLgenerator append(' '); append(name); - append("=\""); + append("=\""); //$NON-NLS-1$ append(niceValue); append('"'); } @@ -284,7 +284,7 @@ public class XMLgenerator { append(' '); append(name); - append("=\"\""); + append("=\"\""); //$NON-NLS-1$ } } @@ -368,18 +368,18 @@ public class XMLgenerator { nextLine(); indent(); - append(""); + append(""); //$NON-NLS-1$ nextLine(); indent(); append(text.toString()); nextLine(); indent(); - append(""); + append(""); //$NON-NLS-1$ } } else { - append(""); + append(""); //$NON-NLS-1$ } } else if (_state == EMPTY) @@ -504,11 +504,11 @@ public class XMLgenerator String tagType = XMLparser.STR_FILE; if (isAppend) { - tagType += ".Append"; + tagType += ".Append"; //$NON-NLS-1$ } if (binary) { - tagType += ".Binary"; + tagType += ".Binary"; //$NON-NLS-1$ } if (object != null) @@ -523,7 +523,7 @@ public class XMLgenerator addReferenceTypeAttribute(object); - addAttribute(DE.P_DEPTH, "" + size); + addAttribute(DE.P_DEPTH, "" + size); //$NON-NLS-1$ addFile(bytes, size, binary); endTag(tagType); @@ -553,7 +553,7 @@ public class XMLgenerator addReferenceTypeAttribute(object); - addAttribute(DE.P_DEPTH, "" + size); + addAttribute(DE.P_DEPTH, "" + size); //$NON-NLS-1$ addFile(bytes, size, true); endTag(tagType); @@ -594,7 +594,7 @@ public class XMLgenerator addReferenceTypeAttribute(object); - addAttribute(DE.P_DEPTH, "" + object.depth()); + addAttribute(DE.P_DEPTH, "" + object.depth()); //$NON-NLS-1$ addData(object.getBuffer()); object.setUpdated(true); @@ -659,7 +659,7 @@ public class XMLgenerator int size = pin.available(); byte[] bytes = new byte[size]; int nRead = pin.read(bytes, 0, size); - addAttribute(DE.P_DEPTH, "" + nRead); + addAttribute(DE.P_DEPTH, "" + nRead); //$NON-NLS-1$ addFile(bytes, nRead, true); outStream.close(); diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/XMLparser.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/XMLparser.java index 431bc1b1f6b..72cfb7d7ee5 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/XMLparser.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/XMLparser.java @@ -81,27 +81,27 @@ public class XMLparser private KeepAliveRequestThread _kart = null; private KeepAliveRequestThread _initialKart = null; - public static String STR_DATAELEMENT = "DataElement"; + public static String STR_DATAELEMENT = "DataElement"; //$NON-NLS-1$ - public static String STR_BUFFER_START = ""; - public static String STR_BUFFER_END = ""; - public static String STR_BUFFER = "Buffer"; + public static String STR_BUFFER_START = ""; //$NON-NLS-1$ + public static String STR_BUFFER_END = ""; //$NON-NLS-1$ + public static String STR_BUFFER = "Buffer"; //$NON-NLS-1$ - public static String STR_STATUS = "status"; - public static String STR_STATUS_DONE = "done"; - public static String STR_STATUS_ALMOST_DONE = "almost done"; + public static String STR_STATUS = "status"; //$NON-NLS-1$ + public static String STR_STATUS_DONE = "done"; //$NON-NLS-1$ + public static String STR_STATUS_ALMOST_DONE = "almost done"; //$NON-NLS-1$ - public static String STR_FILE = "File"; - public static String STR_CLASS = "Class"; - public static String STR_REQUEST_CLASS= "RequestClass"; - public static String STR_SERIALIZED = "Serialized"; + public static String STR_FILE = "File"; //$NON-NLS-1$ + public static String STR_CLASS = "Class"; //$NON-NLS-1$ + public static String STR_REQUEST_CLASS= "RequestClass"; //$NON-NLS-1$ + public static String STR_SERIALIZED = "Serialized"; //$NON-NLS-1$ - public static String STR_AMP = "&"; - public static String STR_QUOTE = """; - public static String STR_APOS = "'"; - public static String STR_LT = "<"; - public static String STR_GT = ">"; - public static String STR_SEMI = ";"; + public static String STR_AMP = "&"; //$NON-NLS-1$ + public static String STR_QUOTE = """; //$NON-NLS-1$ + public static String STR_APOS = "'"; //$NON-NLS-1$ + public static String STR_LT = "<"; //$NON-NLS-1$ + public static String STR_GT = ">"; //$NON-NLS-1$ + public static String STR_SEMI = ";"; //$NON-NLS-1$ /** @@ -196,19 +196,19 @@ public class XMLparser } catch (Error err) { - System.out.println("error!"); + System.out.println("error!"); //$NON-NLS-1$ handlePanic(err); } } - if (_tagType.startsWith("File.Append")) + if (_tagType.startsWith("File.Append")) //$NON-NLS-1$ { - boolean binary = _tagType.equals("File.Append.Binary"); + boolean binary = _tagType.equals("File.Append.Binary"); //$NON-NLS-1$ _dataStore.appendToFile(path, _fileByteBuffer, size, binary, byteStreamHandlerId); } else { - boolean binary = _tagType.equals("File.Binary"); + boolean binary = _tagType.equals("File.Binary"); //$NON-NLS-1$ _dataStore.saveFile(path, _fileByteBuffer, size, binary, byteStreamHandlerId); } } @@ -302,9 +302,9 @@ public class XMLparser if (_firstTime) { - _initialKart = new KeepAliveRequestThread(KEEPALIVE_RESPONSE_TIMEOUT, _dataStore); + _initialKart = new KeepAliveRequestThread(KEEPALIVE_RESPONSE_TIMEOUT); _firstTime = false; - if (VERBOSE_KEEPALIVE) System.out.println("Starting initial KeepAlive thread."); + if (VERBOSE_KEEPALIVE) System.out.println("Starting initial KeepAlive thread."); //$NON-NLS-1$ _initialKart.start(); continue; } @@ -313,13 +313,13 @@ public class XMLparser if (!_initialKart.failed()) { _isKeepAliveCompatible = true; - if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive compatible."); + if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive compatible."); //$NON-NLS-1$ _initialKart = null; } else { _isKeepAliveCompatible = false; - if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive incompatible."); + if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive incompatible."); //$NON-NLS-1$ _initialKart = null; } } @@ -338,14 +338,14 @@ public class XMLparser if ((_kart != null) && _kart.failed()) { done = true; - if (_dataStore.isVirtual()) handlePanic(new Exception("KeepAlive request to server wasnt answered in time.")); - else handlePanic(new Exception("KeepAlive request to client wasnt answered in time.")); + if (_dataStore.isVirtual()) handlePanic(new Exception("KeepAlive request to server wasnt answered in time.")); //$NON-NLS-1$ + else handlePanic(new Exception("KeepAlive request to client wasnt answered in time.")); //$NON-NLS-1$ continue; } else { - _kart = new KeepAliveRequestThread(KEEPALIVE_RESPONSE_TIMEOUT, _dataStore); - if (VERBOSE_KEEPALIVE) System.out.println("No activity on socket. KeepAlive thread started."); + _kart = new KeepAliveRequestThread(KEEPALIVE_RESPONSE_TIMEOUT); + if (VERBOSE_KEEPALIVE) System.out.println("No activity on socket. KeepAlive thread started."); //$NON-NLS-1$ _kart.start(); continue; } @@ -359,7 +359,7 @@ public class XMLparser if (in == -1) { done = true; - Exception e = new Exception("The connection to the server has been lost."); + Exception e = new Exception("The connection to the server has been lost."); //$NON-NLS-1$ handlePanic(e); } else @@ -484,8 +484,8 @@ public class XMLparser if (_dataStore.getReferenceTag() == null) { - if (trimmedTag.indexOf(DE.P_ISREF + "=") > -1) _dataStore.setReferenceTag(DE.P_ISREF); - else if (trimmedTag.indexOf(DE.P_REF_TYPE + "=") > -1) _dataStore.setReferenceTag(DE.P_REF_TYPE); + if (trimmedTag.indexOf(DE.P_ISREF + "=") > -1) _dataStore.setReferenceTag(DE.P_ISREF); //$NON-NLS-1$ + else if (trimmedTag.indexOf(DE.P_REF_TYPE + "=") > -1) _dataStore.setReferenceTag(DE.P_REF_TYPE); //$NON-NLS-1$ } if (!_tagStack.empty()) @@ -505,11 +505,12 @@ public class XMLparser else if (_tagType.equals(STR_BUFFER)) { String buffer = convertStringFromXML(xmlTag); - parent.appendToBuffer(buffer); + if (parent != null) + parent.appendToBuffer(buffer); } else if ((matchTag != null) && trimmedTag.equals(matchTag)) { - if (parent.getType().equals(STR_STATUS)) + if (parent != null && parent.getType().equals(STR_STATUS)) { if (parent.getName().equals(STR_STATUS_ALMOST_DONE)) { @@ -617,7 +618,7 @@ public class XMLparser parent = result; - if (_isFile && (result != null)) + if (_isFile) { int size = result.depth(); String path = result.getSource(); @@ -628,14 +629,12 @@ public class XMLparser // older client or server, fall back to default byteStreamHandler = DataStoreResources.DEFAULT_BYTESTREAMHANDLER; } - if (path != null) - { - readFile(reader, size, path, byteStreamHandler); - } + readFile(reader, size, path, byteStreamHandler); + _isFile = false; //_dataStore.deleteObject(parent, result); } - else if (_isClass && (result != null)) + else if (_isClass) { int size = result.depth(); @@ -643,39 +642,39 @@ public class XMLparser if (result.getName() != null) { - boolean success = readClass(reader, size, result.getName(), classbyteStreamHandler); + readClass(reader, size, result.getName(), classbyteStreamHandler); } _isClass = false; } - else if (_isRequestClass && (result != null)) + else if (_isRequestClass) { result.getDataStore().sendClass(result.getName()); _isRequestClass = false; } - else if (_isKeepAlive && (result != null)) + else if (_isKeepAlive) { - if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive request received, sending confirmation."); + if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive request received, sending confirmation."); //$NON-NLS-1$ result.getDataStore().sendKeepAliveConfirmation(); _isKeepAlive = false; } - else if (_isKeepAliveConfirm && (result != null)) + else if (_isKeepAliveConfirm ) { - if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive confirmation received."); + if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive confirmation received."); //$NON-NLS-1$ if (_initialKart != null) _initialKart.interrupt(); _isKeepAliveConfirm = false; } - else if (_isSerialized && (result != null)) + else if (_isSerialized) { int size = result.depth(); String classbyteStreamHandler = result.getSource(); if (result.getName() != null) { - boolean success = readInstance(reader, size, classbyteStreamHandler); + readInstance(reader, size, classbyteStreamHandler); } _isSerialized = false; } - StringBuffer endTag = new StringBuffer("'); _tagStack.push(endTag.toString()); @@ -711,7 +710,7 @@ public class XMLparser */ protected synchronized DataElement parseTag(String fullTag, DataElement parent) { - if (!fullTag.startsWith("<")) + if (!fullTag.startsWith("<")) //$NON-NLS-1$ return null; try @@ -815,15 +814,7 @@ public class XMLparser { DataElement to = _dataStore.find(origId); - if (parent != null) - { - result = _dataStore.createReference(parent, to, attributes[DE.A_TYPE], false); - - } - else - { - _dataStore.trace("NULL2!"); - } + result = _dataStore.createReference(parent, to, attributes[DE.A_TYPE], false); } else { @@ -840,7 +831,7 @@ public class XMLparser return null; } - if (parent != null && _dataStore.contains(id)) + if (_dataStore.contains(id)) { result = _dataStore.find(id); @@ -871,11 +862,7 @@ public class XMLparser result.setAttributes(attributes); } - if (parent == null) - { - return result; - } - else if (parent == _rootDataElement) + if (parent == _rootDataElement) { DataElement rParent = result.getParent(); parent = rParent; @@ -901,7 +888,7 @@ public class XMLparser { if (result != _dataStore.getRoot()) { - _dataStore.trace("parent of " + result.getName() + " is NULL!"); + _dataStore.trace("parent of " + result.getName() + " is NULL!"); //$NON-NLS-1$ //$NON-NLS-2$ } else { @@ -915,7 +902,7 @@ public class XMLparser else { // new object - if (_dataStore.isVirtual() && parent != null) + if (_dataStore.isVirtual()) { result = _dataStore.find(parent, DE.A_NAME, attributes[DE.A_NAME], 1); } @@ -956,12 +943,12 @@ public class XMLparser int indexOfSemi = input.indexOf(';'); if (indexOfAmp >= 0 && indexOfSemi > indexOfAmp) { - String converted = input.replaceAll(STR_AMP, "&") - .replaceAll(STR_SEMI, ";") - .replaceAll(STR_QUOTE, "\"") - .replaceAll(STR_APOS, "\'") - .replaceAll(STR_LT, "<") - .replaceAll(STR_GT, ">"); + String converted = input.replaceAll(STR_AMP, "&") //$NON-NLS-1$ + .replaceAll(STR_SEMI, ";") //$NON-NLS-1$ + .replaceAll(STR_QUOTE, "\"") //$NON-NLS-1$ + .replaceAll(STR_APOS, "\'") //$NON-NLS-1$ + .replaceAll(STR_LT, "<") //$NON-NLS-1$ + .replaceAll(STR_GT, ">"); //$NON-NLS-1$ return converted; } else @@ -1028,13 +1015,11 @@ public class XMLparser public class KeepAliveRequestThread extends Thread { private long _timeout; - private DataStore _dataStore; private boolean _failed; - public KeepAliveRequestThread(long timeout, DataStore datastore) + public KeepAliveRequestThread(long timeout) { _timeout = timeout; - _dataStore = datastore; _failed = false; } @@ -1047,10 +1032,10 @@ public class XMLparser } catch (InterruptedException e) { - if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive thread interrupted."); + if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive thread interrupted."); //$NON-NLS-1$ return; } - if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive thread failed to be interrupted."); + if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive thread failed to be interrupted."); //$NON-NLS-1$ _failed = true; } diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/ssl/DStoreKeyStore.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/ssl/DStoreKeyStore.java index e0a500ff697..352a6f6c352 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/ssl/DStoreKeyStore.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/ssl/DStoreKeyStore.java @@ -64,7 +64,7 @@ public class DStoreKeyStore /* Do not stomp an existing file */ if(!keyStoreFile.exists()) { - keyStore = KeyStore.getInstance("JKS"); + keyStore = KeyStore.getInstance("JKS"); //$NON-NLS-1$ keyStore.load(null, password.toCharArray()); persistKeyStore(keyStore, filePath, password); } @@ -89,7 +89,7 @@ public class DStoreKeyStore /* Do not stomp an existing file */ if(file.exists()) { - ks=KeyStore.getInstance("JKS"); + ks=KeyStore.getInstance("JKS"); //$NON-NLS-1$ /* Initialize the keystore with no information */ FileInputStream is=new FileInputStream(file); ks.load(is, password.toCharArray()); @@ -102,7 +102,7 @@ public class DStoreKeyStore throws CertificateException, FileNotFoundException { - CertificateFactory factory=CertificateFactory.getInstance("X.509"); + CertificateFactory factory=CertificateFactory.getInstance("X.509"); //$NON-NLS-1$ return factory.generateCertificate(new FileInputStream(certFilename)); } diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/ssl/DStoreSSLContext.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/ssl/DStoreSSLContext.java index cf443ffe05e..f4f39ca732c 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/ssl/DStoreSSLContext.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/ssl/DStoreSSLContext.java @@ -37,7 +37,7 @@ public class DStoreSSLContext KeyManagerFactory kmf = KeyManagerFactory.getInstance(keymgrAlgorithm); kmf.init(ks, password.toCharArray()); - serverContext = SSLContext.getInstance("SSL"); + serverContext = SSLContext.getInstance("SSL"); //$NON-NLS-1$ serverContext.init(kmf.getKeyManagers(), null, null); } catch (Exception e) @@ -55,7 +55,7 @@ public class DStoreSSLContext try { trustManager.setKeystore(filePath, password); - clientContext = SSLContext.getInstance("SSL"); + clientContext = SSLContext.getInstance("SSL"); //$NON-NLS-1$ TrustManager[] mgrs = new TrustManager[1]; mgrs[0] = trustManager; diff --git a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/internal/extra/PropertySource.java b/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/internal/extra/PropertySource.java index 67794da1997..8e6b76a3919 100644 --- a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/internal/extra/PropertySource.java +++ b/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/internal/extra/PropertySource.java @@ -49,21 +49,23 @@ public class PropertySource implements IPropertySource _descriptors = new IPropertyDescriptor[attributesSize + 2]; _descriptors[0] = new TextPropertyDescriptor("type", "type"); //$NON-NLS-1$ //$NON-NLS-2$ _descriptors[1] = new TextPropertyDescriptor("name", "name"); //$NON-NLS-1$ //$NON-NLS-2$ - - for (int i = 0; i < attributesSize; i++) - { - IDataElement attribute = (IDataElement)attributes.get(i); - List types = attribute.getAssociated("attributes"); //$NON-NLS-1$ - - String type = null; - if (types.size() > 0) - type = ((IDataElement)types.get(0)).getName(); - else - type = "String"; //$NON-NLS-1$ - - _properties.put(attribute.getName(), type); - _descriptors[i+2] = new TextPropertyDescriptor(attribute.getName(), attribute.getName()); - } + if (attributes != null) + { + for (int i = 0; i < attributesSize; i++) + { + IDataElement attribute = (IDataElement)attributes.get(i); + List types = attribute.getAssociated("attributes"); //$NON-NLS-1$ + + String type = null; + if (types.size() > 0) + type = ((IDataElement)types.get(0)).getName(); + else + type = "String"; //$NON-NLS-1$ + + _properties.put(attribute.getName(), type); + _descriptors[i+2] = new TextPropertyDescriptor(attribute.getName(), attribute.getName()); + } + } }