import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Collections;
return null;
}
- public boolean pingServer() {
+ public boolean pingServer() throws CDMServerException, IOException {
if(isLocalhostMgd()) {
return true;
}
- try {
- Socket s = new Socket(server, port);
- logger.info("[CDM-Server] Available @ " + server + ":" + port );
- updateInfo();
- return true;
- } catch (IOException ioe) {
-
- } catch (CDMServerException e) {
-
- }
- return false;
+ Socket s = new Socket();
+ s.connect(new InetSocketAddress(server, port), 2000);
+ logger.info("[CDM-Server] Available @ " + server + ":" + port );
+ updateInfo();
+ return true;
}
public boolean pingInstance(CdmInstanceInfo instance, int port) throws CDMServerException {
public static String PresenceAbsenceTermDetailElement_COLOR_NOT_SET;
public static String PresenceAbsenceTermDetailElement_LABEL_COLOR;
public static String RemotingLoginDialog_CHOOSE_COMPATIBLE_CDM_SERVER;
+
+
public static String RemotingLoginDialog_DEFAULT_LOGIN;
+
+
public static String RemotingLoginDialog_LABEL_ADVANCED;
+
+
public static String RemotingLoginDialog_LABEL_CDM_INSTANCE;
+
+
public static String RemotingLoginDialog_LABEL_CDM_SERVER;
+
+
public static String RemotingLoginDialog_LABEL_CONNECT;
+
+
public static String RemotingLoginDialog_LABEL_EDITOR_CDM_VERSION;
+
+
public static String RemotingLoginDialog_LABEL_EDITOR_CDMLIB_VERSION;
+
+
public static String RemotingLoginDialog_LABEL_LOGIN;
+
+
public static String RemotingLoginDialog_LABEL_LOGIN_COLON;
+
+
public static String RemotingLoginDialog_LABEL_PASSWORD;
+
+
public static String RemotingLoginDialog_LABEL_PORT;
+
+
public static String RemotingLoginDialog_LABEL_REFRESH;
+
+
public static String RemotingLoginDialog_LABEL_REMEMBER_ME;
+
+
public static String RemotingLoginDialog_RETRIEVE_SERVER_INSTANCES;
+
+
public static String RemotingLoginDialog_LABEL_SERVER_CDM_VERSION;
+
+
public static String RemotingLoginDialog_LABEL_SERVER_CDMLIB_VERSION;
+
+
public static String RemotingLoginDialog_LABEL_STOP_MANAGED_SERVER;
+
+
public static String RemotingLoginDialog_LOGIN_CANNOT_BE_EMPTY;
+
+
public static String RemotingLoginDialog_MESSAGE_PORT_SHOULD_BE_INTEGER;
+
+
public static String RemotingLoginDialog_PASSWORD_CANNOT_BE_EMPTY;
+
+
public static String RemotingLoginDialog_SERVER_LAUNCH_ERROR;
+
+
public static String RemotingLoginDialog_STATUS_AVAILABLE;
+
+
public static String RemotingLoginDialog_STATUS_CHECKING;
+
+
public static String RemotingLoginDialog_STATUS_ERROR;
public static String RemotingLoginDialog_STATUS_NO_INSTANCES_FOUND;
+
+
public static String RemotingLoginDialog_STATUS_NOT_AVAILABLE;
+
+
public static String RemotingLoginDialog_STATUS_NOT_COMPATIBLE;
+
+
public static String RemotingLoginDialog_STATUS_NOT_STARTED;
+
+
public static String RemotingLoginDialog_STATUS_REMOTING_NOT_ACTIVATED;
public static String RemotingLoginDialog_STATUS_RETRIEVING;
+
+
public static String RemotingLoginDialog_STATUS_STARTED;
+
+
public static String RemotingLoginDialog_UPDATE_EDITOR;
- public static String RemotingLoginDialog_COULD_NOT_STOP_SERVER;
+
+
+ public static String RemotingLoginDialog_CONNECTION_FAILED_MESSAGE;
+
+
+ public static String RemotingLoginDialog_CONNECTION_FAILED_TITLE;
+
+
+ public static String RemotingLoginDialog_COULD_NOT_STOP_SERVER;
+
+
public static String RemotingLoginDialog_ERROR_GENERATING_CONFIG_FILE;
+
+
public static String RemotingLoginDialog_ERROR_STARTING_SERVER;
+
+
public static String RemotingLoginDialog_ERROR_STOPPING_SERVER;
+
+
public static String RemotingLoginDialog_GENERATING_CONFIG_FILE;
+
+
public static String RemotingLoginDialog_JOB_SERVER_LAUNCH;
+
+
public static String RemotingLoginDialog_STARTING_MGD_SERVER;
+
public static String RemotingLoginDialog_TASK_LAUNCHING_SERVER;
+
+
public static String SearchManager_LARGE_RESULT_EXPECTED;
public static String SearchManager_LONG_SEARCH_WARNING;
public static String SupplementalDataViewPart_VIEWER_NAME;
CdmStoreConnector_UPDATE_EDITOR_OR_CHOOSE_COMPATIBLE_DATASOURCE=Please update the Taxonomic Editor (Help->Check for Updates) or choose a compatible datasource
ConfiguratorComposite_CONFIGURE=Configure
+RemotingLoginDialog_CONNECTION_FAILED_MESSAGE=Could not connect to CDM Server.
+RemotingLoginDialog_CONNECTION_FAILED_TITLE=Connection failed
RemotingLoginDialog_DEFAULT_LOGIN=Default: %s (login), %s (password)
RemotingLoginDialog_CHOOSE_COMPATIBLE_CDM_SERVER=Please choose a compatible cdm-server or update the chosen cdm-server
RemotingLoginDialog_LABEL_ADVANCED=advanced
CdmStoreConnector_UPDATE_EDITOR_OR_CHOOSE_COMPATIBLE_DATASOURCE=Bitte aktualisieren Sie den Taxonomic Editor (Hilfe->Suche nach Updates) oder wählen sie eine kompatible Datenquelle
ConfiguratorComposite_CONFIGURE=Einstellungen
+RemotingLoginDialog_CONNECTION_FAILED_MESSAGE=Eine Verbindung zum CDM-Server konnte nicht hergestellt werden.
+RemotingLoginDialog_CONNECTION_FAILED_TITLE=Verbindung fehlgeschlagen
RemotingLoginDialog_DEFAULT_LOGIN=Standard: %s (Login), %s (Kennwort)
RemotingLoginDialog_CHOOSE_COMPATIBLE_CDM_SERVER=Bitte wählen Sie einen kompatiblen CDM-Server oder aktualisieren sie den CDM-Server
RemotingLoginDialog_LABEL_ADVANCED=Erweitert
/**
*
*/
- private static final String DEFAULT_PASS = "00000";
+ private static final String DEFAULT_PASS = "00000"; //$NON-NLS-1$
/**
*
*/
- private static final String DEFAULT_USER = "admin";
+ private static final String DEFAULT_USER = "admin"; //$NON-NLS-1$
private static final String UBUNTU = "Ubuntu"; //$NON-NLS-1$
protected Object result;
protected Shell shlConnect;
txtPort.setEditable(true);
txtPort.setEnabled(true);
}
- if(selectedCsii.pingServer()) {
- txtCdmServerStatus.setText(STATUS_AVAILABLE);
- populateCdmInstanceCombo(true);
- String serverVersionTimestamp = generateLastModifiedTooltip(selectedCsii.getCdmlibLastModified());
- txtServerVersion.setText(selectedCsii.getCdmlibServicesVersion() + ":" + serverVersionTimestamp); //$NON-NLS-1$
- } else {
- txtCdmServerStatus.setText(STATUS_NOT_AVAILABLE);
- comboCdmInstance.removeAll();
- disableCdmInstanceControls("", "");
+ try {
+ if(selectedCsii.pingServer()) {
+ txtCdmServerStatus.setText(STATUS_AVAILABLE);
+ populateCdmInstanceCombo(true);
+ String serverVersionTimestamp = generateLastModifiedTooltip(selectedCsii.getCdmlibLastModified());
+ txtServerVersion.setText(selectedCsii.getCdmlibServicesVersion() + ":" + serverVersionTimestamp); //$NON-NLS-1$
+ } else {
+ txtCdmServerStatus.setText(STATUS_NOT_AVAILABLE);
+ comboCdmInstance.removeAll();
+ disableCdmInstanceControls("", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ } catch (CDMServerException | IOException e) {
+ MessagingUtils.errorDialog(Messages.RemotingLoginDialog_CONNECTION_FAILED_TITLE, this,
+ Messages.RemotingLoginDialog_CONNECTION_FAILED_MESSAGE,
+ TaxeditorStorePlugin.PLUGIN_ID, e, true, true);
}
}
updatePort();
*/
package eu.etaxonomy.taxeditor.ui.dialogs;
+import java.io.IOException;
import java.util.List;
import org.junit.Assert;
public class CdmServerInfoTest extends UnitilsJUnit4 {
@Test
- public void pingServersTest() {
+ public void pingServersTest() throws CDMServerException, IOException {
List<CdmServerInfo> servers = CdmServerInfo.getCdmServers();
for(CdmServerInfo server : servers) {
server.pingServer();