2
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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 |
*/
|
|
20 |
package com.nokia.tcf.impl;
|
|
21 |
|
|
22 |
import org.eclipse.core.runtime.IStatus;
|
|
23 |
import org.eclipse.core.runtime.Status;
|
|
24 |
|
|
25 |
import com.nokia.tcf.Activator;
|
|
26 |
import com.nokia.tcf.api.ITCConnection;
|
|
27 |
import com.nokia.tcf.api.TCErrorConstants;
|
|
28 |
|
|
29 |
public abstract class TCBaseConnection implements ITCConnection {
|
|
30 |
|
60
|
31 |
private String connectionType;
|
2
|
32 |
private long retryInterval;
|
|
33 |
private long retryTimeout;
|
|
34 |
protected String decodeFormat;
|
|
35 |
/**
|
|
36 |
* @param connectionType
|
|
37 |
* @param retryInterval
|
|
38 |
* @param retryTimeout
|
|
39 |
* @param decodeFormat
|
|
40 |
*/
|
60
|
41 |
public TCBaseConnection(String connectionType, long retryInterval,
|
2
|
42 |
long retryTimeout, String decodeFormat) {
|
|
43 |
super();
|
60
|
44 |
this.connectionType = connectionType.toLowerCase();
|
2
|
45 |
this.retryInterval = retryInterval;
|
|
46 |
this.retryTimeout = retryTimeout;
|
|
47 |
this.decodeFormat = decodeFormat;
|
|
48 |
}
|
|
49 |
|
|
50 |
/**
|
|
51 |
* @param connectionType
|
|
52 |
*/
|
60
|
53 |
public TCBaseConnection(String connectionType) {
|
2
|
54 |
super();
|
60
|
55 |
this.connectionType = connectionType.toLowerCase();
|
2
|
56 |
this.retryInterval = DEFAULT_COMM_ERROR_RETRY_INTERVAL;
|
|
57 |
this.retryTimeout = DEFAULT_COMM_ERROR_RETRY_TIMEOUT;
|
|
58 |
this.decodeFormat = "ost";
|
|
59 |
}
|
|
60 |
|
|
61 |
/**
|
|
62 |
* @param connectionType
|
|
63 |
* @param retryInterval
|
|
64 |
* @param retryTimeout
|
|
65 |
*/
|
60
|
66 |
public TCBaseConnection(String connectionType, long retryInterval,
|
2
|
67 |
long retryTimeout) {
|
|
68 |
super();
|
60
|
69 |
this.connectionType = connectionType.toLowerCase();
|
2
|
70 |
this.retryInterval = retryInterval;
|
|
71 |
this.retryTimeout = retryTimeout;
|
|
72 |
this.decodeFormat = "ost";
|
|
73 |
}
|
|
74 |
|
|
75 |
/* (non-Javadoc)
|
|
76 |
* @see com.nokia.tcf.api.ITCConnection#getConnectionString()
|
|
77 |
*/
|
|
78 |
public abstract String getConnectionDescription();
|
|
79 |
|
|
80 |
/* (non-Javadoc)
|
|
81 |
* @see com.nokia.tcf.api.ITCConnection#getConnectionType()
|
|
82 |
*/
|
60
|
83 |
public String getConnectionType() {
|
2
|
84 |
return this.connectionType;
|
|
85 |
}
|
|
86 |
|
|
87 |
/* (non-Javadoc)
|
|
88 |
* @see com.nokia.tcf.api.ITCConnection#getRetryInterval()
|
|
89 |
*/
|
|
90 |
public long getRetryInterval() {
|
|
91 |
return this.retryInterval;
|
|
92 |
}
|
|
93 |
|
|
94 |
/* (non-Javadoc)
|
|
95 |
* @see com.nokia.tcf.api.ITCConnection#getRetryTimeout()
|
|
96 |
*/
|
|
97 |
public long getRetryTimeout() {
|
|
98 |
return this.retryTimeout;
|
|
99 |
}
|
|
100 |
|
|
101 |
/* (non-Javadoc)
|
|
102 |
* @see com.nokia.tcf.api.ITCConnection#setConnectionType(int)
|
|
103 |
*/
|
60
|
104 |
public IStatus setConnectionType(String inConnectionType) {
|
2
|
105 |
IStatus status = new Status(Status.OK, Activator.PLUGIN_ID, (int)TCErrorConstants.TCAPI_ERR_NONE, "OK", null);
|
60
|
106 |
connectionType = inConnectionType.toLowerCase();
|
2
|
107 |
return status;
|
|
108 |
}
|
|
109 |
|
|
110 |
/* (non-Javadoc)
|
|
111 |
* @see com.nokia.tcf.api.ITCConnection#setRetryInterval(long)
|
|
112 |
*/
|
|
113 |
public IStatus setRetryInterval(long inRetryInterval) {
|
|
114 |
IStatus status = new Status(Status.OK, Activator.PLUGIN_ID, (int)TCErrorConstants.TCAPI_ERR_NONE, "OK", null);
|
|
115 |
if (inRetryInterval <= 0) {
|
|
116 |
this.retryInterval = ITCConnection.DEFAULT_COMM_ERROR_RETRY_INTERVAL;
|
|
117 |
} else {
|
|
118 |
this.retryInterval = inRetryInterval;
|
|
119 |
}
|
|
120 |
return status;
|
|
121 |
}
|
|
122 |
|
|
123 |
/* (non-Javadoc)
|
|
124 |
* @see com.nokia.tcf.api.ITCConnection#setRetryTimeout(long)
|
|
125 |
*/
|
|
126 |
public IStatus setRetryTimeout(long inRetryTimeout) {
|
|
127 |
IStatus status = new Status(Status.OK, Activator.PLUGIN_ID, (int)TCErrorConstants.TCAPI_ERR_NONE, "OK", null);
|
|
128 |
if (inRetryTimeout <= 0) {
|
|
129 |
this.retryTimeout = ITCConnection.DEFAULT_COMM_ERROR_RETRY_TIMEOUT;
|
|
130 |
} else {
|
|
131 |
this.retryTimeout = inRetryTimeout;
|
|
132 |
}
|
|
133 |
return status;
|
|
134 |
}
|
|
135 |
|
|
136 |
/* (non-Javadoc)
|
|
137 |
* @see com.nokia.tcf.api.ITCConnection#getDecodeFormat()
|
|
138 |
*/
|
|
139 |
public String getDecodeFormat() {
|
|
140 |
return this.decodeFormat;
|
|
141 |
}
|
|
142 |
|
|
143 |
/* (non-Javadoc)
|
|
144 |
* @see com.nokia.tcf.api.ITCConnection#setDecodeFormat(long)
|
|
145 |
*/
|
|
146 |
public IStatus setDecodeFormat(String inDecodeFormat) {
|
|
147 |
IStatus status = new Status(Status.OK, Activator.PLUGIN_ID, (int)TCErrorConstants.TCAPI_ERR_NONE, "OK", null);
|
60
|
148 |
decodeFormat = inDecodeFormat;
|
2
|
149 |
return status;
|
|
150 |
}
|
|
151 |
|
|
152 |
}
|