Fixes various warnings, mostly ones about performance.

cusax-fix
Lyubomir Marinov 18 years ago
parent 24382db153
commit 990eee6bd8

@ -121,6 +121,7 @@ service.gui.buttons.EDIT_TOOLBAR_BUTTON_PRESSED=resources/images/impl/gui/button
service.gui.buttons.DIAL_BUTTON=resources/images/impl/gui/buttons/dialButton.png
service.gui.buttons.HOLD_BUTTON=resources/images/impl/gui/buttons/holdButton.png
service.gui.buttons.MUTE_BUTTON=resources/images/impl/gui/buttons/muteButton.png
service.gui.buttons.LOCAL_VIDEO_BUTTON=resources/images/impl/gui/buttons/localVideoButton.png
service.gui.buttons.TRANSFER_CALL_BUTTON=resources/images/impl/gui/buttons/transferCallButton.png
service.gui.buttons.SECURE_BUTTON_ON=resources/images/impl/gui/buttons/secureOn.png
service.gui.buttons.SECURE_BUTTON_OFF=resources/images/impl/gui/buttons/secureOff.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

@ -314,6 +314,7 @@ service.gui.ENTER_FULL_SCREEN_TOOL_TIP=Enter Fullscreen
service.gui.EXIT_FULL_SCREEN_TOOL_TIP=Exit Fullscreen
service.gui.HOLD_BUTTON_TOOL_TIP=Toggle Hold
service.gui.MUTE_BUTTON_TOOL_TIP=Toggle Mute
service.gui.LOCAL_VIDEO_BUTTON_TOOL_TIP=Toggle Video
service.gui.TRANSFER_BUTTON_TOOL_TIP=Transfer Call
service.gui.SECURITY_INFO=Security information
service.gui.SECURITY_WARNING=Security warning

@ -333,7 +333,6 @@ public SIPCommDefaultTheme()
public void addCustomEntriesToTable(UIDefaults table)
{
List buttonGradient
= Arrays.asList(new Object[]
{ new Float(.3f), new Float(0f), BUTTON_GRADIENT_DARK_COLOR,
@ -400,9 +399,9 @@ public void addCustomEntriesToTable(UIDefaults table)
"SplitPane.oneTouchButtonsOpaque", Boolean.FALSE,
"SplitPane.dividerFocusColor", SPLIT_PANE_DEVIDER_FOCUS_COLOR,
"SplitPane.dividerSize", new Integer(5),
"SplitPane.dividerSize", Integer.valueOf(5),
"ScrollBar.width", new Integer(12),
"ScrollBar.width", Integer.valueOf(12),
"ScrollBar.horizontalThumbIcon",
ImageLoader.getImage(ImageLoader.SCROLLBAR_THUMB_HORIZONTAL),
"ScrollBar.verticalThumbIcon",

@ -359,6 +359,33 @@ public void createSecurityPanel(
}
}
private class VideoTelephonyListener
implements PropertyChangeListener,
VideoListener
{
public void propertyChange(PropertyChangeEvent event)
{
if (OperationSetVideoTelephony.LOCAL_VIDEO_STREAMING.equals(
event.getPropertyName()))
{
handleLocalVideoStreamingChange(
this,
(Boolean) event.getOldValue(),
(Boolean) event.getNewValue());
}
}
public void videoAdded(VideoEvent event)
{
handleVideoEvent(event);
}
public void videoRemoved(VideoEvent event)
{
handleVideoEvent(event);
}
}
/**
* Sets up listening to notifications about adding or removing video for the
* <code>CallParticipant</code> this panel depicts and displays the video in
@ -379,18 +406,8 @@ private OperationSetVideoTelephony addVideoListener()
if (telephony == null)
return null;
final VideoListener videoListener = new VideoListener()
{
public void videoAdded(VideoEvent event)
{
handleVideoEvent(event);
}
public void videoRemoved(VideoEvent event)
{
handleVideoEvent(event);
}
};
final VideoTelephonyListener videoTelephonyListener
= new VideoTelephonyListener();
/*
* The video is only available while the #callParticipant is in a Call
@ -403,23 +420,24 @@ public void videoRemoved(VideoEvent event)
private void addVideoListener()
{
telephony.addVideoListener(callParticipant, videoListener);
try
{
telephony.createLocalVisualComponent(callParticipant,
videoListener);
}
catch (OperationFailedException ex)
{
logger.error(
"Failed to create local video/visual Component.", ex);
}
telephony.addVideoListener(
callParticipant, videoTelephonyListener);
telephony.addPropertyChangeListener(
call, videoTelephonyListener);
videoListenerIsAdded = true;
synchronized (videoContainers)
{
videoTelephony = telephony;
handleVideoEvent(null);
boolean localVideoStreaming
= videoTelephony.isLocalVideoStreaming(call);
handleLocalVideoStreamingChange(
videoTelephonyListener,
!localVideoStreaming,
localVideoStreaming);
}
}
@ -432,13 +450,13 @@ public synchronized void callParticipantAdded(
CallParticipantEvent event)
{
if (callParticipant.equals(event.getSourceCallParticipant())
&& !videoListenerIsAdded)
&& !videoListenerIsAdded)
{
Call call = callParticipant.getCall();
if ((call != null)
&& CallState.CALL_IN_PROGRESS.equals(call
.getCallState()))
&& CallState.CALL_IN_PROGRESS.equals(
call.getCallState()))
addVideoListener();
}
}
@ -487,13 +505,20 @@ else if (CallState.CALL_IN_PROGRESS.equals(newCallState))
private void removeVideoListener()
{
telephony.removeVideoListener(callParticipant, videoListener);
if (localVideo != null)
telephony.disposeLocalVisualComponent(callParticipant,
localVideo);
telephony.removeVideoListener(
callParticipant, videoTelephonyListener);
telephony.removePropertyChangeListener(
call, videoTelephonyListener);
videoListenerIsAdded = false;
synchronized (videoTelephony)
if (localVideo != null)
{
telephony.disposeLocalVisualComponent(
callParticipant, localVideo);
localVideo = null;
}
synchronized (videoContainers)
{
if (telephony.equals(videoTelephony))
videoTelephony = null;
@ -599,6 +624,37 @@ public void run()
}
}
private void handleLocalVideoStreamingChange(
VideoTelephonyListener listener, boolean oldValue, boolean newValue)
{
synchronized (videoContainers)
{
if (videoTelephony == null)
return;
if (videoTelephony.isLocalVideoStreaming(callParticipant.getCall()))
{
try
{
videoTelephony.createLocalVisualComponent(
callParticipant, listener);
}
catch (OperationFailedException ex)
{
logger.error(
"Failed to create local video/visual Component.",
ex);
}
}
else if (localVideo != null)
{
videoTelephony.disposeLocalVisualComponent(
callParticipant, localVideo);
localVideo = null;
}
}
}
/**
* Sets the state of the contained call participant by specifying the
* state name and icon.

@ -54,8 +54,6 @@ public HoldButton( Call call,
boolean isFullScreenMode,
boolean isSelected)
{
super();
if (isFullScreenMode)
{
this.setBgImage(
@ -91,6 +89,7 @@ public HoldButton( Call call,
*/
private static class HoldButtonModel
extends ToggleButtonModel
implements ActionListener
{
/**
@ -112,21 +111,10 @@ public HoldButtonModel(Call call)
{
this.call = call;
InternalListener listener = new InternalListener();
addActionListener(listener);
addActionListener(this);
}
/**
* Handles actions performed on this model on behalf of a specific
* <tt>ActionListener</tt>.
*
* @param listener the <tt>ActionListener</tt> notified about the
* performing of the action
* @param evt the <tt>ActionEvent</tt> containing the data associated
* with the action and the act of its performing
*/
private void actionPerformed(ActionListener listener, ActionEvent evt)
public void actionPerformed(ActionEvent evt)
{
if (call != null)
{
@ -155,25 +143,5 @@ private void actionPerformed(ActionListener listener, ActionEvent evt)
}
}
}
/**
* Represents the set of <tt>EventListener</tt>s this instance uses
* to track the changes in its <tt>CallParticipant</tt> model.
*/
private class InternalListener
implements ActionListener
{
/**
* Invoked when an action occurs.
*
* @param evt the <tt>ActionEvent</tt> instance containing the data
* associated with the action and the act of its
* performing
*/
public void actionPerformed(ActionEvent evt)
{
HoldButtonModel.this.actionPerformed(this, evt);
}
}
}
}

@ -0,0 +1,117 @@
/*
* 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.gui.main.call;
import java.awt.event.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
/**
* @author Lubomir Marinov
*/
public class LocalVideoButton
extends SIPCommToggleButton
{
private static final Logger logger
= Logger.getLogger(LocalVideoButton.class);
private static final long serialVersionUID = 0L;
public LocalVideoButton(Call call)
{
setBgImage(ImageLoader.getImage(ImageLoader.CALL_SETTING_BUTTON_BG));
setBgRolloverImage(
ImageLoader.getImage(ImageLoader.CALL_SETTING_BUTTON_BG));
setIconImage(ImageLoader.getImage(ImageLoader.LOCAL_VIDEO_BUTTON));
setPressedImage(
ImageLoader.getImage(ImageLoader.CALL_SETTING_BUTTON_PRESSED_BG));
setModel(new LocalVideoButtonModel(call));
setToolTipText(GuiActivator.getResources().getI18NString(
"service.gui.LOCAL_VIDEO_BUTTON_TOOL_TIP"));
}
private static class LocalVideoButtonModel
extends ToggleButtonModel
implements ActionListener,
Runnable
{
private final Call call;
private Thread runner;
public LocalVideoButtonModel(Call call)
{
this.call = call;
addActionListener(this);
}
public boolean isSelected()
{
return false;
}
public synchronized void actionPerformed(ActionEvent event)
{
if (runner == null)
{
runner = new Thread(this, LocalVideoButton.class.getName());
runner.setDaemon(true);
setEnabled(false);
runner.start();
}
}
public void run()
{
try
{
doRun();
}
finally
{
synchronized (this)
{
if (Thread.currentThread().equals(runner))
{
runner = null;
setEnabled(true);
}
}
}
}
private void doRun()
{
OperationSetVideoTelephony telephony = (OperationSetVideoTelephony)
call.getProtocolProvider()
.getOperationSet(OperationSetVideoTelephony.class);
if (telephony != null)
{
try
{
telephony.setLocalVideoAllowed(
call,
!telephony.isLocalVideoAllowed(call));
}
catch (OperationFailedException ex)
{
logger.error(
"Failed to toggle the streaming of local video.",
ex);
}
}
}
}
}

@ -51,8 +51,6 @@ public MuteButton(Call call)
*/
public MuteButton(Call call, boolean isFullScreenMode, boolean isSelected)
{
super();
if (isFullScreenMode)
{
this.setBgImage(
@ -87,6 +85,7 @@ public MuteButton(Call call, boolean isFullScreenMode, boolean isSelected)
*/
private static class MuteButtonModel
extends ToggleButtonModel
implements ActionListener
{
/**
@ -106,33 +105,10 @@ public MuteButtonModel(Call call)
{
this.call = call;
addActionListener(new ActionListener()
{
/**
* Invoked when an action occurs.
*
* @param evt the <tt>ActionEvent</tt> instance containing the
* data associated with the action and the act of its
* performing
*/
public void actionPerformed(ActionEvent evt)
{
MuteButtonModel.this.actionPerformed(this, evt);
}
});
addActionListener(this);
}
/**
* Handles actions performed on this model on behalf of a specific
* <tt>ActionListener</tt>.
*
* @param listener the <tt>ActionListener</tt> notified about the
* performing of the action
* @param evt the <tt>ActionEvent</tt> containing the data associated
* with the action and the act of its performing
*/
private void actionPerformed(ActionListener listener, ActionEvent evt)
public void actionPerformed(ActionEvent evt)
{
if (call != null)
{

@ -219,17 +219,16 @@ private CallParticipant findCallParticipant(String address)
OperationFailedException.INTERNAL_ERROR, ex);
}
Class telephonyClass = OperationSetBasicTelephony.class;
Class<OperationSetBasicTelephony> telephonyClass
= OperationSetBasicTelephony.class;
CallParticipant participant = null;
for (int i = 0; i < serviceReferences.length; i++)
for (ServiceReference serviceReference : serviceReferences)
{
ProtocolProviderService service =
(ProtocolProviderService) bundleContext
.getService(serviceReferences[i]);
OperationSetBasicTelephony telephony =
(OperationSetBasicTelephony) service
.getOperationSet(telephonyClass);
ProtocolProviderService service = (ProtocolProviderService)
bundleContext.getService(serviceReference);
OperationSetBasicTelephony telephony = (OperationSetBasicTelephony)
service.getOperationSet(telephonyClass);
if (telephony != null)
{

@ -128,11 +128,11 @@ else if (italicButton.isSelected())
ActionEvent fontSizeActionEvent
= new ActionEvent( chatEditorPane,
ActionEvent.ACTION_PERFORMED,
new Integer(fontSize).toString());
Integer.toString(fontSize));
action
= new StyledEditorKit.FontSizeAction(
new Integer(fontSize).toString(),
Integer.toString(fontSize),
fontSize);
action.actionPerformed(fontSizeActionEvent);
@ -204,8 +204,8 @@ public void mousePressed(MouseEvent event)
ActionEvent.ACTION_PERFORMED, "");
Action action =
new HTMLEditorKit.ForegroundAction(new Integer(newColor
.getRGB()).toString(), newColor);
new HTMLEditorKit.ForegroundAction(Integer.toString(newColor
.getRGB()), newColor);
action.actionPerformed(evt);
}

@ -64,7 +64,7 @@ public void keyReleased(KeyEvent e) {
* Searches the contact list when any key, different from "space", "+" or
* "-" is typed. Selects the Contact name closest to the typed string. The
* time between two button presses is checked to determine whether the user
* makes a new search or a continious search. When user types the same
* makes a new search or a continuous search. When user types the same
* letter consecutively the search mechanism selects the next Contact name
* starting with the same letter.
*/

@ -983,7 +983,7 @@ public Image createContactStatusImage(Contact protoContact)
g.setFont(Constants.FONT.deriveFont(Font.BOLD, 9));
g.drawImage(statusImage, 0, 0, null);
g.setComposite(ac);
g.drawString(new Integer(index+1).toString(), 14, 8);
g.drawString(Integer.toString(index+1), 14, 8);
img = buffImage;
}

@ -223,7 +223,7 @@ public class Constants
* The default <tt>Font</tt> object used through this ui implementation.
*/
public static final Font FONT = new Font(Constants.FONT_NAME, Font.PLAIN,
new Integer(Constants.FONT_SIZE).intValue());
Integer.parseInt(Constants.FONT_SIZE));
/*
* ======================================================================
@ -290,14 +290,14 @@ public class Constants
/**
* A list of all special chars that should be escaped for some reasons.
*/
private static final ArrayList specialCharsList = new ArrayList();
static{
specialCharsList.add(new Integer(KeyEvent.VK_PLUS));
specialCharsList.add(new Integer(KeyEvent.VK_MINUS));
specialCharsList.add(new Integer(KeyEvent.VK_SPACE));
specialCharsList.add(new Integer(KeyEvent.VK_ENTER));
specialCharsList.add(new Integer(KeyEvent.VK_LEFT));
specialCharsList.add(new Integer(KeyEvent.VK_RIGHT));
private static final int[] specialChars = new int[]
{
KeyEvent.VK_PLUS,
KeyEvent.VK_MINUS,
KeyEvent.VK_SPACE,
KeyEvent.VK_ENTER,
KeyEvent.VK_LEFT,
KeyEvent.VK_RIGHT
};
/**
@ -306,10 +306,11 @@ public class Constants
* @param charCode The char code.
*/
public static boolean isSpecialChar(int charCode) {
if(specialCharsList.contains(new Integer(charCode)))
return true;
else
return false;
for (int specialChar : specialChars) {
if (specialChar == charCode)
return true;
}
return false;
}
/**

@ -395,6 +395,12 @@ public class ImageLoader
public static final ImageID MUTE_BUTTON
= new ImageID("service.gui.buttons.MUTE_BUTTON");
/**
* A local video button icon. The icon shown in the CallParticipant panel.
*/
public static final ImageID LOCAL_VIDEO_BUTTON
= new ImageID("service.gui.buttons.LOCAL_VIDEO_BUTTON");
/**
* A call-transfer button icon. The icon shown in the CallParticipant panel.
*/
@ -1360,7 +1366,7 @@ public static Image getAccountStatusImage(ProtocolProviderService pps)
g.setFont(Constants.FONT.deriveFont(Font.BOLD, 9));
g.drawImage(statusImage, 0, 0, null);
g.setComposite(ac);
g.drawString(new Integer(index + 1).toString(), 14, 8);
g.drawString(Integer.toString(index + 1), 14, 8);
img = buffImage;
}

@ -715,7 +715,7 @@ private Vector filterFilesByDate(
String filename = (String)filelist.next();
files.add(
new Long(filename.substring(0, filename.length() - 4)));
Long.parseLong(filename.substring(0, filename.length() - 4)));
}
TreeSet resultAsLong = new TreeSet();
@ -737,7 +737,7 @@ private Vector filterFilesByDate(
// if there is no startDate limit only to end date
if(startDate == null)
{
Long endLong = new Long(endDate.getTime());
Long endLong = Long.valueOf(endDate.getTime());
files.add(endLong);
resultAsLong.addAll(files.subSet(files.first(), endLong));
@ -747,7 +747,7 @@ private Vector filterFilesByDate(
else if(endDate == null)
{
// end date is null get all the inclusive the one record before the startdate
Long startLong = new Long(startDate.getTime());
Long startLong = Long.valueOf(startDate.getTime());
if(files.size() > 0 &&
(startLong.longValue() < ((Long)files.first()).longValue()))
@ -772,8 +772,8 @@ else if(endDate == null)
{
// if both are present we must return all the elements between
// the two dates and the one before the start date
Long startLong = new Long(startDate.getTime());
Long endLong = new Long(endDate.getTime());
Long startLong = Long.valueOf(startDate.getTime());
Long endLong = Long.valueOf(endDate.getTime());
files.add(startLong);
files.add(endLong);

@ -72,6 +72,7 @@
* @author Emanuel Onica
*/
public class CallSessionImpl
extends PropertyChangeNotifier
implements CallSession
, CallParticipantListener
, CallChangeListener
@ -80,7 +81,6 @@ public class CallSessionImpl
, SessionListener
, ControllerListener
// , SecureEventListener
{
private static final Logger logger
= Logger.getLogger(CallSessionImpl.class);
@ -223,12 +223,6 @@ public class CallSessionImpl
private final Map<Component, LocalVisualComponentData> localVisualComponents =
new HashMap<Component, LocalVisualComponentData>();
/**
* Indicates whether current call is sending video data.
* Used to suppress or not video events for local video.
*/
private boolean sendingVideo = false;
/**
* List of RTP format strings which are supported by SIP Communicator in addition
* to the JMF standard formats.
@ -296,6 +290,12 @@ public static enum ZRTPCustomInfoCodes
*/
private InetAddress lastIntendedDestination;
/**
* The indicator which determines whether this instance is currently
* streaming the local video (to remote destinations).
*/
private boolean localVideoStreaming = false;
/**
* Creates a new session for the specified <tt>call</tt> with a custom
* destination for incoming data.
@ -315,7 +315,7 @@ public CallSessionImpl(Call call,
registerCustomCodecFormats(audioRtpManager);
// not currently needed, we don't have any custom video formats.
registerCustomVideoCodecFormats(videoRtpManager);
registerCustomVideoCodecFormats(videoRtpManager);
call.addCallChangeListener(this);
initializePortNumbers();
@ -391,15 +391,15 @@ public RTPManager getVideoRtpManager()
*
* @throws MediaException if start() fails for all send streams.
*/
private void startStreaming()
public void startStreaming()
throws MediaException
{
//start all audio streams
boolean startedAtLeastOneStream = false;
RTPManager rtpManager = getAudioRtpManager();
Vector<SendStream> sendStreams = rtpManager.getSendStreams();
if(sendStreams != null && sendStreams.size() > 0)
List<SendStream> sendStreams = rtpManager.getSendStreams();
if((sendStreams != null) && (sendStreams.size() > 0))
{
logger.trace("Will be starting " + sendStreams.size()
+ " audio send streams.");
@ -426,8 +426,9 @@ private void startStreaming()
//start video streams
rtpManager = getVideoRtpManager();
sendStreams = rtpManager.getSendStreams();
if(sendStreams != null && sendStreams.size() > 0)
if(mediaServCallback.getMediaControl(getCall()).isLocalVideoAllowed()
&& ((sendStreams = rtpManager.getSendStreams()) != null)
&& (sendStreams.size() > 0))
{
logger.trace("Will be starting " + sendStreams.size()
+ " video send streams.");
@ -444,6 +445,9 @@ private void startStreaming()
logger.warn("Failed to start stream.", ex);
}
}
if (startedAtLeastOneStream)
setLocalVideoStreaming(true);
}
else
{
@ -457,6 +461,8 @@ private void startStreaming()
throw new MediaException("Failed to start streaming"
, MediaException.INTERNAL_ERROR);
}
applyOnHold();
}
/**
@ -485,18 +491,27 @@ public boolean stopStreaming()
return stoppedStreaming;
}
/**
* Stops and closes all streams currently handled by <tt>rtpManager</tt>.
*
* @param rtpManager the rtpManager whose streams we'll be stopping.
* @return <tt>true</tt> if there was an actual change in the streaming i.e.
* the streaming wasn't already stopped before this request;
* <tt>false</tt>, otherwise
*/
private boolean stopStreaming(RTPManager rtpManager)
private boolean stopSendStreaming()
{
boolean stoppedAtLeastOneStream = false;
RTPManager audioRtpManager = getAudioRtpManager();
if ((audioRtpManager != null)
&& stopSendStreaming(audioRtpManager))
stoppedAtLeastOneStream = true;
RTPManager videoRtpManager = getVideoRtpManager();
if ((videoRtpManager != null)
&& stopSendStreaming(videoRtpManager))
stoppedAtLeastOneStream = true;
return stoppedAtLeastOneStream;
}
private boolean stopSendStreaming(RTPManager rtpManager)
{
List<SendStream> sendStreams = rtpManager.getSendStreams();
boolean stoppedAtLeastOneStream = false;
for (SendStream stream : sendStreams)
{
@ -512,6 +527,20 @@ private boolean stopStreaming(RTPManager rtpManager)
}
stoppedAtLeastOneStream = true;
}
return stoppedAtLeastOneStream;
}
/**
* Stops and closes all streams currently handled by <tt>rtpManager</tt>.
*
* @param rtpManager the rtpManager whose streams we'll be stopping.
* @return <tt>true</tt> if there was an actual change in the streaming i.e.
* the streaming wasn't already stopped before this request;
* <tt>false</tt>, otherwise
*/
private boolean stopStreaming(RTPManager rtpManager)
{
boolean stoppedAtLeastOneStream = stopSendStreaming(rtpManager);
List<ReceiveStream> receiveStreams;
try
@ -519,7 +548,7 @@ private boolean stopStreaming(RTPManager rtpManager)
receiveStreams = rtpManager.getReceiveStreams();
}
//it appears that in early call states, when there are no streams
//this method could throug a null pointer exception. Make sure we handle
//this method could throw a null pointer exception. Make sure we handle
//it gracefully
catch (Exception e)
{
@ -671,6 +700,26 @@ public String createSdpOffer(InetAddress intendedDestination)
return createSessionDescription(null, intendedDestination).toString();
}
public String createSdpOffer(String participantSdpDescription)
throws MediaException
{
SessionDescription participantDescription = null;
try
{
participantDescription =
mediaServCallback.getSdpFactory().createSessionDescription(
participantSdpDescription);
}
catch (SdpParseException ex)
{
throw new MediaException(
"Failed to parse the SDP description of the participant.",
MediaException.INTERNAL_ERROR, ex);
}
return createSessionDescription(participantDescription, null).toString();
}
/**
* The method is meant for use by protocol service implementations when
* willing to send an in-dialog invitation to a remote callee to put her
@ -1017,6 +1066,11 @@ public void processSdpAnswer(CallParticipant responder,
//create and init the streams (don't start streaming just yet but wait
//for the call to enter the connected state).
createSendStreams(mediaDescriptions);
CallParticipantState responderState = responder.getState();
if (CallParticipantState.CONNECTED.equals(responderState)
|| CallParticipantState.isOnHold(responderState))
startStreaming();
}
/**
@ -1157,8 +1211,6 @@ private void createSendStreams(Vector<MediaDescription> mediaDescriptions)
PushBufferStream[] streams
= ((PushBufferDataSource)dataSource).getStreams();
sendingVideo = false;
//for each stream - determine whether it is a video or an audio
//stream and assign it to the corresponding rtpmanager
for (int i = 0; i < streams.length; i++)
@ -1170,7 +1222,6 @@ private void createSendStreams(Vector<MediaDescription> mediaDescriptions)
if(format instanceof VideoFormat)
{
rtpManager = getVideoRtpManager();
sendingVideo = true;
}
else if (format instanceof AudioFormat)
{
@ -1315,12 +1366,12 @@ private void initStreamTargets(Connection globalConnParam,
}
/**
* Creates an SDP description of this session using the offer descirption
* Creates an SDP description of this session using the offer description
* (if not null) for limiting. The intendedDestination parameter, which may
* contain the address that the offer is to be sent to, will only be used if
* the <tt>offer</tt> or its connection parameter are <tt>null</tt>. In the
* oposite case we are using the address provided in the connection param as
* an intended destination.
* opposite case we are using the address provided in the connection param
* as an intended destination.
*
* @param offer the call participant meant to receive the offer or null if
* we are to construct our own offer.
@ -1442,10 +1493,7 @@ private SessionDescription createSessionDescription(
lastIntendedDestination = intendedDestination;
if (startStreaming)
{
startStreaming();
applyOnHold();
}
}
InetAddress publicIpAddress = audioPublicAddress.getAddress();
@ -1673,8 +1721,7 @@ else if (mediaType.equalsIgnoreCase("audio"))
byte onHold = this.onHold;
if (!mediaServCallback.getDeviceConfiguration()
.isVideoCaptureSupported())
if (!mediaControl.isLocalVideoAllowed())
{
/* We don't have anything to send. */
onHold |= ON_HOLD_REMOTELY;
@ -1942,8 +1989,6 @@ private InetSocketAddress allocatePort(InetAddress intendedDestination,
NetworkAddressManagerService netAddressManager
= MediaActivator.getNetworkAddressManagerService();
//try to initialize a public address for the rtp manager.
for (int i = bindRetries; i > 0; i--)
{
@ -2406,6 +2451,13 @@ else if (newValue == CallState.CALL_ENDED)
* here shouldn't be necessary because #stopStreaming() should've
* already take care of it.
*/
// Clean up after the support for viewing the local video.
Component[] localVisualComponents
= this.localVisualComponents.keySet().toArray(
new Component[this.localVisualComponents.size()]);
for (Component localVisualComponent : localVisualComponents)
disposeLocalVisualComponent(localVisualComponent);
}
}
@ -2667,7 +2719,6 @@ else if (ce instanceof RealizeCompleteEvent)
// logger.debug("Player does not have gain control.");
logger.debug("A player was realized and will be started.");
player.start();
if (dataSink != null)
{
@ -2939,9 +2990,12 @@ public void addVideoListener(VideoListener listener)
public Component createLocalVisualComponent(final VideoListener listener)
throws MediaException
{
DataSource dataSource =
mediaServCallback.getMediaControl(getCall())
.createLocalVideoDataSource();
if (!isLocalVideoStreaming())
return null;
final MediaControl mediaControl
= mediaServCallback.getMediaControl(getCall());
DataSource dataSource = mediaControl.createLocalVideoDataSource();
if (dataSource != null)
{
@ -2968,9 +3022,8 @@ public Component createLocalVisualComponent(final VideoListener listener)
{
public void controllerUpdate(ControllerEvent event)
{
if(sendingVideo)
controllerUpdateForCreateLocalVisualComponent(event,
listener);
controllerUpdateForCreateLocalVisualComponent(
event, listener, mediaControl);
}
});
player.start();
@ -2979,7 +3032,8 @@ public void controllerUpdate(ControllerEvent event)
}
private void controllerUpdateForCreateLocalVisualComponent(
ControllerEvent controllerEvent, VideoListener listener)
ControllerEvent controllerEvent, VideoListener listener,
MediaControl mediaControl)
{
if (controllerEvent instanceof RealizeCompleteEvent)
{
@ -2988,16 +3042,26 @@ private void controllerUpdateForCreateLocalVisualComponent(
if (visualComponent != null)
{
VideoEvent videoEvent =
new VideoEvent(this, VideoEvent.VIDEO_ADDED,
visualComponent, VideoEvent.LOCAL);
VideoEvent videoEvent = new VideoEvent(
this,
VideoEvent.VIDEO_ADDED,
visualComponent,
VideoEvent.LOCAL);
listener.videoAdded(videoEvent);
if (videoEvent.isConsumed())
{
localVisualComponents.put(visualComponent,
new LocalVisualComponentData(player, listener));
localVisualComponents.put(
visualComponent,
new LocalVisualComponentData(
player, listener, mediaControl));
}
else
{
player.stop();
player.deallocate();
player.close();
}
}
}
@ -3008,22 +3072,19 @@ public void disposeLocalVisualComponent(Component component)
if (component == null)
throw new IllegalArgumentException("component");
LocalVisualComponentData data = localVisualComponents.get(component);
LocalVisualComponentData data = localVisualComponents.remove(component);
if (data != null)
{
Player player = data.player;
player.stop();
player.deallocate();
player.close();
localVisualComponents.remove(component);
VideoListener listener = data.listener;
data.dispose();
if (listener != null)
{
VideoEvent videoEvent =
new VideoEvent(this, VideoEvent.VIDEO_REMOVED, component,
VideoEvent videoEvent = new VideoEvent(
this,
VideoEvent.VIDEO_REMOVED,
component,
VideoEvent.LOCAL);
listener.videoRemoved(videoEvent);
@ -3133,16 +3194,101 @@ protected void fireVideoEvent(int type, Component visualComponent,
}
}
private static class LocalVisualComponentData
/*
* Implements CallSession#setLocalVideoAllowed(boolean).
*/
public void setLocalVideoAllowed(boolean allowed)
throws MediaException
{
stopSendStreaming();
mediaServCallback.getMediaControl(getCall())
.setLocalVideoAllowed(allowed);
}
/*
* Implements CallSession#isLocalVideoAllowed().
*/
public boolean isLocalVideoAllowed()
{
return mediaServCallback.getMediaControl(getCall())
.isLocalVideoAllowed();
}
/**
* Sets the indicator which determine whether this <code>CallSession</code>
* is currently streaming the local video (to remote destinations). If the
* setting causes a change in the current state, registered
* <code>PropertyChangeListener</code>s are notified about a change in the
* value of the property {@link CallSession#LOCAL_VIDEO_STREAMING}.
*
* @param streaming <tt>true</tt> to indicate that this instance is
* currently streaming the local video (to remote destinations);
* otherwise, <tt>false</tt>
*/
private void setLocalVideoStreaming(boolean streaming)
{
if (localVideoStreaming != streaming)
{
boolean oldValue = localVideoStreaming;
localVideoStreaming = streaming;
firePropertyChange(
LOCAL_VIDEO_STREAMING, oldValue, localVideoStreaming);
}
}
/*
* Implements CallSession#isLocalVideoStreaming().
*/
public boolean isLocalVideoStreaming()
{
return localVideoStreaming;
}
private class LocalVisualComponentData
{
public final VideoListener listener;
private final MediaControl mediaControl;
private PropertyChangeListener mediaControlListener;
public final Player player;
public LocalVisualComponentData(Player player, VideoListener listener)
public LocalVisualComponentData(Player player, VideoListener listener,
MediaControl mediaControl)
{
this.player = player;
this.listener = listener;
this.mediaControl = mediaControl;
this.mediaControlListener = new PropertyChangeListener()
{
private final Component component
= LocalVisualComponentData.this.player.getVisualComponent();
public void propertyChange(PropertyChangeEvent event)
{
if (MediaControl.VIDEO_DATA_SOURCE.equals(event.getPropertyName()))
disposeLocalVisualComponent(component);
}
};
this.mediaControl.addPropertyChangeListener(
this.mediaControlListener);
}
public void dispose()
{
if (mediaControlListener != null)
{
mediaControl.removePropertyChangeListener(mediaControlListener);
mediaControlListener = null;
}
player.stop();
player.deallocate();
player.close();
}
}

@ -32,6 +32,7 @@
* @author Lubomir Marinov
*/
public class MediaControl
extends PropertyChangeNotifier
{
private static final Logger logger = Logger.getLogger(MediaControl.class);
@ -51,11 +52,21 @@ public class MediaControl
private DataSource avDataSource = null;
/**
* The audio <tt>DataSource</tt> which provides mute support.
* The audio <code>DataSource</code> which provides mute support.
*/
private MutePushBufferDataSource muteAudioDataSource;
private SourceCloneable cloneableVideoDataSource;
/**
* The current video <code>DataSource</code>. If present, it's available in
* {@link #avDataSource} either directly or as a merged
* <code>DataSource</code>.
*/
private SourceCloneable videoDataSource;
/**
* The property which represents the current video <code>DataSource</code>.
*/
public static final String VIDEO_DATA_SOURCE = "VIDEO_DATA_SOURCE";
/**
* SDP Codes of all video formats that JMF supports for current datasource.
@ -98,6 +109,15 @@ public class MediaControl
private static final String DEBUG_DATA_SOURCE_URL_PROPERTY_NAME
= "net.java.sip.communicator.impl.media.DEBUG_DATA_SOURCE_URL";
/**
* The indicator which determines whether the streaming of local video
* through this <code>MediaControl</code> is allowed. The setting does not
* reflect the availability of actual video capture devices, it just
* expresses the desire of the user to have the local video streamed in the
* case the system is actually able to do so.
*/
private boolean localVideoAllowed = true;
/**
* The default constructor.
*/
@ -182,14 +202,11 @@ private void initCaptureDevices()
if (avDataSource != null)
avDataSource.disconnect();
// Init Capture devices
// Init audio device
CaptureDeviceInfo audioDeviceInfo
= deviceConfiguration.getAudioCaptureDevice();
DataSource audioDataSource = null;
DataSource videoDataSource = null;
CaptureDeviceInfo audioDeviceInfo = null;
CaptureDeviceInfo videoDeviceInfo = null;
// audio device
audioDeviceInfo = deviceConfiguration.getAudioCaptureDevice();
muteAudioDataSource = null;
if (audioDeviceInfo != null)
{
@ -203,25 +220,33 @@ private void initCaptureDevices()
(PushBufferDataSource) audioDataSource);
}
// video device
videoDeviceInfo = deviceConfiguration.getVideoCaptureDevice();
cloneableVideoDataSource = null;
if (videoDeviceInfo != null)
// Init video device
CaptureDeviceInfo videoDeviceInfo
= localVideoAllowed
? deviceConfiguration.getVideoCaptureDevice()
: null;
DataSource videoDataSource = null;
DataSource cloneableVideoDataSource = null;
try
{
videoDataSource = createDataSource(videoDeviceInfo.getLocator());
if (videoDeviceInfo != null)
{
videoDataSource = createDataSource(videoDeviceInfo.getLocator());
// we will check video sizes and will set the most appropriate one
selectVideoSize(videoDataSource);
// we will check video sizes and will set the most appropriate one
selectVideoSize(videoDataSource);
DataSource cloneableVideoDataSource =
Manager.createCloneableDataSource(videoDataSource);
if (cloneableVideoDataSource != null)
{
videoDataSource = cloneableVideoDataSource;
this.cloneableVideoDataSource =
(SourceCloneable) cloneableVideoDataSource;
cloneableVideoDataSource =
Manager.createCloneableDataSource(videoDataSource);
if (cloneableVideoDataSource != null)
videoDataSource = cloneableVideoDataSource;
}
}
finally
{
setVideoDataSource((SourceCloneable) cloneableVideoDataSource);
}
// Create the av data source
if (audioDataSource != null && videoDataSource != null)
@ -276,7 +301,6 @@ public void initDebugDataSource(String debugMediaSource)
{
logger.fatal("Failed to Create the Debug Media Data Source!",e);
}
}
/**
@ -1079,10 +1103,80 @@ public int compare(FormatInfo info0, FormatInfo info1)
return ((VideoFormat) selectedFormat).getSize();
}
/**
* Sets the <code>DataSource</code> to be used by this instance to capture
* video. The <code>DataSource</code> is to be provided in the form of a
* <code>SourceCloneable</code> so that it can give access to the local
* video both as a stand-alone <code>DataSource</code> and a merged one with
* audio. If the setting changes the state of this instance, registered
* <code>PropertyChangeListener</code>s are notified about the change of the
* value of the property {@link #VIDEO_DATA_SOURCE}.
*
* @param videoDataSource a <code>SourceCloneable</code> representing the
* <code>DataSource</code> to be used by this instance to capture
* video.
*/
private void setVideoDataSource(SourceCloneable videoDataSource)
{
Object oldValue = this.videoDataSource;
this.videoDataSource = videoDataSource;
firePropertyChange(VIDEO_DATA_SOURCE, oldValue, this.videoDataSource);
}
/**
* Creates a <code>DataSource</code> which gives access to the local video
* this instance captures and controls.
*
* @return a <code>DataSource</code> which gives access to the local video
* this instance captures and controls; <tt>null</tt> if video is
* not utilized by this instance
*/
public DataSource createLocalVideoDataSource()
{
return (cloneableVideoDataSource == null)
return (videoDataSource == null)
? null
: cloneableVideoDataSource.createClone();
: videoDataSource.createClone();
}
/**
* Sets the indicator which determines whether the streaming of local video
* through this <code>MediaControl</code> is allowed. The setting does not
* reflect the availability of actual video capture devices, it just
* expresses the desire of the user to have the local video streamed in the
* case the system is actually able to do so.
*
* @param allowed <tt>true</tt> to allow the streaming of local video for
* this <code>MediaControl</code>; <tt>false</tt> to disallow it
*/
public void setLocalVideoAllowed(boolean allowed)
throws MediaException
{
if (localVideoAllowed != allowed)
{
localVideoAllowed = allowed;
if (sourceProcessor != null)
sourceProcessor.stop();
initCaptureDevices();
if (sourceProcessor.getState() != Processor.Started)
sourceProcessor.start();
}
}
/**
* Gets the indicator which determines whether the streaming of local video
* through this <code>MediaControl</code> is allowed. The setting does not
* reflect the availability of actual video capture devices, it just
* expresses the desire of the user to have the local video streamed in the
* case the system is actually able to do so.
*
* @return <tt>true</tt> if the streaming of local video for this
* <code>MediaControl</code> is allowed; <tt>false</tt>, otherwise
*/
public boolean isLocalVideoAllowed()
{
return localVideoAllowed;
}
}

@ -343,7 +343,7 @@ public MediaControl getMediaControl()
* <tt>call</tt> is not mapped to a particular <tt>MediaControl</tt>
* instance, the default instance will be returned
*
* @param call the call whose MediaControl we will fetch
* @param call the call to fetch the MediaControl of
* @return the instance of MediaControl that is mapped to <tt>call</tt>
* or the <tt>defaultMediaControl</tt> if no custom one is registered for
* <tt>call</tt>.

@ -4,9 +4,6 @@
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.media;
//~--- non-JDK imports --------------------------------------------------------
@ -24,14 +21,15 @@
* @author Ken Larson
*/
public class ProcessorUtility implements ControllerListener {
private Logger logger = Logger.getLogger(ProcessorUtility.class);
private final Logger logger = Logger.getLogger(ProcessorUtility.class);
/**
* The object that we use for syncing when waiting for a processor
* to enter a specific state.
*/
private Object stateLock = new Object();
private boolean failed = false;
private final Object stateLock = new Object();
private boolean failed = false;
/**
* Default constructor, creates an instance of the of the Processor utility.
@ -83,8 +81,9 @@ public void controllerUpdate(ControllerEvent ce) {
}
if (ce instanceof ControllerEvent) {
synchronized (getStateLock()) {
getStateLock().notifyAll();
Object stateLock = getStateLock();
synchronized (stateLock) {
stateLock.notifyAll();
}
}
}
@ -113,9 +112,10 @@ public synchronized boolean waitForState(Processor processor, int state)
// success of the method, or a failure event.
// See StateListener inner class
while ((processor.getState() < state) &&!failed) {
synchronized (getStateLock()) {
Object stateLock = getStateLock();
synchronized (stateLock) {
try {
getStateLock().wait();
stateLock.wait();
} catch (InterruptedException ie) {
return false;
}

@ -25,6 +25,7 @@
* @author Lubomir Marinov
*/
public class DeviceConfiguration
extends PropertyChangeNotifier
{
/**
@ -68,13 +69,6 @@ public class DeviceConfiguration
*/
private CaptureDeviceInfo videoCaptureDevice;
/**
* Listeners that will be notified every time
* a device has been changed.
*/
private final List<PropertyChangeListener> propertyChangeListeners =
new Vector<PropertyChangeListener>();
/**
* Default constructor.
*/
@ -82,23 +76,6 @@ public DeviceConfiguration()
{
}
public void addPropertyChangeListener(PropertyChangeListener listener)
{
synchronized(propertyChangeListeners)
{
if (!propertyChangeListeners.contains(listener))
propertyChangeListeners.add(listener);
}
}
public void removePropertyChangeListener(PropertyChangeListener listener)
{
synchronized(propertyChangeListeners)
{
propertyChangeListeners.remove(listener);
}
}
/**
* Initializes capture devices.
*/
@ -331,15 +308,6 @@ public void setAudioCaptureDevice(CaptureDeviceInfo device)
}
}
protected void firePropertyChange(String property, Object oldValue,
Object newValue)
{
PropertyChangeEvent event =
new PropertyChangeEvent(this, property, oldValue, newValue);
for (PropertyChangeListener listener : propertyChangeListeners)
listener.propertyChange(event);
}
/**
* Enable or disable Audio stream transmission.
*

@ -70,7 +70,7 @@ public TransformOutputStream(DatagramSocket socket,
public void addTarget(InetAddress remoteAddr, int remotePort)
{
this.remoteAddrs.add(remoteAddr);
this.remotePorts.add(new Integer(remotePort));
this.remotePorts.add(remotePort);
}
/**
@ -84,7 +84,7 @@ public void addTarget(InetAddress remoteAddr, int remotePort)
public boolean removeTarget(InetAddress remoteAddr, int remotePort)
{
return remoteAddrs.remove(remoteAddr)
&& remotePorts.remove(new Integer(remotePort));
&& remotePorts.remove(Integer.valueOf(remotePort));
}
/**

@ -73,7 +73,7 @@ public RawPacket transform(RawPacket pkt)
long ssrc = PacketManipulator.GetRTPSSRC(pkt);
SRTPCryptoContext context =
(SRTPCryptoContext) this.contexts.get(new Long(ssrc));
(SRTPCryptoContext) this.contexts.get(ssrc);
if (context == null)
{
@ -81,7 +81,7 @@ public RawPacket transform(RawPacket pkt)
if (context != null)
{
context.deriveSrtpKeys(0);
this.contexts.put(new Long(ssrc), context);
this.contexts.put(ssrc, context);
}
}
@ -102,7 +102,7 @@ public RawPacket reverseTransform(RawPacket pkt)
long ssrc = PacketManipulator.GetRTPSSRC(pkt);
int seqNum = PacketManipulator.GetRTPSequenceNumber(pkt);
SRTPCryptoContext context =
(SRTPCryptoContext) this.contexts.get(new Long(ssrc));
(SRTPCryptoContext) this.contexts.get(ssrc);
if (context == null)
{
@ -111,7 +111,7 @@ public RawPacket reverseTransform(RawPacket pkt)
if (context != null)
{
context.deriveSrtpKeys(seqNum);
this.contexts.put(new Long(ssrc), context);
this.contexts.put(ssrc, context);
}
}

@ -530,7 +530,7 @@ private void saveNotification( String eventType,
configService.setProperty(
actionTypeNodeName + ".loopInterval",
new Integer(soundHandler.getLoopInterval()));
soundHandler.getLoopInterval());
configService.setProperty(
actionTypeNodeName + ".enabled",
@ -632,7 +632,7 @@ private void loadNotifications()
handler = new SoundNotificationHandlerImpl(
soundFileDescriptor,
new Integer(loopInterval).intValue());
Integer.parseInt(loopInterval));
handler.setEnabled(
isEnabled(actionPropName + ".enabled"));

@ -303,7 +303,7 @@ public String getNickName(String uin)
*/
private List getInfoForRequest(int requestID)
{
List res = (List) retreivedInfo.get(new Integer(requestID));
List res = (List) retreivedInfo.get(requestID);
if (res == null)
{
@ -312,7 +312,7 @@ private List getInfoForRequest(int requestID)
// from the sequence (basic info)
res = new LinkedList();
retreivedInfo.put(new Integer(requestID), res);
retreivedInfo.put(requestID, res);
}
return res;

@ -629,8 +629,7 @@ public void run()
// check till we find a correct message
// or if NoSuchElementException is thrown
// there is no message
while(!checkFirstPacket())
{}
while(!checkFirstPacket());
}
catch (Exception ex)
{

@ -143,36 +143,34 @@ public class OperationSetPersistentPresenceIcqImpl
* A map containing bindings between SIP Communicator's icq presence status
* instances and ICQ status codes
*/
private static Map scToIcqStatusMappings = new Hashtable();
private static final Map<PresenceStatus, Long> scToIcqStatusMappings
= new Hashtable<PresenceStatus, Long>();
static{
scToIcqStatusMappings.put(IcqStatusEnum.AWAY,
new Long(FullUserInfo.ICQSTATUS_AWAY));
FullUserInfo.ICQSTATUS_AWAY);
scToIcqStatusMappings.put(IcqStatusEnum.DO_NOT_DISTURB,
new Long(FullUserInfo.ICQSTATUS_DND ));
FullUserInfo.ICQSTATUS_DND);
scToIcqStatusMappings.put(IcqStatusEnum.FREE_FOR_CHAT,
new Long(FullUserInfo.ICQSTATUS_FFC ));
FullUserInfo.ICQSTATUS_FFC);
scToIcqStatusMappings.put(IcqStatusEnum.INVISIBLE,
new Long(FullUserInfo.ICQSTATUS_INVISIBLE));
FullUserInfo.ICQSTATUS_INVISIBLE);
scToIcqStatusMappings.put(IcqStatusEnum.NOT_AVAILABLE,
new Long(FullUserInfo.ICQSTATUS_NA));
FullUserInfo.ICQSTATUS_NA);
scToIcqStatusMappings.put(IcqStatusEnum.OCCUPIED,
new Long(FullUserInfo.ICQSTATUS_OCCUPIED));
FullUserInfo.ICQSTATUS_OCCUPIED);
scToIcqStatusMappings.put(IcqStatusEnum.ONLINE,
new Long(ICQ_ONLINE_MASK));
ICQ_ONLINE_MASK);
}
private static Map scToAimStatusMappings = new Hashtable();
private static final Map<PresenceStatus, Long> scToAimStatusMappings
= new Hashtable<PresenceStatus, Long>();
static{
scToAimStatusMappings.put(AimStatusEnum.AWAY,
new Long(FullUserInfo.ICQSTATUS_AWAY));
FullUserInfo.ICQSTATUS_AWAY);
scToAimStatusMappings.put(AimStatusEnum.INVISIBLE,
new Long(FullUserInfo.ICQSTATUS_INVISIBLE));
FullUserInfo.ICQSTATUS_INVISIBLE);
scToAimStatusMappings.put(AimStatusEnum.ONLINE,
new Long(ICQ_ONLINE_MASK));
ICQ_ONLINE_MASK);
}
/**
@ -377,9 +375,9 @@ else if ( (icqStatus & FullUserInfo.ICQSTATUS_AWAY ) != 0)
private long presenceStatusToStatusLong(PresenceStatus status)
{
if(parentProvider.USING_ICQ)
return ((Long)scToIcqStatusMappings.get(status)).longValue();
return scToIcqStatusMappings.get(status).longValue();
else
return ((Long)scToAimStatusMappings.get(status)).longValue();
return scToAimStatusMappings.get(status).longValue();
}
/**

@ -824,14 +824,9 @@ static Locale getCountry(int code)
if (code == 0 || code == 9999) // not specified or other
return null;
String cryStr = (String) countryIndexToLocaleString.get(new Integer(
code));
String cryStr = countryIndexToLocaleString.get(code);
// if no such country
if (cryStr == null)
return null;
return new Locale("", cryStr);
return (cryStr == null) ? null : new Locale("", cryStr);
}
/**
@ -844,13 +839,11 @@ static int getCountryCode(Locale cLocale)
if (cLocale == null)
return 0; // not specified
Iterator iter = countryIndexToLocaleString.keySet().iterator();
while (iter.hasNext())
for (Map.Entry<Integer, String> entry : countryIndexToLocaleString.entrySet())
{
Integer key = (Integer) iter.next();
Integer key = entry.getKey();
String countryString = entry.getValue().toUpperCase();
String countryString = ( (String) countryIndexToLocaleString.get(
key)).toUpperCase();
if (countryString.equals(cLocale.getCountry()))
return key.intValue();
}
@ -1224,254 +1217,255 @@ public OriginCountryDetail(Locale locale)
// Hashtable holding the country index
// corresponding to the country locale string
private static Hashtable countryIndexToLocaleString = new Hashtable();
private static final Map<Integer, String> countryIndexToLocaleString
= new Hashtable<Integer, String>();
static
{
// countryIndexToLocaleString.put(new Integer(0),""); //not specified
countryIndexToLocaleString.put(new Integer(1), "us"); //USA
countryIndexToLocaleString.put(new Integer(101), "ai"); //Anguilla
countryIndexToLocaleString.put(new Integer(102), "ag"); //Antigua
countryIndexToLocaleString.put(new Integer(1021), "ag"); //Antigua & Barbuda
countryIndexToLocaleString.put(new Integer(103), "bs"); //Bahamas
countryIndexToLocaleString.put(new Integer(104), "bb"); //Barbados
countryIndexToLocaleString.put(new Integer(105), "bm"); //Bermuda
countryIndexToLocaleString.put(new Integer(106), "vg"); //British Virgin Islands
countryIndexToLocaleString.put(new Integer(107), "ca"); //Canada
countryIndexToLocaleString.put(new Integer(108), "ky"); //Cayman Islands
countryIndexToLocaleString.put(new Integer(109), "dm"); //Dominica
countryIndexToLocaleString.put(new Integer(110), "do"); //Dominican Republic
countryIndexToLocaleString.put(new Integer(111), "gd"); //Grenada
countryIndexToLocaleString.put(new Integer(112), "jm"); //Jamaica
countryIndexToLocaleString.put(new Integer(113), "ms"); //Montserrat
countryIndexToLocaleString.put(new Integer(114), "kn"); //Nevis
countryIndexToLocaleString.put(new Integer(1141), "kn"); //Saint Kitts and Nevis
countryIndexToLocaleString.put(new Integer(115), "kn"); //St. Kitts
countryIndexToLocaleString.put(new Integer(116), "vc"); //St. Vincent & the Grenadines
countryIndexToLocaleString.put(new Integer(117), "tt"); //Trinidad & Tobago
countryIndexToLocaleString.put(new Integer(118), "tc"); //Turks & Caicos Islands
countryIndexToLocaleString.put(new Integer(120), "ag"); //Barbuda
countryIndexToLocaleString.put(new Integer(121), "pr"); //Puerto Rico
countryIndexToLocaleString.put(new Integer(122), "lc"); //Saint Lucia
countryIndexToLocaleString.put(new Integer(123), "vi"); //Virgin Islands (USA)
countryIndexToLocaleString.put(new Integer(178), "es"); //Canary Islands ???
countryIndexToLocaleString.put(new Integer(20), "eg"); //Egypt
countryIndexToLocaleString.put(new Integer(212), "ma"); //Morocco
countryIndexToLocaleString.put(new Integer(213), "dz"); //Algeria
countryIndexToLocaleString.put(new Integer(216), "tn"); //Tunisia
countryIndexToLocaleString.put(new Integer(218), "ly"); //Libyan Arab Jamahiriya
countryIndexToLocaleString.put(new Integer(220), "gm"); //Gambia
countryIndexToLocaleString.put(new Integer(221), "sn"); //Senegal
countryIndexToLocaleString.put(new Integer(222), "mr"); //Mauritania
countryIndexToLocaleString.put(new Integer(223), "ml"); //Mali
countryIndexToLocaleString.put(new Integer(224), "pg"); //Guinea
countryIndexToLocaleString.put(new Integer(225), "ci"); //Cote d'Ivoire
countryIndexToLocaleString.put(new Integer(226), "bf"); //Burkina Faso
countryIndexToLocaleString.put(new Integer(227), "ne"); //Niger
countryIndexToLocaleString.put(new Integer(228), "tg"); //Togo
countryIndexToLocaleString.put(new Integer(229), "bj"); //Benin
countryIndexToLocaleString.put(new Integer(230), "mu"); //Mauritius
countryIndexToLocaleString.put(new Integer(231), "lr"); //Liberia
countryIndexToLocaleString.put(new Integer(232), "sl"); //Sierra Leone
countryIndexToLocaleString.put(new Integer(233), "gh"); //Ghana
countryIndexToLocaleString.put(new Integer(234), "ng"); //Nigeria
countryIndexToLocaleString.put(new Integer(235), "td"); //Chad
countryIndexToLocaleString.put(new Integer(236), "cf"); //Central African Republic
countryIndexToLocaleString.put(new Integer(237), "cm"); //Cameroon
countryIndexToLocaleString.put(new Integer(238), "cv"); //Cape Verde Islands
countryIndexToLocaleString.put(new Integer(239), "st"); //Sao Tome & Principe
countryIndexToLocaleString.put(new Integer(240), "gq"); //Equatorial Guinea
countryIndexToLocaleString.put(new Integer(241), "ga"); //Gabon
countryIndexToLocaleString.put(new Integer(242), "cg"); //Congo, (Rep. of the)
countryIndexToLocaleString.put(new Integer(243), "cd"); //Congo, Democratic Republic of
countryIndexToLocaleString.put(new Integer(244), "ao"); //Angola
countryIndexToLocaleString.put(new Integer(245), "gw"); //Guinea-Bissau
// countryIndexToLocaleString.put(new Integer(246),""); //Diego Garcia ???
// countryIndexToLocaleString.put(new Integer(247),""); //Ascension Island ???
countryIndexToLocaleString.put(new Integer(248), "sc"); //Seychelles
countryIndexToLocaleString.put(new Integer(249), "sd"); //Sudan
countryIndexToLocaleString.put(new Integer(250), "rw"); //Rwanda
countryIndexToLocaleString.put(new Integer(251), "et"); //Ethiopia
countryIndexToLocaleString.put(new Integer(252), "so"); //Somalia
countryIndexToLocaleString.put(new Integer(253), "dj"); //Djibouti
countryIndexToLocaleString.put(new Integer(254), "ke"); //Kenya
countryIndexToLocaleString.put(new Integer(255), "tz"); //Tanzania
countryIndexToLocaleString.put(new Integer(256), "ug"); //Uganda
countryIndexToLocaleString.put(new Integer(257), "bi"); //Burundi
countryIndexToLocaleString.put(new Integer(258), "mz"); //Mozambique
countryIndexToLocaleString.put(new Integer(260), "zm"); //Zambia
countryIndexToLocaleString.put(new Integer(261), "mg"); //Madagascar
// countryIndexToLocaleString.put(new Integer(262),""); //Reunion Island ???
countryIndexToLocaleString.put(new Integer(263), "zw"); //Zimbabwe
countryIndexToLocaleString.put(new Integer(264), "na"); //Namibia
countryIndexToLocaleString.put(new Integer(265), "mw"); //Malawi
countryIndexToLocaleString.put(new Integer(266), "ls"); //Lesotho
countryIndexToLocaleString.put(new Integer(267), "bw"); //Botswana
countryIndexToLocaleString.put(new Integer(268), "sz"); //Swaziland
countryIndexToLocaleString.put(new Integer(269), "yt"); //Mayotte Island
countryIndexToLocaleString.put(new Integer(2691), "km"); //Comoros
countryIndexToLocaleString.put(new Integer(27), "za"); //South Africa
countryIndexToLocaleString.put(new Integer(290), "sh"); //St. Helena
countryIndexToLocaleString.put(new Integer(291), "er"); //Eritrea
countryIndexToLocaleString.put(new Integer(297), "aw"); //Aruba
// countryIndexToLocaleString.put(new Integer(298),""); //Faeroe Islands ???
countryIndexToLocaleString.put(new Integer(299), "gl"); //Greenland
countryIndexToLocaleString.put(new Integer(30), "gr"); //Greece
countryIndexToLocaleString.put(new Integer(31), "nl"); //Netherlands
countryIndexToLocaleString.put(new Integer(32), "be"); //Belgium
countryIndexToLocaleString.put(new Integer(33), "fr"); //France
countryIndexToLocaleString.put(new Integer(34), "es"); //Spain
countryIndexToLocaleString.put(new Integer(350), "gi"); //Gibraltar
countryIndexToLocaleString.put(new Integer(351), "pt"); //Portugal
countryIndexToLocaleString.put(new Integer(352), "lu"); //Luxembourg
countryIndexToLocaleString.put(new Integer(353), "ie"); //Ireland
countryIndexToLocaleString.put(new Integer(354), "is"); //Iceland
countryIndexToLocaleString.put(new Integer(355), "al"); //Albania
countryIndexToLocaleString.put(new Integer(356), "mt"); //Malta
countryIndexToLocaleString.put(new Integer(357), "cy"); //Cyprus
countryIndexToLocaleString.put(new Integer(358), "fi"); //Finland
countryIndexToLocaleString.put(new Integer(359), "bg"); //Bulgaria
countryIndexToLocaleString.put(new Integer(36), "hu"); //Hungary
countryIndexToLocaleString.put(new Integer(370), "lt"); //Lithuania
countryIndexToLocaleString.put(new Integer(371), "lv"); //Latvia
countryIndexToLocaleString.put(new Integer(372), "ee"); //Estonia
countryIndexToLocaleString.put(new Integer(373), "md"); //Moldova, Republic of
countryIndexToLocaleString.put(new Integer(374), "am"); //Armenia
countryIndexToLocaleString.put(new Integer(375), "by"); //Belarus
countryIndexToLocaleString.put(new Integer(376), "ad"); //Andorra
countryIndexToLocaleString.put(new Integer(377), "mc"); //Monaco
countryIndexToLocaleString.put(new Integer(378), "sm"); //San Marino
countryIndexToLocaleString.put(new Integer(379), "va"); //Vatican City
countryIndexToLocaleString.put(new Integer(380), "ua"); //Ukraine
// countryIndexToLocaleString.put(new Integer(381),""); //Yugoslavia ???
countryIndexToLocaleString.put(new Integer(3811), "cs"); //Yugoslavia - Serbia
countryIndexToLocaleString.put(new Integer(382), "cs"); //Yugoslavia - Montenegro
countryIndexToLocaleString.put(new Integer(385), "hr"); //Croatia
countryIndexToLocaleString.put(new Integer(386), "si"); //Slovenia
countryIndexToLocaleString.put(new Integer(387), "ba"); //Bosnia & Herzegovina
countryIndexToLocaleString.put(new Integer(389), "mk"); //Macedonia (F.Y.R.O.M.)
countryIndexToLocaleString.put(new Integer(39), "it"); //Italy
countryIndexToLocaleString.put(new Integer(40), "ro"); //Romania
countryIndexToLocaleString.put(new Integer(41), "ch"); //Switzerland
countryIndexToLocaleString.put(new Integer(4101), "li"); //Liechtenstein
countryIndexToLocaleString.put(new Integer(42), "cz"); //Czech Republic
countryIndexToLocaleString.put(new Integer(4201), "sk"); //Slovakia
countryIndexToLocaleString.put(new Integer(43), "at"); //Austria
countryIndexToLocaleString.put(new Integer(44), "gb"); //United Kingdom
// countryIndexToLocaleString.put(new Integer(441),""); //Wales ???
// countryIndexToLocaleString.put(new Integer(442),""); //Scotland ???
countryIndexToLocaleString.put(new Integer(45), "dk"); //Denmark
countryIndexToLocaleString.put(new Integer(46), "se"); //Sweden
countryIndexToLocaleString.put(new Integer(47), "no"); //Norway
countryIndexToLocaleString.put(new Integer(48), "pl"); //Poland
countryIndexToLocaleString.put(new Integer(49), "de"); //Germany
// countryIndexToLocaleString.put(new Integer(500),""); //Falkland Islands ???
countryIndexToLocaleString.put(new Integer(501), "bz"); //Belize
countryIndexToLocaleString.put(new Integer(502), "gt"); //Guatemala
countryIndexToLocaleString.put(new Integer(503), "sv"); //El Salvador
countryIndexToLocaleString.put(new Integer(504), "hn"); //Honduras
countryIndexToLocaleString.put(new Integer(505), "ni"); //Nicaragua
countryIndexToLocaleString.put(new Integer(506), "cr"); //Costa Rica
countryIndexToLocaleString.put(new Integer(507), "pa"); //Panama
countryIndexToLocaleString.put(new Integer(508), "pm"); //St. Pierre & Miquelon
countryIndexToLocaleString.put(new Integer(509), "ht"); //Haiti
countryIndexToLocaleString.put(new Integer(51), "pe"); //Peru
countryIndexToLocaleString.put(new Integer(52), "mx"); //Mexico
countryIndexToLocaleString.put(new Integer(53), "cu"); //Cuba
countryIndexToLocaleString.put(new Integer(54), "ar"); //Argentina
countryIndexToLocaleString.put(new Integer(55), "br"); //Brazil
countryIndexToLocaleString.put(new Integer(56), "cl"); //Chile, Republic of
countryIndexToLocaleString.put(new Integer(57), "co"); //Colombia
countryIndexToLocaleString.put(new Integer(58), "ve"); //Venezuela
countryIndexToLocaleString.put(new Integer(590), "gp"); //Guadeloupe
countryIndexToLocaleString.put(new Integer(5901), "an"); //French Antilles
countryIndexToLocaleString.put(new Integer(5902), "an"); //Antilles
countryIndexToLocaleString.put(new Integer(591), "bo"); //Bolivia
countryIndexToLocaleString.put(new Integer(592), "gy"); //Guyana
countryIndexToLocaleString.put(new Integer(593), "ec"); //Ecuador
countryIndexToLocaleString.put(new Integer(594), "gy"); //French Guyana
countryIndexToLocaleString.put(new Integer(595), "py"); //Paraguay
countryIndexToLocaleString.put(new Integer(596), "mq"); //Martinique
countryIndexToLocaleString.put(new Integer(597), "sr"); //Suriname
countryIndexToLocaleString.put(new Integer(598), "uy"); //Uruguay
countryIndexToLocaleString.put(new Integer(599), "an"); //Netherlands Antilles
countryIndexToLocaleString.put(new Integer(60), "my"); //Malaysia
countryIndexToLocaleString.put(new Integer(61), "au"); //Australia
countryIndexToLocaleString.put(new Integer(6101), "cc"); //Cocos-Keeling Islands
countryIndexToLocaleString.put(new Integer(6102), "cc"); //Cocos (Keeling) Islands
countryIndexToLocaleString.put(new Integer(62), "id"); //Indonesia
countryIndexToLocaleString.put(new Integer(63), "ph"); //Philippines
countryIndexToLocaleString.put(new Integer(64), "nz"); //New Zealand
countryIndexToLocaleString.put(new Integer(65), "sg"); //Singapore
countryIndexToLocaleString.put(new Integer(66), "th"); //Thailand
// countryIndexToLocaleString.put(new Integer(670),""); //Saipan Island ???
// countryIndexToLocaleString.put(new Integer(6701),""); //Rota Island ???
// countryIndexToLocaleString.put(new Integer(6702),""); //Tinian Island ???
countryIndexToLocaleString.put(new Integer(671), "gu"); //Guam, US Territory of
countryIndexToLocaleString.put(new Integer(672), "cx"); //Christmas Island
countryIndexToLocaleString.put(new Integer(6722), "nf"); //Norfolk Island
countryIndexToLocaleString.put(new Integer(673), "bn"); //Brunei
countryIndexToLocaleString.put(new Integer(674), "nr"); //Nauru
countryIndexToLocaleString.put(new Integer(675), "pg"); //Papua New Guinea
countryIndexToLocaleString.put(new Integer(676), "to"); //Tonga
countryIndexToLocaleString.put(new Integer(677), "sb"); //Solomon Islands
countryIndexToLocaleString.put(new Integer(678), "vu"); //Vanuatu
countryIndexToLocaleString.put(new Integer(679), "fj"); //Fiji
countryIndexToLocaleString.put(new Integer(680), "pw"); //Palau
countryIndexToLocaleString.put(new Integer(681), "wf"); //Wallis & Futuna Islands
countryIndexToLocaleString.put(new Integer(682), "ck"); //Cook Islands
countryIndexToLocaleString.put(new Integer(683), "nu"); //Niue
countryIndexToLocaleString.put(new Integer(684), "as"); //American Samoa
countryIndexToLocaleString.put(new Integer(685), "ws"); //Western Samoa
countryIndexToLocaleString.put(new Integer(686), "ki"); //Kiribati
countryIndexToLocaleString.put(new Integer(687), "nc"); //New Caledonia
countryIndexToLocaleString.put(new Integer(688), "tv"); //Tuvalu
countryIndexToLocaleString.put(new Integer(689), "pf"); //French Polynesia
countryIndexToLocaleString.put(new Integer(690), "tk"); //Tokelau
countryIndexToLocaleString.put(new Integer(691), "fm"); //Micronesia, Federated States of
countryIndexToLocaleString.put(new Integer(692), "mh"); //Marshall Islands
countryIndexToLocaleString.put(new Integer(7), "ru"); //Russia
countryIndexToLocaleString.put(new Integer(705), "kz"); //Kazakhstan
countryIndexToLocaleString.put(new Integer(706), "kg"); //Kyrgyzstan
countryIndexToLocaleString.put(new Integer(708), "tj"); //Tajikistan
countryIndexToLocaleString.put(new Integer(709), "tm"); //Turkmenistan
countryIndexToLocaleString.put(new Integer(711), "uz"); //Uzbekistan
countryIndexToLocaleString.put(new Integer(81), "jp"); //Japan
countryIndexToLocaleString.put(new Integer(82), "kr"); //Korea, South
countryIndexToLocaleString.put(new Integer(84), "vn"); //Viet Nam
countryIndexToLocaleString.put(new Integer(850), "kp"); //Korea, North
countryIndexToLocaleString.put(new Integer(852), "hk"); //Hong Kong
countryIndexToLocaleString.put(new Integer(853), "mo"); //Macau
countryIndexToLocaleString.put(new Integer(855), "kh"); //Cambodia
countryIndexToLocaleString.put(new Integer(856), "la"); //Laos
countryIndexToLocaleString.put(new Integer(86), "cn"); //China
countryIndexToLocaleString.put(new Integer(880), "bd"); //Bangladesh
countryIndexToLocaleString.put(new Integer(886), "tw"); //Taiwan
countryIndexToLocaleString.put(new Integer(90), "tr"); //Turkey
countryIndexToLocaleString.put(new Integer(91), "in"); //India
countryIndexToLocaleString.put(new Integer(92), "pk"); //Pakistan
countryIndexToLocaleString.put(new Integer(93), "af"); //Afghanistan
countryIndexToLocaleString.put(new Integer(94), "lk"); //Sri Lanka
countryIndexToLocaleString.put(new Integer(95), "mm"); //Myanmar
countryIndexToLocaleString.put(new Integer(960), "mv"); //Maldives
countryIndexToLocaleString.put(new Integer(961), "lb"); //Lebanon
countryIndexToLocaleString.put(new Integer(962), "jo"); //Jordan
countryIndexToLocaleString.put(new Integer(963), "sy"); //Syrian Arab Republic
countryIndexToLocaleString.put(new Integer(964), "iq"); //Iraq
countryIndexToLocaleString.put(new Integer(965), "kw"); //Kuwait
countryIndexToLocaleString.put(new Integer(966), "sa"); //Saudi Arabia
countryIndexToLocaleString.put(new Integer(967), "ye"); //Yemen
countryIndexToLocaleString.put(new Integer(968), "om"); //Oman
countryIndexToLocaleString.put(new Integer(971), "ae"); //United Arabian Emirates
countryIndexToLocaleString.put(new Integer(972), "il"); //Israel
countryIndexToLocaleString.put(new Integer(973), "bh"); //Bahrain
countryIndexToLocaleString.put(new Integer(974), "qa"); //Qatar
countryIndexToLocaleString.put(new Integer(975), "bt"); //Bhutan
countryIndexToLocaleString.put(new Integer(976), "mn"); //Mongolia
countryIndexToLocaleString.put(new Integer(977), "np"); //Nepal
countryIndexToLocaleString.put(new Integer(98), "ir"); //Iran (Islamic Republic of)
countryIndexToLocaleString.put(new Integer(994), "az"); //Azerbaijan
countryIndexToLocaleString.put(new Integer(995), "ge"); //Georgia
// countryIndexToLocaleString.put(new Integer(9999),""); //other
// countryIndexToLocaleString.put((0),""); //not specified
countryIndexToLocaleString.put((1), "us"); //USA
countryIndexToLocaleString.put((101), "ai"); //Anguilla
countryIndexToLocaleString.put((102), "ag"); //Antigua
countryIndexToLocaleString.put((1021), "ag"); //Antigua & Barbuda
countryIndexToLocaleString.put((103), "bs"); //Bahamas
countryIndexToLocaleString.put((104), "bb"); //Barbados
countryIndexToLocaleString.put((105), "bm"); //Bermuda
countryIndexToLocaleString.put((106), "vg"); //British Virgin Islands
countryIndexToLocaleString.put((107), "ca"); //Canada
countryIndexToLocaleString.put((108), "ky"); //Cayman Islands
countryIndexToLocaleString.put((109), "dm"); //Dominica
countryIndexToLocaleString.put((110), "do"); //Dominican Republic
countryIndexToLocaleString.put((111), "gd"); //Grenada
countryIndexToLocaleString.put((112), "jm"); //Jamaica
countryIndexToLocaleString.put((113), "ms"); //Montserrat
countryIndexToLocaleString.put((114), "kn"); //Nevis
countryIndexToLocaleString.put((1141), "kn"); //Saint Kitts and Nevis
countryIndexToLocaleString.put((115), "kn"); //St. Kitts
countryIndexToLocaleString.put((116), "vc"); //St. Vincent & the Grenadines
countryIndexToLocaleString.put((117), "tt"); //Trinidad & Tobago
countryIndexToLocaleString.put((118), "tc"); //Turks & Caicos Islands
countryIndexToLocaleString.put((120), "ag"); //Barbuda
countryIndexToLocaleString.put((121), "pr"); //Puerto Rico
countryIndexToLocaleString.put((122), "lc"); //Saint Lucia
countryIndexToLocaleString.put((123), "vi"); //Virgin Islands (USA)
countryIndexToLocaleString.put((178), "es"); //Canary Islands ???
countryIndexToLocaleString.put((20), "eg"); //Egypt
countryIndexToLocaleString.put((212), "ma"); //Morocco
countryIndexToLocaleString.put((213), "dz"); //Algeria
countryIndexToLocaleString.put((216), "tn"); //Tunisia
countryIndexToLocaleString.put((218), "ly"); //Libyan Arab Jamahiriya
countryIndexToLocaleString.put((220), "gm"); //Gambia
countryIndexToLocaleString.put((221), "sn"); //Senegal
countryIndexToLocaleString.put((222), "mr"); //Mauritania
countryIndexToLocaleString.put((223), "ml"); //Mali
countryIndexToLocaleString.put((224), "pg"); //Guinea
countryIndexToLocaleString.put((225), "ci"); //Cote d'Ivoire
countryIndexToLocaleString.put((226), "bf"); //Burkina Faso
countryIndexToLocaleString.put((227), "ne"); //Niger
countryIndexToLocaleString.put((228), "tg"); //Togo
countryIndexToLocaleString.put((229), "bj"); //Benin
countryIndexToLocaleString.put((230), "mu"); //Mauritius
countryIndexToLocaleString.put((231), "lr"); //Liberia
countryIndexToLocaleString.put((232), "sl"); //Sierra Leone
countryIndexToLocaleString.put((233), "gh"); //Ghana
countryIndexToLocaleString.put((234), "ng"); //Nigeria
countryIndexToLocaleString.put((235), "td"); //Chad
countryIndexToLocaleString.put((236), "cf"); //Central African Republic
countryIndexToLocaleString.put((237), "cm"); //Cameroon
countryIndexToLocaleString.put((238), "cv"); //Cape Verde Islands
countryIndexToLocaleString.put((239), "st"); //Sao Tome & Principe
countryIndexToLocaleString.put((240), "gq"); //Equatorial Guinea
countryIndexToLocaleString.put((241), "ga"); //Gabon
countryIndexToLocaleString.put((242), "cg"); //Congo, (Rep. of the)
countryIndexToLocaleString.put((243), "cd"); //Congo, Democratic Republic of
countryIndexToLocaleString.put((244), "ao"); //Angola
countryIndexToLocaleString.put((245), "gw"); //Guinea-Bissau
// countryIndexToLocaleString.put((246),""); //Diego Garcia ???
// countryIndexToLocaleString.put((247),""); //Ascension Island ???
countryIndexToLocaleString.put((248), "sc"); //Seychelles
countryIndexToLocaleString.put((249), "sd"); //Sudan
countryIndexToLocaleString.put((250), "rw"); //Rwanda
countryIndexToLocaleString.put((251), "et"); //Ethiopia
countryIndexToLocaleString.put((252), "so"); //Somalia
countryIndexToLocaleString.put((253), "dj"); //Djibouti
countryIndexToLocaleString.put((254), "ke"); //Kenya
countryIndexToLocaleString.put((255), "tz"); //Tanzania
countryIndexToLocaleString.put((256), "ug"); //Uganda
countryIndexToLocaleString.put((257), "bi"); //Burundi
countryIndexToLocaleString.put((258), "mz"); //Mozambique
countryIndexToLocaleString.put((260), "zm"); //Zambia
countryIndexToLocaleString.put((261), "mg"); //Madagascar
// countryIndexToLocaleString.put((262),""); //Reunion Island ???
countryIndexToLocaleString.put((263), "zw"); //Zimbabwe
countryIndexToLocaleString.put((264), "na"); //Namibia
countryIndexToLocaleString.put((265), "mw"); //Malawi
countryIndexToLocaleString.put((266), "ls"); //Lesotho
countryIndexToLocaleString.put((267), "bw"); //Botswana
countryIndexToLocaleString.put((268), "sz"); //Swaziland
countryIndexToLocaleString.put((269), "yt"); //Mayotte Island
countryIndexToLocaleString.put((2691), "km"); //Comoros
countryIndexToLocaleString.put((27), "za"); //South Africa
countryIndexToLocaleString.put((290), "sh"); //St. Helena
countryIndexToLocaleString.put((291), "er"); //Eritrea
countryIndexToLocaleString.put((297), "aw"); //Aruba
// countryIndexToLocaleString.put((298),""); //Faeroe Islands ???
countryIndexToLocaleString.put((299), "gl"); //Greenland
countryIndexToLocaleString.put((30), "gr"); //Greece
countryIndexToLocaleString.put((31), "nl"); //Netherlands
countryIndexToLocaleString.put((32), "be"); //Belgium
countryIndexToLocaleString.put((33), "fr"); //France
countryIndexToLocaleString.put((34), "es"); //Spain
countryIndexToLocaleString.put((350), "gi"); //Gibraltar
countryIndexToLocaleString.put((351), "pt"); //Portugal
countryIndexToLocaleString.put((352), "lu"); //Luxembourg
countryIndexToLocaleString.put((353), "ie"); //Ireland
countryIndexToLocaleString.put((354), "is"); //Iceland
countryIndexToLocaleString.put((355), "al"); //Albania
countryIndexToLocaleString.put((356), "mt"); //Malta
countryIndexToLocaleString.put((357), "cy"); //Cyprus
countryIndexToLocaleString.put((358), "fi"); //Finland
countryIndexToLocaleString.put((359), "bg"); //Bulgaria
countryIndexToLocaleString.put((36), "hu"); //Hungary
countryIndexToLocaleString.put((370), "lt"); //Lithuania
countryIndexToLocaleString.put((371), "lv"); //Latvia
countryIndexToLocaleString.put((372), "ee"); //Estonia
countryIndexToLocaleString.put((373), "md"); //Moldova, Republic of
countryIndexToLocaleString.put((374), "am"); //Armenia
countryIndexToLocaleString.put((375), "by"); //Belarus
countryIndexToLocaleString.put((376), "ad"); //Andorra
countryIndexToLocaleString.put((377), "mc"); //Monaco
countryIndexToLocaleString.put((378), "sm"); //San Marino
countryIndexToLocaleString.put((379), "va"); //Vatican City
countryIndexToLocaleString.put((380), "ua"); //Ukraine
// countryIndexToLocaleString.put((381),""); //Yugoslavia ???
countryIndexToLocaleString.put((3811), "cs"); //Yugoslavia - Serbia
countryIndexToLocaleString.put((382), "cs"); //Yugoslavia - Montenegro
countryIndexToLocaleString.put((385), "hr"); //Croatia
countryIndexToLocaleString.put((386), "si"); //Slovenia
countryIndexToLocaleString.put((387), "ba"); //Bosnia & Herzegovina
countryIndexToLocaleString.put((389), "mk"); //Macedonia (F.Y.R.O.M.)
countryIndexToLocaleString.put((39), "it"); //Italy
countryIndexToLocaleString.put((40), "ro"); //Romania
countryIndexToLocaleString.put((41), "ch"); //Switzerland
countryIndexToLocaleString.put((4101), "li"); //Liechtenstein
countryIndexToLocaleString.put((42), "cz"); //Czech Republic
countryIndexToLocaleString.put((4201), "sk"); //Slovakia
countryIndexToLocaleString.put((43), "at"); //Austria
countryIndexToLocaleString.put((44), "gb"); //United Kingdom
// countryIndexToLocaleString.put((441),""); //Wales ???
// countryIndexToLocaleString.put((442),""); //Scotland ???
countryIndexToLocaleString.put((45), "dk"); //Denmark
countryIndexToLocaleString.put((46), "se"); //Sweden
countryIndexToLocaleString.put((47), "no"); //Norway
countryIndexToLocaleString.put((48), "pl"); //Poland
countryIndexToLocaleString.put((49), "de"); //Germany
// countryIndexToLocaleString.put((500),""); //Falkland Islands ???
countryIndexToLocaleString.put((501), "bz"); //Belize
countryIndexToLocaleString.put((502), "gt"); //Guatemala
countryIndexToLocaleString.put((503), "sv"); //El Salvador
countryIndexToLocaleString.put((504), "hn"); //Honduras
countryIndexToLocaleString.put((505), "ni"); //Nicaragua
countryIndexToLocaleString.put((506), "cr"); //Costa Rica
countryIndexToLocaleString.put((507), "pa"); //Panama
countryIndexToLocaleString.put((508), "pm"); //St. Pierre & Miquelon
countryIndexToLocaleString.put((509), "ht"); //Haiti
countryIndexToLocaleString.put((51), "pe"); //Peru
countryIndexToLocaleString.put((52), "mx"); //Mexico
countryIndexToLocaleString.put((53), "cu"); //Cuba
countryIndexToLocaleString.put((54), "ar"); //Argentina
countryIndexToLocaleString.put((55), "br"); //Brazil
countryIndexToLocaleString.put((56), "cl"); //Chile, Republic of
countryIndexToLocaleString.put((57), "co"); //Colombia
countryIndexToLocaleString.put((58), "ve"); //Venezuela
countryIndexToLocaleString.put((590), "gp"); //Guadeloupe
countryIndexToLocaleString.put((5901), "an"); //French Antilles
countryIndexToLocaleString.put((5902), "an"); //Antilles
countryIndexToLocaleString.put((591), "bo"); //Bolivia
countryIndexToLocaleString.put((592), "gy"); //Guyana
countryIndexToLocaleString.put((593), "ec"); //Ecuador
countryIndexToLocaleString.put((594), "gy"); //French Guyana
countryIndexToLocaleString.put((595), "py"); //Paraguay
countryIndexToLocaleString.put((596), "mq"); //Martinique
countryIndexToLocaleString.put((597), "sr"); //Suriname
countryIndexToLocaleString.put((598), "uy"); //Uruguay
countryIndexToLocaleString.put((599), "an"); //Netherlands Antilles
countryIndexToLocaleString.put((60), "my"); //Malaysia
countryIndexToLocaleString.put((61), "au"); //Australia
countryIndexToLocaleString.put((6101), "cc"); //Cocos-Keeling Islands
countryIndexToLocaleString.put((6102), "cc"); //Cocos (Keeling) Islands
countryIndexToLocaleString.put((62), "id"); //Indonesia
countryIndexToLocaleString.put((63), "ph"); //Philippines
countryIndexToLocaleString.put((64), "nz"); //New Zealand
countryIndexToLocaleString.put((65), "sg"); //Singapore
countryIndexToLocaleString.put((66), "th"); //Thailand
// countryIndexToLocaleString.put((670),""); //Saipan Island ???
// countryIndexToLocaleString.put((6701),""); //Rota Island ???
// countryIndexToLocaleString.put((6702),""); //Tinian Island ???
countryIndexToLocaleString.put((671), "gu"); //Guam, US Territory of
countryIndexToLocaleString.put((672), "cx"); //Christmas Island
countryIndexToLocaleString.put((6722), "nf"); //Norfolk Island
countryIndexToLocaleString.put((673), "bn"); //Brunei
countryIndexToLocaleString.put((674), "nr"); //Nauru
countryIndexToLocaleString.put((675), "pg"); //Papua New Guinea
countryIndexToLocaleString.put((676), "to"); //Tonga
countryIndexToLocaleString.put((677), "sb"); //Solomon Islands
countryIndexToLocaleString.put((678), "vu"); //Vanuatu
countryIndexToLocaleString.put((679), "fj"); //Fiji
countryIndexToLocaleString.put((680), "pw"); //Palau
countryIndexToLocaleString.put((681), "wf"); //Wallis & Futuna Islands
countryIndexToLocaleString.put((682), "ck"); //Cook Islands
countryIndexToLocaleString.put((683), "nu"); //Niue
countryIndexToLocaleString.put((684), "as"); //American Samoa
countryIndexToLocaleString.put((685), "ws"); //Western Samoa
countryIndexToLocaleString.put((686), "ki"); //Kiribati
countryIndexToLocaleString.put((687), "nc"); //New Caledonia
countryIndexToLocaleString.put((688), "tv"); //Tuvalu
countryIndexToLocaleString.put((689), "pf"); //French Polynesia
countryIndexToLocaleString.put((690), "tk"); //Tokelau
countryIndexToLocaleString.put((691), "fm"); //Micronesia, Federated States of
countryIndexToLocaleString.put((692), "mh"); //Marshall Islands
countryIndexToLocaleString.put((7), "ru"); //Russia
countryIndexToLocaleString.put((705), "kz"); //Kazakhstan
countryIndexToLocaleString.put((706), "kg"); //Kyrgyzstan
countryIndexToLocaleString.put((708), "tj"); //Tajikistan
countryIndexToLocaleString.put((709), "tm"); //Turkmenistan
countryIndexToLocaleString.put((711), "uz"); //Uzbekistan
countryIndexToLocaleString.put((81), "jp"); //Japan
countryIndexToLocaleString.put((82), "kr"); //Korea, South
countryIndexToLocaleString.put((84), "vn"); //Viet Nam
countryIndexToLocaleString.put((850), "kp"); //Korea, North
countryIndexToLocaleString.put((852), "hk"); //Hong Kong
countryIndexToLocaleString.put((853), "mo"); //Macau
countryIndexToLocaleString.put((855), "kh"); //Cambodia
countryIndexToLocaleString.put((856), "la"); //Laos
countryIndexToLocaleString.put((86), "cn"); //China
countryIndexToLocaleString.put((880), "bd"); //Bangladesh
countryIndexToLocaleString.put((886), "tw"); //Taiwan
countryIndexToLocaleString.put((90), "tr"); //Turkey
countryIndexToLocaleString.put((91), "in"); //India
countryIndexToLocaleString.put((92), "pk"); //Pakistan
countryIndexToLocaleString.put((93), "af"); //Afghanistan
countryIndexToLocaleString.put((94), "lk"); //Sri Lanka
countryIndexToLocaleString.put((95), "mm"); //Myanmar
countryIndexToLocaleString.put((960), "mv"); //Maldives
countryIndexToLocaleString.put((961), "lb"); //Lebanon
countryIndexToLocaleString.put((962), "jo"); //Jordan
countryIndexToLocaleString.put((963), "sy"); //Syrian Arab Republic
countryIndexToLocaleString.put((964), "iq"); //Iraq
countryIndexToLocaleString.put((965), "kw"); //Kuwait
countryIndexToLocaleString.put((966), "sa"); //Saudi Arabia
countryIndexToLocaleString.put((967), "ye"); //Yemen
countryIndexToLocaleString.put((968), "om"); //Oman
countryIndexToLocaleString.put((971), "ae"); //United Arabian Emirates
countryIndexToLocaleString.put((972), "il"); //Israel
countryIndexToLocaleString.put((973), "bh"); //Bahrain
countryIndexToLocaleString.put((974), "qa"); //Qatar
countryIndexToLocaleString.put((975), "bt"); //Bhutan
countryIndexToLocaleString.put((976), "mn"); //Mongolia
countryIndexToLocaleString.put((977), "np"); //Nepal
countryIndexToLocaleString.put((98), "ir"); //Iran (Islamic Republic of)
countryIndexToLocaleString.put((994), "az"); //Azerbaijan
countryIndexToLocaleString.put((995), "ge"); //Georgia
// countryIndexToLocaleString.put((9999),""); //other
}
/**

@ -453,7 +453,7 @@ else if (on)
* specified call participant with the sent invite
* @throws OperationFailedException
*/
private void sendInviteRequest(CallParticipantSipImpl sipParticipant,
void sendInviteRequest(CallParticipantSipImpl sipParticipant,
String sdpOffer) throws OperationFailedException
{
Dialog dialog = sipParticipant.getDialog();

@ -1,230 +1,364 @@
/*
* 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.sip;
import java.awt.*;
import net.java.sip.communicator.service.media.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
/**
* Implements <code>OperationSetVideoTelephony</code> in order to give access to
* video-specific functionality in the SIP protocol implementation such as
* visual <code>Component</code>s displaying video and listening to dynamic
* availability of such <code>Component</code>s. Because the video in the SIP
* protocol implementation is provided by the <code>CallSession</code>, this
* <code>OperationSetVideoTelephony</code> just delegates to the
* <code>CallSession</code> while hiding the <code>CallSession</code> as the
* provider of the video and pretending this
* <code>OperationSetVideoTelephony</code> is the provider because other
* implementation may not provider their video through the
* <code>CallSession</code>.
*
* @author Lubomir Marinov
*/
public class OperationSetVideoTelephonySipImpl
implements OperationSetVideoTelephony
{
/*
* Delegates to the CallSession of the Call of the specified CallParticipant
* because the video is provided by the CallSession in the SIP protocol
* implementation. Because other OperationSetVideoTelephony implementations
* may not provide their video through the CallSession, this implementation
* promotes itself as the provider of the video by replacing the CallSession
* in the VideoEvents it fires.
*/
public void addVideoListener(CallParticipant participant,
VideoListener listener)
{
if (listener == null)
throw new NullPointerException("listener");
((CallSipImpl) participant.getCall()).getMediaCallSession()
.addVideoListener(
new InternalVideoListener(this, participant, listener));
}
public Component createLocalVisualComponent(CallParticipant participant,
VideoListener listener) throws OperationFailedException
{
CallSession callSession =
((CallSipImpl) participant.getCall()).getMediaCallSession();
if (callSession != null)
{
try
{
return callSession.createLocalVisualComponent(listener);
}
catch (MediaException ex)
{
throw new OperationFailedException(
"Failed to create visual Component for local video (capture).",
OperationFailedException.INTERNAL_ERROR, ex);
}
}
return null;
}
public void disposeLocalVisualComponent(CallParticipant participant,
Component component)
{
CallSession callSession =
((CallSipImpl) participant.getCall()).getMediaCallSession();
if (callSession != null)
{
callSession.disposeLocalVisualComponent(component);
}
}
/*
* Delegates to the CallSession of the Call of the specified CallParticipant
* because the video is provided by the CallSession in the SIP protocol
* implementation.
*/
public Component[] getVisualComponents(CallParticipant participant)
{
CallSession callSession =
((CallSipImpl) participant.getCall()).getMediaCallSession();
return (callSession != null) ? callSession.getVisualComponents()
: new Component[0];
}
/*
* Delegates to the CallSession of the Call of the specified CallParticipant
* because the video is provided by the CallSession in the SIP protocol
* implementation. Because other OperationSetVideoTelephony implementations
* may not provide their video through the CallSession, this implementation
* promotes itself as the provider of the video by replacing the CallSession
* in the VideoEvents it fires.
*/
public void removeVideoListener(CallParticipant participant,
VideoListener listener)
{
if (listener != null)
{
((CallSipImpl) participant.getCall()).getMediaCallSession()
.removeVideoListener(
new InternalVideoListener(this, participant, listener));
}
}
/**
* Represents a <code>VideoListener</code> which forwards notifications to a
* specific delegate <code>VideoListener</code> and hides the original
* <code>VideoEvent</code> sender from it by pretending the sender is a
* specific <code>OperationSetVideoTelephony</code>. It's necessary in order
* to hide from the <code>VideoListener</code>s the fact that the video of
* the SIP protocol implementation is managed by <code>CallSession</code>.
*/
private static class InternalVideoListener
implements VideoListener
{
/**
* The <code>VideoListener</code> this implementation hides the original
* <code>VideoEvent</code> source from.
*/
private final VideoListener delegate;
/**
* The <code>CallParticipant</code> whose videos {@link #delegate} is
* interested in.
*/
private final CallParticipant participant;
/**
* The <code>OperationSetVideoTelephony</code> which is to be presented
* as the source of the <code>VideoEvents</code> forwarded to
* {@link #delegate}.
*/
private final OperationSetVideoTelephony telephony;
/**
* Initializes a new <code>InternalVideoListener</code> which is to
* impersonate the sources of <code>VideoEvents</code> with a specific
* <code>OperationSetVideoTelephony</code> for a specific
* <code>VideoListener</code> interested in the videos of a specific
* <code>CallParticipant</code>.
*
* @param telephony the <code>OperationSetVideoTelephony</code> which is
* to be stated as the source of the <code>VideoEvent</code>
* sent to the specified delegate <code>VideoListener</code>
* @param participant the <code>CallParticipant</code> whose videos the
* specified delegate <code>VideoListener</code> is
* interested in
* @param delegate the <code>VideoListener</code> which shouldn't know
* that the videos in the SIP protocol implementation is
* managed by the CallSession and not by the specified
* <code>telephony</code>
*/
public InternalVideoListener(OperationSetVideoTelephony telephony,
CallParticipant participant, VideoListener delegate)
{
if (participant == null)
throw new NullPointerException("participant");
this.telephony = telephony;
this.participant = participant;
this.delegate = delegate;
}
/*
* Two InternalVideoListeners are equal if they impersonate the sources
* of VideoEvents with equal OperationSetVideoTelephonies for equal
* delegate VideoListeners added to equal CallParticipants.
*/
public boolean equals(Object other)
{
if (other == this)
return true;
if ((other == null) || !other.getClass().equals(getClass()))
return false;
InternalVideoListener otherListener = (InternalVideoListener) other;
return otherListener.telephony.equals(telephony)
&& otherListener.participant.equals(participant)
&& otherListener.delegate.equals(delegate);
}
public int hashCode()
{
return (telephony.hashCode() << 16) + (delegate.hashCode() >> 16);
}
/*
* Upon receiving a VideoEvent, sends to delegate a new VideoEvent of
* the same type and with the same visual Component but with the source
* of the event being set to #telephony. Thus the fact that the
* CallSession is the original source is hidden from the clients of
* OperationSetVideoTelephony.
*/
public void videoAdded(VideoEvent event)
{
delegate.videoAdded(new VideoEvent(this, event.getType(), event
.getVisualComponent(), event.getOrigin()));
}
/*
* Upon receiving a VideoEvent, sends to delegate a new VideoEvent of
* the same type and with the same visual Component but with the source
* of the event being set to #telephony. Thus the fact that the
* CallSession is the original source is hidden from the clients of
* OperationSetVideoTelephony.
*/
public void videoRemoved(VideoEvent event)
{
delegate.videoAdded(new VideoEvent(this, event.getType(), event
.getVisualComponent(), event.getOrigin()));
}
}
}
/*
* 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.sip;
import java.awt.*;
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.*;
/**
* Implements <code>OperationSetVideoTelephony</code> in order to give access to
* video-specific functionality in the SIP protocol implementation such as
* visual <code>Component</code>s displaying video and listening to dynamic
* availability of such <code>Component</code>s. Because the video in the SIP
* protocol implementation is provided by the <code>CallSession</code>, this
* <code>OperationSetVideoTelephony</code> just delegates to the
* <code>CallSession</code> while hiding the <code>CallSession</code> as the
* provider of the video and pretending this
* <code>OperationSetVideoTelephony</code> is the provider because other
* implementation may not provider their video through the
* <code>CallSession</code>.
*
* @author Lubomir Marinov
*/
public class OperationSetVideoTelephonySipImpl
implements OperationSetVideoTelephony
{
/**
* The telephony-related functionality this extension builds upon.
*/
private final OperationSetBasicTelephonySipImpl basicTelephony;
/**
* Initializes a new <code>OperationSetVideoTelephonySipImpl</code> instance
* which builds upon the telephony-related functionality of a specific
* <code>OperationSetBasicTelephonySipImpl</code>.
*
* @param basicTelephony the <code>OperationSetBasicTelephonySipImpl</code>
* the new extension should build upon
*/
public OperationSetVideoTelephonySipImpl(
OperationSetBasicTelephonySipImpl basicTelephony)
{
this.basicTelephony = basicTelephony;
}
/*
* Delegates to the CallSession of the Call of the specified CallParticipant
* because the video is provided by the CallSession in the SIP protocol
* implementation. Because other OperationSetVideoTelephony implementations
* may not provide their video through the CallSession, this implementation
* promotes itself as the provider of the video by replacing the CallSession
* in the VideoEvents it fires.
*/
public void addVideoListener(CallParticipant participant,
VideoListener listener)
{
if (listener == null)
throw new NullPointerException("listener");
((CallSipImpl) participant.getCall()).getMediaCallSession()
.addVideoListener(
new InternalVideoListener(this, participant, listener));
}
/*
* Implements OperationSetVideoTelephony#createLocalVisualComponent(
* CallParticipant, VideoListener). Delegates to CallSession#createLocalVisualComponent(
* VideoListener) of the Call of the specified CallParticipant because the
* CallSession manages the visual components which represent local video.
*/
public Component createLocalVisualComponent(CallParticipant participant,
VideoListener listener) throws OperationFailedException
{
CallSession callSession =
((CallSipImpl) participant.getCall()).getMediaCallSession();
if (callSession != null)
{
try
{
return callSession.createLocalVisualComponent(listener);
}
catch (MediaException ex)
{
throw new OperationFailedException(
"Failed to create visual Component for local video (capture).",
OperationFailedException.INTERNAL_ERROR, ex);
}
}
return null;
}
/*
* Implements OperationSetVideoTelephony#disposeLocalVisualComponent(
* CallParticipant, Component). Delegates to CallSession#disposeLocalVisualComponent(
* Component) of the Call of the specified CallParticipant because the
* CallSession manages the visual components which represent local video.
*/
public void disposeLocalVisualComponent(CallParticipant participant,
Component component)
{
CallSession callSession =
((CallSipImpl) participant.getCall()).getMediaCallSession();
if (callSession != null)
callSession.disposeLocalVisualComponent(component);
}
/*
* Delegates to the CallSession of the Call of the specified CallParticipant
* because the video is provided by the CallSession in the SIP protocol
* implementation.
*/
public Component[] getVisualComponents(CallParticipant participant)
{
CallSession callSession =
((CallSipImpl) participant.getCall()).getMediaCallSession();
return (callSession != null) ? callSession.getVisualComponents()
: new Component[0];
}
/*
* Delegates to the CallSession of the Call of the specified CallParticipant
* because the video is provided by the CallSession in the SIP protocol
* implementation. Because other OperationSetVideoTelephony implementations
* may not provide their video through the CallSession, this implementation
* promotes itself as the provider of the video by replacing the CallSession
* in the VideoEvents it fires.
*/
public void removeVideoListener(CallParticipant participant,
VideoListener listener)
{
if (listener != null)
{
((CallSipImpl) participant.getCall()).getMediaCallSession()
.removeVideoListener(
new InternalVideoListener(this, participant, listener));
}
}
/*
* Implements OperationSetVideoTelephony#setLocalVideoAllowed(Call,
* boolean). Modifies the local media setup to reflect the requested setting
* for the streaming of the local video and then re-invites all
* CallParticipants to re-negotiate the modified media setup.
*/
public void setLocalVideoAllowed(Call call, boolean allowed)
throws OperationFailedException
{
/*
* Modify the local media setup to reflect the requested setting for the
* streaming of the local video.
*/
CallSipImpl sipCall = (CallSipImpl) call;
CallSession callSession = sipCall.getMediaCallSession();
try
{
callSession.setLocalVideoAllowed(allowed);
}
catch (MediaException ex)
{
throw new OperationFailedException(
"Failed to allow/disallow the streaming of local video.",
OperationFailedException.INTERNAL_ERROR, ex);
}
/*
* Once the local state has been modified, re-invite all
* CallParticipants to re-negotiate the modified media setup.
*/
Iterator<CallParticipant> participants = call.getCallParticipants();
while (participants.hasNext())
{
CallParticipantSipImpl participant
= (CallParticipantSipImpl) participants.next();
String sdpOffer = null;
try
{
sdpOffer
= callSession.createSdpOffer(
participant.getSdpDescription());
}
catch (MediaException ex)
{
throw new OperationFailedException(
"Failed to create re-invite offer for participant "
+ participant,
OperationFailedException.INTERNAL_ERROR,
ex);
}
basicTelephony.sendInviteRequest(participant, sdpOffer);
}
}
/*
* Implements OperationSetVideoTelephony#isLocalVideoAllowed(Call).
* Delegates to CallSession#isLocalVideoAllowed() of the specified Call.
*/
public boolean isLocalVideoAllowed(Call call)
{
return ((CallSipImpl) call).getMediaCallSession().isLocalVideoAllowed();
}
/*
* Implements OperationSetVideoTelephony#isLocalVideoStreaming(Call).
* Delegates to CallSession#isLocalVideoStreaming() of the specified Call.
*/
public boolean isLocalVideoStreaming(Call call)
{
return ((CallSipImpl) call)
.getMediaCallSession().isLocalVideoStreaming();
}
/*
* Implements OperationSetVideoTelephony#addPropertyChangeListener(Call,
* PropertyChangeListener). Delegates to CallSession#addPropertyChangeListener(
* PropertyChangeListener) of the specified Call because CallSession
* contains the properties associated with a Call.
*/
public void addPropertyChangeListener(
Call call, PropertyChangeListener listener)
{
((CallSipImpl) call)
.getMediaCallSession().addPropertyChangeListener(listener);
}
/*
* Implements OperationSetVideoTelephony#removePropertyChangeListener(Call,
* PropertyChangeListener). Delegates to CallSession#removePropertyChangeListener(
* PropertyChangeListener) of the specified Call because CallSession
* contains the properties associated with a Call.
*/
public void removePropertyChangeListener(
Call call, PropertyChangeListener listener)
{
((CallSipImpl) call)
.getMediaCallSession().removePropertyChangeListener(listener);
}
/**
* Represents a <code>VideoListener</code> which forwards notifications to a
* specific delegate <code>VideoListener</code> and hides the original
* <code>VideoEvent</code> sender from it by pretending the sender is a
* specific <code>OperationSetVideoTelephony</code>. It's necessary in order
* to hide from the <code>VideoListener</code>s the fact that the video of
* the SIP protocol implementation is managed by <code>CallSession</code>.
*/
private static class InternalVideoListener
implements VideoListener
{
/**
* The <code>VideoListener</code> this implementation hides the original
* <code>VideoEvent</code> source from.
*/
private final VideoListener delegate;
/**
* The <code>CallParticipant</code> whose videos {@link #delegate} is
* interested in.
*/
private final CallParticipant participant;
/**
* The <code>OperationSetVideoTelephony</code> which is to be presented
* as the source of the <code>VideoEvents</code> forwarded to
* {@link #delegate}.
*/
private final OperationSetVideoTelephony telephony;
/**
* Initializes a new <code>InternalVideoListener</code> which is to
* impersonate the sources of <code>VideoEvents</code> with a specific
* <code>OperationSetVideoTelephony</code> for a specific
* <code>VideoListener</code> interested in the videos of a specific
* <code>CallParticipant</code>.
*
* @param telephony the <code>OperationSetVideoTelephony</code> which is
* to be stated as the source of the <code>VideoEvent</code>
* sent to the specified delegate <code>VideoListener</code>
* @param participant the <code>CallParticipant</code> whose videos the
* specified delegate <code>VideoListener</code> is
* interested in
* @param delegate the <code>VideoListener</code> which shouldn't know
* that the videos in the SIP protocol implementation is
* managed by the CallSession and not by the specified
* <code>telephony</code>
*/
public InternalVideoListener(OperationSetVideoTelephony telephony,
CallParticipant participant, VideoListener delegate)
{
if (participant == null)
throw new NullPointerException("participant");
this.telephony = telephony;
this.participant = participant;
this.delegate = delegate;
}
/*
* Two InternalVideoListeners are equal if they impersonate the sources
* of VideoEvents with equal OperationSetVideoTelephonies for equal
* delegate VideoListeners added to equal CallParticipants.
*/
public boolean equals(Object other)
{
if (other == this)
return true;
if ((other == null) || !other.getClass().equals(getClass()))
return false;
InternalVideoListener otherListener = (InternalVideoListener) other;
return otherListener.telephony.equals(telephony)
&& otherListener.participant.equals(participant)
&& otherListener.delegate.equals(delegate);
}
public int hashCode()
{
return (telephony.hashCode() << 16) + (delegate.hashCode() >> 16);
}
/*
* Upon receiving a VideoEvent, sends to delegate a new VideoEvent of
* the same type and with the same visual Component but with the source
* of the event being set to #telephony. Thus the fact that the
* CallSession is the original source is hidden from the clients of
* OperationSetVideoTelephony.
*/
public void videoAdded(VideoEvent event)
{
delegate.videoAdded(new VideoEvent(this, event.getType(), event
.getVisualComponent(), event.getOrigin()));
}
/*
* Upon receiving a VideoEvent, sends to delegate a new VideoEvent of
* the same type and with the same visual Component but with the source
* of the event being set to #telephony. Thus the fact that the
* CallSession is the original source is hidden from the clients of
* OperationSetVideoTelephony.
*/
public void videoRemoved(VideoEvent event)
{
delegate.videoAdded(new VideoEvent(this, event.getType(), event
.getVisualComponent(), event.getOrigin()));
}
}
}

@ -432,20 +432,20 @@ protected void initialize(String sipAddress,
initRegistrarConnection(accountID);
//init our call processor
OperationSetAdvancedTelephony opSetAdvancedTelephony
OperationSetBasicTelephonySipImpl opSetBasicTelephonySipImpl
= new OperationSetBasicTelephonySipImpl(this);
this.supportedOperationSets.put(
OperationSetBasicTelephony.class.getName()
, opSetAdvancedTelephony);
, opSetBasicTelephonySipImpl);
this.supportedOperationSets.put(
OperationSetAdvancedTelephony.class.getName()
, opSetAdvancedTelephony);
, opSetBasicTelephonySipImpl);
// init ZRTP (OperationSetBasicTelephonySipImpl implements
// OperationSetSecureTelephony)
this.supportedOperationSets.put(
OperationSetSecureTelephony.class.getName()
, opSetAdvancedTelephony);
, opSetBasicTelephonySipImpl);
//init presence op set.
OperationSetPersistentPresence opSetPersPresence
@ -474,8 +474,9 @@ protected void initialize(String sipAddress,
opSetTyping);
// OperationSetVideoTelephony
supportedOperationSets.put(OperationSetVideoTelephony.class
.getName(), new OperationSetVideoTelephonySipImpl());
supportedOperationSets.put(
OperationSetVideoTelephony.class.getName(),
new OperationSetVideoTelephonySipImpl(opSetBasicTelephonySipImpl));
// init DTMF (from JM Heitz)
OperationSetDTMF opSetDTMF = new OperationSetDTMFSipImpl(this);

@ -8,10 +8,8 @@
*
* SSH Suport in SIP Communicator - GSoC' 07 Projec
*/
package net.java.sip.communicator.impl.protocol.ssh;
import java.io.*;
import java.util.*;
@ -33,7 +31,7 @@ public class ContactSSHImpl
= Logger.getLogger(ContactSSHImpl.class);
/**
* This acts as a seperator between details stored in persistent data
* This acts as a separator between details stored in persistent data
*/
private final String separator =
Resources.getString("impl.protocol.ssh.DETAILS_SEPARATOR");
@ -381,8 +379,8 @@ public void setPersistentData(String persistentData)
this.persistentData.substring(fourthCommaIndex + 1,
fifthCommaIndex));
this.sshConfigurationForm.setUpdateInterval(new Integer(Integer
.parseInt(this.persistentData.substring(fifthCommaIndex+1)) ));
this.sshConfigurationForm.setUpdateInterval(
Integer.parseInt(this.persistentData.substring(fifthCommaIndex+1)));
}
/**

@ -109,7 +109,7 @@ public SSHContactInfo(ContactSSH sshContact) {
* initialize the form.
*/
public void initForm() {
updateTimer.setValue(new Integer(30));
updateTimer.setValue(30);
MaskFormatter maskFormatter = new MaskFormatter();
try {
maskFormatter.setMask("#####");
@ -118,7 +118,7 @@ public void initForm() {
}
maskFormatter.setAllowsInvalid(false);
portField = new JFormattedTextField(maskFormatter);
portField.setValue(new Integer(22));
portField.setValue(22);
userNameField.setEnabled(false);
passwordField.setEditable(false);
@ -314,7 +314,7 @@ public void setTerminalType(String termType) {
*
* @param interval to be associated
*/
public void setUpdateInterval(Integer interval) {
public void setUpdateInterval(int interval) {
this.updateTimer.setValue(interval);
}

@ -9,10 +9,12 @@
import java.beans.PropertyChangeEvent;
import java.io.*;
import java.util.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.service.protocol.yahooconstants.*;
import net.java.sip.communicator.util.*;
import ymsg.network.*;
import ymsg.network.event.*;
@ -86,34 +88,35 @@ public class OperationSetPersistentPresenceYahooImpl
* A map containing bindings between SIP Communicator's yahoo presence status
* instances and Yahoo status codes
*/
private static Map scToYahooModesMappings = new Hashtable();
private static final Map<PresenceStatus, Long> scToYahooModesMappings
= new Hashtable<PresenceStatus, Long>();
static{
scToYahooModesMappings.put(YahooStatusEnum.AVAILABLE,
new Long(StatusConstants.STATUS_AVAILABLE));
StatusConstants.STATUS_AVAILABLE);
scToYahooModesMappings.put(YahooStatusEnum.BE_RIGHT_BACK,
new Long(StatusConstants.STATUS_BRB));
StatusConstants.STATUS_BRB);
scToYahooModesMappings.put(YahooStatusEnum.BUSY,
new Long(StatusConstants.STATUS_BUSY));
StatusConstants.STATUS_BUSY);
scToYahooModesMappings.put(YahooStatusEnum.IDLE,
new Long(StatusConstants.STATUS_IDLE));
StatusConstants.STATUS_IDLE);
scToYahooModesMappings.put(YahooStatusEnum.INVISIBLE,
new Long(StatusConstants.STATUS_INVISIBLE));
StatusConstants.STATUS_INVISIBLE);
scToYahooModesMappings.put(YahooStatusEnum.NOT_AT_DESK,
new Long(StatusConstants.STATUS_NOTATDESK));
StatusConstants.STATUS_NOTATDESK);
scToYahooModesMappings.put(YahooStatusEnum.NOT_AT_HOME,
new Long(StatusConstants.STATUS_NOTATHOME));
StatusConstants.STATUS_NOTATHOME);
scToYahooModesMappings.put(YahooStatusEnum.NOT_IN_OFFICE,
new Long(StatusConstants.STATUS_NOTINOFFICE));
StatusConstants.STATUS_NOTINOFFICE);
scToYahooModesMappings.put(YahooStatusEnum.OFFLINE,
new Long(StatusConstants.STATUS_OFFLINE));
StatusConstants.STATUS_OFFLINE);
scToYahooModesMappings.put(YahooStatusEnum.ON_THE_PHONE,
new Long(StatusConstants.STATUS_ONPHONE));
StatusConstants.STATUS_ONPHONE);
scToYahooModesMappings.put(YahooStatusEnum.ON_VACATION,
new Long(StatusConstants.STATUS_ONVACATION));
StatusConstants.STATUS_ONVACATION);
scToYahooModesMappings.put(YahooStatusEnum.OUT_TO_LUNCH,
new Long(StatusConstants.STATUS_OUTTOLUNCH));
StatusConstants.STATUS_OUTTOLUNCH);
scToYahooModesMappings.put(YahooStatusEnum.STEPPED_OUT,
new Long(StatusConstants.STATUS_STEPPEDOUT));
StatusConstants.STATUS_STEPPEDOUT);
}
/**
@ -436,7 +439,7 @@ public void publishPresenceStatus(PresenceStatus status,
}
parentProvider.getYahooSession().setStatus(
((Long)scToYahooModesMappings.get(status)).longValue());
scToYahooModesMappings.get(status).longValue());
fireProviderPresenceStatusChangeEvent(currentStatus, status);
}
@ -1018,4 +1021,4 @@ public void subscriptionMoved(SubscriptionMovedEvent evt) {}
public void subscriptionResolved(SubscriptionEvent evt) {}
public void contactModified(ContactPropertyChangeEvent evt) {}
}
}
}

@ -261,7 +261,7 @@ void writeName(String name) throws IOException
writeByte(val);
return;
}
names.put(name, new Integer(off));
names.put(name, off);
writeUTF(name, 0, n);
name = name.substring(n);
if (name.startsWith("."))

@ -359,7 +359,7 @@ private void loadSummaryDetails()
if (c.get(Calendar.MONTH) < calendarDetail.get(Calendar.MONTH))
age--;
ageDetail = new Integer(age).toString().trim();
ageDetail = Integer.toString(age).trim();
}
birthdayField.setText(birthDateDetailString);

@ -339,7 +339,7 @@ private JPanel createSummaryInfoPanel()
if (c.get(Calendar.MONTH) < calendarDetail.get(Calendar.MONTH))
age--;
ageDetail = new Integer(age).toString().trim();
ageDetail = Integer.toString(age).trim();
}
if (birthDateDetail.equals(""))

@ -7,7 +7,6 @@
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.List;
import javax.swing.*;
@ -314,7 +313,7 @@ public void commitPage()
int port = Integer.parseInt(portField.getText());
boolean isModified = false;
if (this.initAccountID instanceof AccountID)
if (this.initAccountID != null)
{ // We check if there are modifications to the server
String accHost =
this.initAccountID.getAccountPropertyString(
@ -323,7 +322,8 @@ public void commitPage()
Integer.parseInt(this.initAccountID
.getAccountPropertyString(ProtocolProviderFactory.SERVER_PORT));
if (accHost != host || accPort != port)
if (((accHost == null) ? (host != null) : !accHost.equals(host))
|| (accPort != port))
{
isModified = true;
}
@ -514,8 +514,7 @@ private boolean hasAccount()
ProtocolProviderFactory factory =
DictAccRegWizzActivator.getDictProtocolProviderFactory();
ArrayList registeredAccounts = factory.getRegisteredAccounts();
return !registeredAccounts.isEmpty();
return !factory.getRegisteredAccounts().isEmpty();
}
/**

@ -159,8 +159,7 @@ public static void loadGuiConfigurations()
&& chatHistorySizeString.length() > 0)
{
chatHistorySize
= new Integer(chatHistorySizeString)
.intValue();
= Integer.parseInt(chatHistorySizeString);
}
// Load the "isTransparentWindowEnabled" property.
@ -196,7 +195,7 @@ public static void loadGuiConfigurations()
&& windowTransparencyString.length() > 0)
{
windowTransparency
= new Integer(windowTransparencyString).intValue();
= Integer.parseInt(windowTransparencyString);
}
}
@ -342,7 +341,7 @@ public static void setWindowTransparency(int windowTransparency)
configService.setProperty(
"impl.gui.WINDOW_TRANSPARENCY",
new Integer(windowTransparency).toString());
Integer.toString(windowTransparency));
}
/**
@ -462,4 +461,4 @@ public static void setChatHistorySize(int historySize)
"service.gui.MESSAGE_HISTORY_SIZE",
Integer.toString(chatHistorySize));
}
}
}

@ -55,11 +55,8 @@ public class MailboxConfigurationPanel
private JLabel jlblWaitTime
= new JLabel(Resources.getString("plugin.mailbox.WAIT_TIME"));
private JSpinner jsWaitTime = new JSpinner(new SpinnerNumberModel(
new Integer(10000),
new Integer(0),
null,
new Integer(1000)));
private JSpinner jsWaitTime =
new JSpinner(new SpinnerNumberModel(10000, 0, null, 1000));
private JPanel jpWaitTime =
new TransparentPanel(new FlowLayout(FlowLayout.LEFT));
@ -67,11 +64,8 @@ public class MailboxConfigurationPanel
private JLabel jlblMaxMessageTime
= new JLabel(Resources.getString("plugin.mailbox.MAX_MESSAGE_TIME"));
private JSpinner jsMaxMessageTime = new JSpinner(new SpinnerNumberModel(
new Integer(10000),
new Integer(0),
null,
new Integer(1000)));
private JSpinner jsMaxMessageTime
= new JSpinner(new SpinnerNumberModel(10000, 0, null, 1000));
private JPanel jpMaxMessageTime = new TransparentPanel(
new FlowLayout(FlowLayout.LEFT));
@ -106,13 +100,12 @@ public MailboxConfigurationPanel()
jpIncomingMessage.add(jbtnIncomingMessage);
//get our wait time panel set up
jsWaitTime.setValue(new Integer(Mailbox.getWaitTime()));
jsWaitTime.setValue(Mailbox.getWaitTime());
jpWaitTime.add(jlblWaitTime);
jpWaitTime.add(jsWaitTime);
//get our max message time panel set up
jsMaxMessageTime.setValue(new Integer(
Mailbox.getMaxMessageDuration()));
jsMaxMessageTime.setValue(Mailbox.getMaxMessageDuration());
jpMaxMessageTime.add(jlblMaxMessageTime);
jpMaxMessageTime.add(jsMaxMessageTime);
@ -197,9 +190,9 @@ else if (e.getSource() == jbtnDefault)
config.setProperty(Mailbox.OUTGOING_MESSAGE_PROPERTY_NAME,
null);
config.setProperty(Mailbox.MAX_MSG_DURATION_PROPERTY_NAME,
new Integer(Mailbox.getMaxMessageDuration()));
Mailbox.getMaxMessageDuration());
config.setProperty(Mailbox.WAIT_TIME_PROPERTY_NAME,
new Integer(Mailbox.getWaitTime()));
Mailbox.getWaitTime());
config.setProperty(Mailbox.INCOMING_MESSAGE_PROPERTY_NAME,
Mailbox.getIncomingMessageDirectory());
config.setProperty(Mailbox.OUTGOING_MESSAGE_PROPERTY_NAME,
@ -212,9 +205,9 @@ else if (e.getSource() == jbtnDefault)
jtfOutgoingMessage.setText(Mailbox
.getOutgoingMessageFileLocation()
.toString());
jsWaitTime.setValue(new Integer(Mailbox.getWaitTime()));
jsMaxMessageTime.setValue(new Integer(
Mailbox.getMaxMessageDuration()));
jsWaitTime.setValue(Mailbox.getWaitTime());
jsMaxMessageTime.setValue(
Mailbox.getMaxMessageDuration());
}
}

@ -308,10 +308,10 @@ public WhiteboardFrame(WhiteboardSessionManager wps,
setSize(800, 600);
initializeTransform();
Integer value = new Integer(1);
Integer min = new Integer(1);
Integer max = new Integer(10);
Integer step = new Integer(1);
Integer value = 1;
Integer min = 1;
Integer max = 10;
Integer step = 1;
spinModel = new SpinnerNumberModel(value, min, max, step);
jSpinnerThickness.setModel(spinModel);
@ -469,8 +469,7 @@ public void mousePressed(MouseEvent e)
{
shape.setSelected(true);
selectedShape = shape;
spinModel.setValue(new Integer(selectedShape
.getThickness()));
spinModel.setValue(selectedShape.getThickness());
jLabelColor.setBackground(Color.getColor("",
selectedShape.getColor()));
break;
@ -495,8 +494,7 @@ else if (currentTool == MODIF)
shape.setModifyPoint(point);
selectedShape = shape;
spinModel.setValue(new Integer(selectedShape
.getThickness()));
spinModel.setValue(selectedShape.getThickness());
jLabelColor.setBackground(
Color.getColor("", selectedShape.getColor()));
break;
@ -2547,4 +2545,4 @@ public void whiteboardStateChanged(WhiteboardChangeEvent evt)
{
}
}
}
}

@ -13,6 +13,7 @@
import net.java.sip.communicator.service.media.event.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
/**
* A CallSession contains parameters associated with a particular Call such as
@ -33,6 +34,7 @@
*/
public interface CallSession
{
/**
* The method is meant for use by protocol service implementations when
* willing to send an invitation to a remote callee.
@ -62,6 +64,22 @@ public String createSdpOffer()
public String createSdpOffer(InetAddress intendedDestination)
throws MediaException;
/**
* Creates a SDP description including the current state of the local media
* setup and in accord with a specific SDP description of a call participant
* (who is to be offered the created SDP description, for example, as part
* of a re-INVITE).
*
* @param participantSdpDescription the SDP description (of a call
* participant) to have the created SDP description in accord
* with
* @return a SDP description including the current state of the local media
* setup and in accord with the specified SDP description of a call
* participant
*/
public String createSdpOffer(String participantSdpDescription)
throws MediaException;
/**
* The method is meant for use by protocol service implementations when
* willing to send an in-dialog invitation to a remote callee to put her
@ -190,6 +208,12 @@ public void processSdpAnswer(CallParticipant responder, String sdpAnswer)
*/
public void setMute(boolean mute);
/**
* Starts the streaming of the local media (to the remote destinations).
*/
public void startStreaming()
throws MediaException;
/**
* Stops and closes the audio and video streams flowing through this
* session.
@ -231,12 +255,37 @@ public void processSdpAnswer(CallParticipant responder, String sdpAnswer)
* visual/video <code>Component</code>s are being added or
* removed in this <code>CallSession</code>
*/
void addVideoListener(VideoListener listener);
public void addVideoListener(VideoListener listener);
Component createLocalVisualComponent(VideoListener listener)
/**
* Creates a visual <code>Component</code> which represents the local video
* streamed by this <code>CallSession</code> (to remote destinations). If
* the synchronous creation of the <code>Component</code> isn't supported,
* it will be carried out asynchronously and the progress of the operation
* and its result will be delivered through a specific
* <code>VideoListener</code>.
*
* @param listener the <code>VideoListener</code> to track the progress of
* the creation and deliver its result in case the operation is
* carried out asynchronously by this implementation
* @return a visual <code>Component</code> which represents the local video
* if this implementation creates it synchronously; <tt>null</tt> if
* this implementation attempts asynchronous creation in which case
* the result will be delivered to the specified
* <code>VideoListener</code>
*/
public Component createLocalVisualComponent(VideoListener listener)
throws MediaException;
void disposeLocalVisualComponent(Component component);
/**
* Disposes of a specific visual <code>Component</code> representing local
* video which has been created by this instance with
* {@link #createLocalVisualComponent(VideoListener)}.
*
* @param component the visual <code>Component</code> representing local
* video to be disposed
*/
public void disposeLocalVisualComponent(Component component);
/**
* Gets the visual/video <code>Component</code>s available in this
@ -245,7 +294,7 @@ Component createLocalVisualComponent(VideoListener listener)
* @return an array of the visual <code>Component</code>s available in this
* <code>CallSession</code>
*/
Component[] getVisualComponents();
public Component[] getVisualComponents();
/**
* Removes a specific <code>VideoListener</code> from this
@ -257,7 +306,32 @@ Component createLocalVisualComponent(VideoListener listener)
* when visual/video <code>Component</code>s are being added or
* removed in this <code>CallSession</code>
*/
void removeVideoListener(VideoListener listener);
public void removeVideoListener(VideoListener listener);
/**
* Sets the indicator which determines whether the streaming of local video
* in this <code>CallSession</code> is allowed. The setting does not reflect
* the availability of actual video capture devices, it just expresses the
* desire of the user to have the local video streamed in the case the
* system is actually able to do so.
*
* @param allowed <tt>true</tt> to allow the streaming of local video for
* this <code>CallSession</code>; <tt>false</tt> to disallow it
*/
public void setLocalVideoAllowed(boolean allowed)
throws MediaException;
/**
* Gets the indicator which determines whether the streaming of local video
* in this <code>CallSession</code> is allowed. The setting does not reflect
* the availability of actual video capture devices, it just expresses the
* desire of the user to have the local video streamed in the case the
* system is actually able to do so.
*
* @return <tt>true</tt> if the streaming of local video in this
* <code>CallSession</code> is allowed; otherwise, <tt>false</tt>
*/
public boolean isLocalVideoAllowed();
/**
* Sets a <tt>SessionCreatorCallback</tt> that will listen for
@ -277,4 +351,44 @@ public void setSessionCreatorCallback(
* security events
*/
public SessionCreatorCallback getSessionCreatorCallback();
/**
* The property which indicates whether a <code>CallSession</code> is
* currently streaming the local video (to a remote destination).
*/
public static final String LOCAL_VIDEO_STREAMING = "LOCAL_VIDEO_STREAMING";
/**
* Gets the indicator which determines whether this <code>CallSession</code>
* is currently streaming the local video (to a remote destination).
*
* @return <tt>true</tt> if this <code>CallSession</code> is currently
* streaming the local video (to a remote destination); otherwise,
* <tt>false</tt>
*/
public boolean isLocalVideoStreaming();
/**
* Adds a specific <code>PropertyChangeListener</code> to the list of
* listeners which get notified when the properties (e.g.
* {@link #LOCAL_VIDEO_STREAMING}) associated with this
* <code>CallSession</code> change their values.
*
* @param listener the <code>PropertyChangeListener</code> to be notified
* when the properties associated with this
* <code>CallSession</code> change their values
*/
public void addPropertyChangeListener(PropertyChangeListener listener);
/**
* Removes a specific <code>PropertyChangeListener</code> from the list of
* listeners which get notified when the properties (e.g.
* {@link #LOCAL_VIDEO_STREAMING}) associated with this
* <code>CallSession</code> change their values.
*
* @param listener the <code>PropertyChangeListener</code> to no longer be
* notified when the properties associated with this
* <code>CallSession</code> change their values
*/
public void removePropertyChangeListener(PropertyChangeListener listener);
}

@ -80,7 +80,7 @@ public class CallParticipantState
/**
* This constant value indicates that the state of the call participant is
* is CONNECTING - which means that a network connection to that participant
* CONNECTING - which means that a network connection to that participant
* is currently being established.
*/
public static final CallParticipantState CONNECTING =
@ -95,7 +95,7 @@ public class CallParticipantState
/**
* This constant value indicates that the state of the call participant is
* is CONNECTING - which means that a network connection to that participant
* CONNECTING - which means that a network connection to that participant
* is currently being established.
*/
public static final CallParticipantState CONNECTING_WITH_EARLY_MEDIA =

@ -1,67 +1,181 @@
/*
* 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.service.protocol;
import java.awt.*;
import net.java.sip.communicator.service.protocol.event.*;
/**
* Represents an <code>OperationSet</code> giving access to video-specific
* functionality in telephony such as visual <code>Component</code>s displaying
* video and listening to dynamic availability of such <code>Component</code>s.
*
* @author Lubomir Marinov
*/
public interface OperationSetVideoTelephony
extends OperationSet
{
/**
* Adds a specific <code>VideoListener</code> to this telephony in order to
* receive notifications when visual/video <code>Component</code>s are being
* added and removed for a specific <code>CallParticipant</code>.
*
* @param participant the <code>CallParticipant</code> whose video the
* specified listener is to be notified about
* @param listener the <code>VideoListener</code> to be notified when
* visual/video <code>Component</code>s are being added or
* removed for <code>participant</code>
*/
void addVideoListener(CallParticipant participant, VideoListener listener);
Component createLocalVisualComponent(CallParticipant participant,
VideoListener listener) throws OperationFailedException;
void disposeLocalVisualComponent(CallParticipant participant,
Component component);
/**
* Gets the visual/video <code>Component</code>s available in this telephony
* for a specific <code>CallParticipant</code>.
*
* @param participant the <code>CallParticipant</code> whose videos are to
* be retrieved
* @return an array of the visual <code>Component</code>s available in this
* telephony for the specified <code>participant</code>
*/
Component[] getVisualComponents(CallParticipant participant);
/**
* Removes a specific <code>VideoListener</code> from this telephony in
* order to no longer have it receive notifications when visual/video
* <code>Component</code>s are being added and removed for a specific
* <code>CallParticipant</code>.
*
* @param participant the <code>CallParticipant</code> whose video the
* specified listener is to no longer be notified about
* @param listener the <code>VideoListener</code> to no longer be notified
* when visual/video <code>Component</code>s are being added or
* removed for <code>participant</code>
*/
void removeVideoListener(CallParticipant participant, VideoListener listener);
}
/*
* 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.service.protocol;
import java.awt.*;
import net.java.sip.communicator.service.media.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
/**
* Represents an <code>OperationSet</code> giving access to video-specific
* functionality in telephony such as visual <code>Component</code>s displaying
* video and listening to dynamic availability of such <code>Component</code>s.
*
* @author Lubomir Marinov
*/
public interface OperationSetVideoTelephony
extends OperationSet
{
/**
* Adds a specific <code>VideoListener</code> to this telephony in order to
* receive notifications when visual/video <code>Component</code>s are being
* added and removed for a specific <code>CallParticipant</code>.
*
* @param participant the <code>CallParticipant</code> whose video the
* specified listener is to be notified about
* @param listener the <code>VideoListener</code> to be notified when
* visual/video <code>Component</code>s are being added or
* removed for <code>participant</code>
*/
public void addVideoListener(
CallParticipant participant, VideoListener listener);
/**
* Creates a visual <code>Component</code> which depicts the local video
* being streamed to a specific <code>CallParticipant</code>. The returned
* visual <code>Component</code> should be disposed when it is no longer
* required through {@link #disposeLocalVisualComponent(CallParticipant, Component) disposeLocalVisualComponent}.
*
* @param participant the <code>CallParticipant</code> to whom the local
* video which is to be depicted by the returned visual
* <code>Component</code> is being streamed
* @param listener if not <tt>null</tt>, a <code>VideoListener</code> to
* track the progress of the creation in case this telephony
* chooses to perform it asynchronously and to not return the
* created visual <code>Component</code> immediately/as the
* result of this method call
* @return a visual <code>Component</code> which depicts the local video
* being streamed to the specified <code>CallParticipant</code> if
* this telephony chooses to carry out the creation synchronously;
* <tt>null</tt> if this telephony chooses to create the requested
* visual <code>Component</code> asynchronously.
*/
public Component createLocalVisualComponent(
CallParticipant participant, VideoListener listener)
throws OperationFailedException;
/**
* Disposes of a visual <code>Component</code> depicting the local video for
* a specific <code>CallParticipant</code> (previously obtained through
* {@link createLocalVisualComponent(CallParticipant, VideoListener) createLocalVisualComponent}).
* The disposal may include, but is not limited to, releasing the
* <code>Player</code> which provides the <code>component</code> and renders
* the local video into it, disconnecting from the video capture device.
*
* @param participant the <code>CallParticipant</code> for whom the visual
* <code>Component</code> depicts the local video
* @param component the visual <code>Component</code> depicting the local
* video to be disposed
*/
public void disposeLocalVisualComponent(
CallParticipant participant, Component component);
/**
* Gets the visual/video <code>Component</code>s available in this telephony
* for a specific <code>CallParticipant</code>.
*
* @param participant the <code>CallParticipant</code> whose videos are to
* be retrieved
* @return an array of the visual <code>Component</code>s available in this
* telephony for the specified <code>participant</code>
*/
public Component[] getVisualComponents(CallParticipant participant);
/**
* Removes a specific <code>VideoListener</code> from this telephony in
* order to no longer have it receive notifications when visual/video
* <code>Component</code>s are being added and removed for a specific
* <code>CallParticipant</code>.
*
* @param participant the <code>CallParticipant</code> whose video the
* specified listener is to no longer be notified about
* @param listener the <code>VideoListener</code> to no longer be notified
* when visual/video <code>Component</code>s are being added or
* removed for <code>participant</code>
*/
public void removeVideoListener(
CallParticipant participant, VideoListener listener);
/**
* Sets the indicator which determines whether the streaming of local video
* in a specific <code>Call</code> is allowed. The setting does not reflect
* the availability of actual video capture devices, it just expresses the
* desire of the user to have the local video streamed in the case the
* system is actually able to do so.
*
* @param call the <code>Call</code> to allow/disallow the streaming of
* local video for
* @param allowed <tt>true</tt> to allow the streaming of local video for
* the specified <code>Call</code>; <tt>false</tt> to disallow it
*/
public void setLocalVideoAllowed(Call call, boolean allowed)
throws OperationFailedException;
/**
* Gets the indicator which determines whether the streaming of local video
* in a specific <code>Call</code> is allowed. The setting does not reflect
* the availability of actual video capture devices, it just expresses the
* desire of the user to have the local video streamed in the case the
* system is actually able to do so.
*
* @param call the <code>Call</code> to get the indicator of
* @return <tt>true</tt> if the streaming of local video for the specified
* <code>Call</code> is allowed; otherwise, <tt>false</tt>
*/
public boolean isLocalVideoAllowed(Call call);
/**
* The property which indicates whether a specific <code>Call</code> is
* currently streaming the local video (to a remote destination).
*/
public static final String LOCAL_VIDEO_STREAMING
= CallSession.LOCAL_VIDEO_STREAMING;
/**
* Gets the indicator which determines whether a specific <code>Call</code>
* is currently streaming the local video (to a remote destination).
*
* @param call the <code>Call</code> to get the indicator of
* @return <tt>true</tt> if the specified <code>Call</code> is currently
* streaming the local video (to a remote destination); otherwise,
* <tt>false</tt>
*/
public boolean isLocalVideoStreaming(Call call);
/**
* Adds a specific <code>PropertyChangeListener</code> to the list of
* listeners which get notified when the properties (e.g.
* {@link #LOCAL_VIDEO_STREAMING}) associated with a specific
* <code>Call</code> change their values.
*
* @param call the <code>Call</code> to start listening to the changes of
* the property values of
* @param listener the <code>PropertyChangeListener</code> to be notified
* when the properties associated with the specified
* <code>Call</code> change their values
*/
public void addPropertyChangeListener(
Call call, PropertyChangeListener listener);
/**
* Removes a specific <code>PropertyChangeListener</code> from the list of
* listeners which get notified when the properties (e.g.
* {@link #LOCAL_VIDEO_STREAMING}) associated with a specific
* <code>Call</code> change their values.
*
* @param call the <code>Call</code> to stop listening to the changes of the
* property values of
* @param listener the <code>PropertyChangeListener</code> to no longer be
* notified when the properties associated with the specified
* <code>Call</code> change their values
*/
public void removePropertyChangeListener(
Call call, PropertyChangeListener listener);
}

@ -19,8 +19,18 @@
public class VideoEvent
extends EventObject
{
/**
* The video origin of a <code>VideoEvent</code> which is local to the
* executing client such as a local video capture device.
*/
public static final int LOCAL = 1;
/**
* The video origin of a <code>VideoEvent</code> which is remote to the
* executing client such as a video being remotely streamed from a
* <code>CallParticipant</code>.
*/
public static final int REMOTE = 2;
/**
@ -46,6 +56,10 @@ public class VideoEvent
*/
private boolean consumed;
/**
* The origin of the video this <code>VideoEvent</code> notifies about which
* is one of {@link #LOCAL} and {@link #REMOTE}.
*/
private final int origin;
/**
@ -74,7 +88,8 @@ public class VideoEvent
* @param visualComponent the visual <code>Component</code> depicting video
* which had its availability in the <code>source</code> provider
* changed
* @param origin
* @param origin the origin of the video the new <code>VideoEvent</code> is
* to notify about
*/
public VideoEvent(Object source, int type, Component visualComponent,
int origin)
@ -98,6 +113,13 @@ public void consume()
consumed = true;
}
/**
* Gets the origin of the video this <code>VideoEvent</code> notifies about
* which is one of {@link #LOCAL} and {@link #REMOTE}.
*
* @return one of {@link LOCAL} and {@link #REMOTE} which specifies the
* origin of the video this <code>VideoEvent</code> notifies about
*/
public int getOrigin()
{
return origin;

@ -6,13 +6,13 @@ Bundle-Version: 0.0.1
System-Bundle: yes
Import-Package: org.osgi.framework,
net.java.sip.communicator.service.configuration,
net.java.sip.communicator.util,
net.java.sip.communicator.service.configuration.event,
net.java.sip.communicator.util
Export-Package: net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.icqconstants,
net.java.sip.communicator.service.protocol.aimconstants,
net.java.sip.communicator.service.protocol.event,
net.java.sip.communicator.service.protocol.icqconstants,
net.java.sip.communicator.service.protocol.jabberconstants,
net.java.sip.communicator.service.protocol.msnconstants,
net.java.sip.communicator.service.protocol.yahooconstants,
net.java.sip.communicator.service.protocol.event,
net.java.sip.communicator.service.protocol.whiteboardobjects
net.java.sip.communicator.service.protocol.whiteboardobjects,
net.java.sip.communicator.service.protocol.yahooconstants

@ -0,0 +1,62 @@
/*
* 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.util;
import java.util.*;
/**
* @author Lubomir Marinov
*/
public class PropertyChangeNotifier
{
private final List<PropertyChangeListener> listeners
= new Vector<PropertyChangeListener>();
public void addPropertyChangeListener(PropertyChangeListener listener)
{
synchronized(listeners)
{
if (!listeners.contains(listener))
listeners.add(listener);
}
}
public void removePropertyChangeListener(PropertyChangeListener listener)
{
synchronized(listeners)
{
listeners.remove(listener);
}
}
protected void firePropertyChange(String property, Object oldValue,
Object newValue)
{
PropertyChangeListener[] listeners;
synchronized (this.listeners)
{
listeners
= this.listeners.toArray(
new PropertyChangeListener[this.listeners.size()]);
}
PropertyChangeEvent event = new PropertyChangeEvent(
getPropertyChangeSource(property, oldValue, newValue),
property,
oldValue,
newValue);
for (PropertyChangeListener listener : listeners)
listener.propertyChange(event);
}
protected Object getPropertyChangeSource(String property, Object oldValue,
Object newValue)
{
return this;
}
}

@ -0,0 +1,33 @@
/*
* 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.util;
/**
* @author Lubomir Marinov
*/
public class PropertyChangeSupport
extends PropertyChangeNotifier
{
private final Object source;
public PropertyChangeSupport(Object source)
{
this.source = source;
}
public void firePropertyChange(String property, Object oldValue,
Object newValue)
{
super.firePropertyChange(property, oldValue, newValue);
}
protected Object getPropertyChangeSource(String property, Object oldValue,
Object newValue)
{
return source;
}
}

@ -36,8 +36,8 @@ public class SIPCommTabbedPaneEnhancedUI
private static final Color whiteColor = Color.white;
private static final int TAB_OVERLAP
= new Integer(UtilActivator.getResources().
getSettingsString("impl.gui.TAB_OVERLAP")).intValue();
= Integer.parseInt(UtilActivator.getResources().
getSettingsString("impl.gui.TAB_OVERLAP"));
private static final int PREFERRED_WIDTH = 150;

@ -254,7 +254,7 @@ public static void writeXML(Document document,
// not working for jdk 1.4
try
{
tf.setAttribute("indent-number", new Integer(4));
tf.setAttribute("indent-number", 4);
}catch(Exception e){}
Transformer serializer = tf.newTransformer();

Loading…
Cancel
Save