mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-01 20:53:12 +02:00
[220126] [dstore][api][breaking] Single process server for multiple clients
This commit is contained in:
parent
fa1290c248
commit
9296837517
32 changed files with 648 additions and 191 deletions
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* 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;
|
package org.eclipse.dstore.core.miners;
|
||||||
|
@ -332,6 +332,7 @@ implements ISchemaExtender
|
||||||
*/
|
*/
|
||||||
public final void setDataStore(DataStore dataStore)
|
public final void setDataStore(DataStore dataStore)
|
||||||
{
|
{
|
||||||
|
super.setDataStore(dataStore);
|
||||||
_dataStore = dataStore;
|
_dataStore = dataStore;
|
||||||
|
|
||||||
DataElement root = _dataStore.getMinerRoot();
|
DataElement root = _dataStore.getMinerRoot();
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -12,15 +12,18 @@
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* 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;
|
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.
|
* 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;
|
private volatile Thread minerThread;
|
||||||
|
@ -31,7 +34,15 @@ public abstract class MinerThread extends Thread
|
||||||
*/
|
*/
|
||||||
public MinerThread()
|
public MinerThread()
|
||||||
{
|
{
|
||||||
super();
|
_isCancelled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor with dataStore
|
||||||
|
*/
|
||||||
|
public MinerThread(DataStore dataStore)
|
||||||
|
{
|
||||||
|
super(dataStore);
|
||||||
_isCancelled = false;
|
_isCancelled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +73,7 @@ public abstract class MinerThread extends Thread
|
||||||
*/
|
*/
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
super.run();
|
||||||
Thread thisThread = Thread.currentThread();
|
Thread thisThread = Thread.currentThread();
|
||||||
minerThread = thisThread;
|
minerThread = thisThread;
|
||||||
//thisThread.setPriority(thisThread.getPriority()+1);
|
//thisThread.setPriority(thisThread.getPriority()+1);
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -17,6 +17,7 @@
|
||||||
* David McKnight (IBM) - 202822 findDeleted should not be synchronized
|
* David McKnight (IBM) - 202822 findDeleted should not be synchronized
|
||||||
* David McKnight (IBM) [220123][dstore] Configurable timeout on irresponsiveness
|
* David McKnight (IBM) [220123][dstore] Configurable timeout on irresponsiveness
|
||||||
* David McKnight (IBM) - [222168][dstore] Buffer in DataElement is not sent
|
* 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;
|
package org.eclipse.dstore.core.model;
|
||||||
|
@ -159,6 +160,7 @@ public final class DataStore
|
||||||
private int _serverMinor;
|
private int _serverMinor;
|
||||||
|
|
||||||
private List _lastCreatedElements;
|
private List _lastCreatedElements;
|
||||||
|
private Client _client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new <code>DataStore</code> instance
|
* Creates a new <code>DataStore</code> 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -12,22 +12,23 @@
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* 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;
|
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 Handler class is the base class for the threaded mechanisms in
|
||||||
* the DataStore. This is a thread that periodically does some activity.
|
* the DataStore. This is a thread that periodically does some activity.
|
||||||
* The frequency of handling can be configured.
|
* The frequency of handling can be configured.
|
||||||
*/
|
*/
|
||||||
public abstract class Handler extends Thread
|
public abstract class Handler extends SecuredThread
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
protected int _waitIncrement;
|
protected int _waitIncrement;
|
||||||
protected DataStore _dataStore;
|
|
||||||
protected boolean _keepRunning;
|
protected boolean _keepRunning;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,7 +64,7 @@ public abstract class Handler extends Thread
|
||||||
*/
|
*/
|
||||||
public void setDataStore(DataStore dataStore)
|
public void setDataStore(DataStore dataStore)
|
||||||
{
|
{
|
||||||
_dataStore = dataStore;
|
super.setDataStore(dataStore);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,6 +114,7 @@ public abstract class Handler extends Thread
|
||||||
*/
|
*/
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
super.run();
|
||||||
while (_keepRunning)
|
while (_keepRunning)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* 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;
|
package org.eclipse.dstore.core.server;
|
||||||
|
@ -28,7 +28,7 @@ import org.eclipse.dstore.internal.core.server.ServerReturnCodes;
|
||||||
* the DataStore.
|
* the DataStore.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Server
|
public class Server implements Runnable
|
||||||
{
|
{
|
||||||
|
|
||||||
private ConnectionEstablisher _establisher;
|
private ConnectionEstablisher _establisher;
|
||||||
|
@ -161,4 +161,15 @@ public class Server
|
||||||
{
|
{
|
||||||
_establisher.start();
|
_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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -14,6 +14,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* David McKnight (IBM) [220123][dstore] Configurable timeout on irresponsiveness
|
* David McKnight (IBM) [220123][dstore] Configurable timeout on irresponsiveness
|
||||||
* David McKnight (IBM) [220892][dstore] Backward compatibility: Server and Daemon should support old clients
|
* 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;
|
package org.eclipse.dstore.internal.core.server;
|
||||||
|
@ -64,6 +65,7 @@ public class ConnectionEstablisher
|
||||||
|
|
||||||
private int _maxConnections;
|
private int _maxConnections;
|
||||||
private int _timeout;
|
private int _timeout;
|
||||||
|
private String _msg;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -139,6 +141,31 @@ public class ConnectionEstablisher
|
||||||
{
|
{
|
||||||
return _dataStore;
|
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
|
* Tells the connection establisher to clean up and shutdown
|
||||||
|
@ -155,7 +182,7 @@ public class ConnectionEstablisher
|
||||||
_updateHandler.finish();
|
_updateHandler.finish();
|
||||||
_dataStore.finish();
|
_dataStore.finish();
|
||||||
System.out.println(ServerReturnCodes.RC_FINISHED);
|
System.out.println(ServerReturnCodes.RC_FINISHED);
|
||||||
System.exit(0);
|
//System.exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -14,6 +14,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* David McKnight (IBM) [220123][dstore] Configurable timeout on irresponsiveness
|
* David McKnight (IBM) [220123][dstore] Configurable timeout on irresponsiveness
|
||||||
* David McKnight (IBM) [222003] Client remains connected after server terminates
|
* 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;
|
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.DataElement;
|
||||||
import org.eclipse.dstore.core.model.DataStore;
|
import org.eclipse.dstore.core.model.DataStore;
|
||||||
import org.eclipse.dstore.core.model.IDataStorePreferenceListener;
|
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
|
* This class is used for receiving data from a socket in the DataStore
|
||||||
* communication layer.
|
* communication layer.
|
||||||
*/
|
*/
|
||||||
public abstract class Receiver extends Thread implements IDataStorePreferenceListener
|
public abstract class Receiver extends SecuredThread implements IDataStorePreferenceListener
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
private Socket _socket;
|
private Socket _socket;
|
||||||
|
|
||||||
protected DataStore _dataStore;
|
|
||||||
|
|
||||||
private XMLparser _xmlParser;
|
private XMLparser _xmlParser;
|
||||||
private BufferedInputStream _in;
|
private BufferedInputStream _in;
|
||||||
|
|
||||||
|
@ -51,9 +51,9 @@ public abstract class Receiver extends Thread implements IDataStorePreferenceLis
|
||||||
*/
|
*/
|
||||||
public Receiver(Socket socket, DataStore dataStore)
|
public Receiver(Socket socket, DataStore dataStore)
|
||||||
{
|
{
|
||||||
|
super(dataStore);
|
||||||
setName("DStore Receiver"+getName()); //$NON-NLS-1$
|
setName("DStore Receiver"+getName()); //$NON-NLS-1$
|
||||||
_socket = socket;
|
_socket = socket;
|
||||||
_dataStore = dataStore;
|
|
||||||
_canExit = false;
|
_canExit = false;
|
||||||
_xmlParser = new XMLparser(dataStore);
|
_xmlParser = new XMLparser(dataStore);
|
||||||
|
|
||||||
|
@ -107,6 +107,7 @@ public abstract class Receiver extends Thread implements IDataStorePreferenceLis
|
||||||
*/
|
*/
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
super.run();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
while (!_canExit)
|
while (!_canExit)
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -15,6 +15,7 @@
|
||||||
* David McKnight (IBM) - [191599] use specified encoding for shell
|
* David McKnight (IBM) - [191599] use specified encoding for shell
|
||||||
* David McKnight (IBM) - [202822] canceled output should be created before thread cleanup
|
* 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
|
* 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;
|
package org.eclipse.rse.dstore.universal.miners;
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -14,11 +14,13 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
* {Name} (company) - description of contribution.
|
||||||
* David McKnight (IBM) - [196624] dstore miner IDs should be String constants rather than dynamic lookup
|
* 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;
|
package org.eclipse.rse.dstore.universal.miners;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -27,12 +29,13 @@ import java.util.List;
|
||||||
import org.eclipse.dstore.core.miners.Miner;
|
import org.eclipse.dstore.core.miners.Miner;
|
||||||
import org.eclipse.dstore.core.model.DE;
|
import org.eclipse.dstore.core.model.DE;
|
||||||
import org.eclipse.dstore.core.model.DataElement;
|
import org.eclipse.dstore.core.model.DataElement;
|
||||||
|
import org.eclipse.dstore.core.model.Client;
|
||||||
|
|
||||||
|
|
||||||
public class EnvironmentMiner extends Miner
|
public class EnvironmentMiner extends Miner
|
||||||
{
|
{
|
||||||
private DataElement _system;
|
private DataElement _system;
|
||||||
|
|
||||||
|
|
||||||
public void load()
|
public void load()
|
||||||
{
|
{
|
||||||
getSystemNode();
|
getSystemNode();
|
||||||
|
@ -56,6 +59,19 @@ public class EnvironmentMiner extends Miner
|
||||||
|
|
||||||
public void extendSchema(DataElement schemaRoot)
|
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$
|
DataElement envVar = _dataStore.createObjectDescriptor(schemaRoot, "Environment Variable"); //$NON-NLS-1$
|
||||||
_dataStore.createReference(envVar, _dataStore.createRelationDescriptor(schemaRoot,"Parent Environment")); //$NON-NLS-1$
|
_dataStore.createReference(envVar, _dataStore.createRelationDescriptor(schemaRoot,"Parent Environment")); //$NON-NLS-1$
|
||||||
DataElement containerObjectD = _dataStore.findObjectDescriptor("Container Object"); //$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$
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* 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.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* 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;
|
package org.eclipse.rse.dstore.universal.miners;
|
||||||
|
@ -22,9 +22,14 @@ import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.ResourceBundle;
|
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
|
// Constants for logging - for use in rsecomm.properties
|
||||||
|
@ -44,7 +49,9 @@ public class ServerLogger {
|
||||||
private static int log_level = 0;
|
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) {
|
public ServerLogger(String logPathName) {
|
||||||
if (_logFileStream == null) {
|
if (_logFileStream == null) {
|
||||||
|
@ -84,13 +91,12 @@ public class ServerLogger {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* logInfo
|
* Logs an informational message
|
||||||
*
|
|
||||||
* @param minerName
|
|
||||||
*
|
*
|
||||||
|
* @param minerName the name of the miner associated with this message
|
||||||
* @param message Message text to be logged.
|
* @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 (log_level >= LOG_INFO) {
|
||||||
if (_logFileStream != null) {
|
if (_logFileStream != null) {
|
||||||
synchronized(writeLock) {
|
synchronized(writeLock) {
|
||||||
|
@ -107,13 +113,12 @@ public class ServerLogger {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* logWarning
|
* Logs a warning message
|
||||||
*
|
|
||||||
* @param minerName
|
|
||||||
*
|
*
|
||||||
|
* @param minerName the name of the miner associated with this message
|
||||||
* @param message Message text to be logged.
|
* @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 (log_level >= LOG_WARNING) {
|
||||||
if (_logFileStream != null) {
|
if (_logFileStream != null) {
|
||||||
synchronized(writeLock) {
|
synchronized(writeLock) {
|
||||||
|
@ -130,15 +135,14 @@ public class ServerLogger {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* logError
|
* Logs an error message
|
||||||
*
|
|
||||||
* @param minerName
|
|
||||||
*
|
*
|
||||||
|
* @param minerName the name of the miner associated with this message
|
||||||
* @param message Message text to be logged.
|
* @param message Message text to be logged.
|
||||||
*
|
*
|
||||||
* @param exception Exception that generated the error. Used to print a stack trace.
|
* @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) {
|
if (_logFileStream != null) {
|
||||||
synchronized(writeLock) {
|
synchronized(writeLock) {
|
||||||
try {
|
try {
|
||||||
|
@ -156,13 +160,12 @@ public class ServerLogger {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* logDebugMessage
|
* Logs a debug message
|
||||||
*
|
|
||||||
* @param minerName
|
|
||||||
*
|
*
|
||||||
|
* @param minerName the name of the miner associated with this message
|
||||||
* @param message Message text to be logged.
|
* @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 (DEBUG && log_level == LOG_DEBUG) {
|
||||||
if (_logFileStream != null) {
|
if (_logFileStream != null) {
|
||||||
synchronized(writeLock) {
|
synchronized(writeLock) {
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
* Xuan Chen (IBM) - [194481] [dstore][Archive] Save Conflict After Renaming a File that is Open
|
* 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
|
* 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
|
* 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;
|
package org.eclipse.rse.dstore.universal.miners;
|
||||||
|
@ -120,7 +121,7 @@ public class UniversalFileSystemMiner extends Miner {
|
||||||
DataElement status = getCommandStatus(theElement);
|
DataElement status = getCommandStatus(theElement);
|
||||||
DataElement subject = getCommandArgument(theElement, 0);
|
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);
|
String queryType = (String) subject.getElementProperty(DE.P_TYPE);
|
||||||
boolean caseSensitive = !_isWindows;
|
boolean caseSensitive = !_isWindows;
|
||||||
|
@ -222,7 +223,7 @@ public class UniversalFileSystemMiner extends Miner {
|
||||||
return handleSetFilePermissions(subject, newPermissions, status);
|
return handleSetFilePermissions(subject, newPermissions, status);
|
||||||
} else {
|
} else {
|
||||||
UniversalServerUtilities.logError(CLASSNAME,
|
UniversalServerUtilities.logError(CLASSNAME,
|
||||||
"Invalid query to handlecommand", null); //$NON-NLS-1$
|
"Invalid query to handlecommand", null, _dataStore); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return statusDone(status);
|
return statusDone(status);
|
||||||
}
|
}
|
||||||
|
@ -262,7 +263,7 @@ public class UniversalFileSystemMiner extends Miner {
|
||||||
}
|
}
|
||||||
// otherwise log error, and return as done
|
// otherwise log error, and return as done
|
||||||
else {
|
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);
|
return statusDone(status);
|
||||||
}
|
}
|
||||||
//If the subject is a virtual folder, we could not just use check file.exists() to determine if we need
|
//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
|
else
|
||||||
{
|
{
|
||||||
UniversalServerUtilities.logError(CLASSNAME,
|
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)
|
if (fileobj != null)
|
||||||
|
@ -478,7 +479,7 @@ public class UniversalFileSystemMiner extends Miner {
|
||||||
+ File.separatorChar + subject.getName());
|
+ File.separatorChar + subject.getName());
|
||||||
else
|
else
|
||||||
UniversalServerUtilities.logError(CLASSNAME,
|
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())
|
if (!fileobj.exists())
|
||||||
|
@ -535,7 +536,7 @@ public class UniversalFileSystemMiner extends Miner {
|
||||||
+ File.separatorChar + subject.getName());
|
+ File.separatorChar + subject.getName());
|
||||||
else
|
else
|
||||||
UniversalServerUtilities.logError(CLASSNAME,
|
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())
|
if (!fileobj.exists())
|
||||||
{
|
{
|
||||||
|
@ -733,7 +734,7 @@ public class UniversalFileSystemMiner extends Miner {
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
UniversalServerUtilities.logError(CLASSNAME,
|
UniversalServerUtilities.logError(CLASSNAME,
|
||||||
"handleSetreadOnly", e); //$NON-NLS-1$
|
"handleSetreadOnly", e, _dataStore); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_dataStore.refresh(subject);
|
_dataStore.refresh(subject);
|
||||||
|
@ -775,7 +776,7 @@ public class UniversalFileSystemMiner extends Miner {
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
UniversalServerUtilities.logError(CLASSNAME,
|
UniversalServerUtilities.logError(CLASSNAME,
|
||||||
"handleSetLastModified", e); //$NON-NLS-1$
|
"handleSetLastModified", e, _dataStore); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_dataStore.refresh(subject);
|
_dataStore.refresh(subject);
|
||||||
|
@ -933,7 +934,7 @@ public class UniversalFileSystemMiner extends Miner {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
UniversalServerUtilities.logError(CLASSNAME,
|
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);
|
return statusDone(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1048,7 +1049,7 @@ public class UniversalFileSystemMiner extends Miner {
|
||||||
status.setAttribute(DE.A_SOURCE, IServiceConstants.SUCCESS);
|
status.setAttribute(DE.A_SOURCE, IServiceConstants.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
UniversalServerUtilities.logWarning(CLASSNAME,
|
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));
|
subject.setAttribute(DE.A_SOURCE, setProperties(child));
|
||||||
status
|
status
|
||||||
.setAttribute(DE.A_SOURCE,
|
.setAttribute(DE.A_SOURCE,
|
||||||
|
@ -1226,7 +1227,7 @@ public class UniversalFileSystemMiner extends Miner {
|
||||||
socket.close();
|
socket.close();
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
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;
|
port = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1387,7 +1388,7 @@ public class UniversalFileSystemMiner extends Miner {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
UniversalServerUtilities.logError(CLASSNAME,
|
UniversalServerUtilities.logError(CLASSNAME,
|
||||||
"I/O error occured trying to read class file " + filePath, //$NON-NLS-1$
|
"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$
|
_dataStore.createObject(status, IUniversalDataStoreConstants.TYPE_QUALIFIED_CLASSNAME, "null"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -12,8 +12,8 @@
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
|
||||||
* David McKnight (IBM) - [196624] dstore miner IDs should be String constants rather than dynamic lookup
|
* 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;
|
package org.eclipse.rse.dstore.universal.miners;
|
||||||
|
@ -89,7 +89,7 @@ public class UniversalProcessMiner extends Miner
|
||||||
|
|
||||||
if (subject == null) {
|
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$
|
status.setAttribute(DE.A_NAME, "done"); //$NON-NLS-1$
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,8 @@ public class UniversalProcessMiner extends Miner
|
||||||
}
|
}
|
||||||
else
|
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$
|
status.setAttribute(DE.A_NAME, "done"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,13 +126,15 @@ public class UniversalProcessMiner extends Miner
|
||||||
}
|
}
|
||||||
else
|
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$
|
status.setAttribute(DE.A_NAME, "done"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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$
|
status.setAttribute(DE.A_NAME, "done"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +222,7 @@ public class UniversalProcessMiner extends Miner
|
||||||
lookupProcesses(pfs, subject);
|
lookupProcesses(pfs, subject);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
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_VALUE, e.getMessage());
|
||||||
status.setAttribute(DE.A_NAME, "done"); //$NON-NLS-1$
|
status.setAttribute(DE.A_NAME, "done"); //$NON-NLS-1$
|
||||||
_dataStore.refresh(status);
|
_dataStore.refresh(status);
|
||||||
|
@ -396,7 +399,7 @@ public class UniversalProcessMiner extends Miner
|
||||||
subject.setAttribute(DE.A_VALUE, result.getAllProperties());
|
subject.setAttribute(DE.A_VALUE, result.getAllProperties());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} 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_VALUE, e.getMessage());
|
||||||
status.setAttribute(DE.A_NAME, "done"); //$NON-NLS-1$
|
status.setAttribute(DE.A_NAME, "done"); //$NON-NLS-1$
|
||||||
_dataStore.refresh(status);
|
_dataStore.refresh(status);
|
||||||
|
|
|
@ -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
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* 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.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* 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;
|
package org.eclipse.rse.dstore.universal.miners;
|
||||||
|
|
||||||
import java.io.File;
|
import org.eclipse.dstore.core.model.DataStore;
|
||||||
|
|
||||||
public class UniversalServerUtilities {
|
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
|
* logInfo
|
||||||
*
|
*
|
||||||
|
@ -70,8 +28,9 @@ public class UniversalServerUtilities {
|
||||||
*
|
*
|
||||||
* @param message Message text to be logged.
|
* @param message Message text to be logged.
|
||||||
*/
|
*/
|
||||||
public static void logInfo(String minerName, String message) {
|
public static void logInfo(String minerName, String message, DataStore dataStore)
|
||||||
ServerLogger.logInfo(minerName, message);
|
{
|
||||||
|
dataStore.getClient().getLogger().logInfo(minerName, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,8 +40,9 @@ public class UniversalServerUtilities {
|
||||||
*
|
*
|
||||||
* @param message Message text to be logged.
|
* @param message Message text to be logged.
|
||||||
*/
|
*/
|
||||||
public static void logWarning(String minerName, String message) {
|
public static void logWarning(String minerName, String message, DataStore dataStore)
|
||||||
ServerLogger.logWarning(minerName, message);
|
{
|
||||||
|
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.
|
* @param exception Exception that generated the error. Used to print a stack trace.
|
||||||
*/
|
*/
|
||||||
public static void logError(String minerName, String message, Throwable exception) {
|
public static void logError(String minerName, String message, Throwable exception, DataStore dataStore)
|
||||||
ServerLogger.logError(minerName, message, exception);
|
{
|
||||||
|
dataStore.getClient().getLogger().logError(minerName, message, exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -105,8 +66,9 @@ public class UniversalServerUtilities {
|
||||||
*
|
*
|
||||||
* @param message Message text to be logged.
|
* @param message Message text to be logged.
|
||||||
*/
|
*/
|
||||||
public static void logDebugMessage(String minerName, String message) {
|
public static void logDebugMessage(String minerName, String message, DataStore dataStore)
|
||||||
ServerLogger.logDebugMessage(minerName, message);
|
{
|
||||||
|
dataStore.getClient().getLogger().logDebugMessage(minerName, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -15,6 +15,7 @@
|
||||||
* {Name} (company) - description of contribution.
|
* {Name} (company) - description of contribution.
|
||||||
* David McKnight (IBM) - [202822] updating cleanup
|
* David McKnight (IBM) - [202822] updating cleanup
|
||||||
* David McKnight (IBM) - [196624] dstore miner IDs should be String constants rather than dynamic lookup
|
* 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;
|
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.miners.MinerThread;
|
||||||
import org.eclipse.dstore.core.model.DE;
|
import org.eclipse.dstore.core.model.DE;
|
||||||
import org.eclipse.dstore.core.model.DataElement;
|
import org.eclipse.dstore.core.model.DataElement;
|
||||||
import org.eclipse.dstore.core.model.DataStore;
|
|
||||||
import org.eclipse.dstore.core.model.DataStoreAttributes;
|
import org.eclipse.dstore.core.model.DataStoreAttributes;
|
||||||
import org.eclipse.rse.dstore.universal.miners.CommandMiner;
|
import org.eclipse.rse.dstore.universal.miners.CommandMiner;
|
||||||
import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants;
|
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
|
public class CommandMinerThread extends MinerThread
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
private DataElement _status;
|
private DataElement _status;
|
||||||
private DataStore _dataStore;
|
|
||||||
private String _invocation;
|
private String _invocation;
|
||||||
|
|
||||||
private DataInputStream _stdInput;
|
private DataInputStream _stdInput;
|
||||||
|
@ -70,7 +67,7 @@ public class CommandMinerThread extends MinerThread
|
||||||
|
|
||||||
private DataElement _subject;
|
private DataElement _subject;
|
||||||
private String _cwdStr;
|
private String _cwdStr;
|
||||||
private OutputHandler _stdOutputHandler;
|
private OutputHandler _stdOutputHandler;
|
||||||
private OutputHandler _stdErrorHandler;
|
private OutputHandler _stdErrorHandler;
|
||||||
private boolean _isShell;
|
private boolean _isShell;
|
||||||
private boolean _isDone;
|
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)
|
public CommandMinerThread(DataElement theElement, String invocation, DataElement status, Patterns thePatterns, CommandMiner.CommandMinerDescriptors descriptors)
|
||||||
{
|
{
|
||||||
|
super(theElement.getDataStore());
|
||||||
_isShell = false;
|
_isShell = false;
|
||||||
_isDone = false;
|
_isDone = false;
|
||||||
_status = status;
|
_status = status;
|
||||||
_dataStore = theElement.getDataStore();
|
|
||||||
_descriptors = descriptors;
|
_descriptors = descriptors;
|
||||||
|
|
||||||
_subject = theElement;
|
_subject = theElement;
|
||||||
|
@ -187,6 +184,15 @@ public class CommandMinerThread extends MinerThread
|
||||||
isSHonZ = true;
|
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 = new OutputHandler(_stdInput, null, _isWindows || _isTTY, false, _isShell, this);
|
||||||
_stdOutputHandler.setWaitTime(100);
|
_stdOutputHandler.setWaitTime(100);
|
||||||
|
_stdOutputHandler.setDataStore(_dataStore);
|
||||||
_stdOutputHandler.start();
|
_stdOutputHandler.start();
|
||||||
|
|
||||||
_stdErrorHandler = new OutputHandler(_stdError, null, _isWindows || _isTTY, true, _isShell, this);
|
_stdErrorHandler = new OutputHandler(_stdError, null, _isWindows || _isTTY, true, _isShell, this);
|
||||||
_stdErrorHandler.setWaitTime(100);
|
_stdErrorHandler.setWaitTime(100);
|
||||||
|
_stdOutputHandler.setDataStore(_dataStore);
|
||||||
_stdErrorHandler.start();
|
_stdErrorHandler.start();
|
||||||
|
|
||||||
if (didLogin && !userHome.equals(_cwdStr))
|
if (didLogin && !userHome.equals(_cwdStr))
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -12,8 +12,8 @@
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
|
||||||
* David McKnight (IBM) - [196624] dstore miner IDs should be String constants rather than dynamic lookup
|
* 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;
|
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.DE;
|
||||||
import org.eclipse.dstore.core.model.DataElement;
|
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;
|
import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* QueryPathThread is used to determine available command completions
|
* QueryPathThread is used to determine available command completions
|
||||||
*/
|
*/
|
||||||
public class QueryPathThread extends Thread
|
public class QueryPathThread extends SecuredThread
|
||||||
{
|
{
|
||||||
|
|
||||||
private DataStore _dataStore;
|
|
||||||
private DataElement _status;
|
private DataElement _status;
|
||||||
|
|
||||||
public QueryPathThread(DataElement status)
|
public QueryPathThread(DataElement status)
|
||||||
{
|
{
|
||||||
super();
|
super(status.getDataStore());
|
||||||
_status = status;
|
_status = status;
|
||||||
_dataStore = status.getDataStore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
super.run();
|
||||||
|
|
||||||
getPossibleCommands(_status);
|
getPossibleCommands(_status);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
* component that contains this file: David McKnight.
|
* component that contains this file: David McKnight.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
|
||||||
* Kevin Doyle (IBM) - [191548] Deleting Read-Only directory removes it from view and displays no error
|
* 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
|
* 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;
|
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
|
||||||
|
|
||||||
|
@ -49,6 +49,8 @@ public class ArchiveQueryThread extends QueryThread {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
super.run();
|
||||||
|
|
||||||
doQueryAll();
|
doQueryAll();
|
||||||
|
|
||||||
if (!isCancelled()) {
|
if (!isCancelled()) {
|
||||||
|
@ -333,7 +335,7 @@ public class ArchiveQueryThread extends QueryThread {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
UniversalServerUtilities.logError(
|
UniversalServerUtilities.logError(
|
||||||
UniversalFileSystemMiner.CLASSNAME,
|
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
|
} // end currentObj not 0
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
* component that contains this file: David McKnight.
|
* component that contains this file: David McKnight.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
|
||||||
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
|
* 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;
|
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ public class CopyBatchThread extends CopyThread {
|
||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
super.run();
|
||||||
handleCopyBatch();
|
handleCopyBatch();
|
||||||
_isDone = true;
|
_isDone = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
* component that contains this file: David McKnight.
|
* component that contains this file: David McKnight.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
|
||||||
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
|
* 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;
|
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ public class CopySingleThread extends CopyThread {
|
||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
super.run();
|
||||||
handleCopy();
|
handleCopy();
|
||||||
_isDone = true;
|
_isDone = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
* component that contains this file: David McKnight.
|
* component that contains this file: David McKnight.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
|
||||||
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
|
* 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;
|
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.IServiceConstants;
|
||||||
import org.eclipse.rse.services.clientserver.PathUtility;
|
import org.eclipse.rse.services.clientserver.PathUtility;
|
||||||
import org.eclipse.rse.services.clientserver.SystemOperationMonitor;
|
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 targetFolder;
|
||||||
protected DataElement theElement;
|
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)
|
public CopyThread(DataElement targetFolder, DataElement theElement, UniversalFileSystemMiner miner, boolean isWindows, DataElement status)
|
||||||
{
|
{
|
||||||
|
super(theElement.getDataStore());
|
||||||
this.targetFolder = targetFolder;
|
this.targetFolder = targetFolder;
|
||||||
this.theElement = theElement;
|
this.theElement = theElement;
|
||||||
this.miner = miner;
|
this.miner = miner;
|
||||||
|
@ -224,7 +226,7 @@ public class CopyThread extends Thread implements ICancellableHandler {
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
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_SOURCE, IServiceConstants.FAILED);
|
||||||
status.setAttribute(DE.A_VALUE, e.getMessage());
|
status.setAttribute(DE.A_VALUE, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
* component that contains this file: David McKnight.
|
* component that contains this file: David McKnight.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
|
||||||
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
|
* 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;
|
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.AbsoluteVirtualPath;
|
||||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
||||||
import org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler;
|
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 _subject;
|
||||||
protected DataElement _status;
|
protected DataElement _status;
|
||||||
private DataStore _dataStore;
|
|
||||||
protected UniversalFileSystemMiner _miner;
|
protected UniversalFileSystemMiner _miner;
|
||||||
protected String _queryType;
|
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)
|
public CreateFileThread(DataElement theElement, String queryType, UniversalFileSystemMiner miner, DataStore dataStore, DataElement status)
|
||||||
{
|
{
|
||||||
|
super(dataStore);
|
||||||
this._subject = theElement;
|
this._subject = theElement;
|
||||||
this._miner = miner;
|
this._miner = miner;
|
||||||
this._dataStore = dataStore;
|
|
||||||
this._status = status;
|
this._status = status;
|
||||||
this._queryType = queryType;
|
this._queryType = queryType;
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,8 @@ public class CreateFileThread extends Thread implements ICancellableHandler {
|
||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
super.run();
|
||||||
|
|
||||||
handleCreateFile();
|
handleCreateFile();
|
||||||
_isDone = true;
|
_isDone = true;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +104,7 @@ public class CreateFileThread extends Thread implements ICancellableHandler {
|
||||||
+ File.separatorChar + _subject.getName());
|
+ File.separatorChar + _subject.getName());
|
||||||
else
|
else
|
||||||
UniversalServerUtilities.logError(CLASSNAME,
|
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)
|
if (filename != null)
|
||||||
{
|
{
|
||||||
|
@ -141,7 +143,7 @@ public class CreateFileThread extends Thread implements ICancellableHandler {
|
||||||
_status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
_status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
UniversalServerUtilities.logError(CLASSNAME,
|
UniversalServerUtilities.logError(CLASSNAME,
|
||||||
"handleCreateFile failed", e); //$NON-NLS-1$
|
"handleCreateFile failed", e, _dataStore); //$NON-NLS-1$
|
||||||
_status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
_status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
* component that contains this file: David McKnight.
|
* component that contains this file: David McKnight.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
|
||||||
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
|
* 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;
|
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.AbsoluteVirtualPath;
|
||||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
||||||
import org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler;
|
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 _subject;
|
||||||
protected DataElement _status;
|
protected DataElement _status;
|
||||||
private DataStore _dataStore;
|
|
||||||
protected UniversalFileSystemMiner _miner;
|
protected UniversalFileSystemMiner _miner;
|
||||||
protected String _queryType;
|
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)
|
public CreateFolderThread(DataElement theElement, String queryType, UniversalFileSystemMiner miner, DataStore dataStore, DataElement status)
|
||||||
{
|
{
|
||||||
|
super(dataStore);
|
||||||
this._subject = theElement;
|
this._subject = theElement;
|
||||||
this._miner = miner;
|
this._miner = miner;
|
||||||
this._dataStore = dataStore;
|
|
||||||
this._status = status;
|
this._status = status;
|
||||||
this._queryType = queryType;
|
this._queryType = queryType;
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,7 @@ public class CreateFolderThread extends Thread implements ICancellableHandler {
|
||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
super.run();
|
||||||
handleCreateFile();
|
handleCreateFile();
|
||||||
_isDone = true;
|
_isDone = true;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +108,7 @@ public class CreateFolderThread extends Thread implements ICancellableHandler {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
UniversalServerUtilities.logError(CLASSNAME,
|
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)
|
if (filename != null)
|
||||||
{
|
{
|
||||||
|
@ -132,7 +133,7 @@ public class CreateFolderThread extends Thread implements ICancellableHandler {
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
UniversalServerUtilities.logError(CLASSNAME,
|
UniversalServerUtilities.logError(CLASSNAME,
|
||||||
"handleCreateFolder failed", e); //$NON-NLS-1$
|
"handleCreateFolder failed", e, _dataStore); //$NON-NLS-1$
|
||||||
_status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
_status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
* component that contains this file: David McKnight.
|
* component that contains this file: David McKnight.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
|
||||||
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
|
* 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;
|
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.AbsoluteVirtualPath;
|
||||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
||||||
import org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler;
|
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 _theElement;
|
||||||
protected DataElement _status;
|
protected DataElement _status;
|
||||||
private DataStore _dataStore;
|
|
||||||
protected UniversalFileSystemMiner _miner;
|
protected UniversalFileSystemMiner _miner;
|
||||||
protected boolean _batch;
|
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)
|
public DeleteThread(DataElement theElement, UniversalFileSystemMiner miner, DataStore dataStore, boolean batch, DataElement status)
|
||||||
{
|
{
|
||||||
|
super(dataStore);
|
||||||
this._theElement = theElement;
|
this._theElement = theElement;
|
||||||
this._miner = miner;
|
this._miner = miner;
|
||||||
this._dataStore = dataStore;
|
|
||||||
this._status = status;
|
this._status = status;
|
||||||
this._batch = batch;
|
this._batch = batch;
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,7 @@ public class DeleteThread extends Thread implements ICancellableHandler {
|
||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
super.run();
|
||||||
if (_batch)
|
if (_batch)
|
||||||
{
|
{
|
||||||
handleDeleteBatch();
|
handleDeleteBatch();
|
||||||
|
@ -124,7 +125,7 @@ public class DeleteThread extends Thread implements ICancellableHandler {
|
||||||
if (!deleteObj.exists()) {
|
if (!deleteObj.exists()) {
|
||||||
thisStatus.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED_WITH_DOES_NOT_EXIST + "|" + deleteObj.getAbsolutePath()); //$NON-NLS-1$
|
thisStatus.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED_WITH_DOES_NOT_EXIST + "|" + deleteObj.getAbsolutePath()); //$NON-NLS-1$
|
||||||
UniversalServerUtilities.logError(CLASSNAME,
|
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 {
|
} else {
|
||||||
try {
|
try {
|
||||||
if (deleteObj.isFile()) {
|
if (deleteObj.isFile()) {
|
||||||
|
@ -147,7 +148,7 @@ public class DeleteThread extends Thread implements ICancellableHandler {
|
||||||
if (deleteObj.delete() == false) {
|
if (deleteObj.delete() == false) {
|
||||||
thisStatus.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED + "|" + deleteObj.getAbsolutePath()); //$NON-NLS-1$
|
thisStatus.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED + "|" + deleteObj.getAbsolutePath()); //$NON-NLS-1$
|
||||||
UniversalServerUtilities.logError(CLASSNAME,
|
UniversalServerUtilities.logError(CLASSNAME,
|
||||||
"Deletion of dir fialed", null); //$NON-NLS-1$
|
"Deletion of dir fialed", null, _dataStore); //$NON-NLS-1$
|
||||||
} else {
|
} else {
|
||||||
_dataStore.deleteObjects(subject);
|
_dataStore.deleteObjects(subject);
|
||||||
DataElement parent = subject.getParent();
|
DataElement parent = subject.getParent();
|
||||||
|
@ -160,13 +161,13 @@ public class DeleteThread extends Thread implements ICancellableHandler {
|
||||||
.logError(
|
.logError(
|
||||||
CLASSNAME,
|
CLASSNAME,
|
||||||
"The object to delete is neither a File or Folder! in handleDelete", //$NON-NLS-1$
|
"The object to delete is neither a File or Folder! in handleDelete", //$NON-NLS-1$
|
||||||
null);
|
null, _dataStore);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
thisStatus.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED_WITH_EXCEPTION + "|" + deleteObj.getAbsolutePath()); //$NON-NLS-1$
|
thisStatus.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED_WITH_EXCEPTION + "|" + deleteObj.getAbsolutePath()); //$NON-NLS-1$
|
||||||
thisStatus.setAttribute(DE.A_VALUE, e.getLocalizedMessage());
|
thisStatus.setAttribute(DE.A_VALUE, e.getLocalizedMessage());
|
||||||
UniversalServerUtilities.logError(CLASSNAME,
|
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);
|
_dataStore.refresh(subject);
|
||||||
|
@ -219,14 +220,14 @@ public class DeleteThread extends Thread implements ICancellableHandler {
|
||||||
if (!(list[i].delete())) {
|
if (!(list[i].delete())) {
|
||||||
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
||||||
UniversalServerUtilities.logWarning(CLASSNAME,
|
UniversalServerUtilities.logWarning(CLASSNAME,
|
||||||
"Deletion of dir failed"); //$NON-NLS-1$
|
"Deletion of dir failed", _dataStore); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
deleteDir(list[i], status);
|
deleteDir(list[i], status);
|
||||||
if (!(list[i].delete())) {
|
if (!(list[i].delete())) {
|
||||||
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
||||||
UniversalServerUtilities.logWarning(CLASSNAME,
|
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_SOURCE, IServiceConstants.FAILED_WITH_EXCEPTION);
|
||||||
status.setAttribute(DE.A_VALUE, e.getLocalizedMessage());
|
status.setAttribute(DE.A_VALUE, e.getLocalizedMessage());
|
||||||
UniversalServerUtilities.logError(CLASSNAME,
|
UniversalServerUtilities.logError(CLASSNAME,
|
||||||
"Deletion of dir failed", e); //$NON-NLS-1$
|
"Deletion of dir failed", e, _dataStore); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* David McKnight (IBM) - [192884] Should not use filter to determine previous query results
|
* 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)
|
* 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;
|
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
|
||||||
|
|
||||||
|
@ -61,6 +62,8 @@ public class FileQueryThread extends QueryThread
|
||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
super.run();
|
||||||
|
|
||||||
doQueryAll();
|
doQueryAll();
|
||||||
|
|
||||||
if (!isCancelled())
|
if (!isCancelled())
|
||||||
|
@ -365,7 +368,7 @@ public class FileQueryThread extends QueryThread
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
UniversalServerUtilities.logError(UniversalFileSystemMiner.CLASSNAME,
|
UniversalServerUtilities.logError(UniversalFileSystemMiner.CLASSNAME,
|
||||||
"createDataElement failed with exception - isFile ", e); //$NON-NLS-1$
|
"createDataElement failed with exception - isFile ", e, _dataStore); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
* component that contains this file: David McKnight.
|
* component that contains this file: David McKnight.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* 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;
|
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.DE;
|
||||||
import org.eclipse.dstore.core.model.DataElement;
|
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.model.DataStoreResources;
|
||||||
|
import org.eclipse.dstore.core.server.SecuredThread;
|
||||||
import org.eclipse.rse.dstore.universal.miners.ICancellableHandler;
|
import org.eclipse.rse.dstore.universal.miners.ICancellableHandler;
|
||||||
import org.eclipse.rse.services.clientserver.IServiceConstants;
|
import org.eclipse.rse.services.clientserver.IServiceConstants;
|
||||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
||||||
import org.eclipse.rse.services.clientserver.archiveutils.VirtualChild;
|
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 _subject;
|
||||||
protected DataElement _status;
|
protected DataElement _status;
|
||||||
|
|
||||||
protected boolean _isCancelled = false;
|
protected boolean _isCancelled = false;
|
||||||
protected boolean _isDone = false;
|
protected boolean _isDone = false;
|
||||||
protected DataStore _dataStore;
|
|
||||||
|
|
||||||
public QueryThread(DataElement subject, DataElement status)
|
public QueryThread(DataElement subject, DataElement status)
|
||||||
{
|
{
|
||||||
|
super(subject.getDataStore());
|
||||||
_subject = subject;
|
_subject = subject;
|
||||||
_dataStore = _subject.getDataStore();
|
|
||||||
_status = status;
|
_status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
* component that contains this file: David McKnight.
|
* component that contains this file: David McKnight.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
|
||||||
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
|
* 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;
|
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.AbsoluteVirtualPath;
|
||||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
||||||
import org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler;
|
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 _subject;
|
||||||
protected DataElement _status;
|
protected DataElement _status;
|
||||||
private DataStore _dataStore;
|
|
||||||
protected UniversalFileSystemMiner _miner;
|
protected UniversalFileSystemMiner _miner;
|
||||||
|
|
||||||
protected boolean _isCancelled = false;
|
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)
|
public RenameThread(DataElement theElement, UniversalFileSystemMiner miner, DataStore dataStore, DataElement status)
|
||||||
{
|
{
|
||||||
|
super(dataStore);
|
||||||
this._subject = theElement;
|
this._subject = theElement;
|
||||||
this._miner = miner;
|
this._miner = miner;
|
||||||
this._dataStore = dataStore;
|
|
||||||
this._status = status;
|
this._status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
_isCancelled = true;
|
_isCancelled = true;
|
||||||
|
@ -72,6 +71,7 @@ public class RenameThread extends Thread implements ICancellableHandler {
|
||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
super.run();
|
||||||
handleRename();
|
handleRename();
|
||||||
_isDone = true;
|
_isDone = true;
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ public class RenameThread extends Thread implements ICancellableHandler {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
_status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
_status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
|
||||||
UniversalServerUtilities.logError(CLASSNAME,
|
UniversalServerUtilities.logError(CLASSNAME,
|
||||||
"handleRename failed", e); //$NON-NLS-1$
|
"handleRename failed", e, _dataStore); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_dataStore.refresh(_subject);
|
_dataStore.refresh(_subject);
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -12,8 +12,8 @@
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
|
||||||
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
|
* 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;
|
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.AbsoluteVirtualPath;
|
||||||
import org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler;
|
import org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler;
|
||||||
import org.eclipse.rse.services.clientserver.archiveutils.VirtualChild;
|
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 boolean _isDone = false;
|
||||||
private DataStore _dataStore;
|
|
||||||
private UniversalFileSystemMiner _miner;
|
private UniversalFileSystemMiner _miner;
|
||||||
private DataElement _status;
|
private DataElement _status;
|
||||||
private DataElement _cmdElement;
|
private DataElement _cmdElement;
|
||||||
|
@ -52,14 +52,16 @@ public class UniversalDownloadHandler extends Thread implements ICancellableHand
|
||||||
public UniversalDownloadHandler(DataStore dataStore, UniversalFileSystemMiner miner, DataElement cmdElement,
|
public UniversalDownloadHandler(DataStore dataStore, UniversalFileSystemMiner miner, DataElement cmdElement,
|
||||||
DataElement status)
|
DataElement status)
|
||||||
{
|
{
|
||||||
|
super(dataStore);
|
||||||
_miner = miner;
|
_miner = miner;
|
||||||
_dataStore = dataStore;
|
|
||||||
_status = status;
|
_status = status;
|
||||||
_cmdElement = cmdElement;
|
_cmdElement = cmdElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
super.run();
|
||||||
|
|
||||||
handleDownload(_cmdElement, _status);
|
handleDownload(_cmdElement, _status);
|
||||||
_isDone = true;
|
_isDone = true;
|
||||||
}
|
}
|
||||||
|
@ -222,25 +224,25 @@ public class UniversalDownloadHandler extends Thread implements ICancellableHand
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException e)
|
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;
|
resultType = IUniversalDataStoreConstants.DOWNLOAD_RESULT_FILE_NOT_FOUND_EXCEPTION;
|
||||||
resultMessage = e.getLocalizedMessage();
|
resultMessage = e.getLocalizedMessage();
|
||||||
}
|
}
|
||||||
catch (UnsupportedEncodingException e)
|
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;
|
resultType = IUniversalDataStoreConstants.DOWNLOAD_RESULT_UNSUPPORTED_ENCODING_EXCEPTION;
|
||||||
resultMessage = e.getLocalizedMessage();
|
resultMessage = e.getLocalizedMessage();
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
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;
|
resultType = IUniversalDataStoreConstants.DOWNLOAD_RESULT_IO_EXCEPTION;
|
||||||
resultMessage = e.getLocalizedMessage();
|
resultMessage = e.getLocalizedMessage();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
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;
|
resultType = IUniversalDataStoreConstants.DOWNLOAD_RESULT_EXCEPTION;
|
||||||
resultMessage = e.getLocalizedMessage();
|
resultMessage = e.getLocalizedMessage();
|
||||||
}
|
}
|
||||||
|
@ -256,7 +258,7 @@ public class UniversalDownloadHandler extends Thread implements ICancellableHand
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
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;
|
resultType = IUniversalDataStoreConstants.DOWNLOAD_RESULT_IO_EXCEPTION;
|
||||||
resultMessage = e.getMessage();
|
resultMessage = e.getMessage();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
* David McKnight (IBM) - [190010] cancelling search
|
* David McKnight (IBM) - [190010] cancelling search
|
||||||
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
|
* 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
|
* 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;
|
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.SystemSearchLineMatch;
|
||||||
import org.eclipse.rse.services.clientserver.search.SystemSearchStringMatchLocator;
|
import org.eclipse.rse.services.clientserver.search.SystemSearchStringMatchLocator;
|
||||||
import org.eclipse.rse.services.clientserver.search.SystemSearchStringMatcher;
|
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;
|
protected HashSet _alreadySearched;
|
||||||
|
|
||||||
|
@ -54,8 +56,7 @@ public class UniversalSearchHandler extends Thread implements ICancellableHandle
|
||||||
protected boolean _isCancelled;
|
protected boolean _isCancelled;
|
||||||
protected boolean _isDone;
|
protected boolean _isDone;
|
||||||
protected int _depth = -1;
|
protected int _depth = -1;
|
||||||
|
|
||||||
protected DataStore _dataStore;
|
|
||||||
protected UniversalFileSystemMiner _miner;
|
protected UniversalFileSystemMiner _miner;
|
||||||
protected DataElement _status;
|
protected DataElement _status;
|
||||||
|
|
||||||
|
@ -74,7 +75,7 @@ public class UniversalSearchHandler extends Thread implements ICancellableHandle
|
||||||
protected boolean _fsCaseSensitive;
|
protected boolean _fsCaseSensitive;
|
||||||
|
|
||||||
public UniversalSearchHandler(DataStore dataStore, UniversalFileSystemMiner miner, SystemSearchString searchString, boolean fsCaseSensitive, File theFile, DataElement status) {
|
public UniversalSearchHandler(DataStore dataStore, UniversalFileSystemMiner miner, SystemSearchString searchString, boolean fsCaseSensitive, File theFile, DataElement status) {
|
||||||
_dataStore = dataStore;
|
super(dataStore);
|
||||||
_miner = miner;
|
_miner = miner;
|
||||||
_searchString = searchString;
|
_searchString = searchString;
|
||||||
_fsCaseSensitive = fsCaseSensitive;
|
_fsCaseSensitive = fsCaseSensitive;
|
||||||
|
@ -113,12 +114,12 @@ public class UniversalSearchHandler extends Thread implements ICancellableHandle
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
super.run();
|
||||||
try {
|
try {
|
||||||
internalSearch(_rootFile, _depth);
|
internalSearch(_rootFile, _depth);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
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;
|
_isDone = true;
|
||||||
|
@ -299,7 +300,7 @@ public class UniversalSearchHandler extends Thread implements ICancellableHandle
|
||||||
virtualchildren = ArchiveHandlerManager.getInstance().getContents(archive, virtualPath);
|
virtualchildren = ArchiveHandlerManager.getInstance().getContents(archive, virtualPath);
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
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) {
|
if (virtualchildren != null) {
|
||||||
|
@ -361,7 +362,7 @@ public class UniversalSearchHandler extends Thread implements ICancellableHandle
|
||||||
return foundMatches;
|
return foundMatches;
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
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());
|
remoteFile.setAttribute(DE.A_VALUE, e.getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue