aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip
diff options
context:
space:
mode:
authorLyubomir Marinov <lyubomir.marinov@jitsi.org>2009-04-27 11:31:04 +0000
committerLyubomir Marinov <lyubomir.marinov@jitsi.org>2009-04-27 11:31:04 +0000
commit66a5e4f5d75892fe5e3bdcd39beadc77644f44b9 (patch)
tree4ca167d721ab6049d9c1a4760dac712b2e242ba0 /src/net/java/sip
parent5b39274f8e655d927b9fda85d1c63fa41096a1eb (diff)
downloadjitsi-66a5e4f5d75892fe5e3bdcd39beadc77644f44b9.zip
jitsi-66a5e4f5d75892fe5e3bdcd39beadc77644f44b9.tar.gz
jitsi-66a5e4f5d75892fe5e3bdcd39beadc77644f44b9.tar.bz2
Removes duplication in Call and its implementers with respect to setCallState().
Diffstat (limited to 'src/net/java/sip')
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/CallJabberImpl.java39
-rw-r--r--src/net/java/sip/communicator/impl/protocol/mock/MockCall.java42
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/CallSipImpl.java36
-rw-r--r--src/net/java/sip/communicator/service/protocol/Call.java32
4 files changed, 38 insertions, 111 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/CallJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/CallJabberImpl.java
index e3f6222..70ff899 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/CallJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/CallJabberImpl.java
@@ -8,10 +8,11 @@ package net.java.sip.communicator.impl.protocol.jabber;
import java.util.*;
+import net.java.sip.communicator.service.media.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
-import net.java.sip.communicator.service.media.*;
+
import org.jivesoftware.smackx.jingle.*;
/**
@@ -35,11 +36,6 @@ public class CallJabberImpl
private Vector callParticipants = new Vector();
/**
- * The state that this call is currently in.
- */
- private CallState callState = CallState.CALL_INITIALIZATION;
-
- /**
* The <tt>CallSession</tt> that the media service has created for this
* call.
*/
@@ -100,37 +96,6 @@ public class CallJabberImpl
}
/**
- * Sets the state of this call and fires a call change event notifying
- * registered listenres for the change.
- *
- * @param newState a reference to the <tt>CallState</tt> instance that
- * the call is to enter.
- */
- public void setCallState(CallState newState)
- {
- CallState oldState = getCallState();
-
- if(oldState == newState)
- return;
-
- this.callState = newState;
-
- fireCallChangeEvent(
- CallChangeEvent.CALL_STATE_CHANGE, oldState, newState);
- }
-
- /**
- * Returns the state that this call is currently in.
- *
- * @return a reference to the <tt>CallState</tt> instance that the call is
- * currently in.
- */
- public CallState getCallState()
- {
- return callState;
- }
-
- /**
* Returns an iterator over all call participants.
* @return an Iterator over all participants currently involved in the call.
*/
diff --git a/src/net/java/sip/communicator/impl/protocol/mock/MockCall.java b/src/net/java/sip/communicator/impl/protocol/mock/MockCall.java
index 8a37f39..8c2ff84 100644
--- a/src/net/java/sip/communicator/impl/protocol/mock/MockCall.java
+++ b/src/net/java/sip/communicator/impl/protocol/mock/MockCall.java
@@ -1,3 +1,9 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
package net.java.sip.communicator.impl.protocol.mock;
import java.util.*;
@@ -20,11 +26,6 @@ public class MockCall
*/
private Vector callParticipants = new Vector();
- /**
- * The state that this call is currently in.
- */
- private CallState callState = CallState.CALL_INITIALIZATION;
-
public MockCall(MockProvider sourceProvider)
{
@@ -54,17 +55,6 @@ public class MockCall
}
/**
- * Returns the state that this call is currently in.
- *
- * @return a reference to the <tt>CallState</tt> instance that the call
- * is currently in.
- */
- public CallState getCallState()
- {
- return callState;
- }
-
- /**
* Adds <tt>callParticipant</tt> to the list of participants in this call.
* If the call participant is already included in the call, the method has
* no effect.
@@ -108,26 +98,6 @@ public class MockCall
setCallState(CallState.CALL_ENDED);
}
- /**
- * Sets the state of this call and fires a call change event notifying
- * registered listenres for the change.
- *
- * @param newState a reference to the <tt>CallState</tt> instance that
- * the call is to enter.
- */
- public void setCallState(CallState newState)
- {
- CallState oldState = getCallState();
-
- if(oldState == newState)
- return;
-
- this.callState = newState;
-
- fireCallChangeEvent(
- CallChangeEvent.CALL_STATE_CHANGE, oldState, newState);
- }
-
public void participantStateChanged(CallParticipantChangeEvent evt)
{
if ( ( (CallParticipantState) evt.getNewValue())
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/CallSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/CallSipImpl.java
index 1fd39e6..c9f86ec 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/CallSipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/CallSipImpl.java
@@ -32,11 +32,6 @@ public class CallSipImpl
new Vector<CallParticipantSipImpl>();
/**
- * The state that this call is currently in.
- */
- private CallState callState = CallState.CALL_INITIALIZATION;
-
- /**
* The <tt>CallSession</tt> that the media service has created for this
* call.
*/
@@ -108,37 +103,6 @@ public class CallSipImpl
}
/**
- * Sets the state of this call and fires a call change event notifying
- * registered listeners for the change.
- *
- * @param newState a reference to the <tt>CallState</tt> instance that the
- * call is to enter.
- */
- public void setCallState(CallState newState)
- {
- CallState oldState = getCallState();
-
- if (oldState == newState)
- return;
-
- this.callState = newState;
-
- fireCallChangeEvent(CallChangeEvent.CALL_STATE_CHANGE, oldState,
- newState);
- }
-
- /**
- * Returns the state that this call is currently in.
- *
- * @return a reference to the <tt>CallState</tt> instance that the call is
- * currently in.
- */
- public CallState getCallState()
- {
- return callState;
- }
-
- /**
* Returns an iterator over all call participants.
*
* @return an Iterator over all participants currently involved in the call.
diff --git a/src/net/java/sip/communicator/service/protocol/Call.java b/src/net/java/sip/communicator/service/protocol/Call.java
index 2a7e3f4..c10aba4 100644
--- a/src/net/java/sip/communicator/service/protocol/Call.java
+++ b/src/net/java/sip/communicator/service/protocol/Call.java
@@ -56,6 +56,11 @@ public abstract class Call
private final boolean sipZrtpAttribute;
/**
+ * The state that this call is currently in.
+ */
+ private CallState callState = CallState.CALL_INITIALIZATION;
+
+ /**
* Creates a new Call instance.
*
* @param sourceProvider the proto provider that created us.
@@ -256,9 +261,32 @@ public abstract class Call
* Returns the state that this call is currently in.
*
* @return a reference to the <tt>CallState</tt> instance that the call is
- * currently in.
+ * currently in.
*/
- public abstract CallState getCallState();
+ public CallState getCallState()
+ {
+ return callState;
+ }
+
+ /**
+ * Sets the state of this call and fires a call change event notifying
+ * registered listeners for the change.
+ *
+ * @param newState a reference to the <tt>CallState</tt> instance that the
+ * call is to enter.
+ */
+ protected void setCallState(CallState newState)
+ {
+ CallState oldState = getCallState();
+
+ if (oldState != newState)
+ {
+ this.callState = newState;
+
+ fireCallChangeEvent(
+ CallChangeEvent.CALL_STATE_CHANGE, oldState, newState);
+ }
+ }
/**
* Returns the default call encryption flag