Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 196617 Details for
Bug 220126
[dstore][api][breaking] Single process server for multiple clients
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Reattach for tracking purposes
patch for 220126.txt (text/plain), 88.22 KB, created by
Noriaki Takatsu
on 2011-05-25 21:47:36 EDT
(
hide
)
Description:
Reattach for tracking purposes
Filename:
MIME Type:
Creator:
Noriaki Takatsu
Created:
2011-05-25 21:47:36 EDT
Size:
88.22 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.dstore.core >Index: src/org/eclipse/dstore/core/miners/Miner.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/miners/Miner.java,v >retrieving revision 1.3 >diff -u -r1.3 Miner.java >--- src/org/eclipse/dstore/core/miners/Miner.java 24 May 2007 13:59:12 -0000 1.3 >+++ src/org/eclipse/dstore/core/miners/Miner.java 28 Mar 2008 15:25:28 -0000 >@@ -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 @@ > */ > public final void setDataStore(DataStore dataStore) > { >+ super.setDataStore(dataStore); > _dataStore = dataStore; > > DataElement root = _dataStore.getMinerRoot(); >Index: src/org/eclipse/dstore/core/miners/MinerThread.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/miners/MinerThread.java,v >retrieving revision 1.2 >diff -u -r1.2 MinerThread.java >--- src/org/eclipse/dstore/core/miners/MinerThread.java 24 May 2007 13:59:12 -0000 1.2 >+++ src/org/eclipse/dstore/core/miners/MinerThread.java 28 Mar 2008 15:25:28 -0000 >@@ -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 MinerThread() > { >- super(); >+ _isCancelled = false; >+ } >+ >+ /** >+ * Constructor with dataStore >+ */ >+ public MinerThread(DataStore dataStore) >+ { >+ super(dataStore); > _isCancelled = false; > } > >@@ -62,6 +73,7 @@ > */ > public void run() > { >+ super.run(); > Thread thisThread = Thread.currentThread(); > minerThread = thisThread; > //thisThread.setPriority(thisThread.getPriority()+1); >Index: src/org/eclipse/dstore/internal/core/util/Receiver.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/util/Receiver.java,v >retrieving revision 1.4 >diff -u -r1.4 Receiver.java >--- src/org/eclipse/dstore/internal/core/util/Receiver.java 10 Mar 2008 14:53:26 -0000 1.4 >+++ src/org/eclipse/dstore/internal/core/util/Receiver.java 28 Mar 2008 15:25:30 -0000 >@@ -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 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 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 void run() > { >+ super.run(); > try > { > while (!_canExit) >Index: src/org/eclipse/dstore/core/model/Handler.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/Handler.java,v >retrieving revision 1.4 >diff -u -r1.4 Handler.java >--- src/org/eclipse/dstore/core/model/Handler.java 24 May 2007 13:59:11 -0000 1.4 >+++ src/org/eclipse/dstore/core/model/Handler.java 28 Mar 2008 15:25:30 -0000 >@@ -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 void setDataStore(DataStore dataStore) > { >- _dataStore = dataStore; >+ super.setDataStore(dataStore); > } > > /** >@@ -113,6 +114,7 @@ > */ > public void run() > { >+ super.run(); > while (_keepRunning) > { > /* >Index: src/org/eclipse/dstore/core/model/DataStore.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataStore.java,v >retrieving revision 1.28 >diff -u -r1.28 DataStore.java >--- src/org/eclipse/dstore/core/model/DataStore.java 13 Mar 2008 19:42:07 -0000 1.28 >+++ src/org/eclipse/dstore/core/model/DataStore.java 28 Mar 2008 15:25:30 -0000 >@@ -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 @@ > private int _serverMinor; > > private List _lastCreatedElements; >+ private Client _client; > > /** > * Creates a new <code>DataStore</code> instance >@@ -4384,4 +4386,25 @@ > } > } > >+ /** >+ * 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; >+ } >+ >+ > } >Index: src/org/eclipse/dstore/internal/core/server/ConnectionEstablisher.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/server/ConnectionEstablisher.java,v >retrieving revision 1.4 >diff -u -r1.4 ConnectionEstablisher.java >--- src/org/eclipse/dstore/internal/core/server/ConnectionEstablisher.java 10 Mar 2008 19:17:54 -0000 1.4 >+++ src/org/eclipse/dstore/internal/core/server/ConnectionEstablisher.java 28 Mar 2008 15:25:30 -0000 >@@ -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 @@ > > private int _maxConnections; > private int _timeout; >+ private String _msg; > > > /** >@@ -139,6 +141,31 @@ > { > 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 @@ > _updateHandler.finish(); > _dataStore.finish(); > System.out.println(ServerReturnCodes.RC_FINISHED); >- System.exit(0); >+ //System.exit(0); > } > } > >Index: src/org/eclipse/dstore/core/server/Server.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/Server.java,v >retrieving revision 1.5 >diff -u -r1.5 Server.java >--- src/org/eclipse/dstore/core/server/Server.java 24 May 2007 13:59:12 -0000 1.5 >+++ src/org/eclipse/dstore/core/server/Server.java 28 Mar 2008 15:25:30 -0000 >@@ -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 @@ > * the DataStore. > * > */ >-public class Server >+public class Server implements Runnable > { > > private ConnectionEstablisher _establisher; >@@ -161,4 +161,15 @@ > { > _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; >+ } >+ > } >Index: src/org/eclipse/dstore/core/server/ISystemService.java >=================================================================== >RCS file: src/org/eclipse/dstore/core/server/ISystemService.java >diff -N src/org/eclipse/dstore/core/server/ISystemService.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/dstore/core/server/ISystemService.java 1 Jan 1970 00:00:00 -0000 >@@ -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); >+} >Index: src/org/eclipse/dstore/core/server/SystemServiceManager.java >=================================================================== >RCS file: src/org/eclipse/dstore/core/server/SystemServiceManager.java >diff -N src/org/eclipse/dstore/core/server/SystemServiceManager.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/dstore/core/server/SystemServiceManager.java 1 Jan 1970 00:00:00 -0000 >@@ -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; >+ } >+ >+ >+} >Index: src/org/eclipse/dstore/core/server/SecuredThread.java >=================================================================== >RCS file: src/org/eclipse/dstore/core/server/SecuredThread.java >diff -N src/org/eclipse/dstore/core/server/SecuredThread.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/dstore/core/server/SecuredThread.java 1 Jan 1970 00:00:00 -0000 >@@ -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 <code>setDataStore(DataStore)</code>. >+ */ >+ 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 <code>ISystemService.setThreadSecurity(Client)</code> is called before <code>Thread.run()</code> >+ * is called. >+ * >+ * If a Runnable was passed into the constructor for SecuredThread then, when <code>Thread.run()</code> >+ * 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(); >+ } >+ >+} >+ >Index: src/org/eclipse/dstore/core/model/Client.java >=================================================================== >RCS file: src/org/eclipse/dstore/core/model/Client.java >diff -N src/org/eclipse/dstore/core/model/Client.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/dstore/core/model/Client.java 1 Jan 1970 00:00:00 -0000 >@@ -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); >+ } >+ >+} >+ >Index: src/org/eclipse/dstore/core/server/IServerLogger.java >=================================================================== >RCS file: src/org/eclipse/dstore/core/server/IServerLogger.java >diff -N src/org/eclipse/dstore/core/server/IServerLogger.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/dstore/core/server/IServerLogger.java 1 Jan 1970 00:00:00 -0000 >@@ -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); >+} >#P org.eclipse.rse.services.dstore >Index: miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalDownloadHandler.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalDownloadHandler.java,v >retrieving revision 1.4 >diff -u -r1.4 UniversalDownloadHandler.java >--- miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalDownloadHandler.java 14 Nov 2007 17:56:31 -0000 1.4 >+++ miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalDownloadHandler.java 28 Mar 2008 15:25:35 -0000 >@@ -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.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 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 @@ > } > 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 @@ > } > 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(); > } >Index: miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CreateFileThread.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CreateFileThread.java,v >retrieving revision 1.1 >diff -u -r1.1 CreateFileThread.java >--- miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CreateFileThread.java 19 Dec 2007 03:04:33 -0000 1.1 >+++ miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CreateFileThread.java 28 Mar 2008 15:25:35 -0000 >@@ -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.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 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 void run() > { >+ super.run(); >+ > handleCreateFile(); > _isDone = true; > } >@@ -102,7 +104,7 @@ > + 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 @@ > _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); > } > } >Index: miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CreateFolderThread.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CreateFolderThread.java,v >retrieving revision 1.1 >diff -u -r1.1 CreateFolderThread.java >--- miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CreateFolderThread.java 19 Dec 2007 03:04:33 -0000 1.1 >+++ miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CreateFolderThread.java 28 Mar 2008 15:25:35 -0000 >@@ -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.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 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 void run() > { >+ super.run(); > handleCreateFile(); > _isDone = true; > } >@@ -107,7 +108,7 @@ > } > 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 @@ > > } 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); > } > } >Index: miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/FileQueryThread.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/FileQueryThread.java,v >retrieving revision 1.3 >diff -u -r1.3 FileQueryThread.java >--- miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/FileQueryThread.java 12 Nov 2007 20:09:36 -0000 1.3 >+++ miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/FileQueryThread.java 28 Mar 2008 15:25:35 -0000 >@@ -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 void run() > { >+ super.run(); >+ > doQueryAll(); > > if (!isCancelled()) >@@ -365,7 +368,7 @@ > } 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$ > } > > } >Index: miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopyThread.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopyThread.java,v >retrieving revision 1.3 >diff -u -r1.3 CopyThread.java >--- miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopyThread.java 12 Feb 2008 23:42:08 -0000 1.3 >+++ miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopyThread.java 28 Mar 2008 15:25:35 -0000 >@@ -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.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 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 @@ > } > 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()); > } >Index: miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/DeleteThread.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/DeleteThread.java,v >retrieving revision 1.4 >diff -u -r1.4 DeleteThread.java >--- miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/DeleteThread.java 12 Feb 2008 23:42:08 -0000 1.4 >+++ miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/DeleteThread.java 28 Mar 2008 15:25:35 -0000 >@@ -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.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 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 void run() > { >+ super.run(); > if (_batch) > { > handleDeleteBatch(); >@@ -124,7 +125,7 @@ > 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 @@ > 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 @@ > .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 @@ > 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 @@ > 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$ > } > } > >Index: miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopySingleThread.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopySingleThread.java,v >retrieving revision 1.3 >diff -u -r1.3 CopySingleThread.java >--- miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopySingleThread.java 12 Feb 2008 23:42:08 -0000 1.3 >+++ miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopySingleThread.java 28 Mar 2008 15:25:34 -0000 >@@ -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 void run() > { >+ super.run(); > handleCopy(); > _isDone = true; > } >Index: miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/ArchiveQueryThread.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/ArchiveQueryThread.java,v >retrieving revision 1.4 >diff -u -r1.4 ArchiveQueryThread.java >--- miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/ArchiveQueryThread.java 11 Jan 2008 02:49:58 -0000 1.4 >+++ miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/ArchiveQueryThread.java 28 Mar 2008 15:25:34 -0000 >@@ -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 void run() { >+ super.run(); >+ > doQueryAll(); > > if (!isCancelled()) { >@@ -333,7 +335,7 @@ > 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 > >Index: miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/RenameThread.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/RenameThread.java,v >retrieving revision 1.3 >diff -u -r1.3 RenameThread.java >--- miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/RenameThread.java 12 Feb 2008 23:42:08 -0000 1.3 >+++ miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/RenameThread.java 28 Mar 2008 15:25:35 -0000 >@@ -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.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 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 void run() > { >+ super.run(); > handleRename(); > _isDone = true; > } >@@ -134,7 +134,7 @@ > } 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); >Index: miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/QueryThread.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/QueryThread.java,v >retrieving revision 1.1 >diff -u -r1.1 QueryThread.java >--- miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/QueryThread.java 9 Jul 2007 17:59:35 -0000 1.1 >+++ miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/QueryThread.java 28 Mar 2008 15:25:35 -0000 >@@ -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 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; > } > >Index: miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalSearchHandler.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalSearchHandler.java,v >retrieving revision 1.11 >diff -u -r1.11 UniversalSearchHandler.java >--- miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalSearchHandler.java 12 Feb 2008 23:42:08 -0000 1.11 >+++ miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalSearchHandler.java 28 Mar 2008 15:25:35 -0000 >@@ -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.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 @@ > protected boolean _isCancelled; > protected boolean _isDone; > protected int _depth = -1; >- >- protected DataStore _dataStore; >+ > protected UniversalFileSystemMiner _miner; > protected DataElement _status; > >@@ -74,7 +75,7 @@ > 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 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 @@ > 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 @@ > 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; > } >Index: miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopyBatchThread.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopyBatchThread.java,v >retrieving revision 1.1 >diff -u -r1.1 CopyBatchThread.java >--- miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopyBatchThread.java 19 Dec 2007 03:04:33 -0000 1.1 >+++ miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/CopyBatchThread.java 28 Mar 2008 15:25:34 -0000 >@@ -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 void run() > { >+ super.run(); > handleCopyBatch(); > _isDone = true; > } >Index: miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java,v >retrieving revision 1.36 >diff -u -r1.36 UniversalFileSystemMiner.java >--- miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java 12 Mar 2008 13:54:49 -0000 1.36 >+++ miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java 28 Mar 2008 15:25:33 -0000 >@@ -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 @@ > 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 @@ > 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 @@ > } > // 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 @@ > 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 @@ > + 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 @@ > + 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 @@ > > } catch (Exception e) { > UniversalServerUtilities.logError(CLASSNAME, >- "handleSetreadOnly", e); //$NON-NLS-1$ >+ "handleSetreadOnly", e, _dataStore); //$NON-NLS-1$ > } > } > _dataStore.refresh(subject); >@@ -775,7 +776,7 @@ > > } catch (Exception e) { > UniversalServerUtilities.logError(CLASSNAME, >- "handleSetLastModified", e); //$NON-NLS-1$ >+ "handleSetLastModified", e, _dataStore); //$NON-NLS-1$ > } > } > _dataStore.refresh(subject); >@@ -933,7 +934,7 @@ > } > 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 @@ > 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 @@ > 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 @@ > } 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$ > } >Index: miners/org/eclipse/rse/dstore/universal/miners/ServerLogger.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/ServerLogger.java,v >retrieving revision 1.2 >diff -u -r1.2 ServerLogger.java >--- miners/org/eclipse/rse/dstore/universal/miners/ServerLogger.java 28 Nov 2006 17:26:30 -0000 1.2 >+++ miners/org/eclipse/rse/dstore/universal/miners/ServerLogger.java 28 Mar 2008 15:25:32 -0000 >@@ -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.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 @@ > 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 @@ > > > /** >- * 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 @@ > > > /** >- * 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 @@ > > > /** >- * 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 @@ > > > /** >- * 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) { >Index: miners/org/eclipse/rse/dstore/universal/miners/UniversalServerUtilities.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalServerUtilities.java,v >retrieving revision 1.4 >diff -u -r1.4 UniversalServerUtilities.java >--- miners/org/eclipse/rse/dstore/universal/miners/UniversalServerUtilities.java 28 Nov 2006 17:26:30 -0000 1.4 >+++ miners/org/eclipse/rse/dstore/universal/miners/UniversalServerUtilities.java 28 Mar 2008 15:25:33 -0000 >@@ -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 @@ > * > * @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 @@ > * > * @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 @@ > * > * @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 @@ > * > * @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 >Index: miners/org/eclipse/rse/dstore/universal/miners/CommandMiner.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/CommandMiner.java,v >retrieving revision 1.7 >diff -u -r1.7 CommandMiner.java >--- miners/org/eclipse/rse/dstore/universal/miners/CommandMiner.java 3 Dec 2007 17:05:09 -0000 1.7 >+++ miners/org/eclipse/rse/dstore/universal/miners/CommandMiner.java 28 Mar 2008 15:25:32 -0000 >@@ -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; >Index: miners/org/eclipse/rse/dstore/universal/miners/UniversalProcessMiner.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalProcessMiner.java,v >retrieving revision 1.3 >diff -u -r1.3 UniversalProcessMiner.java >--- miners/org/eclipse/rse/dstore/universal/miners/UniversalProcessMiner.java 3 Dec 2007 17:06:41 -0000 1.3 >+++ miners/org/eclipse/rse/dstore/universal/miners/UniversalProcessMiner.java 28 Mar 2008 15:25:33 -0000 >@@ -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 @@ > > 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 @@ > } > 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 @@ > } > 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 @@ > 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 @@ > 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); >Index: miners/org/eclipse/rse/dstore/universal/miners/EnvironmentMiner.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/EnvironmentMiner.java,v >retrieving revision 1.3 >diff -u -r1.3 EnvironmentMiner.java >--- miners/org/eclipse/rse/dstore/universal/miners/EnvironmentMiner.java 3 Dec 2007 17:05:26 -0000 1.3 >+++ miners/org/eclipse/rse/dstore/universal/miners/EnvironmentMiner.java 28 Mar 2008 15:25:32 -0000 >@@ -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 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 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 @@ > { > 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; >+ } > } >Index: miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java,v >retrieving revision 1.19 >diff -u -r1.19 CommandMinerThread.java >--- miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java 12 Feb 2008 23:42:07 -0000 1.19 >+++ miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java 28 Mar 2008 15:25:34 -0000 >@@ -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 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 @@ > */ > public class CommandMinerThread extends MinerThread > { >- >- > private DataElement _status; >- private DataStore _dataStore; > private String _invocation; > > private DataInputStream _stdInput; >@@ -70,7 +67,7 @@ > > 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 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 @@ > 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 @@ > > _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)) >Index: miners/org/eclipse/rse/internal/dstore/universal/miners/command/QueryPathThread.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/QueryPathThread.java,v >retrieving revision 1.4 >diff -u -r1.4 QueryPathThread.java >--- miners/org/eclipse/rse/internal/dstore/universal/miners/command/QueryPathThread.java 3 Dec 2007 17:07:22 -0000 1.4 >+++ miners/org/eclipse/rse/internal/dstore/universal/miners/command/QueryPathThread.java 28 Mar 2008 15:25:34 -0000 >@@ -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 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); > > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
mober.at+eclipse
:
iplog+
Actions:
View
Attachments on
bug 220126
:
93838
|
93840
|
93982
| 196617