connectivity/com.nokia.carbide.remoteConnections.tests/src/com/nokia/carbide/remoteconnections/tests/extensions/DefaultProvidingTCPIPService.java
author dadubrow
Tue, 19 May 2009 15:33:01 -0500
changeset 164 88b7eb94b003
permissions -rw-r--r--
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
164
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
     1
/*
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
     3
* All rights reserved.
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
     4
* This component and the accompanying materials are made available
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
     6
* which accompanies this distribution, and is available
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
     8
*
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
     9
* Initial Contributors:
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    11
*
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    12
* Contributors:
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    13
*
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    14
* Description: 
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    15
*
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    16
*/
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    17
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    18
package com.nokia.carbide.remoteconnections.tests.extensions;
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    19
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    20
import com.nokia.carbide.remoteconnections.interfaces.*;
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    21
import com.nokia.carbide.trk.support.connection.TCPIPConnectionFactory;
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    22
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    23
import org.osgi.framework.Version;
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    24
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    25
import java.util.Collections;
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    26
import java.util.Map;
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    27
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    28
@SuppressWarnings("restriction")
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    29
public class DefaultProvidingTCPIPService implements IService2 {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    30
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    31
	public static final String DEFAULT_PORT = "4144";
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    32
	public static String ID = DefaultProvidingTCPIPService.class.getName();
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    33
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    34
	public DefaultProvidingTCPIPService() {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    35
	}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    36
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    37
	public String getAdditionalServiceInfo() {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    38
		return "No testing available for this service";
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    39
	}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    40
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    41
	public String getDisplayName() {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    42
		return "Default Providing Service";
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    43
	}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    44
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    45
	public String getIdentifier() {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    46
		return ID;
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    47
	}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    48
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    49
	public IRemoteAgentInstallerProvider getInstallerProvider() {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    50
		return null;
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    51
	}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    52
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    53
	public boolean isTestable() {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    54
		return false;
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    55
	}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    56
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    57
	public Map<String, String> getDefaults() {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    58
		return Collections.singletonMap(TCPIPConnectionFactory.IP_PORT, DEFAULT_PORT);
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    59
	}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    60
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    61
	public IConnectedService createInstance(IConnection connection) {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    62
		final IConnectedService[] connectedService = { null }; 
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    63
		IConnectedService cs = new IConnectedService() {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    64
			private boolean enabled;
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    65
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    66
			public void addStatusChangedListener(IStatusChangedListener listener) {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    67
			}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    68
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    69
			public void dispose() {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    70
			}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    71
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    72
			public IService getService() {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    73
				return DefaultProvidingTCPIPService.this;
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    74
			}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    75
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    76
			public IStatus getStatus() {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    77
				return new IStatus() {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    78
					public IConnectedService getConnectedService() {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    79
						return connectedService[0];
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    80
					}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    81
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    82
					public EStatus getEStatus() {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    83
						return EStatus.UNKNOWN;
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    84
					}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    85
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    86
					public String getLongDescription() {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    87
						return "This is for testing only";
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    88
					}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    89
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    90
					public String getShortDescription() {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    91
						return "Unknown status";
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    92
					}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    93
				};
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    94
			}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    95
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    96
			public boolean isEnabled() {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    97
				return enabled;
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    98
			}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
    99
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   100
			public void removeStatusChangedListener(IStatusChangedListener listener) {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   101
			}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   102
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   103
			public void setDeviceOS(String familyName, Version version) {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   104
			}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   105
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   106
			public void setEnabled(boolean enabled) {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   107
				this.enabled = enabled;
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   108
			}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   109
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   110
			public void testStatus() {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   111
			}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   112
		};
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   113
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   114
		connectedService[0] = cs;
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   115
		return cs;
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   116
	}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   117
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   118
	public boolean wantsDeviceOS() {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   119
		return false;
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   120
	}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   121
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   122
	public Object getAdapter(Class adapter) {
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   123
		return null;
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   124
	}
88b7eb94b003 [Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff changeset
   125
}