connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/AbstractConnection.java
changeset 0 fb279309251b
child 698 9162f4cfad65
child 857 d66843399035
equal deleted inserted replaced
-1:000000000000 0:fb279309251b
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 package com.nokia.carbide.remoteconnections.interfaces;
       
    20 
       
    21 import com.nokia.carbide.remoteconnections.interfaces.IConnection;
       
    22 import com.nokia.carbide.remoteconnections.interfaces.IConnectionType;
       
    23 
       
    24 import java.util.HashMap;
       
    25 import java.util.Map;
       
    26 
       
    27 /**
       
    28  * A standard implementation of IConnection
       
    29  */
       
    30 public abstract class AbstractConnection implements IConnection {
       
    31 
       
    32 	private final IConnectionType connectionType;
       
    33 	private final Map<String, String> settings;
       
    34 	private String name;
       
    35 	private String id;
       
    36 
       
    37 	public AbstractConnection(IConnectionType connectionType, Map<String, String> settings) {
       
    38 		this.connectionType = connectionType;
       
    39 		this.settings = new HashMap<String, String>(settings);
       
    40 	}
       
    41 
       
    42 	public void dispose() {
       
    43 	}
       
    44 
       
    45 	public IConnectionType getConnectionType() {
       
    46 		return connectionType;
       
    47 	}
       
    48 
       
    49 	public String getDisplayName() {
       
    50 		return name;
       
    51 	}
       
    52 
       
    53 	public String getIdentifier() {
       
    54 		return id;
       
    55 	}
       
    56 
       
    57 	public Map<String, String> getSettings() {
       
    58 		return settings;
       
    59 	}
       
    60 
       
    61 	public void setDisplayName(String name) {
       
    62 		this.name = name;
       
    63 	}
       
    64 
       
    65 	public void setIdentifier(String id) {
       
    66 		this.id = id;
       
    67 	}
       
    68 
       
    69 	public synchronized void updateSettings(Map<String, String> newSettings) {
       
    70 //		System.out.println("settings update, thread="+Thread.currentThread().getId());
       
    71 		settings.putAll(newSettings);
       
    72 	}
       
    73 
       
    74 }