mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 23:25:26 +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:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* David McKnight (IBM) [220123][dstore] Configurable timeout on irresponsiveness
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* @noextend This class is not intended to be subclassed 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
|
||||
{
|
||||
|
@ -81,12 +83,12 @@ public class ConnectionEstablisher
|
|||
private int _timeout;
|
||||
private String _msg;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates the default ConnectionEstablisher. Communication occurs
|
||||
* on a default port, there is no timeout and no ticket is required
|
||||
* for a client to work with the DataStore.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public ConnectionEstablisher()
|
||||
{
|
||||
|
@ -98,7 +100,7 @@ public class ConnectionEstablisher
|
|||
* Creates a ConnectionEstablisher. Communication occurs
|
||||
* on the specified port, there is no timeout and no ticket is required
|
||||
* for a client to work with the DataStore.
|
||||
*
|
||||
*
|
||||
* @param port the number of the socket port
|
||||
*/
|
||||
public ConnectionEstablisher(String port)
|
||||
|
@ -111,7 +113,7 @@ public class ConnectionEstablisher
|
|||
* on the specified port, a timeout value indicates the idle wait
|
||||
* time before shutting down, and no ticket is required
|
||||
* for a client to work with the DataStore.
|
||||
*
|
||||
*
|
||||
* @param port the number of the socket port
|
||||
* @param timeout the idle duration to wait before shutting down
|
||||
*/
|
||||
|
@ -119,7 +121,7 @@ public class ConnectionEstablisher
|
|||
{
|
||||
setup(port, timeout, null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a ConnectionEstablisher. Communication occurs
|
||||
* on the specified port, a timeout value indicates the idle wait
|
||||
|
@ -135,7 +137,7 @@ public class ConnectionEstablisher
|
|||
setup(port, timeout, ticket);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Starts the run loop for the ConnectionEstablisher.
|
||||
*/
|
||||
|
@ -155,10 +157,10 @@ public class ConnectionEstablisher
|
|||
{
|
||||
return _dataStore;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the Server port opened for this client
|
||||
*
|
||||
*
|
||||
* @return the Server port opened for this client
|
||||
*/
|
||||
public int getServerPort()
|
||||
|
@ -167,13 +169,13 @@ public class ConnectionEstablisher
|
|||
{
|
||||
return _serverSocket.getLocalPort();
|
||||
}
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the connection status for this client
|
||||
*
|
||||
*
|
||||
* * @return the connection status for this client
|
||||
*/
|
||||
public String getStatus()
|
||||
|
@ -196,7 +198,7 @@ public class ConnectionEstablisher
|
|||
_updateHandler.finish();
|
||||
_dataStore.finish();
|
||||
System.out.println(ServerReturnCodes.RC_FINISHED);
|
||||
|
||||
|
||||
if (SystemServiceManager.getInstance().getSystemService() == null)
|
||||
System.exit(0);
|
||||
}
|
||||
|
@ -211,7 +213,7 @@ public class ConnectionEstablisher
|
|||
Socket newSocket = _serverSocket.accept();
|
||||
if (_dataStore.usingSSL())
|
||||
{
|
||||
|
||||
|
||||
// wait for connection
|
||||
SSLSocket sslSocket = (SSLSocket)newSocket;
|
||||
sslSocket.setUseClientMode(false);
|
||||
|
@ -225,16 +227,16 @@ public class ConnectionEstablisher
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
doHandShake(newSocket);
|
||||
newSocket.setKeepAlive(true);
|
||||
|
||||
ServerReceiver receiver = new ServerReceiver(newSocket, this);
|
||||
_dataStore.addDataStorePreferenceListener(receiver);
|
||||
|
||||
|
||||
if (_dataStore.getClient() != null)
|
||||
_dataStore.getClient().setServerReceiver(receiver);
|
||||
|
||||
|
||||
Sender sender = new Sender(newSocket, _dataStore);
|
||||
|
||||
// add this connection to list of elements
|
||||
|
@ -244,7 +246,7 @@ public class ConnectionEstablisher
|
|||
receiver.start();
|
||||
|
||||
if (_receivers.size() == 1)
|
||||
{
|
||||
{
|
||||
_updateHandler.start();
|
||||
_commandHandler.start();
|
||||
}
|
||||
|
@ -265,28 +267,28 @@ public class ConnectionEstablisher
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private ServerSocket createSocket(String portStr) throws UnknownHostException
|
||||
{
|
||||
ServerSocket serverSocket = null;
|
||||
SSLContext sslContext = null;
|
||||
// port
|
||||
// port
|
||||
int port = 0;
|
||||
|
||||
|
||||
if (_dataStore.usingSSL())
|
||||
{
|
||||
String keyStoreFileName = _dataStore.getKeyStoreLocation();
|
||||
String keyStorePassword = _dataStore.getKeyStorePassword();
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
sslContext = DStoreSSLContext.getServerSSLContext(keyStoreFileName, keyStorePassword);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -299,14 +301,14 @@ public class ConnectionEstablisher
|
|||
try
|
||||
{
|
||||
lPort = Integer.parseInt(range[0]);
|
||||
hPort = Integer.parseInt(range[1]);
|
||||
hPort = Integer.parseInt(range[1]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
for (int i = lPort; i < hPort; i++)
|
||||
{
|
||||
{
|
||||
// create server socket from port
|
||||
try
|
||||
{
|
||||
|
@ -314,7 +316,7 @@ public class ConnectionEstablisher
|
|||
{
|
||||
try
|
||||
{
|
||||
serverSocket = sslContext.getServerSocketFactory().createServerSocket(i);
|
||||
serverSocket = sslContext.getServerSocketFactory().createServerSocket(i);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -328,7 +330,7 @@ public class ConnectionEstablisher
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_dataStore.trace(e);
|
||||
_dataStore.trace(e);
|
||||
}
|
||||
if (serverSocket != null && serverSocket.getLocalPort() > 0)
|
||||
{
|
||||
|
@ -339,14 +341,14 @@ public class ConnectionEstablisher
|
|||
else
|
||||
{
|
||||
port = Integer.parseInt(portStr);
|
||||
|
||||
|
||||
|
||||
|
||||
// create server socket from port
|
||||
if (_dataStore.usingSSL() && sslContext != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
serverSocket = sslContext.getServerSocketFactory().createServerSocket(port);
|
||||
serverSocket = sslContext.getServerSocketFactory().createServerSocket(port);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -367,7 +369,7 @@ public class ConnectionEstablisher
|
|||
}
|
||||
return serverSocket;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the DataStore and initializes it's handlers and communications.
|
||||
*
|
||||
|
@ -386,16 +388,16 @@ public class ConnectionEstablisher
|
|||
_updateHandler = new ServerUpdateHandler();
|
||||
|
||||
ISSLProperties sslProperties = new ServerSSLProperties();
|
||||
|
||||
|
||||
_dataStore = new DataStore(_serverAttributes, _commandHandler, _updateHandler, null);
|
||||
_dataStore.setSSLProperties(sslProperties);
|
||||
|
||||
|
||||
DataElement ticket = _dataStore.getTicket();
|
||||
ticket.setAttribute(DE.A_NAME, ticketStr);
|
||||
|
||||
_updateHandler.setDataStore(_dataStore);
|
||||
_commandHandler.setDataStore(_dataStore);
|
||||
|
||||
|
||||
if (SystemServiceManager.getInstance().getSystemService() == null)
|
||||
{
|
||||
Client client = new Client();
|
||||
|
@ -409,14 +411,14 @@ public class ConnectionEstablisher
|
|||
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
_serverSocket = createSocket(portStr);
|
||||
if (_serverSocket == null)
|
||||
{
|
||||
System.err.println(ServerReturnCodes.RC_BIND_ERROR);
|
||||
_msg = ServerReturnCodes.RC_BIND_ERROR;
|
||||
_continue = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// timeout
|
||||
|
@ -428,12 +430,12 @@ public class ConnectionEstablisher
|
|||
{
|
||||
_timeout = 120000;
|
||||
}
|
||||
|
||||
|
||||
if (_timeout > 0)
|
||||
{
|
||||
_serverSocket.setSoTimeout(_timeout);
|
||||
}
|
||||
|
||||
|
||||
System.err.println(ServerReturnCodes.RC_SUCCESS);
|
||||
System.err.println(_serverSocket.getLocalPort());
|
||||
try
|
||||
|
@ -478,7 +480,7 @@ public class ConnectionEstablisher
|
|||
}
|
||||
|
||||
private void doHandShake(Socket socket)
|
||||
{
|
||||
{
|
||||
try
|
||||
{
|
||||
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$
|
||||
if (preferenceVersion != null && preferenceVersion.length() > 0){
|
||||
version = preferenceVersion;
|
||||
}
|
||||
}
|
||||
writer.println(version);
|
||||
writer.flush();
|
||||
}
|
||||
|
@ -496,6 +498,6 @@ public class ConnectionEstablisher
|
|||
{
|
||||
System.out.println(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* 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
|
||||
*******************************************************************************/
|
||||
|
@ -18,19 +18,22 @@ package org.eclipse.dstore.core.server;
|
|||
|
||||
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.
|
||||
*
|
||||
*
|
||||
* @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
|
||||
* from thread pools.
|
||||
*
|
||||
*
|
||||
* @param securedThread the securedThread object that implements
|
||||
* Runnable.
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* 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
|
||||
* 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;
|
||||
|
||||
public class SecuredThread extends Thread
|
||||
/**
|
||||
* @since 3.0
|
||||
*/
|
||||
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
|
||||
* 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
|
||||
|
@ -56,8 +59,8 @@ public class SecuredThread extends Thread
|
|||
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.
|
||||
|
@ -69,7 +72,7 @@ public class SecuredThread extends Thread
|
|||
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.
|
||||
|
@ -82,8 +85,8 @@ public class SecuredThread extends Thread
|
|||
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.
|
||||
|
@ -97,8 +100,8 @@ public class SecuredThread extends Thread
|
|||
super(group, runnable, threadName);
|
||||
_dataStore = dataStore;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the DataStore associated with the client
|
||||
* @param dataStore
|
||||
|
@ -107,17 +110,17 @@ public class SecuredThread extends Thread
|
|||
{
|
||||
_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.
|
||||
* 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()
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -130,21 +133,21 @@ public class SecuredThread extends Thread
|
|||
{
|
||||
e.printStackTrace(new PrintWriter(System.err));
|
||||
}
|
||||
|
||||
|
||||
super.run();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
* In this case, the run() method is invoked in a thread assigned from the running
|
||||
* work threads
|
||||
* If there isn't, the <code>super.start()</code> is called.
|
||||
* work threads
|
||||
* If there isn't, the <code>super.start()</code> is called.
|
||||
* In this case. the run() method is invoked as a new thread.
|
||||
|
||||
|
||||
public void start()
|
||||
{
|
||||
|
||||
|
@ -155,7 +158,7 @@ public class SecuredThread extends Thread
|
|||
if (systemService != null){
|
||||
systemService.executeThread(this);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
super.start();
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* 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
|
||||
|
@ -28,7 +28,7 @@ import org.eclipse.dstore.internal.core.server.ServerReturnCodes;
|
|||
* Server is the standard way of instantiating and controlling a remote DataStore.
|
||||
* The server runs a ConnectionEstablisher which manages client connections to
|
||||
* the DataStore.
|
||||
*
|
||||
*
|
||||
* @noextend This class is not intended to be subclassed by clients.
|
||||
*/
|
||||
public class Server implements Runnable
|
||||
|
@ -39,7 +39,7 @@ public class Server implements Runnable
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
|
@ -55,7 +55,7 @@ public class Server implements Runnable
|
|||
String[] vers = new String[3];
|
||||
vers[0] = tokenizer.nextToken();
|
||||
vers[1] = tokenizer.nextToken();
|
||||
|
||||
|
||||
int version = Integer.parseInt(vers[0]);
|
||||
int major = Integer.parseInt(vers[1]);
|
||||
|
||||
|
@ -73,13 +73,13 @@ public class Server implements Runnable
|
|||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
{
|
||||
// version is bad
|
||||
System.err.println(ServerReturnCodes.RC_JRE_VERSION_ERROR);
|
||||
if (SystemServiceManager.getInstance().getSystemService() == null)
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
Server theServer = null;
|
||||
|
@ -101,7 +101,7 @@ public class Server implements Runnable
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (theServer != null)
|
||||
{
|
||||
theServer.run();
|
||||
|
@ -138,7 +138,7 @@ public class Server implements Runnable
|
|||
* the specified time interval before shutting down.
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
|
@ -147,30 +147,33 @@ public class Server implements Runnable
|
|||
|
||||
/**
|
||||
* 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 timeout the idle time to wait before shutting down
|
||||
* @param ticket the ticket that the client needs to interact with the DataStore
|
||||
* @param timeout the idle time to wait before shutting down
|
||||
* @param ticket the ticket that the client needs to interact with the DataStore
|
||||
*/
|
||||
public Server(String port, String timeout, String ticket)
|
||||
{
|
||||
_establisher = new ConnectionEstablisher(port, timeout, ticket);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Runs the server by starting the ConnectionEstablisher
|
||||
* Runs the server by starting the ConnectionEstablisher
|
||||
*/
|
||||
public void run()
|
||||
{
|
||||
_establisher.start();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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()
|
||||
{
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2002, 2008 IBM Corporation. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* 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: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* 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
|
||||
* 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;
|
||||
|
@ -27,45 +27,47 @@ import java.util.Date;
|
|||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* Class that facilitates logging for errors, warnings, debug messages and info for DataStore
|
||||
* servers.
|
||||
* Class that facilitates logging for errors, warnings, debug messages and info
|
||||
* for DataStore servers.
|
||||
*
|
||||
* @since 3.0 moved from non-API to API
|
||||
*/
|
||||
public class ServerLogger implements IServerLogger
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
// Constants for logging - for use in rsecomm.properties
|
||||
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 int LOG_WARNING = 1;
|
||||
private static final int LOG_INFO = 2;
|
||||
private static final int LOG_DEBUG = 3;
|
||||
|
||||
|
||||
private static final String LOG_TO_STDOUT = "Log_To_StdOut"; //$NON-NLS-1$
|
||||
|
||||
private Object writeLock = new Object();
|
||||
private PrintWriter _logFileStream = null;
|
||||
|
||||
|
||||
public static final boolean DEBUG = false;
|
||||
private static int log_level = 0;
|
||||
|
||||
|
||||
private boolean initialized = false;
|
||||
private String logPathName = null;
|
||||
private boolean logToFile = true;
|
||||
|
||||
/**
|
||||
* Constructs a new ServerLogger.
|
||||
*
|
||||
*
|
||||
* @param logPathName the path on the filesystem to store the log information
|
||||
*/
|
||||
public ServerLogger(String logPathName) {
|
||||
this.logPathName = logPathName;
|
||||
// Read .properties file to configure
|
||||
try {
|
||||
try {
|
||||
ResourceBundle properties = ResourceBundle.getBundle("rsecomm"); //$NON-NLS-1$
|
||||
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();
|
||||
if (log_location.equalsIgnoreCase(LOG_TO_STDOUT)) {
|
||||
logToFile = false;
|
||||
|
@ -76,32 +78,32 @@ public class ServerLogger implements IServerLogger
|
|||
//e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void initialize()
|
||||
{
|
||||
initialized = true;
|
||||
if (_logFileStream == null) {
|
||||
if (_logFileStream == null) {
|
||||
if (logToFile) {
|
||||
try {
|
||||
File _logFile = new File(logPathName, "rsecomm.log"); //$NON-NLS-1$
|
||||
|
||||
|
||||
if (!_logFile.exists()) {
|
||||
_logFile.createNewFile();
|
||||
}
|
||||
|
||||
|
||||
_logFileStream = new PrintWriter(new FileOutputStream(_logFile));
|
||||
|
||||
|
||||
} catch (IOException e) {
|
||||
System.out.println("Error opening log file " + logPathName + "rsecomm.log"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Logs an informational message
|
||||
*
|
||||
*
|
||||
* @param minerName the name of the miner associated with this message
|
||||
* @param message Message text to be logged.
|
||||
*/
|
||||
|
@ -125,7 +127,7 @@ public class ServerLogger implements IServerLogger
|
|||
|
||||
/**
|
||||
* Logs a warning message
|
||||
*
|
||||
*
|
||||
* @param minerName the name of the miner associated with this message
|
||||
* @param message Message text to be logged.
|
||||
*/
|
||||
|
@ -145,14 +147,14 @@ public class ServerLogger implements IServerLogger
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Logs an error message
|
||||
*
|
||||
*
|
||||
* @param minerName the name of the miner associated with this message
|
||||
* @param message Message text to be logged.
|
||||
*
|
||||
*
|
||||
* @param exception Exception that generated the error. Used to print a stack trace.
|
||||
*/
|
||||
public void logError(String minerName, String message, Throwable exception) {
|
||||
|
@ -176,7 +178,7 @@ public class ServerLogger implements IServerLogger
|
|||
|
||||
/**
|
||||
* Logs a debug message
|
||||
*
|
||||
*
|
||||
* @param minerName the name of the miner associated with this message
|
||||
* @param message Message text to be logged.
|
||||
*/
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* David McKnight (IBM) - [225507][api][breaking] RSE dstore API leaks non-API types
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* The ServerReciever is responsible for recieving data from
|
||||
* the client side.
|
||||
*
|
||||
* The ServerReciever is responsible for recieving data from the client side.
|
||||
*
|
||||
* @noextend This class is not intended to be subclassed 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
|
||||
{
|
||||
|
@ -38,21 +38,21 @@ public class ServerReceiver extends Receiver
|
|||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*
|
||||
* @param socket the socket to receive from
|
||||
* @param connection the connection establisher
|
||||
*/
|
||||
public ServerReceiver(Socket socket, ConnectionEstablisher connection)
|
||||
{
|
||||
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.
|
||||
*
|
||||
*
|
||||
* @param documentObject to tree root of received data.
|
||||
*/
|
||||
public void handleDocument(DataElement documentObject)
|
||||
|
@ -68,7 +68,7 @@ public class ServerReceiver extends Receiver
|
|||
if (rootOutput.getName().equals("C_EXIT")) //$NON-NLS-1$
|
||||
{
|
||||
finish();
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ public class ServerReceiver extends Receiver
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void finish()
|
||||
{
|
||||
_dataStore.setConnected(false);
|
||||
|
|
|
@ -8,31 +8,33 @@
|
|||
* 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
|
||||
/**
|
||||
* @since 3.0
|
||||
*/
|
||||
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()
|
||||
private SystemServiceManager()
|
||||
{}
|
||||
|
||||
|
||||
/**
|
||||
* Get the SystemServiceManager object for this system.
|
||||
*
|
||||
*
|
||||
* @return the object of the SystemServiceManager
|
||||
*/
|
||||
public static SystemServiceManager getInstance()
|
||||
|
@ -43,26 +45,26 @@ public class 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* 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
|
||||
|
@ -26,13 +26,16 @@ import org.eclipse.dstore.core.model.DataStore;
|
|||
import org.eclipse.dstore.core.model.DataStoreResources;
|
||||
|
||||
/**
|
||||
* This class is used to generate command object instances from command descriptors and arguments to commands.
|
||||
* Command instances are instances of command descriptors. Each command instance contains a set of data arguments
|
||||
* 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.
|
||||
*
|
||||
* This class is used to generate command object instances from command
|
||||
* descriptors and arguments to commands. Command instances are instances of
|
||||
* command descriptors. Each command instance contains a set of data arguments
|
||||
* 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.
|
||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||
* @since 3.0 moved from non-API to API
|
||||
*/
|
||||
public class CommandGenerator
|
||||
{
|
||||
|
@ -67,7 +70,7 @@ public class CommandGenerator
|
|||
public DataElement logCommand(DataElement commandObject)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
// create time and status objects
|
||||
StringBuffer id = new StringBuffer(commandObject.getId());
|
||||
id.append(DataStoreResources.model_status);
|
||||
|
@ -77,7 +80,7 @@ public class CommandGenerator
|
|||
DataStoreResources.model_start,
|
||||
"", //$NON-NLS-1$
|
||||
id.toString());
|
||||
|
||||
|
||||
_log.addNestedData(commandObject, false);
|
||||
|
||||
}
|
||||
|
@ -115,7 +118,7 @@ public class CommandGenerator
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void clearDeleted(DataElement element)
|
||||
{
|
||||
for (int i = 0; i < element.getNestedSize(); i++)
|
||||
|
@ -123,18 +126,18 @@ public class CommandGenerator
|
|||
DataElement child = element.get(i).dereference();
|
||||
if (child.isDeleted())
|
||||
{
|
||||
element.removeNestedData(child);
|
||||
}
|
||||
}
|
||||
element.removeNestedData(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new command from a command descriptor and it's arguments.
|
||||
*
|
||||
*
|
||||
* @param commandDescriptor the command type of the new command
|
||||
* @param arguments the arguments for the command, besides the subject
|
||||
* @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
|
||||
*/
|
||||
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.
|
||||
*
|
||||
*
|
||||
* @param commandDescriptor the command type of the new command
|
||||
* @param arg the arguement for the command, besides the subject
|
||||
* @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
|
||||
*/
|
||||
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$
|
||||
}
|
||||
|
||||
|
||||
|
||||
return logCommand(commandObject);
|
||||
}
|
||||
|
@ -233,10 +236,10 @@ public class CommandGenerator
|
|||
|
||||
/**
|
||||
* Creates a new command from a command descriptor and it's arguments.
|
||||
*
|
||||
*
|
||||
* @param commandDescriptor the command type of the new 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
|
||||
*/
|
||||
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.
|
||||
*
|
||||
*
|
||||
* @param document the root of the response
|
||||
* @param objects the data contained in the response
|
||||
* @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.
|
||||
*
|
||||
*
|
||||
* @param responseType the type of data to respond with
|
||||
* @param dataObject the child object in the response tree
|
||||
* @return the response tree root
|
||||
|
@ -303,7 +306,7 @@ public class CommandGenerator
|
|||
|
||||
/**
|
||||
* Creates a simple response object of the specified type
|
||||
*
|
||||
*
|
||||
* @param responseType the type of data to respond with
|
||||
* @return the response object
|
||||
*/
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* David McKnight (IBM) [220123][dstore] Configurable timeout on irresponsiveness
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* @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
|
||||
{
|
||||
|
@ -74,8 +75,8 @@ public abstract class Receiver extends SecuredThread implements IDataStorePrefer
|
|||
{
|
||||
//System.out.println("Receiver:" + ioe);
|
||||
}
|
||||
|
||||
// keepalive preferences
|
||||
|
||||
// keepalive preferences
|
||||
String keepAliveResponseTimeout = System.getProperty(XMLparser.KEEPALIVE_RESPONSE_TIMEOUT_PREFERENCE);
|
||||
if (keepAliveResponseTimeout != null){
|
||||
preferenceChanged(XMLparser.KEEPALIVE_RESPONSE_TIMEOUT_PREFERENCE, keepAliveResponseTimeout);
|
||||
|
@ -119,7 +120,7 @@ public abstract class Receiver extends SecuredThread implements IDataStorePrefer
|
|||
{
|
||||
handleInput();
|
||||
}
|
||||
|
||||
|
||||
if (_canExit){
|
||||
// is this an unexpected exit?
|
||||
if (_dataStore.isConnected()){
|
||||
|
@ -186,7 +187,7 @@ public abstract class Receiver extends SecuredThread implements IDataStorePrefer
|
|||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
|
@ -195,8 +196,8 @@ public abstract class Receiver extends SecuredThread implements IDataStorePrefer
|
|||
* @param e an exception that occurred
|
||||
*/
|
||||
public abstract void handleError(Throwable e);
|
||||
|
||||
|
||||
|
||||
|
||||
public void preferenceChanged(String property, String value)
|
||||
{
|
||||
//System.out.println("setting preference: "+property + "="+value);
|
||||
|
@ -215,5 +216,5 @@ public abstract class Receiver extends SecuredThread implements IDataStorePrefer
|
|||
_xmlParser.setEnableKeepalive(enable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2008 IBM Corporation. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* 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: David McKnight.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Extracted interface from DataStoreTrustManager.
|
||||
* @since 3.0
|
||||
*/
|
||||
public interface IDataStoreTrustManager extends X509TrustManager
|
||||
{
|
||||
/**
|
||||
|
@ -25,7 +29,7 @@ public interface IDataStoreTrustManager extends X509TrustManager
|
|||
* @param password the password
|
||||
*/
|
||||
public void setKeystore(String filePath, String password);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the list of untrusted certificates
|
||||
* @return the list of untrusted certificates
|
||||
|
|
|
@ -500,8 +500,9 @@ public class ArchiveHandlerManager
|
|||
|
||||
/**
|
||||
* Create an empty archive
|
||||
*
|
||||
*
|
||||
* @throws SystemMessageException in case of an error
|
||||
* @since 3.0 returns void but throws SystemMessageException
|
||||
*/
|
||||
public void createEmptyArchive(File newFile) throws SystemMessageException
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue