diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/miners/Miner.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/miners/Miner.java
index 9b99a70bf8a..04cec9dab76 100644
--- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/miners/Miner.java
+++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/miners/Miner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
+ * Copyright (c) 2002, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,7 +12,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * Noriaki Takatsu (IBM) [220126] [dstore][api][breaking] Single process server for multiple clients
*******************************************************************************/
package org.eclipse.dstore.core.miners;
@@ -332,6 +332,7 @@ implements ISchemaExtender
*/
public final void setDataStore(DataStore dataStore)
{
+ super.setDataStore(dataStore);
_dataStore = dataStore;
DataElement root = _dataStore.getMinerRoot();
diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/miners/MinerThread.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/miners/MinerThread.java
index 6ac885dd476..ba7a86f6b5d 100644
--- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/miners/MinerThread.java
+++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/miners/MinerThread.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
+ * Copyright (c) 2002, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,15 +12,18 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * Noriaki Takatsu (IBM) [220126] [dstore][api][breaking] Single process server for multiple clients
*******************************************************************************/
package org.eclipse.dstore.core.miners;
+import org.eclipse.dstore.core.server.SecuredThread;
+import org.eclipse.dstore.core.model.DataStore;
+
/**
* MinerThread is a utility class used for doing threaded operations in a miner.
*/
-public abstract class MinerThread extends Thread
+public abstract class MinerThread extends SecuredThread
{
private volatile Thread minerThread;
@@ -31,7 +34,15 @@ public abstract class MinerThread extends Thread
*/
public MinerThread()
{
- super();
+ _isCancelled = false;
+ }
+
+ /**
+ * Constructor with dataStore
+ */
+ public MinerThread(DataStore dataStore)
+ {
+ super(dataStore);
_isCancelled = false;
}
@@ -62,6 +73,7 @@ public abstract class MinerThread extends Thread
*/
public void run()
{
+ super.run();
Thread thisThread = Thread.currentThread();
minerThread = thisThread;
//thisThread.setPriority(thisThread.getPriority()+1);
diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/Client.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/Client.java
new file mode 100644
index 00000000000..f5331712df6
--- /dev/null
+++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/Client.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: Noriaki Takatsu and Masao Nishimoto
+ *
+ * Contributors:
+ * Noriaki Takatsu (IBM) [220126] [dstore][api][breaking] Single process server for multiple clients
+ *******************************************************************************/
+
+package org.eclipse.dstore.core.model;
+
+import org.eclipse.dstore.core.server.IServerLogger;
+
+public class Client
+{
+ public String _userid;
+ private IServerLogger _logger;
+
+
+ public void setUserid(String userid)
+ {
+ _userid = userid;
+ }
+
+ public String getUserid()
+ {
+ return _userid;
+ }
+
+ public void setLogger(IServerLogger logger)
+ {
+ _logger = logger;
+ }
+
+ public IServerLogger getLogger()
+ {
+ return _logger;
+ }
+
+ public String getProperty(String key)
+ {
+ return System.getProperty(key);
+ }
+
+}
+
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 fffe3420dbf..acf06dbfe1f 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
+ * Copyright (c) 2002, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,6 +17,7 @@
* David McKnight (IBM) - 202822 findDeleted should not be synchronized
* David McKnight (IBM) [220123][dstore] Configurable timeout on irresponsiveness
* David McKnight (IBM) - [222168][dstore] Buffer in DataElement is not sent
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
*******************************************************************************/
package org.eclipse.dstore.core.model;
@@ -159,6 +160,7 @@ public final class DataStore
private int _serverMinor;
private List _lastCreatedElements;
+ private Client _client;
/**
* Creates a new DataStore
instance
@@ -4384,4 +4386,25 @@ public final class DataStore
}
}
+ /**
+ * This method is used to set the Client object for each user.
+ *
+ * @param client the object of the Client class
+ */
+ public void setClient(Client client)
+ {
+ _client = client;
+ }
+
+ /**
+ * This method is used to get the object of the Client stored for each user.
+ *
+ * @return the object of the Client stored for each user
+ */
+ public Client getClient()
+ {
+ return _client;
+ }
+
+
}
diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/Handler.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/Handler.java
index c39e33cd337..a0580224948 100644
--- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/Handler.java
+++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/Handler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
+ * Copyright (c) 2002, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,22 +12,23 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
*******************************************************************************/
package org.eclipse.dstore.core.model;
+import org.eclipse.dstore.core.server.SecuredThread;
+
/**
* The Handler class is the base class for the threaded mechanisms in
* the DataStore. This is a thread that periodically does some activity.
* The frequency of handling can be configured.
*/
-public abstract class Handler extends Thread
+public abstract class Handler extends SecuredThread
{
protected int _waitIncrement;
- protected DataStore _dataStore;
protected boolean _keepRunning;
/**
@@ -63,7 +64,7 @@ public abstract class Handler extends Thread
*/
public void setDataStore(DataStore dataStore)
{
- _dataStore = dataStore;
+ super.setDataStore(dataStore);
}
/**
@@ -113,6 +114,7 @@ public abstract class Handler extends Thread
*/
public void run()
{
+ super.run();
while (_keepRunning)
{
/*
diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/IServerLogger.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/IServerLogger.java
new file mode 100644
index 00000000000..9feedbc9e1a
--- /dev/null
+++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/IServerLogger.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: Noriaki Takatsu and Masao Nishimoto
+
+ * Contributors:
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
+ *******************************************************************************/
+
+package org.eclipse.dstore.core.server;
+
+public interface IServerLogger
+{
+ /**
+ * logInfo
+ *
+ * @param minerName
+ * @param message Message text to be logged.
+ */
+ public void logInfo(String minerName, String message);
+
+ /**
+ * logWarning
+ *
+ * @param minerName
+ * @param message Message text to be logged.
+ */
+ public void logWarning(String minerName, String message);
+
+ /**
+ * logError
+ *
+ * @param minerName
+ * @param message Message text to be logged.
+ * @param exception Exception that generated the error. Used to print a stack trace.
+ */
+ public void logError(String minerName, String message, Throwable exception);
+
+ /**
+ * logDebugMessage
+ * @param minerName
+ * @param message Message text to be logged.
+ */
+ public void logDebugMessage(String minerName, String message);
+}
diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ISystemService.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ISystemService.java
new file mode 100644
index 00000000000..fea7399712a
--- /dev/null
+++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ISystemService.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: Noriaki Takatsu and Masao Nishimoto
+ *
+ * Contributors:
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
+ *******************************************************************************/
+
+
+package org.eclipse.dstore.core.server;
+
+import org.eclipse.dstore.core.model.Client;
+
+public interface ISystemService
+{
+ /**
+ * This method is used to establish a thread-level security.
+ *
+ * @param client the object of the client
+ */
+ public void setThreadSecurity(Client client);
+}
diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/SecuredThread.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/SecuredThread.java
new file mode 100644
index 00000000000..46e7ca78ae9
--- /dev/null
+++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/SecuredThread.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: Noriaki Takatsu and Masao Nishimoto
+ *
+ * Contributors:
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
+ *******************************************************************************/
+
+package org.eclipse.dstore.core.server;
+
+
+import java.io.PrintWriter;
+
+import org.eclipse.dstore.core.model.DataStore;
+
+public class SecuredThread extends Thread
+{
+
+ public DataStore _dataStore;
+
+
+ /**
+ * Constructs a new SecuredThread without a DataStore. In this case, the DataStore
+ * needs to be set sometime after creation via setDataStore(DataStore)
.
+ */
+ public SecuredThread() {
+ }
+
+ /**
+ * Constructs a new SecuredThread given a DataStore.
+ *
+ * @param dataStore used to extract user id and password for a client
+ */
+ public SecuredThread(DataStore dataStore)
+ {
+ this(null, dataStore);
+ }
+
+
+ /**
+ * Constructs a new SecuredThread with a DataStore and a runnable. After
+ * the thread starts, the runnable will be implicitly executed.
+ *
+ * @param runnable the runnable to be executed by the thread
+ * @param dataStore used to extract user id and password for a client
+ */
+ public SecuredThread(Runnable runnable, DataStore dataStore) {
+ super(runnable);
+ _dataStore = dataStore;
+ }
+
+
+ /**
+ * Constructs a new SecuredThread with a DataStore, a runnable and name for the thread.
+ * After the thread starts, the runnable will be implicitly executed.
+ *
+ * @param runnable the runnable to be executed by the thread
+ * @param threadName the name for the SecuredThread being created
+ * @param dataStore used to extract user id and password for a client
+ */
+ public SecuredThread(Runnable runnable, String threadName, DataStore dataStore) {
+ this(null, runnable, threadName, dataStore);
+ }
+
+ /**
+ * Constructs a new SecuredThread with a DataStore, a runnable and a ThreadGroup.
+ * After the thread starts, the runnable will be implicitly executed.
+ *
+ * @param group the thread group for which this thread will belong
+ * @param runnable the runnable to be executed by the thread
+ * @param dataStore used to extract user id and password for a client
+ */
+ public SecuredThread(ThreadGroup group, Runnable runnable, DataStore dataStore) {
+ super(group, runnable);
+ _dataStore = dataStore;
+ }
+
+
+ /**
+ * Constructs a new SecuredThread with a DataStore, a runnable, a name and a ThreadGroup.
+ * After the thread starts, the runnable will be implicitly executed.
+ *
+ * @param group the thread group for which this thread will belong
+ * @param runnable the runnable to be executed by the thread
+ * @param threadName the name for the SecuredThread being created
+ * @param dataStore used to extract user id and password for a client
+ */
+ public SecuredThread(ThreadGroup group, Runnable runnable, String threadName, DataStore dataStore) {
+ super(group, runnable, threadName);
+ _dataStore = dataStore;
+ }
+
+
+ /**
+ * Sets the DataStore associated with the client
+ * @param dataStore
+ */
+ public void setDataStore(DataStore dataStore)
+ {
+ _dataStore = dataStore;
+ }
+
+
+ /**
+ * When run() is called, a check is made to see if there is an ISystemService. If there is
+ * the ISystemService.setThreadSecurity(Client)
is called before Thread.run()
+ * is called.
+ *
+ * If a Runnable was passed into the constructor for SecuredThread then, when Thread.run()
+ * is called, the Runnable will be invoked.
+ */
+ public void run()
+ {
+ try
+ {
+ ISystemService systemService = SystemServiceManager.getInstance().getSystemService();
+ if (systemService != null){
+ systemService.setThreadSecurity(_dataStore.getClient());
+ }
+ }
+ catch (Throwable e)
+ {
+ e.printStackTrace(new PrintWriter(System.err));
+ }
+
+ super.run();
+ }
+
+}
+
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 b20977cbfbb..856d6b2e282 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
+ * Copyright (c) 2002, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,7 +12,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
*******************************************************************************/
package org.eclipse.dstore.core.server;
@@ -28,7 +28,7 @@ import org.eclipse.dstore.internal.core.server.ServerReturnCodes;
* the DataStore.
*
*/
-public class Server
+public class Server implements Runnable
{
private ConnectionEstablisher _establisher;
@@ -161,4 +161,15 @@ public class Server
{
_establisher.start();
}
+
+ /**
+ * Return the reference for the ConnectionEstablisher for this client
+ *
+ * * @return the the reference for the ConnectionEstablisher instance for this client
+ */
+ public ConnectionEstablisher getEstablisher()
+ {
+ return _establisher;
+ }
+
}
diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/SystemServiceManager.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/SystemServiceManager.java
new file mode 100644
index 00000000000..e84ff93beea
--- /dev/null
+++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/SystemServiceManager.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: Noriaki Takatsu and Masao Nishimoto
+ *
+ * Contributors:
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
+ *******************************************************************************/
+
+package org.eclipse.dstore.core.server;
+
+
+public class SystemServiceManager
+{
+ private static SystemServiceManager instance = null;
+ private static ISystemService _systemService;
+
+
+ /**
+ * Creates an instance of SystemServiceManager to hold the system-specific
+ * parts that needs unique implementations for this system.
+ *
+ */
+ private SystemServiceManager()
+ {}
+
+ /**
+ * Get the SystemServiceManager object for this system.
+ *
+ * @return the object of the SystemServiceManager
+ */
+ public static SystemServiceManager getInstance()
+ {
+ if (instance == null)
+ {
+ instance = new SystemServiceManager();
+ }
+ return instance;
+ }
+
+ /**
+ * Set the SystemService object for this system.
+ *
+ * @param systemService the object of the SystemService
+ */
+ public void setSystemService(ISystemService systemService)
+ {
+ _systemService = systemService;
+ }
+
+ /**
+ * Get the SystemService object for this system.
+ *
+ * @return the object of the SystemService stored in SystemServiceManager
+ */
+ public ISystemService getSystemService()
+ {
+ return _systemService;
+ }
+
+
+}
diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/server/ConnectionEstablisher.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/server/ConnectionEstablisher.java
index 9baf9eaea21..b36f45f94c3 100644
--- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/server/ConnectionEstablisher.java
+++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/server/ConnectionEstablisher.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
+ * Copyright (c) 2002, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,6 +14,7 @@
* Contributors:
* David McKnight (IBM) [220123][dstore] Configurable timeout on irresponsiveness
* David McKnight (IBM) [220892][dstore] Backward compatibility: Server and Daemon should support old clients
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
*******************************************************************************/
package org.eclipse.dstore.internal.core.server;
@@ -64,6 +65,7 @@ public class ConnectionEstablisher
private int _maxConnections;
private int _timeout;
+ private String _msg;
/**
@@ -139,6 +141,31 @@ public class ConnectionEstablisher
{
return _dataStore;
}
+
+ /**
+ * Return the Server port opened for this client
+ *
+ * @return the Server port opened for this client
+ */
+ public int getServerPort()
+ {
+ if (_serverSocket != null)
+ {
+ return _serverSocket.getLocalPort();
+ }
+
+ return -1;
+ }
+
+ /**
+ * Return the connection status for this client
+ *
+ * * @return the connection status for this client
+ */
+ public String getStatus()
+ {
+ return _msg;
+ }
/**
* Tells the connection establisher to clean up and shutdown
@@ -155,7 +182,7 @@ public class ConnectionEstablisher
_updateHandler.finish();
_dataStore.finish();
System.out.println(ServerReturnCodes.RC_FINISHED);
- System.exit(0);
+ //System.exit(0);
}
}
diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/util/Receiver.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/util/Receiver.java
index 169506f2420..d2c080ac61d 100644
--- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/util/Receiver.java
+++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/util/Receiver.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
+ * Copyright (c) 2002, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,6 +14,7 @@
* Contributors:
* David McKnight (IBM) [220123][dstore] Configurable timeout on irresponsiveness
* David McKnight (IBM) [222003] Client remains connected after server terminates
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
*******************************************************************************/
package org.eclipse.dstore.internal.core.util;
@@ -26,19 +27,18 @@ import java.net.UnknownHostException;
import org.eclipse.dstore.core.model.DataElement;
import org.eclipse.dstore.core.model.DataStore;
import org.eclipse.dstore.core.model.IDataStorePreferenceListener;
+import org.eclipse.dstore.core.server.SecuredThread;
/**
* This class is used for receiving data from a socket in the DataStore
* communication layer.
*/
-public abstract class Receiver extends Thread implements IDataStorePreferenceListener
+public abstract class Receiver extends SecuredThread implements IDataStorePreferenceListener
{
private Socket _socket;
- protected DataStore _dataStore;
-
private XMLparser _xmlParser;
private BufferedInputStream _in;
@@ -51,9 +51,9 @@ public abstract class Receiver extends Thread implements IDataStorePreferenceLis
*/
public Receiver(Socket socket, DataStore dataStore)
{
+ super(dataStore);
setName("DStore Receiver"+getName()); //$NON-NLS-1$
_socket = socket;
- _dataStore = dataStore;
_canExit = false;
_xmlParser = new XMLparser(dataStore);
@@ -107,6 +107,7 @@ public abstract class Receiver extends Thread implements IDataStorePreferenceLis
*/
public void run()
{
+ super.run();
try
{
while (!_canExit)
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/CommandMiner.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/CommandMiner.java
index 762e61ec023..2d269784a60 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/CommandMiner.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/CommandMiner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,6 +15,7 @@
* David McKnight (IBM) - [191599] use specified encoding for shell
* David McKnight (IBM) - [202822] canceled output should be created before thread cleanup
* David McKnight (IBM) - [196624] dstore miner IDs should be String constants rather than dynamic lookup
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
*******************************************************************************/
package org.eclipse.rse.dstore.universal.miners;
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/EnvironmentMiner.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/EnvironmentMiner.java
index af16ad4e797..8c82aba019f 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/EnvironmentMiner.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/EnvironmentMiner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
+ * Copyright (c) 2002, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,11 +14,13 @@
* Contributors:
* {Name} (company) - description of contribution.
* David McKnight (IBM) - [196624] dstore miner IDs should be String constants rather than dynamic lookup
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
*******************************************************************************/
package org.eclipse.rse.dstore.universal.miners;
import java.io.BufferedReader;
+import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
@@ -27,12 +29,13 @@ import java.util.List;
import org.eclipse.dstore.core.miners.Miner;
import org.eclipse.dstore.core.model.DE;
import org.eclipse.dstore.core.model.DataElement;
+import org.eclipse.dstore.core.model.Client;
+
public class EnvironmentMiner extends Miner
{
private DataElement _system;
-
public void load()
{
getSystemNode();
@@ -56,6 +59,19 @@ public class EnvironmentMiner extends Miner
public void extendSchema(DataElement schemaRoot)
{
+ if (_dataStore.getClient() != null)
+ {
+ ServerLogger logger = new ServerLogger(getUserPreferencesDirectory());
+ _dataStore.getClient().setLogger(logger);
+ }
+ else
+ {
+ Client client = new Client();
+ _dataStore.setClient(client);
+ ServerLogger logger = new ServerLogger(getUserPreferencesDirectory());
+ client.setLogger(logger);
+ }
+
DataElement envVar = _dataStore.createObjectDescriptor(schemaRoot, "Environment Variable"); //$NON-NLS-1$
_dataStore.createReference(envVar, _dataStore.createRelationDescriptor(schemaRoot,"Parent Environment")); //$NON-NLS-1$
DataElement containerObjectD = _dataStore.findObjectDescriptor("Container Object"); //$NON-NLS-1$
@@ -229,4 +245,38 @@ public class EnvironmentMiner extends Miner
{
return "6.4.0"; //$NON-NLS-1$
}
+
+ /**
+ * getUserPreferencesDirectory() - returns directory on IFS where to store user settings
+ */
+ public String getUserPreferencesDirectory()
+ {
+ String userPreferencesDirectory = _dataStore.getClient().getProperty("user.home"); //$NON-NLS-1$
+
+ String clientUserID = System.getProperty("client.username"); //$NON-NLS-1$
+ if (clientUserID == null || clientUserID.equals("")) //$NON-NLS-1$
+ {
+ clientUserID = ""; //$NON-NLS-1$
+ }
+ else
+ {
+ clientUserID += File.separator;
+ }
+
+ // append a '/' if not there
+ if ( userPreferencesDirectory.length() == 0 ||
+ userPreferencesDirectory.charAt( userPreferencesDirectory.length() -1 ) != File.separatorChar ) {
+
+ userPreferencesDirectory = userPreferencesDirectory + File.separator;
+ }
+
+ 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();
+ }
+
+ return userPreferencesDirectory;
+ }
}
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/ServerLogger.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/ServerLogger.java
index 03b1e8b69e6..a5491c5c7dc 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/ServerLogger.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/ServerLogger.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2002, 2008 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -11,7 +11,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
********************************************************************************/
package org.eclipse.rse.dstore.universal.miners;
@@ -22,9 +22,14 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import java.util.ResourceBundle;
+import org.eclipse.dstore.core.server.IServerLogger;
-
-public class ServerLogger {
+/**
+ * Class that facilitates logging for errors, warnings, debug messages and info for DataStore
+ * servers.
+ */
+public class ServerLogger implements IServerLogger
+{
// Constants for logging - for use in rsecomm.properties
@@ -44,7 +49,9 @@ public class ServerLogger {
private static int log_level = 0;
/**
+ * Constructs a new ServerLogger.
*
+ * @param logPathName the path on the filesystem to store the log information
*/
public ServerLogger(String logPathName) {
if (_logFileStream == null) {
@@ -84,13 +91,12 @@ public class ServerLogger {
/**
- * logInfo
- *
- * @param minerName
+ * Logs an informational message
*
+ * @param minerName the name of the miner associated with this message
* @param message Message text to be logged.
*/
- public static void logInfo(String minerName, String message) {
+ public void logInfo(String minerName, String message) {
if (log_level >= LOG_INFO) {
if (_logFileStream != null) {
synchronized(writeLock) {
@@ -107,13 +113,12 @@ public class ServerLogger {
/**
- * logWarning
- *
- * @param minerName
+ * Logs a warning message
*
+ * @param minerName the name of the miner associated with this message
* @param message Message text to be logged.
*/
- public static void logWarning(String minerName, String message) {
+ public void logWarning(String minerName, String message) {
if (log_level >= LOG_WARNING) {
if (_logFileStream != null) {
synchronized(writeLock) {
@@ -130,15 +135,14 @@ public class ServerLogger {
/**
- * logError
- *
- * @param minerName
+ * Logs an error message
*
+ * @param minerName the name of the miner associated with this message
* @param message Message text to be logged.
*
* @param exception Exception that generated the error. Used to print a stack trace.
*/
- public static void logError(String minerName, String message, Throwable exception) {
+ public void logError(String minerName, String message, Throwable exception) {
if (_logFileStream != null) {
synchronized(writeLock) {
try {
@@ -156,13 +160,12 @@ public class ServerLogger {
/**
- * logDebugMessage
- *
- * @param minerName
+ * Logs a debug message
*
+ * @param minerName the name of the miner associated with this message
* @param message Message text to be logged.
*/
- public synchronized static void logDebugMessage(String minerName, String message) {
+ public synchronized void logDebugMessage(String minerName, String message) {
if (DEBUG && log_level == LOG_DEBUG) {
if (_logFileStream != null) {
synchronized(writeLock) {
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java
index 2584ac5a93a..4d58e03f7ff 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java
@@ -30,6 +30,7 @@
* Xuan Chen (IBM) - [194481] [dstore][Archive] Save Conflict After Renaming a File that is Open
* David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files
* Johnson Ma (Wind River) - [195402] Add tar.gz archive support
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
*******************************************************************************/
package org.eclipse.rse.dstore.universal.miners;
@@ -120,7 +121,7 @@ public class UniversalFileSystemMiner extends Miner {
DataElement status = getCommandStatus(theElement);
DataElement subject = getCommandArgument(theElement, 0);
- UniversalServerUtilities.logInfo(getName(), name + ":" + subject); //$NON-NLS-1$
+ UniversalServerUtilities.logInfo(getName(), name + ":" + subject, _dataStore); //$NON-NLS-1$
String queryType = (String) subject.getElementProperty(DE.P_TYPE);
boolean caseSensitive = !_isWindows;
@@ -222,7 +223,7 @@ public class UniversalFileSystemMiner extends Miner {
return handleSetFilePermissions(subject, newPermissions, status);
} else {
UniversalServerUtilities.logError(CLASSNAME,
- "Invalid query to handlecommand", null); //$NON-NLS-1$
+ "Invalid query to handlecommand", null, _dataStore); //$NON-NLS-1$
}
return statusDone(status);
}
@@ -262,7 +263,7 @@ public class UniversalFileSystemMiner extends Miner {
}
// otherwise log error, and return as done
else {
- UniversalServerUtilities.logError(CLASSNAME, "Invalid query type to handleSearch", null); //$NON-NLS-1$
+ UniversalServerUtilities.logError(CLASSNAME, "Invalid query type to handleSearch", null, _dataStore); //$NON-NLS-1$
return statusDone(status);
}
//If the subject is a virtual folder, we could not just use check file.exists() to determine if we need
@@ -381,7 +382,7 @@ public class UniversalFileSystemMiner extends Miner {
else
{
UniversalServerUtilities.logError(CLASSNAME,
- "Invalid query type to handleQueryAll", null); //$NON-NLS-1$
+ "Invalid query type to handleQueryAll", null, _dataStore); //$NON-NLS-1$
}
if (fileobj != null)
@@ -478,7 +479,7 @@ public class UniversalFileSystemMiner extends Miner {
+ File.separatorChar + subject.getName());
else
UniversalServerUtilities.logError(CLASSNAME,
- "Invalid query type to handleQueryFiles", null); //$NON-NLS-1$
+ "Invalid query type to handleQueryFiles", null, _dataStore); //$NON-NLS-1$
if (!fileobj.exists())
@@ -535,7 +536,7 @@ public class UniversalFileSystemMiner extends Miner {
+ File.separatorChar + subject.getName());
else
UniversalServerUtilities.logError(CLASSNAME,
- "Invalid query type to handleQueryFolders", null); //$NON-NLS-1$
+ "Invalid query type to handleQueryFolders", null, _dataStore); //$NON-NLS-1$
if (!fileobj.exists())
{
@@ -733,7 +734,7 @@ public class UniversalFileSystemMiner extends Miner {
} catch (Exception e) {
UniversalServerUtilities.logError(CLASSNAME,
- "handleSetreadOnly", e); //$NON-NLS-1$
+ "handleSetreadOnly", e, _dataStore); //$NON-NLS-1$
}
}
_dataStore.refresh(subject);
@@ -775,7 +776,7 @@ public class UniversalFileSystemMiner extends Miner {
} catch (Exception e) {
UniversalServerUtilities.logError(CLASSNAME,
- "handleSetLastModified", e); //$NON-NLS-1$
+ "handleSetLastModified", e, _dataStore); //$NON-NLS-1$
}
}
_dataStore.refresh(subject);
@@ -933,7 +934,7 @@ public class UniversalFileSystemMiner extends Miner {
}
else {
UniversalServerUtilities.logError(CLASSNAME,
- "Invalid query type to handleQueryGetRemoteObject", null); //$NON-NLS-1$
+ "Invalid query type to handleQueryGetRemoteObject", null, _dataStore); //$NON-NLS-1$
return statusDone(status);
}
@@ -1048,7 +1049,7 @@ public class UniversalFileSystemMiner extends Miner {
status.setAttribute(DE.A_SOURCE, IServiceConstants.SUCCESS);
} else {
UniversalServerUtilities.logWarning(CLASSNAME,
- "object does not exist"); //$NON-NLS-1$
+ "object does not exist", _dataStore); //$NON-NLS-1$
subject.setAttribute(DE.A_SOURCE, setProperties(child));
status
.setAttribute(DE.A_SOURCE,
@@ -1226,7 +1227,7 @@ public class UniversalFileSystemMiner extends Miner {
socket.close();
}
catch (IOException e) {
- UniversalServerUtilities.logError(CLASSNAME, "Can not get unused port", e); //$NON-NLS-1$
+ UniversalServerUtilities.logError(CLASSNAME, "Can not get unused port", e, _dataStore); //$NON-NLS-1$
port = -1;
}
@@ -1387,7 +1388,7 @@ public class UniversalFileSystemMiner extends Miner {
} catch (IOException e) {
UniversalServerUtilities.logError(CLASSNAME,
"I/O error occured trying to read class file " + filePath, //$NON-NLS-1$
- null);
+ null, _dataStore);
_dataStore.createObject(status, IUniversalDataStoreConstants.TYPE_QUALIFIED_CLASSNAME, "null"); //$NON-NLS-1$
}
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalProcessMiner.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalProcessMiner.java
index 549fe73ffca..a843cb9b1b4 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalProcessMiner.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalProcessMiner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,8 +12,8 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
* David McKnight (IBM) - [196624] dstore miner IDs should be String constants rather than dynamic lookup
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
*******************************************************************************/
package org.eclipse.rse.dstore.universal.miners;
@@ -89,7 +89,7 @@ public class UniversalProcessMiner extends Miner
if (subject == null) {
- UniversalServerUtilities.logError(IUniversalProcessDataStoreConstants.UNIVERSAL_PROCESS_MINER, "Subject for UniversalProcessMiner command " + name + " is null", null); //$NON-NLS-1$ //$NON-NLS-2$
+ UniversalServerUtilities.logError(IUniversalProcessDataStoreConstants.UNIVERSAL_PROCESS_MINER, "Subject for UniversalProcessMiner command " + name + " is null", null, _dataStore); //$NON-NLS-1$ //$NON-NLS-2$
status.setAttribute(DE.A_NAME, "done"); //$NON-NLS-1$
return status;
}
@@ -109,7 +109,8 @@ public class UniversalProcessMiner extends Miner
}
else
{
- UniversalServerUtilities.logError(IUniversalProcessDataStoreConstants.UNIVERSAL_PROCESS_MINER, "Unknown filter command: " + name, null); //$NON-NLS-1$
+ UniversalServerUtilities.logError(IUniversalProcessDataStoreConstants.UNIVERSAL_PROCESS_MINER,
+ "Unknown filter command: " + name, null, _dataStore); //$NON-NLS-1$
status.setAttribute(DE.A_NAME, "done"); //$NON-NLS-1$
}
}
@@ -125,13 +126,15 @@ public class UniversalProcessMiner extends Miner
}
else
{
- UniversalServerUtilities.logError(IUniversalProcessDataStoreConstants.UNIVERSAL_PROCESS_MINER, "Unsupported process command: " + name, null); //$NON-NLS-1$
+ UniversalServerUtilities.logError(IUniversalProcessDataStoreConstants.UNIVERSAL_PROCESS_MINER,
+ "Unsupported process command: " + name, null, _dataStore); //$NON-NLS-1$
status.setAttribute(DE.A_NAME, "done"); //$NON-NLS-1$
}
}
else
{
- UniversalServerUtilities.logError(IUniversalProcessDataStoreConstants.UNIVERSAL_PROCESS_MINER, "Unsupported subject for command: " + subject, null); //$NON-NLS-1$
+ UniversalServerUtilities.logError(IUniversalProcessDataStoreConstants.UNIVERSAL_PROCESS_MINER,
+ "Unsupported subject for command: " + subject, null, _dataStore); //$NON-NLS-1$
status.setAttribute(DE.A_NAME, "done"); //$NON-NLS-1$
}
@@ -219,7 +222,7 @@ public class UniversalProcessMiner extends Miner
lookupProcesses(pfs, subject);
} catch (Exception e) {
e.printStackTrace();
- UniversalServerUtilities.logError("UniversalProcessMiner", "handleQuery()", e); //$NON-NLS-1$ //$NON-NLS-2$
+ UniversalServerUtilities.logError("UniversalProcessMiner", "handleQuery()", e, _dataStore); //$NON-NLS-1$ //$NON-NLS-2$
status.setAttribute(DE.A_VALUE, e.getMessage());
status.setAttribute(DE.A_NAME, "done"); //$NON-NLS-1$
_dataStore.refresh(status);
@@ -396,7 +399,7 @@ public class UniversalProcessMiner extends Miner
subject.setAttribute(DE.A_VALUE, result.getAllProperties());
}
} catch (Exception e) {
- UniversalServerUtilities.logError("UniversalProcessMiner", "handleQuery()", e); //$NON-NLS-1$ //$NON-NLS-2$
+ UniversalServerUtilities.logError("UniversalProcessMiner", "handleQuery()", e, _dataStore); //$NON-NLS-1$ //$NON-NLS-2$
status.setAttribute(DE.A_VALUE, e.getMessage());
status.setAttribute(DE.A_NAME, "done"); //$NON-NLS-1$
_dataStore.refresh(status);
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalServerUtilities.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalServerUtilities.java
index e45b36cf6ae..81442727fba 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalServerUtilities.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalServerUtilities.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2002, 2008 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -11,58 +11,16 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
********************************************************************************/
package org.eclipse.rse.dstore.universal.miners;
-import java.io.File;
+import org.eclipse.dstore.core.model.DataStore;
public class UniversalServerUtilities {
- private static String _userPreferencesDirectory = null;
-
- static {
- new ServerLogger(getUserPreferencesDirectory());
- }
-
- /**
- * getUserPreferencesDirectory() - returns directory on IFS where to store user settings
- */
- public static String getUserPreferencesDirectory()
- {
- if (_userPreferencesDirectory == null) {
-
- _userPreferencesDirectory = System.getProperty("user.home"); //$NON-NLS-1$
-
- String clientUserID = System.getProperty("client.username"); //$NON-NLS-1$
- if (clientUserID == null || clientUserID.equals("")) //$NON-NLS-1$
- {
- clientUserID = ""; //$NON-NLS-1$
- }
- else
- {
- clientUserID += File.separator;
- }
-
- // append a '/' if not there
- if ( _userPreferencesDirectory.length() == 0 ||
- _userPreferencesDirectory.charAt( _userPreferencesDirectory.length() -1 ) != File.separatorChar ) {
-
- _userPreferencesDirectory = _userPreferencesDirectory + File.separator;
- }
-
- _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();
- }
- }
- return _userPreferencesDirectory;
- }
-
/**
* logInfo
*
@@ -70,8 +28,9 @@ public class UniversalServerUtilities {
*
* @param message Message text to be logged.
*/
- public static void logInfo(String minerName, String message) {
- ServerLogger.logInfo(minerName, message);
+ public static void logInfo(String minerName, String message, DataStore dataStore)
+ {
+ dataStore.getClient().getLogger().logInfo(minerName, message);
}
/**
@@ -81,8 +40,9 @@ public class UniversalServerUtilities {
*
* @param message Message text to be logged.
*/
- public static void logWarning(String minerName, String message) {
- ServerLogger.logWarning(minerName, message);
+ public static void logWarning(String minerName, String message, DataStore dataStore)
+ {
+ dataStore.getClient().getLogger().logWarning(minerName, message);
}
/**
@@ -94,8 +54,9 @@ public class UniversalServerUtilities {
*
* @param exception Exception that generated the error. Used to print a stack trace.
*/
- public static void logError(String minerName, String message, Throwable exception) {
- ServerLogger.logError(minerName, message, exception);
+ public static void logError(String minerName, String message, Throwable exception, DataStore dataStore)
+ {
+ dataStore.getClient().getLogger().logError(minerName, message, exception);
}
/**
@@ -105,8 +66,9 @@ public class UniversalServerUtilities {
*
* @param message Message text to be logged.
*/
- public static void logDebugMessage(String minerName, String message) {
- ServerLogger.logDebugMessage(minerName, message);
+ public static void logDebugMessage(String minerName, String message, DataStore dataStore)
+ {
+ dataStore.getClient().getLogger().logDebugMessage(minerName, message);
}
}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java
index 6a244634baa..4871e8bbd32 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java
@@ -15,6 +15,7 @@
* {Name} (company) - description of contribution.
* David McKnight (IBM) - [202822] updating cleanup
* David McKnight (IBM) - [196624] dstore miner IDs should be String constants rather than dynamic lookup
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
*******************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.command;
@@ -36,7 +37,6 @@ import java.util.List;
import org.eclipse.dstore.core.miners.MinerThread;
import org.eclipse.dstore.core.model.DE;
import org.eclipse.dstore.core.model.DataElement;
-import org.eclipse.dstore.core.model.DataStore;
import org.eclipse.dstore.core.model.DataStoreAttributes;
import org.eclipse.rse.dstore.universal.miners.CommandMiner;
import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants;
@@ -51,10 +51,7 @@ import org.eclipse.rse.internal.dstore.universal.miners.command.patterns.Pattern
*/
public class CommandMinerThread extends MinerThread
{
-
-
private DataElement _status;
- private DataStore _dataStore;
private String _invocation;
private DataInputStream _stdInput;
@@ -70,7 +67,7 @@ public class CommandMinerThread extends MinerThread
private DataElement _subject;
private String _cwdStr;
- private OutputHandler _stdOutputHandler;
+ private OutputHandler _stdOutputHandler;
private OutputHandler _stdErrorHandler;
private boolean _isShell;
private boolean _isDone;
@@ -87,10 +84,10 @@ public class CommandMinerThread extends MinerThread
public CommandMinerThread(DataElement theElement, String invocation, DataElement status, Patterns thePatterns, CommandMiner.CommandMinerDescriptors descriptors)
{
+ super(theElement.getDataStore());
_isShell = false;
_isDone = false;
_status = status;
- _dataStore = theElement.getDataStore();
_descriptors = descriptors;
_subject = theElement;
@@ -187,6 +184,15 @@ public class CommandMinerThread extends MinerThread
isSHonZ = true;
}
}
+ // In a single-process server, both user.home and HOME don't represent
+ // each client home directory.
+ if (_dataStore.getClient() != null)
+ {
+ if (var.startsWith("HOME")) //$NON-NLS-1$
+ {
+ env[i] = "HOME=" + _dataStore.getClient().getProperty("user.home"); //$NON-NLS-1$
+ }
+ }
}
@@ -424,10 +430,12 @@ public class CommandMinerThread extends MinerThread
_stdOutputHandler = new OutputHandler(_stdInput, null, _isWindows || _isTTY, false, _isShell, this);
_stdOutputHandler.setWaitTime(100);
+ _stdOutputHandler.setDataStore(_dataStore);
_stdOutputHandler.start();
_stdErrorHandler = new OutputHandler(_stdError, null, _isWindows || _isTTY, true, _isShell, this);
_stdErrorHandler.setWaitTime(100);
+ _stdOutputHandler.setDataStore(_dataStore);
_stdErrorHandler.start();
if (didLogin && !userHome.equals(_cwdStr))
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/QueryPathThread.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/QueryPathThread.java
index 89458510576..89d99567de7 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/QueryPathThread.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/QueryPathThread.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,8 +12,8 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
* David McKnight (IBM) - [196624] dstore miner IDs should be String constants rather than dynamic lookup
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
*******************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.command;
@@ -28,27 +28,27 @@ import java.util.StringTokenizer;
import org.eclipse.dstore.core.model.DE;
import org.eclipse.dstore.core.model.DataElement;
-import org.eclipse.dstore.core.model.DataStore;
+import org.eclipse.dstore.core.server.SecuredThread;
import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants;
/**
* QueryPathThread is used to determine available command completions
*/
-public class QueryPathThread extends Thread
+public class QueryPathThread extends SecuredThread
{
- private DataStore _dataStore;
private DataElement _status;
public QueryPathThread(DataElement status)
{
- super();
+ super(status.getDataStore());
_status = status;
- _dataStore = status.getDataStore();
}
public void run()
{
+ super.run();
+
getPossibleCommands(_status);
}
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/ArchiveQueryThread.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/ArchiveQueryThread.java
index 202cadebb6d..e073f4080af 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/ArchiveQueryThread.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/ArchiveQueryThread.java
@@ -9,9 +9,9 @@
* component that contains this file: David McKnight.
*
* Contributors:
- * {Name} (company) - description of contribution.
* Kevin Doyle (IBM) - [191548] Deleting Read-Only directory removes it from view and displays no error
* Xuan Chen (IBM) - [200417] [regression][dstore] Rename an expanded folder in an Archive displays no children
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
********************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@@ -49,6 +49,8 @@ public class ArchiveQueryThread extends QueryThread {
}
public void run() {
+ super.run();
+
doQueryAll();
if (!isCancelled()) {
@@ -333,7 +335,7 @@ public class ArchiveQueryThread extends QueryThread {
e.printStackTrace();
UniversalServerUtilities.logError(
UniversalFileSystemMiner.CLASSNAME,
- "createDataElement failed with exception - isFile ", e); //$NON-NLS-1$
+ "createDataElement failed with exception - isFile ", e, _dataStore); //$NON-NLS-1$
}
} // end currentObj not 0
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopyBatchThread.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopyBatchThread.java
index 01fa19456d6..9c848cdc224 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopyBatchThread.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopyBatchThread.java
@@ -9,8 +9,8 @@
* component that contains this file: David McKnight.
*
* Contributors:
- * {Name} (company) - description of contribution.
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
********************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@@ -38,6 +38,7 @@ public class CopyBatchThread extends CopyThread {
public void run()
{
+ super.run();
handleCopyBatch();
_isDone = true;
}
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopySingleThread.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopySingleThread.java
index cc13fcf2a9d..bcb3641ae57 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopySingleThread.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopySingleThread.java
@@ -10,8 +10,8 @@
* component that contains this file: David McKnight.
*
* Contributors:
- * {Name} (company) - description of contribution.
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
*******************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@@ -41,6 +41,7 @@ public class CopySingleThread extends CopyThread {
public void run()
{
+ super.run();
handleCopy();
_isDone = true;
}
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopyThread.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopyThread.java
index 6ad570b1ce3..b6ad984b05b 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopyThread.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopyThread.java
@@ -10,8 +10,8 @@
* component that contains this file: David McKnight.
*
* Contributors:
- * {Name} (company) - description of contribution.
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
*******************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@@ -27,8 +27,9 @@ import org.eclipse.rse.dstore.universal.miners.UniversalServerUtilities;
import org.eclipse.rse.services.clientserver.IServiceConstants;
import org.eclipse.rse.services.clientserver.PathUtility;
import org.eclipse.rse.services.clientserver.SystemOperationMonitor;
+import org.eclipse.dstore.core.server.SecuredThread;
-public class CopyThread extends Thread implements ICancellableHandler {
+public class CopyThread extends SecuredThread implements ICancellableHandler {
protected DataElement targetFolder;
protected DataElement theElement;
@@ -45,6 +46,7 @@ public class CopyThread extends Thread implements ICancellableHandler {
public CopyThread(DataElement targetFolder, DataElement theElement, UniversalFileSystemMiner miner, boolean isWindows, DataElement status)
{
+ super(theElement.getDataStore());
this.targetFolder = targetFolder;
this.theElement = theElement;
this.miner = miner;
@@ -224,7 +226,7 @@ public class CopyThread extends Thread implements ICancellableHandler {
}
catch (Exception e)
{
- UniversalServerUtilities.logError(CLASSNAME, "Exception is handleCopy", e); //$NON-NLS-1$
+ UniversalServerUtilities.logError(CLASSNAME, "Exception is handleCopy", e, _dataStore); //$NON-NLS-1$
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
status.setAttribute(DE.A_VALUE, e.getMessage());
}
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CreateFileThread.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CreateFileThread.java
index 6fab3c1d780..9604b02b880 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CreateFileThread.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CreateFileThread.java
@@ -9,8 +9,8 @@
* component that contains this file: David McKnight.
*
* Contributors:
- * {Name} (company) - description of contribution.
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
********************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@@ -28,12 +28,12 @@ import org.eclipse.rse.services.clientserver.SystemOperationMonitor;
import org.eclipse.rse.services.clientserver.archiveutils.AbsoluteVirtualPath;
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
import org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler;
+import org.eclipse.dstore.core.server.SecuredThread;
-public class CreateFileThread extends Thread implements ICancellableHandler {
+public class CreateFileThread extends SecuredThread implements ICancellableHandler {
protected DataElement _subject;
protected DataElement _status;
- private DataStore _dataStore;
protected UniversalFileSystemMiner _miner;
protected String _queryType;
@@ -46,9 +46,9 @@ public class CreateFileThread extends Thread implements ICancellableHandler {
public CreateFileThread(DataElement theElement, String queryType, UniversalFileSystemMiner miner, DataStore dataStore, DataElement status)
{
+ super(dataStore);
this._subject = theElement;
this._miner = miner;
- this._dataStore = dataStore;
this._status = status;
this._queryType = queryType;
}
@@ -74,6 +74,8 @@ public class CreateFileThread extends Thread implements ICancellableHandler {
public void run()
{
+ super.run();
+
handleCreateFile();
_isDone = true;
}
@@ -102,7 +104,7 @@ public class CreateFileThread extends Thread implements ICancellableHandler {
+ File.separatorChar + _subject.getName());
else
UniversalServerUtilities.logError(CLASSNAME,
- "Invalid query type to handleCreateFile", null); //$NON-NLS-1$
+ "Invalid query type to handleCreateFile", null, _dataStore); //$NON-NLS-1$
if (filename != null)
{
@@ -141,7 +143,7 @@ public class CreateFileThread extends Thread implements ICancellableHandler {
_status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
} catch (Exception e) {
UniversalServerUtilities.logError(CLASSNAME,
- "handleCreateFile failed", e); //$NON-NLS-1$
+ "handleCreateFile failed", e, _dataStore); //$NON-NLS-1$
_status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
}
}
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CreateFolderThread.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CreateFolderThread.java
index ccb0136e47e..9b37573aa1e 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CreateFolderThread.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CreateFolderThread.java
@@ -9,8 +9,8 @@
* component that contains this file: David McKnight.
*
* Contributors:
- * {Name} (company) - description of contribution.
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
********************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@@ -28,12 +28,12 @@ import org.eclipse.rse.services.clientserver.SystemOperationMonitor;
import org.eclipse.rse.services.clientserver.archiveutils.AbsoluteVirtualPath;
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
import org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler;
+import org.eclipse.dstore.core.server.SecuredThread;
-public class CreateFolderThread extends Thread implements ICancellableHandler {
+public class CreateFolderThread extends SecuredThread implements ICancellableHandler {
protected DataElement _subject;
protected DataElement _status;
- private DataStore _dataStore;
protected UniversalFileSystemMiner _miner;
protected String _queryType;
@@ -46,9 +46,9 @@ public class CreateFolderThread extends Thread implements ICancellableHandler {
public CreateFolderThread(DataElement theElement, String queryType, UniversalFileSystemMiner miner, DataStore dataStore, DataElement status)
{
+ super(dataStore);
this._subject = theElement;
this._miner = miner;
- this._dataStore = dataStore;
this._status = status;
this._queryType = queryType;
}
@@ -74,6 +74,7 @@ public class CreateFolderThread extends Thread implements ICancellableHandler {
public void run()
{
+ super.run();
handleCreateFile();
_isDone = true;
}
@@ -107,7 +108,7 @@ public class CreateFolderThread extends Thread implements ICancellableHandler {
}
else
UniversalServerUtilities.logError(CLASSNAME,
- "Invalid query type to handleCreateFolder", null); //$NON-NLS-1$
+ "Invalid query type to handleCreateFolder", null, _dataStore); //$NON-NLS-1$
if (filename != null)
{
@@ -132,7 +133,7 @@ public class CreateFolderThread extends Thread implements ICancellableHandler {
} catch (Exception e) {
UniversalServerUtilities.logError(CLASSNAME,
- "handleCreateFolder failed", e); //$NON-NLS-1$
+ "handleCreateFolder failed", e, _dataStore); //$NON-NLS-1$
_status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
}
}
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/DeleteThread.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/DeleteThread.java
index 45da83483ed..aaaa18a62c4 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/DeleteThread.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/DeleteThread.java
@@ -10,8 +10,8 @@
* component that contains this file: David McKnight.
*
* Contributors:
- * {Name} (company) - description of contribution.
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
*******************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@@ -29,12 +29,12 @@ import org.eclipse.rse.services.clientserver.SystemOperationMonitor;
import org.eclipse.rse.services.clientserver.archiveutils.AbsoluteVirtualPath;
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
import org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler;
+import org.eclipse.dstore.core.server.SecuredThread;
-public class DeleteThread extends Thread implements ICancellableHandler {
+public class DeleteThread extends SecuredThread implements ICancellableHandler {
protected DataElement _theElement;
protected DataElement _status;
- private DataStore _dataStore;
protected UniversalFileSystemMiner _miner;
protected boolean _batch;
@@ -47,9 +47,9 @@ public class DeleteThread extends Thread implements ICancellableHandler {
public DeleteThread(DataElement theElement, UniversalFileSystemMiner miner, DataStore dataStore, boolean batch, DataElement status)
{
+ super(dataStore);
this._theElement = theElement;
this._miner = miner;
- this._dataStore = dataStore;
this._status = status;
this._batch = batch;
}
@@ -75,6 +75,7 @@ public class DeleteThread extends Thread implements ICancellableHandler {
public void run()
{
+ super.run();
if (_batch)
{
handleDeleteBatch();
@@ -124,7 +125,7 @@ public class DeleteThread extends Thread implements ICancellableHandler {
if (!deleteObj.exists()) {
thisStatus.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED_WITH_DOES_NOT_EXIST + "|" + deleteObj.getAbsolutePath()); //$NON-NLS-1$
UniversalServerUtilities.logError(CLASSNAME,
- "The object to delete does not exist", null); //$NON-NLS-1$
+ "The object to delete does not exist", null, _dataStore); //$NON-NLS-1$
} else {
try {
if (deleteObj.isFile()) {
@@ -147,7 +148,7 @@ public class DeleteThread extends Thread implements ICancellableHandler {
if (deleteObj.delete() == false) {
thisStatus.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED + "|" + deleteObj.getAbsolutePath()); //$NON-NLS-1$
UniversalServerUtilities.logError(CLASSNAME,
- "Deletion of dir fialed", null); //$NON-NLS-1$
+ "Deletion of dir fialed", null, _dataStore); //$NON-NLS-1$
} else {
_dataStore.deleteObjects(subject);
DataElement parent = subject.getParent();
@@ -160,13 +161,13 @@ public class DeleteThread extends Thread implements ICancellableHandler {
.logError(
CLASSNAME,
"The object to delete is neither a File or Folder! in handleDelete", //$NON-NLS-1$
- null);
+ null, _dataStore);
}
} catch (Exception e) {
thisStatus.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED_WITH_EXCEPTION + "|" + deleteObj.getAbsolutePath()); //$NON-NLS-1$
thisStatus.setAttribute(DE.A_VALUE, e.getLocalizedMessage());
UniversalServerUtilities.logError(CLASSNAME,
- "Delete of the object failed", e); //$NON-NLS-1$
+ "Delete of the object failed", e, _dataStore); //$NON-NLS-1$
}
}
_dataStore.refresh(subject);
@@ -219,14 +220,14 @@ public class DeleteThread extends Thread implements ICancellableHandler {
if (!(list[i].delete())) {
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
UniversalServerUtilities.logWarning(CLASSNAME,
- "Deletion of dir failed"); //$NON-NLS-1$
+ "Deletion of dir failed", _dataStore); //$NON-NLS-1$
}
} else {
deleteDir(list[i], status);
if (!(list[i].delete())) {
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
UniversalServerUtilities.logWarning(CLASSNAME,
- "Deletion of dir failed"); //$NON-NLS-1$
+ "Deletion of dir failed", _dataStore); //$NON-NLS-1$
}
}
}
@@ -234,7 +235,7 @@ public class DeleteThread extends Thread implements ICancellableHandler {
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED_WITH_EXCEPTION);
status.setAttribute(DE.A_VALUE, e.getLocalizedMessage());
UniversalServerUtilities.logError(CLASSNAME,
- "Deletion of dir failed", e); //$NON-NLS-1$
+ "Deletion of dir failed", e, _dataStore); //$NON-NLS-1$
}
}
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/FileQueryThread.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/FileQueryThread.java
index 2baadea0021..7120ed9cf00 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/FileQueryThread.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/FileQueryThread.java
@@ -11,6 +11,7 @@
* Contributors:
* David McKnight (IBM) - [192884] Should not use filter to determine previous query results
* David McKnight (IBM) - [209387] Should not delete elements for files that still exist (but are filtered out)
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
********************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@@ -61,6 +62,8 @@ public class FileQueryThread extends QueryThread
public void run()
{
+ super.run();
+
doQueryAll();
if (!isCancelled())
@@ -365,7 +368,7 @@ public class FileQueryThread extends QueryThread
} catch (Exception e) {
e.printStackTrace();
UniversalServerUtilities.logError(UniversalFileSystemMiner.CLASSNAME,
- "createDataElement failed with exception - isFile ", e); //$NON-NLS-1$
+ "createDataElement failed with exception - isFile ", e, _dataStore); //$NON-NLS-1$
}
}
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/QueryThread.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/QueryThread.java
index bb27b22185a..97961884489 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/QueryThread.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/QueryThread.java
@@ -9,7 +9,7 @@
* component that contains this file: David McKnight.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
********************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@@ -17,26 +17,25 @@ import java.io.File;
import org.eclipse.dstore.core.model.DE;
import org.eclipse.dstore.core.model.DataElement;
-import org.eclipse.dstore.core.model.DataStore;
import org.eclipse.dstore.core.model.DataStoreResources;
+import org.eclipse.dstore.core.server.SecuredThread;
import org.eclipse.rse.dstore.universal.miners.ICancellableHandler;
import org.eclipse.rse.services.clientserver.IServiceConstants;
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
import org.eclipse.rse.services.clientserver.archiveutils.VirtualChild;
-public class QueryThread extends Thread implements ICancellableHandler {
+public class QueryThread extends SecuredThread implements ICancellableHandler {
protected DataElement _subject;
protected DataElement _status;
protected boolean _isCancelled = false;
protected boolean _isDone = false;
- protected DataStore _dataStore;
public QueryThread(DataElement subject, DataElement status)
{
+ super(subject.getDataStore());
_subject = subject;
- _dataStore = _subject.getDataStore();
_status = status;
}
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/RenameThread.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/RenameThread.java
index 5218260a76c..25ed22d205e 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/RenameThread.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/RenameThread.java
@@ -10,8 +10,8 @@
* component that contains this file: David McKnight.
*
* Contributors:
- * {Name} (company) - description of contribution.
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
*******************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@@ -28,12 +28,12 @@ import org.eclipse.rse.services.clientserver.SystemOperationMonitor;
import org.eclipse.rse.services.clientserver.archiveutils.AbsoluteVirtualPath;
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
import org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler;
+import org.eclipse.dstore.core.server.SecuredThread;
-public class RenameThread extends Thread implements ICancellableHandler {
+public class RenameThread extends SecuredThread implements ICancellableHandler {
protected DataElement _subject;
protected DataElement _status;
- private DataStore _dataStore;
protected UniversalFileSystemMiner _miner;
protected boolean _isCancelled = false;
@@ -45,14 +45,13 @@ public class RenameThread extends Thread implements ICancellableHandler {
public RenameThread(DataElement theElement, UniversalFileSystemMiner miner, DataStore dataStore, DataElement status)
{
+ super(dataStore);
this._subject = theElement;
this._miner = miner;
- this._dataStore = dataStore;
this._status = status;
}
-
public void cancel() {
_isCancelled = true;
@@ -72,6 +71,7 @@ public class RenameThread extends Thread implements ICancellableHandler {
public void run()
{
+ super.run();
handleRename();
_isDone = true;
}
@@ -134,7 +134,7 @@ public class RenameThread extends Thread implements ICancellableHandler {
} catch (Exception e) {
_status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
UniversalServerUtilities.logError(CLASSNAME,
- "handleRename failed", e); //$NON-NLS-1$
+ "handleRename failed", e, _dataStore); //$NON-NLS-1$
}
}
_dataStore.refresh(_subject);
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalDownloadHandler.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalDownloadHandler.java
index ebda5e903b6..d33bf47d936 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalDownloadHandler.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalDownloadHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,8 +12,8 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
*******************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@@ -37,13 +37,13 @@ import org.eclipse.rse.services.clientserver.IServiceConstants;
import org.eclipse.rse.services.clientserver.archiveutils.AbsoluteVirtualPath;
import org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler;
import org.eclipse.rse.services.clientserver.archiveutils.VirtualChild;
+import org.eclipse.dstore.core.server.SecuredThread;
-public class UniversalDownloadHandler extends Thread implements ICancellableHandler
+public class UniversalDownloadHandler extends SecuredThread implements ICancellableHandler
{
private boolean _isDone = false;
- private DataStore _dataStore;
private UniversalFileSystemMiner _miner;
private DataElement _status;
private DataElement _cmdElement;
@@ -52,14 +52,16 @@ public class UniversalDownloadHandler extends Thread implements ICancellableHand
public UniversalDownloadHandler(DataStore dataStore, UniversalFileSystemMiner miner, DataElement cmdElement,
DataElement status)
{
+ super(dataStore);
_miner = miner;
- _dataStore = dataStore;
_status = status;
_cmdElement = cmdElement;
}
public void run()
{
+ super.run();
+
handleDownload(_cmdElement, _status);
_isDone = true;
}
@@ -222,25 +224,25 @@ public class UniversalDownloadHandler extends Thread implements ICancellableHand
}
catch (FileNotFoundException e)
{
- UniversalServerUtilities.logError(UniversalFileSystemMiner.CLASSNAME, "handleDownload: error reading file " + remotePath, e); //$NON-NLS-1$
+ UniversalServerUtilities.logError(UniversalFileSystemMiner.CLASSNAME, "handleDownload: error reading file " + remotePath, e, _dataStore); //$NON-NLS-1$
resultType = IUniversalDataStoreConstants.DOWNLOAD_RESULT_FILE_NOT_FOUND_EXCEPTION;
resultMessage = e.getLocalizedMessage();
}
catch (UnsupportedEncodingException e)
{
- UniversalServerUtilities.logError(UniversalFileSystemMiner.CLASSNAME, "handleDownload: error reading file " + remotePath, e); //$NON-NLS-1$
+ UniversalServerUtilities.logError(UniversalFileSystemMiner.CLASSNAME, "handleDownload: error reading file " + remotePath, e, _dataStore); //$NON-NLS-1$
resultType = IUniversalDataStoreConstants.DOWNLOAD_RESULT_UNSUPPORTED_ENCODING_EXCEPTION;
resultMessage = e.getLocalizedMessage();
}
catch (IOException e)
{
- UniversalServerUtilities.logError(UniversalFileSystemMiner.CLASSNAME, "handleDownload: error reading file " + remotePath, e); //$NON-NLS-1$
+ UniversalServerUtilities.logError(UniversalFileSystemMiner.CLASSNAME, "handleDownload: error reading file " + remotePath, e, _dataStore); //$NON-NLS-1$
resultType = IUniversalDataStoreConstants.DOWNLOAD_RESULT_IO_EXCEPTION;
resultMessage = e.getLocalizedMessage();
}
catch (Exception e)
{
- UniversalServerUtilities.logError(UniversalFileSystemMiner.CLASSNAME, "handleDownload: error reading file " + remotePath, e); //$NON-NLS-1$
+ UniversalServerUtilities.logError(UniversalFileSystemMiner.CLASSNAME, "handleDownload: error reading file " + remotePath, e, _dataStore); //$NON-NLS-1$
resultType = IUniversalDataStoreConstants.DOWNLOAD_RESULT_EXCEPTION;
resultMessage = e.getLocalizedMessage();
}
@@ -256,7 +258,7 @@ public class UniversalDownloadHandler extends Thread implements ICancellableHand
}
catch (IOException e)
{
- UniversalServerUtilities.logError(UniversalFileSystemMiner.CLASSNAME, "handleDownload: error closing reader on " + remotePath, e); //$NON-NLS-1$
+ UniversalServerUtilities.logError(UniversalFileSystemMiner.CLASSNAME, "handleDownload: error closing reader on " + remotePath, e, _dataStore); //$NON-NLS-1$
resultType = IUniversalDataStoreConstants.DOWNLOAD_RESULT_IO_EXCEPTION;
resultMessage = e.getMessage();
}
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalSearchHandler.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalSearchHandler.java
index 42d7ab301bd..a4524527347 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalSearchHandler.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalSearchHandler.java
@@ -16,6 +16,7 @@
* David McKnight (IBM) - [190010] cancelling search
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
* David McKnight (IBM) - [214378] canonical path not required - problem is in the client
+ * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
*******************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@@ -44,8 +45,9 @@ import org.eclipse.rse.services.clientserver.search.SystemSearchFileNameMatcher;
import org.eclipse.rse.services.clientserver.search.SystemSearchLineMatch;
import org.eclipse.rse.services.clientserver.search.SystemSearchStringMatchLocator;
import org.eclipse.rse.services.clientserver.search.SystemSearchStringMatcher;
+import org.eclipse.dstore.core.server.SecuredThread;
-public class UniversalSearchHandler extends Thread implements ICancellableHandler
+public class UniversalSearchHandler extends SecuredThread implements ICancellableHandler
{
protected HashSet _alreadySearched;
@@ -54,8 +56,7 @@ public class UniversalSearchHandler extends Thread implements ICancellableHandle
protected boolean _isCancelled;
protected boolean _isDone;
protected int _depth = -1;
-
- protected DataStore _dataStore;
+
protected UniversalFileSystemMiner _miner;
protected DataElement _status;
@@ -74,7 +75,7 @@ public class UniversalSearchHandler extends Thread implements ICancellableHandle
protected boolean _fsCaseSensitive;
public UniversalSearchHandler(DataStore dataStore, UniversalFileSystemMiner miner, SystemSearchString searchString, boolean fsCaseSensitive, File theFile, DataElement status) {
- _dataStore = dataStore;
+ super(dataStore);
_miner = miner;
_searchString = searchString;
_fsCaseSensitive = fsCaseSensitive;
@@ -113,12 +114,12 @@ public class UniversalSearchHandler extends Thread implements ICancellableHandle
}
public void run() {
-
+ super.run();
try {
internalSearch(_rootFile, _depth);
}
catch (Exception e) {
- UniversalServerUtilities.logError(_miner.getName(), "Error occured when calling internal search", e); //$NON-NLS-1$
+ UniversalServerUtilities.logError(_miner.getName(), "Error occured when calling internal search", e, _dataStore); //$NON-NLS-1$
}
_isDone = true;
@@ -299,7 +300,7 @@ public class UniversalSearchHandler extends Thread implements ICancellableHandle
virtualchildren = ArchiveHandlerManager.getInstance().getContents(archive, virtualPath);
}
catch (IOException e) {
- UniversalServerUtilities.logError(_miner.getName(), "Error occured trying to get the canonical file", e); //$NON-NLS-1$
+ UniversalServerUtilities.logError(_miner.getName(), "Error occured trying to get the canonical file", e, _dataStore); //$NON-NLS-1$
}
if (virtualchildren != null) {
@@ -361,7 +362,7 @@ public class UniversalSearchHandler extends Thread implements ICancellableHandle
return foundMatches;
}
catch (Exception e) {
- UniversalServerUtilities.logError(_miner.getName(), "Error occured when trying to locate matches", e); //$NON-NLS-1$
+ UniversalServerUtilities.logError(_miner.getName(), "Error occured when trying to locate matches", e, _dataStore); //$NON-NLS-1$
remoteFile.setAttribute(DE.A_VALUE, e.getMessage());
return false;
}