connectivity/com.nokia.tcf/src/com/nokia/tcf/impl/TCBaseConnection.java
author chpeckha
Mon, 06 Apr 2009 15:18:48 -0500
changeset 60 9d2210c8eed2
parent 2 d760517a8095
permissions -rw-r--r--
Commit changes for 2.1.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
cawthron
parents:
diff changeset
     1
/*
cawthron
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
cawthron
parents:
diff changeset
     3
* All rights reserved.
cawthron
parents:
diff changeset
     4
* This component and the accompanying materials are made available
cawthron
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
cawthron
parents:
diff changeset
     6
* which accompanies this distribution, and is available
cawthron
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
cawthron
parents:
diff changeset
     8
*
cawthron
parents:
diff changeset
     9
* Initial Contributors:
cawthron
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
cawthron
parents:
diff changeset
    11
*
cawthron
parents:
diff changeset
    12
* Contributors:
cawthron
parents:
diff changeset
    13
*
cawthron
parents:
diff changeset
    14
* Description: 
cawthron
parents:
diff changeset
    15
*
cawthron
parents:
diff changeset
    16
*/
cawthron
parents:
diff changeset
    17
/**
cawthron
parents:
diff changeset
    18
 * 
cawthron
parents:
diff changeset
    19
 */
cawthron
parents:
diff changeset
    20
package com.nokia.tcf.impl;
cawthron
parents:
diff changeset
    21
cawthron
parents:
diff changeset
    22
import org.eclipse.core.runtime.IStatus;
cawthron
parents:
diff changeset
    23
import org.eclipse.core.runtime.Status;
cawthron
parents:
diff changeset
    24
cawthron
parents:
diff changeset
    25
import com.nokia.tcf.Activator;
cawthron
parents:
diff changeset
    26
import com.nokia.tcf.api.ITCConnection;
cawthron
parents:
diff changeset
    27
import com.nokia.tcf.api.TCErrorConstants;
cawthron
parents:
diff changeset
    28
cawthron
parents:
diff changeset
    29
public abstract class TCBaseConnection implements ITCConnection {
cawthron
parents:
diff changeset
    30
60
9d2210c8eed2 Commit changes for 2.1.0
chpeckha
parents: 2
diff changeset
    31
	private String connectionType;
2
cawthron
parents:
diff changeset
    32
	private long retryInterval;
cawthron
parents:
diff changeset
    33
	private long retryTimeout;
cawthron
parents:
diff changeset
    34
	protected String decodeFormat;
cawthron
parents:
diff changeset
    35
	/**
cawthron
parents:
diff changeset
    36
	 * @param connectionType
cawthron
parents:
diff changeset
    37
	 * @param retryInterval
cawthron
parents:
diff changeset
    38
	 * @param retryTimeout
cawthron
parents:
diff changeset
    39
	 * @param decodeFormat
cawthron
parents:
diff changeset
    40
	 */
60
9d2210c8eed2 Commit changes for 2.1.0
chpeckha
parents: 2
diff changeset
    41
	public TCBaseConnection(String connectionType, long retryInterval,
2
cawthron
parents:
diff changeset
    42
			long retryTimeout, String decodeFormat) {
cawthron
parents:
diff changeset
    43
		super();
60
9d2210c8eed2 Commit changes for 2.1.0
chpeckha
parents: 2
diff changeset
    44
		this.connectionType = connectionType.toLowerCase();
2
cawthron
parents:
diff changeset
    45
		this.retryInterval = retryInterval;
cawthron
parents:
diff changeset
    46
		this.retryTimeout = retryTimeout;
cawthron
parents:
diff changeset
    47
		this.decodeFormat = decodeFormat;
cawthron
parents:
diff changeset
    48
	}
cawthron
parents:
diff changeset
    49
cawthron
parents:
diff changeset
    50
	/**
cawthron
parents:
diff changeset
    51
	 * @param connectionType
cawthron
parents:
diff changeset
    52
	 */
60
9d2210c8eed2 Commit changes for 2.1.0
chpeckha
parents: 2
diff changeset
    53
	public TCBaseConnection(String connectionType) {
2
cawthron
parents:
diff changeset
    54
		super();
60
9d2210c8eed2 Commit changes for 2.1.0
chpeckha
parents: 2
diff changeset
    55
		this.connectionType = connectionType.toLowerCase();
2
cawthron
parents:
diff changeset
    56
		this.retryInterval = DEFAULT_COMM_ERROR_RETRY_INTERVAL;
cawthron
parents:
diff changeset
    57
		this.retryTimeout = DEFAULT_COMM_ERROR_RETRY_TIMEOUT;
cawthron
parents:
diff changeset
    58
		this.decodeFormat = "ost";
cawthron
parents:
diff changeset
    59
	}
cawthron
parents:
diff changeset
    60
cawthron
parents:
diff changeset
    61
	/**
cawthron
parents:
diff changeset
    62
	 * @param connectionType
cawthron
parents:
diff changeset
    63
	 * @param retryInterval
cawthron
parents:
diff changeset
    64
	 * @param retryTimeout
cawthron
parents:
diff changeset
    65
	 */
60
9d2210c8eed2 Commit changes for 2.1.0
chpeckha
parents: 2
diff changeset
    66
	public TCBaseConnection(String connectionType, long retryInterval,
2
cawthron
parents:
diff changeset
    67
			long retryTimeout) {
cawthron
parents:
diff changeset
    68
		super();
60
9d2210c8eed2 Commit changes for 2.1.0
chpeckha
parents: 2
diff changeset
    69
		this.connectionType = connectionType.toLowerCase();
2
cawthron
parents:
diff changeset
    70
		this.retryInterval = retryInterval;
cawthron
parents:
diff changeset
    71
		this.retryTimeout = retryTimeout;
cawthron
parents:
diff changeset
    72
		this.decodeFormat = "ost";
cawthron
parents:
diff changeset
    73
	}
cawthron
parents:
diff changeset
    74
cawthron
parents:
diff changeset
    75
	/* (non-Javadoc)
cawthron
parents:
diff changeset
    76
	 * @see com.nokia.tcf.api.ITCConnection#getConnectionString()
cawthron
parents:
diff changeset
    77
	 */
cawthron
parents:
diff changeset
    78
	public abstract String getConnectionDescription();
cawthron
parents:
diff changeset
    79
	
cawthron
parents:
diff changeset
    80
	/* (non-Javadoc)
cawthron
parents:
diff changeset
    81
	 * @see com.nokia.tcf.api.ITCConnection#getConnectionType()
cawthron
parents:
diff changeset
    82
	 */
60
9d2210c8eed2 Commit changes for 2.1.0
chpeckha
parents: 2
diff changeset
    83
	public String getConnectionType() {
2
cawthron
parents:
diff changeset
    84
		return this.connectionType;
cawthron
parents:
diff changeset
    85
	}
cawthron
parents:
diff changeset
    86
cawthron
parents:
diff changeset
    87
	/* (non-Javadoc)
cawthron
parents:
diff changeset
    88
	 * @see com.nokia.tcf.api.ITCConnection#getRetryInterval()
cawthron
parents:
diff changeset
    89
	 */
cawthron
parents:
diff changeset
    90
	public long getRetryInterval() {
cawthron
parents:
diff changeset
    91
		return this.retryInterval;
cawthron
parents:
diff changeset
    92
	}
cawthron
parents:
diff changeset
    93
cawthron
parents:
diff changeset
    94
	/* (non-Javadoc)
cawthron
parents:
diff changeset
    95
	 * @see com.nokia.tcf.api.ITCConnection#getRetryTimeout()
cawthron
parents:
diff changeset
    96
	 */
cawthron
parents:
diff changeset
    97
	public long getRetryTimeout() {
cawthron
parents:
diff changeset
    98
		return this.retryTimeout;
cawthron
parents:
diff changeset
    99
	}
cawthron
parents:
diff changeset
   100
cawthron
parents:
diff changeset
   101
	/* (non-Javadoc)
cawthron
parents:
diff changeset
   102
	 * @see com.nokia.tcf.api.ITCConnection#setConnectionType(int)
cawthron
parents:
diff changeset
   103
	 */
60
9d2210c8eed2 Commit changes for 2.1.0
chpeckha
parents: 2
diff changeset
   104
	public IStatus setConnectionType(String inConnectionType) {
2
cawthron
parents:
diff changeset
   105
		IStatus status = new Status(Status.OK, Activator.PLUGIN_ID, (int)TCErrorConstants.TCAPI_ERR_NONE, "OK", null);
60
9d2210c8eed2 Commit changes for 2.1.0
chpeckha
parents: 2
diff changeset
   106
		connectionType = inConnectionType.toLowerCase();
2
cawthron
parents:
diff changeset
   107
		return status;
cawthron
parents:
diff changeset
   108
	}
cawthron
parents:
diff changeset
   109
cawthron
parents:
diff changeset
   110
	/* (non-Javadoc)
cawthron
parents:
diff changeset
   111
	 * @see com.nokia.tcf.api.ITCConnection#setRetryInterval(long)
cawthron
parents:
diff changeset
   112
	 */
cawthron
parents:
diff changeset
   113
	public IStatus setRetryInterval(long inRetryInterval) {
cawthron
parents:
diff changeset
   114
		IStatus status = new Status(Status.OK, Activator.PLUGIN_ID, (int)TCErrorConstants.TCAPI_ERR_NONE, "OK", null);
cawthron
parents:
diff changeset
   115
		if (inRetryInterval <= 0) {
cawthron
parents:
diff changeset
   116
			this.retryInterval = ITCConnection.DEFAULT_COMM_ERROR_RETRY_INTERVAL;
cawthron
parents:
diff changeset
   117
		} else {
cawthron
parents:
diff changeset
   118
			this.retryInterval = inRetryInterval;
cawthron
parents:
diff changeset
   119
		}
cawthron
parents:
diff changeset
   120
		return status;
cawthron
parents:
diff changeset
   121
	}
cawthron
parents:
diff changeset
   122
cawthron
parents:
diff changeset
   123
	/* (non-Javadoc)
cawthron
parents:
diff changeset
   124
	 * @see com.nokia.tcf.api.ITCConnection#setRetryTimeout(long)
cawthron
parents:
diff changeset
   125
	 */
cawthron
parents:
diff changeset
   126
	public IStatus setRetryTimeout(long inRetryTimeout) {
cawthron
parents:
diff changeset
   127
		IStatus status = new Status(Status.OK, Activator.PLUGIN_ID, (int)TCErrorConstants.TCAPI_ERR_NONE, "OK", null);
cawthron
parents:
diff changeset
   128
		if (inRetryTimeout <= 0) {
cawthron
parents:
diff changeset
   129
			this.retryTimeout = ITCConnection.DEFAULT_COMM_ERROR_RETRY_TIMEOUT;
cawthron
parents:
diff changeset
   130
		} else {
cawthron
parents:
diff changeset
   131
			this.retryTimeout = inRetryTimeout;
cawthron
parents:
diff changeset
   132
		}
cawthron
parents:
diff changeset
   133
		return status;
cawthron
parents:
diff changeset
   134
	}
cawthron
parents:
diff changeset
   135
cawthron
parents:
diff changeset
   136
	/* (non-Javadoc)
cawthron
parents:
diff changeset
   137
	 * @see com.nokia.tcf.api.ITCConnection#getDecodeFormat()
cawthron
parents:
diff changeset
   138
	 */
cawthron
parents:
diff changeset
   139
	public String getDecodeFormat() {
cawthron
parents:
diff changeset
   140
		return this.decodeFormat;
cawthron
parents:
diff changeset
   141
	}
cawthron
parents:
diff changeset
   142
cawthron
parents:
diff changeset
   143
	/* (non-Javadoc)
cawthron
parents:
diff changeset
   144
	 * @see com.nokia.tcf.api.ITCConnection#setDecodeFormat(long)
cawthron
parents:
diff changeset
   145
	 */
cawthron
parents:
diff changeset
   146
	public IStatus setDecodeFormat(String inDecodeFormat) {
cawthron
parents:
diff changeset
   147
		IStatus status = new Status(Status.OK, Activator.PLUGIN_ID, (int)TCErrorConstants.TCAPI_ERR_NONE, "OK", null);
60
9d2210c8eed2 Commit changes for 2.1.0
chpeckha
parents: 2
diff changeset
   148
		decodeFormat = inDecodeFormat;
2
cawthron
parents:
diff changeset
   149
		return status;
cawthron
parents:
diff changeset
   150
	}
cawthron
parents:
diff changeset
   151
cawthron
parents:
diff changeset
   152
}