mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-15 21:15:23 +02:00
[releng][cleanup] Fix @since tags according to API Tooling
This commit is contained in:
parent
2b1dd8f0b3
commit
35bbf33e9b
11 changed files with 225 additions and 201 deletions
|
@ -7,10 +7,10 @@
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
@ -56,11 +56,13 @@ import org.eclipse.dstore.internal.core.util.Sender;
|
||||||
import org.eclipse.dstore.internal.core.util.ssl.DStoreSSLContext;
|
import org.eclipse.dstore.internal.core.util.ssl.DStoreSSLContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ConnectionEstablisher is responsible for managing the server DataStore and
|
* ConnectionEstablisher is responsible for managing the server DataStore and
|
||||||
* facilitating the communication between client and server DataStores.
|
* facilitating the communication between client and server DataStores.
|
||||||
*
|
*
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||||
|
*
|
||||||
|
* @since 3.0 moved from non-API to API
|
||||||
*/
|
*/
|
||||||
public class ConnectionEstablisher
|
public class ConnectionEstablisher
|
||||||
{
|
{
|
||||||
|
@ -81,12 +83,12 @@ public class ConnectionEstablisher
|
||||||
private int _timeout;
|
private int _timeout;
|
||||||
private String _msg;
|
private String _msg;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the default ConnectionEstablisher. Communication occurs
|
* Creates the default ConnectionEstablisher. Communication occurs
|
||||||
* on a default port, there is no timeout and no ticket is required
|
* on a default port, there is no timeout and no ticket is required
|
||||||
* for a client to work with the DataStore.
|
* for a client to work with the DataStore.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public ConnectionEstablisher()
|
public ConnectionEstablisher()
|
||||||
{
|
{
|
||||||
|
@ -98,7 +100,7 @@ public class ConnectionEstablisher
|
||||||
* Creates a ConnectionEstablisher. Communication occurs
|
* Creates a ConnectionEstablisher. Communication occurs
|
||||||
* on the specified port, there is no timeout and no ticket is required
|
* on the specified port, there is no timeout and no ticket is required
|
||||||
* for a client to work with the DataStore.
|
* for a client to work with the DataStore.
|
||||||
*
|
*
|
||||||
* @param port the number of the socket port
|
* @param port the number of the socket port
|
||||||
*/
|
*/
|
||||||
public ConnectionEstablisher(String port)
|
public ConnectionEstablisher(String port)
|
||||||
|
@ -111,7 +113,7 @@ public class ConnectionEstablisher
|
||||||
* on the specified port, a timeout value indicates the idle wait
|
* on the specified port, a timeout value indicates the idle wait
|
||||||
* time before shutting down, and no ticket is required
|
* time before shutting down, and no ticket is required
|
||||||
* for a client to work with the DataStore.
|
* for a client to work with the DataStore.
|
||||||
*
|
*
|
||||||
* @param port the number of the socket port
|
* @param port the number of the socket port
|
||||||
* @param timeout the idle duration to wait before shutting down
|
* @param timeout the idle duration to wait before shutting down
|
||||||
*/
|
*/
|
||||||
|
@ -119,7 +121,7 @@ public class ConnectionEstablisher
|
||||||
{
|
{
|
||||||
setup(port, timeout, null);
|
setup(port, timeout, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a ConnectionEstablisher. Communication occurs
|
* Creates a ConnectionEstablisher. Communication occurs
|
||||||
* on the specified port, a timeout value indicates the idle wait
|
* on the specified port, a timeout value indicates the idle wait
|
||||||
|
@ -135,7 +137,7 @@ public class ConnectionEstablisher
|
||||||
setup(port, timeout, ticket);
|
setup(port, timeout, ticket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the run loop for the ConnectionEstablisher.
|
* Starts the run loop for the ConnectionEstablisher.
|
||||||
*/
|
*/
|
||||||
|
@ -155,10 +157,10 @@ public class ConnectionEstablisher
|
||||||
{
|
{
|
||||||
return _dataStore;
|
return _dataStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Server port opened for this client
|
* Return the Server port opened for this client
|
||||||
*
|
*
|
||||||
* @return the Server port opened for this client
|
* @return the Server port opened for this client
|
||||||
*/
|
*/
|
||||||
public int getServerPort()
|
public int getServerPort()
|
||||||
|
@ -167,13 +169,13 @@ public class ConnectionEstablisher
|
||||||
{
|
{
|
||||||
return _serverSocket.getLocalPort();
|
return _serverSocket.getLocalPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the connection status for this client
|
* Return the connection status for this client
|
||||||
*
|
*
|
||||||
* * @return the connection status for this client
|
* * @return the connection status for this client
|
||||||
*/
|
*/
|
||||||
public String getStatus()
|
public String getStatus()
|
||||||
|
@ -196,7 +198,7 @@ public class ConnectionEstablisher
|
||||||
_updateHandler.finish();
|
_updateHandler.finish();
|
||||||
_dataStore.finish();
|
_dataStore.finish();
|
||||||
System.out.println(ServerReturnCodes.RC_FINISHED);
|
System.out.println(ServerReturnCodes.RC_FINISHED);
|
||||||
|
|
||||||
if (SystemServiceManager.getInstance().getSystemService() == null)
|
if (SystemServiceManager.getInstance().getSystemService() == null)
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
@ -211,7 +213,7 @@ public class ConnectionEstablisher
|
||||||
Socket newSocket = _serverSocket.accept();
|
Socket newSocket = _serverSocket.accept();
|
||||||
if (_dataStore.usingSSL())
|
if (_dataStore.usingSSL())
|
||||||
{
|
{
|
||||||
|
|
||||||
// wait for connection
|
// wait for connection
|
||||||
SSLSocket sslSocket = (SSLSocket)newSocket;
|
SSLSocket sslSocket = (SSLSocket)newSocket;
|
||||||
sslSocket.setUseClientMode(false);
|
sslSocket.setUseClientMode(false);
|
||||||
|
@ -225,16 +227,16 @@ public class ConnectionEstablisher
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
doHandShake(newSocket);
|
doHandShake(newSocket);
|
||||||
newSocket.setKeepAlive(true);
|
newSocket.setKeepAlive(true);
|
||||||
|
|
||||||
ServerReceiver receiver = new ServerReceiver(newSocket, this);
|
ServerReceiver receiver = new ServerReceiver(newSocket, this);
|
||||||
_dataStore.addDataStorePreferenceListener(receiver);
|
_dataStore.addDataStorePreferenceListener(receiver);
|
||||||
|
|
||||||
if (_dataStore.getClient() != null)
|
if (_dataStore.getClient() != null)
|
||||||
_dataStore.getClient().setServerReceiver(receiver);
|
_dataStore.getClient().setServerReceiver(receiver);
|
||||||
|
|
||||||
Sender sender = new Sender(newSocket, _dataStore);
|
Sender sender = new Sender(newSocket, _dataStore);
|
||||||
|
|
||||||
// add this connection to list of elements
|
// add this connection to list of elements
|
||||||
|
@ -244,7 +246,7 @@ public class ConnectionEstablisher
|
||||||
receiver.start();
|
receiver.start();
|
||||||
|
|
||||||
if (_receivers.size() == 1)
|
if (_receivers.size() == 1)
|
||||||
{
|
{
|
||||||
_updateHandler.start();
|
_updateHandler.start();
|
||||||
_commandHandler.start();
|
_commandHandler.start();
|
||||||
}
|
}
|
||||||
|
@ -265,28 +267,28 @@ public class ConnectionEstablisher
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private ServerSocket createSocket(String portStr) throws UnknownHostException
|
private ServerSocket createSocket(String portStr) throws UnknownHostException
|
||||||
{
|
{
|
||||||
ServerSocket serverSocket = null;
|
ServerSocket serverSocket = null;
|
||||||
SSLContext sslContext = null;
|
SSLContext sslContext = null;
|
||||||
// port
|
// port
|
||||||
int port = 0;
|
int port = 0;
|
||||||
|
|
||||||
if (_dataStore.usingSSL())
|
if (_dataStore.usingSSL())
|
||||||
{
|
{
|
||||||
String keyStoreFileName = _dataStore.getKeyStoreLocation();
|
String keyStoreFileName = _dataStore.getKeyStoreLocation();
|
||||||
String keyStorePassword = _dataStore.getKeyStorePassword();
|
String keyStorePassword = _dataStore.getKeyStorePassword();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sslContext = DStoreSSLContext.getServerSSLContext(keyStoreFileName, keyStorePassword);
|
sslContext = DStoreSSLContext.getServerSSLContext(keyStoreFileName, keyStorePassword);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,14 +301,14 @@ public class ConnectionEstablisher
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
lPort = Integer.parseInt(range[0]);
|
lPort = Integer.parseInt(range[0]);
|
||||||
hPort = Integer.parseInt(range[1]);
|
hPort = Integer.parseInt(range[1]);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = lPort; i < hPort; i++)
|
for (int i = lPort; i < hPort; i++)
|
||||||
{
|
{
|
||||||
// create server socket from port
|
// create server socket from port
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -314,7 +316,7 @@ public class ConnectionEstablisher
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
serverSocket = sslContext.getServerSocketFactory().createServerSocket(i);
|
serverSocket = sslContext.getServerSocketFactory().createServerSocket(i);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -328,7 +330,7 @@ public class ConnectionEstablisher
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_dataStore.trace(e);
|
_dataStore.trace(e);
|
||||||
}
|
}
|
||||||
if (serverSocket != null && serverSocket.getLocalPort() > 0)
|
if (serverSocket != null && serverSocket.getLocalPort() > 0)
|
||||||
{
|
{
|
||||||
|
@ -339,14 +341,14 @@ public class ConnectionEstablisher
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
port = Integer.parseInt(portStr);
|
port = Integer.parseInt(portStr);
|
||||||
|
|
||||||
|
|
||||||
// create server socket from port
|
// create server socket from port
|
||||||
if (_dataStore.usingSSL() && sslContext != null)
|
if (_dataStore.usingSSL() && sslContext != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
serverSocket = sslContext.getServerSocketFactory().createServerSocket(port);
|
serverSocket = sslContext.getServerSocketFactory().createServerSocket(port);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -367,7 +369,7 @@ public class ConnectionEstablisher
|
||||||
}
|
}
|
||||||
return serverSocket;
|
return serverSocket;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the DataStore and initializes it's handlers and communications.
|
* Create the DataStore and initializes it's handlers and communications.
|
||||||
*
|
*
|
||||||
|
@ -386,16 +388,16 @@ public class ConnectionEstablisher
|
||||||
_updateHandler = new ServerUpdateHandler();
|
_updateHandler = new ServerUpdateHandler();
|
||||||
|
|
||||||
ISSLProperties sslProperties = new ServerSSLProperties();
|
ISSLProperties sslProperties = new ServerSSLProperties();
|
||||||
|
|
||||||
_dataStore = new DataStore(_serverAttributes, _commandHandler, _updateHandler, null);
|
_dataStore = new DataStore(_serverAttributes, _commandHandler, _updateHandler, null);
|
||||||
_dataStore.setSSLProperties(sslProperties);
|
_dataStore.setSSLProperties(sslProperties);
|
||||||
|
|
||||||
DataElement ticket = _dataStore.getTicket();
|
DataElement ticket = _dataStore.getTicket();
|
||||||
ticket.setAttribute(DE.A_NAME, ticketStr);
|
ticket.setAttribute(DE.A_NAME, ticketStr);
|
||||||
|
|
||||||
_updateHandler.setDataStore(_dataStore);
|
_updateHandler.setDataStore(_dataStore);
|
||||||
_commandHandler.setDataStore(_dataStore);
|
_commandHandler.setDataStore(_dataStore);
|
||||||
|
|
||||||
if (SystemServiceManager.getInstance().getSystemService() == null)
|
if (SystemServiceManager.getInstance().getSystemService() == null)
|
||||||
{
|
{
|
||||||
Client client = new Client();
|
Client client = new Client();
|
||||||
|
@ -409,14 +411,14 @@ public class ConnectionEstablisher
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
_serverSocket = createSocket(portStr);
|
_serverSocket = createSocket(portStr);
|
||||||
if (_serverSocket == null)
|
if (_serverSocket == null)
|
||||||
{
|
{
|
||||||
System.err.println(ServerReturnCodes.RC_BIND_ERROR);
|
System.err.println(ServerReturnCodes.RC_BIND_ERROR);
|
||||||
_msg = ServerReturnCodes.RC_BIND_ERROR;
|
_msg = ServerReturnCodes.RC_BIND_ERROR;
|
||||||
_continue = false;
|
_continue = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// timeout
|
// timeout
|
||||||
|
@ -428,12 +430,12 @@ public class ConnectionEstablisher
|
||||||
{
|
{
|
||||||
_timeout = 120000;
|
_timeout = 120000;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_timeout > 0)
|
if (_timeout > 0)
|
||||||
{
|
{
|
||||||
_serverSocket.setSoTimeout(_timeout);
|
_serverSocket.setSoTimeout(_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.err.println(ServerReturnCodes.RC_SUCCESS);
|
System.err.println(ServerReturnCodes.RC_SUCCESS);
|
||||||
System.err.println(_serverSocket.getLocalPort());
|
System.err.println(_serverSocket.getLocalPort());
|
||||||
try
|
try
|
||||||
|
@ -478,7 +480,7 @@ public class ConnectionEstablisher
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doHandShake(Socket socket)
|
private void doHandShake(Socket socket)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
BufferedWriter bwriter = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), DE.ENCODING_UTF_8));
|
BufferedWriter bwriter = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), DE.ENCODING_UTF_8));
|
||||||
|
@ -488,7 +490,7 @@ public class ConnectionEstablisher
|
||||||
String preferenceVersion = System.getProperty("DSTORE_VERSION"); //$NON-NLS-1$
|
String preferenceVersion = System.getProperty("DSTORE_VERSION"); //$NON-NLS-1$
|
||||||
if (preferenceVersion != null && preferenceVersion.length() > 0){
|
if (preferenceVersion != null && preferenceVersion.length() > 0){
|
||||||
version = preferenceVersion;
|
version = preferenceVersion;
|
||||||
}
|
}
|
||||||
writer.println(version);
|
writer.println(version);
|
||||||
writer.flush();
|
writer.flush();
|
||||||
}
|
}
|
||||||
|
@ -496,6 +498,6 @@ public class ConnectionEstablisher
|
||||||
{
|
{
|
||||||
System.out.println(e);
|
System.out.println(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: Noriaki Takatsu and Masao Nishimoto
|
* component that contains this file: Noriaki Takatsu and Masao Nishimoto
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
|
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -18,19 +18,22 @@ package org.eclipse.dstore.core.server;
|
||||||
|
|
||||||
import org.eclipse.dstore.core.model.Client;
|
import org.eclipse.dstore.core.model.Client;
|
||||||
|
|
||||||
public interface ISystemService
|
/**
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public interface ISystemService
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* This method is used to establish a thread-level security.
|
* This method is used to establish a thread-level security.
|
||||||
*
|
*
|
||||||
* @param client the object of the client
|
* @param client the object of the client
|
||||||
*/
|
*/
|
||||||
public void setThreadSecurity(Client client);
|
public void setThreadSecurity(Client client);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is used to execute run() in a thread assigned
|
* This method is used to execute run() in a thread assigned
|
||||||
* from thread pools.
|
* from thread pools.
|
||||||
*
|
*
|
||||||
* @param securedThread the securedThread object that implements
|
* @param securedThread the securedThread object that implements
|
||||||
* Runnable.
|
* Runnable.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: Noriaki Takatsu and Masao Nishimoto
|
* component that contains this file: Noriaki Takatsu and Masao Nishimoto
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
|
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
|
||||||
* Noriaki Takatsu (IBM) - [228335] [dstore][multithread] start() in SecuredThread class
|
* Noriaki Takatsu (IBM) - [228335] [dstore][multithread] start() in SecuredThread class
|
||||||
|
@ -21,32 +21,35 @@ import java.io.PrintWriter;
|
||||||
|
|
||||||
import org.eclipse.dstore.core.model.DataStore;
|
import org.eclipse.dstore.core.model.DataStore;
|
||||||
|
|
||||||
public class SecuredThread extends Thread
|
/**
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public class SecuredThread extends Thread
|
||||||
{
|
{
|
||||||
|
|
||||||
public DataStore _dataStore;
|
public DataStore _dataStore;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new SecuredThread without a DataStore. In this case, the 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>.
|
* needs to be set sometime after creation via <code>setDataStore(DataStore)</code>.
|
||||||
*/
|
*/
|
||||||
public SecuredThread() {
|
public SecuredThread() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new SecuredThread given a DataStore.
|
* Constructs a new SecuredThread given a DataStore.
|
||||||
*
|
*
|
||||||
* @param dataStore used to extract user id and password for a client
|
* @param dataStore used to extract user id and password for a client
|
||||||
*/
|
*/
|
||||||
public SecuredThread(DataStore dataStore)
|
public SecuredThread(DataStore dataStore)
|
||||||
{
|
{
|
||||||
this(null, dataStore);
|
this(null, dataStore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new SecuredThread with a DataStore and a runnable. After
|
* Constructs a new SecuredThread with a DataStore and a runnable. After
|
||||||
* the thread starts, the runnable will be implicitly executed.
|
* the thread starts, the runnable will be implicitly executed.
|
||||||
*
|
*
|
||||||
* @param runnable the runnable to be executed by the thread
|
* @param runnable the runnable to be executed by the thread
|
||||||
|
@ -56,8 +59,8 @@ public class SecuredThread extends Thread
|
||||||
super(runnable);
|
super(runnable);
|
||||||
_dataStore = dataStore;
|
_dataStore = dataStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new SecuredThread with a DataStore, a runnable and name for the thread.
|
* Constructs a new SecuredThread with a DataStore, a runnable and name for the thread.
|
||||||
* After the thread starts, the runnable will be implicitly executed.
|
* After the thread starts, the runnable will be implicitly executed.
|
||||||
|
@ -69,7 +72,7 @@ public class SecuredThread extends Thread
|
||||||
public SecuredThread(Runnable runnable, String threadName, DataStore dataStore) {
|
public SecuredThread(Runnable runnable, String threadName, DataStore dataStore) {
|
||||||
this(null, runnable, threadName, dataStore);
|
this(null, runnable, threadName, dataStore);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new SecuredThread with a DataStore, a runnable and a ThreadGroup.
|
* Constructs a new SecuredThread with a DataStore, a runnable and a ThreadGroup.
|
||||||
* After the thread starts, the runnable will be implicitly executed.
|
* After the thread starts, the runnable will be implicitly executed.
|
||||||
|
@ -82,8 +85,8 @@ public class SecuredThread extends Thread
|
||||||
super(group, runnable);
|
super(group, runnable);
|
||||||
_dataStore = dataStore;
|
_dataStore = dataStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new SecuredThread with a DataStore, a runnable, a name and a ThreadGroup.
|
* Constructs a new SecuredThread with a DataStore, a runnable, a name and a ThreadGroup.
|
||||||
* After the thread starts, the runnable will be implicitly executed.
|
* After the thread starts, the runnable will be implicitly executed.
|
||||||
|
@ -97,8 +100,8 @@ public class SecuredThread extends Thread
|
||||||
super(group, runnable, threadName);
|
super(group, runnable, threadName);
|
||||||
_dataStore = dataStore;
|
_dataStore = dataStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the DataStore associated with the client
|
* Sets the DataStore associated with the client
|
||||||
* @param dataStore
|
* @param dataStore
|
||||||
|
@ -107,17 +110,17 @@ public class SecuredThread extends Thread
|
||||||
{
|
{
|
||||||
_dataStore = dataStore;
|
_dataStore = dataStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When run() is called, a check is made to see if there is an ISystemService. If there is
|
* 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>
|
* the <code>ISystemService.setThreadSecurity(Client)</code> is called before <code>Thread.run()</code>
|
||||||
* is called.
|
* is called.
|
||||||
*
|
*
|
||||||
* If a Runnable was passed into the constructor for SecuredThread then, when <code>Thread.run()</code>
|
* If a Runnable was passed into the constructor for SecuredThread then, when <code>Thread.run()</code>
|
||||||
* is called, the Runnable will be invoked.
|
* is called, the Runnable will be invoked.
|
||||||
*/
|
*/
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -130,21 +133,21 @@ public class SecuredThread extends Thread
|
||||||
{
|
{
|
||||||
e.printStackTrace(new PrintWriter(System.err));
|
e.printStackTrace(new PrintWriter(System.err));
|
||||||
}
|
}
|
||||||
|
|
||||||
super.run();
|
super.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* As per bug 228335, this is commented out.
|
* As per bug 228335, this is commented out.
|
||||||
*
|
*
|
||||||
* When start() is called, a check is made to see if there is an ISystemService.
|
* When start() is called, a check is made to see if there is an ISystemService.
|
||||||
* If there is, the <code>ISystemService.executeThread(SecuredThread)</code> is called.
|
* If there is, the <code>ISystemService.executeThread(SecuredThread)</code> is called.
|
||||||
* In this case, the run() method is invoked in a thread assigned from the running
|
* In this case, the run() method is invoked in a thread assigned from the running
|
||||||
* work threads
|
* work threads
|
||||||
* If there isn't, the <code>super.start()</code> is called.
|
* If there isn't, the <code>super.start()</code> is called.
|
||||||
* In this case. the run() method is invoked as a new thread.
|
* In this case. the run() method is invoked as a new thread.
|
||||||
|
|
||||||
public void start()
|
public void start()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -155,7 +158,7 @@ public class SecuredThread extends Thread
|
||||||
if (systemService != null){
|
if (systemService != null){
|
||||||
systemService.executeThread(this);
|
systemService.executeThread(this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
super.start();
|
super.start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
|
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
|
||||||
* David McKnight (IBM) [224906] [dstore] changes for getting properties and doing exit due to single-process capability
|
* David McKnight (IBM) [224906] [dstore] changes for getting properties and doing exit due to single-process capability
|
||||||
|
@ -28,7 +28,7 @@ import org.eclipse.dstore.internal.core.server.ServerReturnCodes;
|
||||||
* Server is the standard way of instantiating and controlling a remote DataStore.
|
* Server is the standard way of instantiating and controlling a remote DataStore.
|
||||||
* The server runs a ConnectionEstablisher which manages client connections to
|
* The server runs a ConnectionEstablisher which manages client connections to
|
||||||
* the DataStore.
|
* the DataStore.
|
||||||
*
|
*
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
*/
|
*/
|
||||||
public class Server implements Runnable
|
public class Server implements Runnable
|
||||||
|
@ -39,7 +39,7 @@ public class Server implements Runnable
|
||||||
/**
|
/**
|
||||||
* The startup interface to run the Server.
|
* The startup interface to run the Server.
|
||||||
*
|
*
|
||||||
* @param args a list of arguments for running the server. These consist of
|
* @param args a list of arguments for running the server. These consist of
|
||||||
* the socket port to wait on, the timeout value, and the the ticket
|
* the socket port to wait on, the timeout value, and the the ticket
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
|
@ -55,7 +55,7 @@ public class Server implements Runnable
|
||||||
String[] vers = new String[3];
|
String[] vers = new String[3];
|
||||||
vers[0] = tokenizer.nextToken();
|
vers[0] = tokenizer.nextToken();
|
||||||
vers[1] = tokenizer.nextToken();
|
vers[1] = tokenizer.nextToken();
|
||||||
|
|
||||||
int version = Integer.parseInt(vers[0]);
|
int version = Integer.parseInt(vers[0]);
|
||||||
int major = Integer.parseInt(vers[1]);
|
int major = Integer.parseInt(vers[1]);
|
||||||
|
|
||||||
|
@ -73,13 +73,13 @@ public class Server implements Runnable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
// version is bad
|
// version is bad
|
||||||
System.err.println(ServerReturnCodes.RC_JRE_VERSION_ERROR);
|
System.err.println(ServerReturnCodes.RC_JRE_VERSION_ERROR);
|
||||||
if (SystemServiceManager.getInstance().getSystemService() == null)
|
if (SystemServiceManager.getInstance().getSystemService() == null)
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Server theServer = null;
|
Server theServer = null;
|
||||||
|
@ -101,7 +101,7 @@ public class Server implements Runnable
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (theServer != null)
|
if (theServer != null)
|
||||||
{
|
{
|
||||||
theServer.run();
|
theServer.run();
|
||||||
|
@ -138,7 +138,7 @@ public class Server implements Runnable
|
||||||
* the specified time interval before shutting down.
|
* the specified time interval before shutting down.
|
||||||
*
|
*
|
||||||
* @param port the number of the socket port to wait on
|
* @param port the number of the socket port to wait on
|
||||||
* @param timeout the idle time to wait before shutting down
|
* @param timeout the idle time to wait before shutting down
|
||||||
*/
|
*/
|
||||||
public Server(String port, String timeout)
|
public Server(String port, String timeout)
|
||||||
{
|
{
|
||||||
|
@ -147,30 +147,33 @@ public class Server implements Runnable
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Server that waits on the specified socket port for
|
* Creates a new Server that waits on the specified socket port for
|
||||||
* the specified time interval before shutting down.
|
* the specified time interval before shutting down.
|
||||||
*
|
*
|
||||||
* @param port the number of the socket port to wait on
|
* @param port the number of the socket port to wait on
|
||||||
* @param timeout the idle time to wait before shutting down
|
* @param timeout the idle time to wait before shutting down
|
||||||
* @param ticket the ticket that the client needs to interact with the DataStore
|
* @param ticket the ticket that the client needs to interact with the DataStore
|
||||||
*/
|
*/
|
||||||
public Server(String port, String timeout, String ticket)
|
public Server(String port, String timeout, String ticket)
|
||||||
{
|
{
|
||||||
_establisher = new ConnectionEstablisher(port, timeout, ticket);
|
_establisher = new ConnectionEstablisher(port, timeout, ticket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs the server by starting the ConnectionEstablisher
|
* Runs the server by starting the ConnectionEstablisher
|
||||||
*/
|
*/
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
_establisher.start();
|
_establisher.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the reference for the ConnectionEstablisher for this client
|
* Return the reference for the ConnectionEstablisher for this client
|
||||||
*
|
*
|
||||||
* * @return the the reference for the ConnectionEstablisher instance for this client
|
* @return the the reference for the ConnectionEstablisher instance for this
|
||||||
|
* client
|
||||||
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public ConnectionEstablisher getEstablisher()
|
public ConnectionEstablisher getEstablisher()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (c) 2002, 2008 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
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
|
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
|
||||||
* David McKnight (IBM) - [226086] [dstore][api][breaking] Move ServerLogger class to dstore.core
|
* David McKnight (IBM) - [226086] [dstore][api][breaking] Move ServerLogger class to dstore.core
|
||||||
* Jacob Garcowski (IBM) - [232738] [dstore] Delay creation of log file until written to
|
* Jacob Garcowski (IBM) - [232738] [dstore] Delay creation of log file until written to
|
||||||
* Noriaki Takatsu (IBM) - [232443] [multithread] A single rsecomm.log for all clients
|
* Noriaki Takatsu (IBM) - [232443] [multithread] A single rsecomm.log for all clients
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.dstore.core.server;
|
package org.eclipse.dstore.core.server;
|
||||||
|
@ -27,45 +27,47 @@ import java.util.Date;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class that facilitates logging for errors, warnings, debug messages and info for DataStore
|
* Class that facilitates logging for errors, warnings, debug messages and info
|
||||||
* servers.
|
* for DataStore servers.
|
||||||
|
*
|
||||||
|
* @since 3.0 moved from non-API to API
|
||||||
*/
|
*/
|
||||||
public class ServerLogger implements IServerLogger
|
public class ServerLogger implements IServerLogger
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// Constants for logging - for use in rsecomm.properties
|
// Constants for logging - for use in rsecomm.properties
|
||||||
private static final String DEBUG_LEVEL = "debug_level"; //$NON-NLS-1$
|
private static final String DEBUG_LEVEL = "debug_level"; //$NON-NLS-1$
|
||||||
private static final String LOG_LOCATION = "log_location"; //$NON-NLS-1$
|
private static final String LOG_LOCATION = "log_location"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final int LOG_WARNING = 1;
|
private static final int LOG_WARNING = 1;
|
||||||
private static final int LOG_INFO = 2;
|
private static final int LOG_INFO = 2;
|
||||||
private static final int LOG_DEBUG = 3;
|
private static final int LOG_DEBUG = 3;
|
||||||
|
|
||||||
private static final String LOG_TO_STDOUT = "Log_To_StdOut"; //$NON-NLS-1$
|
private static final String LOG_TO_STDOUT = "Log_To_StdOut"; //$NON-NLS-1$
|
||||||
|
|
||||||
private Object writeLock = new Object();
|
private Object writeLock = new Object();
|
||||||
private PrintWriter _logFileStream = null;
|
private PrintWriter _logFileStream = null;
|
||||||
|
|
||||||
public static final boolean DEBUG = false;
|
public static final boolean DEBUG = false;
|
||||||
private static int log_level = 0;
|
private static int log_level = 0;
|
||||||
|
|
||||||
private boolean initialized = false;
|
private boolean initialized = false;
|
||||||
private String logPathName = null;
|
private String logPathName = null;
|
||||||
private boolean logToFile = true;
|
private boolean logToFile = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new ServerLogger.
|
* Constructs a new ServerLogger.
|
||||||
*
|
*
|
||||||
* @param logPathName the path on the filesystem to store the log information
|
* @param logPathName the path on the filesystem to store the log information
|
||||||
*/
|
*/
|
||||||
public ServerLogger(String logPathName) {
|
public ServerLogger(String logPathName) {
|
||||||
this.logPathName = logPathName;
|
this.logPathName = logPathName;
|
||||||
// Read .properties file to configure
|
// Read .properties file to configure
|
||||||
try {
|
try {
|
||||||
ResourceBundle properties = ResourceBundle.getBundle("rsecomm"); //$NON-NLS-1$
|
ResourceBundle properties = ResourceBundle.getBundle("rsecomm"); //$NON-NLS-1$
|
||||||
String debug_level = properties.getString(DEBUG_LEVEL).trim();
|
String debug_level = properties.getString(DEBUG_LEVEL).trim();
|
||||||
log_level = Integer.parseInt(debug_level);
|
log_level = Integer.parseInt(debug_level);
|
||||||
String log_location = properties.getString(LOG_LOCATION).trim();
|
String log_location = properties.getString(LOG_LOCATION).trim();
|
||||||
if (log_location.equalsIgnoreCase(LOG_TO_STDOUT)) {
|
if (log_location.equalsIgnoreCase(LOG_TO_STDOUT)) {
|
||||||
logToFile = false;
|
logToFile = false;
|
||||||
|
@ -76,32 +78,32 @@ public class ServerLogger implements IServerLogger
|
||||||
//e.printStackTrace();
|
//e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initialize()
|
private void initialize()
|
||||||
{
|
{
|
||||||
initialized = true;
|
initialized = true;
|
||||||
if (_logFileStream == null) {
|
if (_logFileStream == null) {
|
||||||
if (logToFile) {
|
if (logToFile) {
|
||||||
try {
|
try {
|
||||||
File _logFile = new File(logPathName, "rsecomm.log"); //$NON-NLS-1$
|
File _logFile = new File(logPathName, "rsecomm.log"); //$NON-NLS-1$
|
||||||
|
|
||||||
if (!_logFile.exists()) {
|
if (!_logFile.exists()) {
|
||||||
_logFile.createNewFile();
|
_logFile.createNewFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
_logFileStream = new PrintWriter(new FileOutputStream(_logFile));
|
_logFileStream = new PrintWriter(new FileOutputStream(_logFile));
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("Error opening log file " + logPathName + "rsecomm.log"); //$NON-NLS-1$ //$NON-NLS-2$
|
System.out.println("Error opening log file " + logPathName + "rsecomm.log"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs an informational message
|
* Logs an informational message
|
||||||
*
|
*
|
||||||
* @param minerName the name of the miner associated with this message
|
* @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.
|
||||||
*/
|
*/
|
||||||
|
@ -125,7 +127,7 @@ public class ServerLogger implements IServerLogger
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs a warning message
|
* Logs a warning message
|
||||||
*
|
*
|
||||||
* @param minerName the name of the miner associated with this message
|
* @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.
|
||||||
*/
|
*/
|
||||||
|
@ -145,14 +147,14 @@ public class ServerLogger implements IServerLogger
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs an error message
|
* Logs an error message
|
||||||
*
|
*
|
||||||
* @param minerName the name of the miner associated with this message
|
* @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 void logError(String minerName, String message, Throwable exception) {
|
public void logError(String minerName, String message, Throwable exception) {
|
||||||
|
@ -176,7 +178,7 @@ public class ServerLogger implements IServerLogger
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs a debug message
|
* Logs a debug message
|
||||||
*
|
*
|
||||||
* @param minerName the name of the miner associated with this message
|
* @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.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* David McKnight (IBM) - [225507][api][breaking] RSE dstore API leaks non-API types
|
* David McKnight (IBM) - [225507][api][breaking] RSE dstore API leaks non-API types
|
||||||
* Noriaki Takatsu (IBM) - [227905] prevent double invocations of finished in ConncetionEstablisher
|
* Noriaki Takatsu (IBM) - [227905] prevent double invocations of finished in ConncetionEstablisher
|
||||||
|
@ -25,11 +25,11 @@ import org.eclipse.dstore.core.model.DataElement;
|
||||||
import org.eclipse.dstore.core.util.Receiver;
|
import org.eclipse.dstore.core.util.Receiver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ServerReciever is responsible for recieving data from
|
* The ServerReciever is responsible for recieving data from the client side.
|
||||||
* the client side.
|
*
|
||||||
*
|
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||||
|
* @since 3.0 moved from non-API to API
|
||||||
*/
|
*/
|
||||||
public class ServerReceiver extends Receiver
|
public class ServerReceiver extends Receiver
|
||||||
{
|
{
|
||||||
|
@ -38,21 +38,21 @@ public class ServerReceiver extends Receiver
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param socket the socket to receive from
|
* @param socket the socket to receive from
|
||||||
* @param connection the connection establisher
|
* @param connection the connection establisher
|
||||||
*/
|
*/
|
||||||
public ServerReceiver(Socket socket, ConnectionEstablisher connection)
|
public ServerReceiver(Socket socket, ConnectionEstablisher connection)
|
||||||
{
|
{
|
||||||
super(socket, connection.getDataStore());
|
super(socket, connection.getDataStore());
|
||||||
_connection = connection;
|
_connection = connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation for handling the receiving on documents on
|
* Implementation for handling the receiving on documents on
|
||||||
* the server side.
|
* the server side.
|
||||||
*
|
*
|
||||||
* @param documentObject to tree root of received data.
|
* @param documentObject to tree root of received data.
|
||||||
*/
|
*/
|
||||||
public void handleDocument(DataElement documentObject)
|
public void handleDocument(DataElement documentObject)
|
||||||
|
@ -68,7 +68,7 @@ public class ServerReceiver extends Receiver
|
||||||
if (rootOutput.getName().equals("C_EXIT")) //$NON-NLS-1$
|
if (rootOutput.getName().equals("C_EXIT")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -76,7 +76,7 @@ public class ServerReceiver extends Receiver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void finish()
|
public void finish()
|
||||||
{
|
{
|
||||||
_dataStore.setConnected(false);
|
_dataStore.setConnected(false);
|
||||||
|
|
|
@ -8,31 +8,33 @@
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: Noriaki Takatsu and Masao Nishimoto
|
* component that contains this file: Noriaki Takatsu and Masao Nishimoto
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
|
* 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;
|
||||||
|
|
||||||
|
/**
|
||||||
public class SystemServiceManager
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public class SystemServiceManager
|
||||||
{
|
{
|
||||||
private static SystemServiceManager instance = null;
|
private static SystemServiceManager instance = null;
|
||||||
private static ISystemService _systemService;
|
private static ISystemService _systemService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an instance of SystemServiceManager to hold the system-specific
|
* Creates an instance of SystemServiceManager to hold the system-specific
|
||||||
* parts that needs unique implementations for this system.
|
* parts that needs unique implementations for this system.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private SystemServiceManager()
|
private SystemServiceManager()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the SystemServiceManager object for this system.
|
* Get the SystemServiceManager object for this system.
|
||||||
*
|
*
|
||||||
* @return the object of the SystemServiceManager
|
* @return the object of the SystemServiceManager
|
||||||
*/
|
*/
|
||||||
public static SystemServiceManager getInstance()
|
public static SystemServiceManager getInstance()
|
||||||
|
@ -43,26 +45,26 @@ public class SystemServiceManager
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the SystemService object for this system.
|
* Set the SystemService object for this system.
|
||||||
*
|
*
|
||||||
* @param systemService the object of the SystemService
|
* @param systemService the object of the SystemService
|
||||||
*/
|
*/
|
||||||
public void setSystemService(ISystemService systemService)
|
public void setSystemService(ISystemService systemService)
|
||||||
{
|
{
|
||||||
_systemService = systemService;
|
_systemService = systemService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the SystemService object for this system.
|
* Get the SystemService object for this system.
|
||||||
*
|
*
|
||||||
* @return the object of the SystemService stored in SystemServiceManager
|
* @return the object of the SystemService stored in SystemServiceManager
|
||||||
*/
|
*/
|
||||||
public ISystemService getSystemService()
|
public ISystemService getSystemService()
|
||||||
{
|
{
|
||||||
return _systemService;
|
return _systemService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* David McKnight (IBM) - [225507][api][breaking] RSE dstore API leaks non-API types
|
* David McKnight (IBM) - [225507][api][breaking] RSE dstore API leaks non-API types
|
||||||
* David McKnight (IBM) - [226561] [apidoc] Add API markup to RSE Javadocs where extend / implement is allowed
|
* David McKnight (IBM) - [226561] [apidoc] Add API markup to RSE Javadocs where extend / implement is allowed
|
||||||
|
@ -26,13 +26,16 @@ import org.eclipse.dstore.core.model.DataStore;
|
||||||
import org.eclipse.dstore.core.model.DataStoreResources;
|
import org.eclipse.dstore.core.model.DataStoreResources;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is used to generate command object instances from command descriptors and arguments to commands.
|
* This class is used to generate command object instances from command
|
||||||
* Command instances are instances of command descriptors. Each command instance contains a set of data arguments
|
* descriptors and arguments to commands. Command instances are instances of
|
||||||
* and a status object, that represents the current state of a command. After a command instance is created,
|
* command descriptors. Each command instance contains a set of data arguments
|
||||||
* it is referenced in the command log for the DataStore.
|
* and a status object, that represents the current state of a command. After a
|
||||||
*
|
* command instance is created, it is referenced in the command log for the
|
||||||
|
* DataStore.
|
||||||
|
*
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||||
|
* @since 3.0 moved from non-API to API
|
||||||
*/
|
*/
|
||||||
public class CommandGenerator
|
public class CommandGenerator
|
||||||
{
|
{
|
||||||
|
@ -67,7 +70,7 @@ public class CommandGenerator
|
||||||
public DataElement logCommand(DataElement commandObject)
|
public DataElement logCommand(DataElement commandObject)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// create time and status objects
|
// create time and status objects
|
||||||
StringBuffer id = new StringBuffer(commandObject.getId());
|
StringBuffer id = new StringBuffer(commandObject.getId());
|
||||||
id.append(DataStoreResources.model_status);
|
id.append(DataStoreResources.model_status);
|
||||||
|
@ -77,7 +80,7 @@ public class CommandGenerator
|
||||||
DataStoreResources.model_start,
|
DataStoreResources.model_start,
|
||||||
"", //$NON-NLS-1$
|
"", //$NON-NLS-1$
|
||||||
id.toString());
|
id.toString());
|
||||||
|
|
||||||
_log.addNestedData(commandObject, false);
|
_log.addNestedData(commandObject, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -115,7 +118,7 @@ public class CommandGenerator
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearDeleted(DataElement element)
|
private void clearDeleted(DataElement element)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < element.getNestedSize(); i++)
|
for (int i = 0; i < element.getNestedSize(); i++)
|
||||||
|
@ -123,18 +126,18 @@ public class CommandGenerator
|
||||||
DataElement child = element.get(i).dereference();
|
DataElement child = element.get(i).dereference();
|
||||||
if (child.isDeleted())
|
if (child.isDeleted())
|
||||||
{
|
{
|
||||||
element.removeNestedData(child);
|
element.removeNestedData(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new command from a command descriptor and it's arguments.
|
* Creates a new command from a command descriptor and it's arguments.
|
||||||
*
|
*
|
||||||
* @param commandDescriptor the command type of the new command
|
* @param commandDescriptor the command type of the new command
|
||||||
* @param arguments the arguments for the command, besides the subject
|
* @param arguments the arguments for the command, besides the subject
|
||||||
* @param dataObject the subject of the command
|
* @param dataObject the subject of the command
|
||||||
* @param refArg indicates whether the subject should be represented as a reference or directly
|
* @param refArg indicates whether the subject should be represented as a reference or directly
|
||||||
* @return the status object of the command
|
* @return the status object of the command
|
||||||
*/
|
*/
|
||||||
public DataElement generateCommand(DataElement commandDescriptor, ArrayList arguments, DataElement dataObject, boolean refArg)
|
public DataElement generateCommand(DataElement commandDescriptor, ArrayList arguments, DataElement dataObject, boolean refArg)
|
||||||
|
@ -187,11 +190,11 @@ public class CommandGenerator
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new command from a command descriptor and it's arguments.
|
* Creates a new command from a command descriptor and it's arguments.
|
||||||
*
|
*
|
||||||
* @param commandDescriptor the command type of the new command
|
* @param commandDescriptor the command type of the new command
|
||||||
* @param arg the arguement for the command, besides the subject
|
* @param arg the arguement for the command, besides the subject
|
||||||
* @param dataObject the subject of the command
|
* @param dataObject the subject of the command
|
||||||
* @param refArg indicates whether the subject should be represented as a reference or directly
|
* @param refArg indicates whether the subject should be represented as a reference or directly
|
||||||
* @return the status object of the command
|
* @return the status object of the command
|
||||||
*/
|
*/
|
||||||
public DataElement generateCommand(DataElement commandDescriptor, DataElement arg, DataElement dataObject, boolean refArg)
|
public DataElement generateCommand(DataElement commandDescriptor, DataElement arg, DataElement dataObject, boolean refArg)
|
||||||
|
@ -221,7 +224,7 @@ public class CommandGenerator
|
||||||
{
|
{
|
||||||
_dataStore.createReference(commandObject, arg, "argument"); //$NON-NLS-1$
|
_dataStore.createReference(commandObject, arg, "argument"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return logCommand(commandObject);
|
return logCommand(commandObject);
|
||||||
}
|
}
|
||||||
|
@ -233,10 +236,10 @@ public class CommandGenerator
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new command from a command descriptor and it's arguments.
|
* Creates a new command from a command descriptor and it's arguments.
|
||||||
*
|
*
|
||||||
* @param commandDescriptor the command type of the new command
|
* @param commandDescriptor the command type of the new command
|
||||||
* @param dataObject the subject of the command
|
* @param dataObject the subject of the command
|
||||||
* @param refArg indicates whether the subject should be represented as a reference or directly
|
* @param refArg indicates whether the subject should be represented as a reference or directly
|
||||||
* @return the status object of the command
|
* @return the status object of the command
|
||||||
*/
|
*/
|
||||||
public DataElement generateCommand(DataElement commandDescriptor, DataElement dataObject, boolean refArg)
|
public DataElement generateCommand(DataElement commandDescriptor, DataElement dataObject, boolean refArg)
|
||||||
|
@ -269,7 +272,7 @@ public class CommandGenerator
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a response tree for transmitting a set of data from a server to a client.
|
* Creates a response tree for transmitting a set of data from a server to a client.
|
||||||
*
|
*
|
||||||
* @param document the root of the response
|
* @param document the root of the response
|
||||||
* @param objects the data contained in the response
|
* @param objects the data contained in the response
|
||||||
* @return the response tree root
|
* @return the response tree root
|
||||||
|
@ -282,7 +285,7 @@ public class CommandGenerator
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a response tree for transmitting a set of data from a server to a client.
|
* Creates a response tree for transmitting a set of data from a server to a client.
|
||||||
*
|
*
|
||||||
* @param responseType the type of data to respond with
|
* @param responseType the type of data to respond with
|
||||||
* @param dataObject the child object in the response tree
|
* @param dataObject the child object in the response tree
|
||||||
* @return the response tree root
|
* @return the response tree root
|
||||||
|
@ -303,7 +306,7 @@ public class CommandGenerator
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a simple response object of the specified type
|
* Creates a simple response object of the specified type
|
||||||
*
|
*
|
||||||
* @param responseType the type of data to respond with
|
* @param responseType the type of data to respond with
|
||||||
* @return the response object
|
* @return the response object
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
@ -33,10 +33,11 @@ import org.eclipse.dstore.core.server.SecuredThread;
|
||||||
import org.eclipse.dstore.internal.core.util.XMLparser;
|
import org.eclipse.dstore.internal.core.util.XMLparser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
|
* @since 3.0 Moved from non-API to API
|
||||||
*/
|
*/
|
||||||
public abstract class Receiver extends SecuredThread implements IDataStorePreferenceListener
|
public abstract class Receiver extends SecuredThread implements IDataStorePreferenceListener
|
||||||
{
|
{
|
||||||
|
@ -74,8 +75,8 @@ public abstract class Receiver extends SecuredThread implements IDataStorePrefer
|
||||||
{
|
{
|
||||||
//System.out.println("Receiver:" + ioe);
|
//System.out.println("Receiver:" + ioe);
|
||||||
}
|
}
|
||||||
|
|
||||||
// keepalive preferences
|
// keepalive preferences
|
||||||
String keepAliveResponseTimeout = System.getProperty(XMLparser.KEEPALIVE_RESPONSE_TIMEOUT_PREFERENCE);
|
String keepAliveResponseTimeout = System.getProperty(XMLparser.KEEPALIVE_RESPONSE_TIMEOUT_PREFERENCE);
|
||||||
if (keepAliveResponseTimeout != null){
|
if (keepAliveResponseTimeout != null){
|
||||||
preferenceChanged(XMLparser.KEEPALIVE_RESPONSE_TIMEOUT_PREFERENCE, keepAliveResponseTimeout);
|
preferenceChanged(XMLparser.KEEPALIVE_RESPONSE_TIMEOUT_PREFERENCE, keepAliveResponseTimeout);
|
||||||
|
@ -119,7 +120,7 @@ public abstract class Receiver extends SecuredThread implements IDataStorePrefer
|
||||||
{
|
{
|
||||||
handleInput();
|
handleInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_canExit){
|
if (_canExit){
|
||||||
// is this an unexpected exit?
|
// is this an unexpected exit?
|
||||||
if (_dataStore.isConnected()){
|
if (_dataStore.isConnected()){
|
||||||
|
@ -186,7 +187,7 @@ public abstract class Receiver extends SecuredThread implements IDataStorePrefer
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implemented to provide a means of handling received input
|
* Implemented to provide a means of handling received input
|
||||||
* @param documentObject the root object of the received data
|
* @param documentObject the root object of the received data
|
||||||
*/
|
*/
|
||||||
public abstract void handleDocument(DataElement documentObject);
|
public abstract void handleDocument(DataElement documentObject);
|
||||||
|
|
||||||
|
@ -195,8 +196,8 @@ public abstract class Receiver extends SecuredThread implements IDataStorePrefer
|
||||||
* @param e an exception that occurred
|
* @param e an exception that occurred
|
||||||
*/
|
*/
|
||||||
public abstract void handleError(Throwable e);
|
public abstract void handleError(Throwable e);
|
||||||
|
|
||||||
|
|
||||||
public void preferenceChanged(String property, String value)
|
public void preferenceChanged(String property, String value)
|
||||||
{
|
{
|
||||||
//System.out.println("setting preference: "+property + "="+value);
|
//System.out.println("setting preference: "+property + "="+value);
|
||||||
|
@ -215,5 +216,5 @@ public abstract class Receiver extends SecuredThread implements IDataStorePrefer
|
||||||
_xmlParser.setEnableKeepalive(enable);
|
_xmlParser.setEnableKeepalive(enable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (c) 2008 IBM Corporation. All rights reserved.
|
* Copyright (c) 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
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight.
|
* component that contains this file: David McKnight.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* David McKnight (IBM) - [225507][api][breaking] RSE dstore API leaks non-API types
|
* David McKnight (IBM) - [225507][api][breaking] RSE dstore API leaks non-API types
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
@ -17,6 +17,10 @@ import java.util.List;
|
||||||
|
|
||||||
import javax.net.ssl.X509TrustManager;
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracted interface from DataStoreTrustManager.
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
public interface IDataStoreTrustManager extends X509TrustManager
|
public interface IDataStoreTrustManager extends X509TrustManager
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -25,7 +29,7 @@ public interface IDataStoreTrustManager extends X509TrustManager
|
||||||
* @param password the password
|
* @param password the password
|
||||||
*/
|
*/
|
||||||
public void setKeystore(String filePath, String password);
|
public void setKeystore(String filePath, String password);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of untrusted certificates
|
* Returns the list of untrusted certificates
|
||||||
* @return the list of untrusted certificates
|
* @return the list of untrusted certificates
|
||||||
|
|
|
@ -500,8 +500,9 @@ public class ArchiveHandlerManager
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an empty archive
|
* Create an empty archive
|
||||||
*
|
*
|
||||||
* @throws SystemMessageException in case of an error
|
* @throws SystemMessageException in case of an error
|
||||||
|
* @since 3.0 returns void but throws SystemMessageException
|
||||||
*/
|
*/
|
||||||
public void createEmptyArchive(File newFile) throws SystemMessageException
|
public void createEmptyArchive(File newFile) throws SystemMessageException
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue