diff options
Diffstat (limited to 'src/net/java/sip/communicator/impl/protocol')
22 files changed, 420 insertions, 286 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/InfoRetreiver.java b/src/net/java/sip/communicator/impl/protocol/jabber/InfoRetreiver.java index 175020b..1bd17ea 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/InfoRetreiver.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/InfoRetreiver.java @@ -53,7 +53,7 @@ public class InfoRetreiver { this.jabberProvider = jabberProvider; this.ownerUin = ownerUin; - + vcardTimeoutReply = JabberActivator.getConfigurationService().getLong( ProtocolProviderServiceJabberImpl.VCARD_REPLY_TIMEOUT_PROPERTY, -1); @@ -329,6 +329,12 @@ public class InfoRetreiver /** * Load VCard for the given user. * Using the specified timeout. + * + * @param vcard VCard + * @param connection XMPP connection + * @param user the user + * @param timeout timeout in second + * @throws XMPPException if something went wrong during VCard loading */ public void load(VCard vcard, Connection connection, diff --git a/src/net/java/sip/communicator/impl/protocol/msn/AdHocChatRoomMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/AdHocChatRoomMsnImpl.java index 3ca7511..15b54cd 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/AdHocChatRoomMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/AdHocChatRoomMsnImpl.java @@ -1,6 +1,6 @@ /* * Jitsi, 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.msn; @@ -13,7 +13,7 @@ import net.java.sip.communicator.util.*; import net.sf.jml.*; /** - * Implements ad-hoc chat rooms for MSN. + * Implements ad-hoc chat rooms for MSN. * * @author Rupert Burchardi * @author Valentin Martinet @@ -42,18 +42,18 @@ public class AdHocChatRoomMsnImpl private MsnSwitchboard switchboard = null; /** - * Listeners that will be notified of changes in participants status in the + * Listeners that will be notified of changes in participants status in the * ad-hoc room, such as participant joined, left, etc. */ - private Vector<AdHocChatRoomParticipantPresenceListener> - participantsPresenceListeners = + private Vector<AdHocChatRoomParticipantPresenceListener> + participantsPresenceListeners = new Vector<AdHocChatRoomParticipantPresenceListener>(); /** * Listeners that will be notified every time a new message is received on * this ad-hoc chat room. */ - private Vector<AdHocChatRoomMessageListener> messageListeners + private Vector<AdHocChatRoomMessageListener> messageListeners = new Vector<AdHocChatRoomMessageListener>(); /** @@ -70,7 +70,7 @@ public class AdHocChatRoomMsnImpl /** * The list of participants of this ad-hoc chat room. */ - private final Hashtable<String, Contact> participants = + private final Hashtable<String, Contact> participants = new Hashtable<String, Contact>(); /** @@ -84,19 +84,19 @@ public class AdHocChatRoomMsnImpl private final OperationSetPersistentPresenceMsnImpl presenceOpSet; /** - * Creates a new ad-hoc chat room for MSN named <tt>name</tt>, using the + * Creates a new ad-hoc chat room for MSN named <tt>name</tt>, using the * protocol provider <tt>provider</tt>. - * + * * @param name * @param provider */ public AdHocChatRoomMsnImpl(String name, - ProtocolProviderServiceMsnImpl provider) + ProtocolProviderServiceMsnImpl provider) { this.name = name; this.provider = provider; - this.opSetAdHocMuc = - (OperationSetAdHocMultiUserChatMsnImpl) + this.opSetAdHocMuc = + (OperationSetAdHocMultiUserChatMsnImpl) this.provider.getOperationSet(OperationSetAdHocMultiUserChat.class); this.presenceOpSet @@ -106,22 +106,22 @@ public class AdHocChatRoomMsnImpl } /** - * Creates a new ad-hoc chat room for MSN named <tt>name</tt>, using the + * Creates a new ad-hoc chat room for MSN named <tt>name</tt>, using the * protocol provider <tt>provider</tt> and the msn switchboard * <tt>switchboard</tt>. - * + * * @param name * @param provider * @param switchboard */ public AdHocChatRoomMsnImpl(String name, ProtocolProviderServiceMsnImpl provider, - MsnSwitchboard switchboard) + MsnSwitchboard switchboard) { this.name = name; this.provider = provider; this.opSetAdHocMuc - = (OperationSetAdHocMultiUserChatMsnImpl) + = (OperationSetAdHocMultiUserChatMsnImpl) this.provider.getOperationSet(OperationSetAdHocMultiUserChat.class); this.presenceOpSet @@ -129,7 +129,7 @@ public class AdHocChatRoomMsnImpl this.provider.getOperationSet( OperationSetPersistentPresence.class); - this.switchboard = switchboard; + this.switchboard = switchboard; this.updateParticipantsList(switchboard); } @@ -137,7 +137,7 @@ public class AdHocChatRoomMsnImpl /** * Adds a listener that will be notified of changes in our status in the * room. - * + * * @param listener a participant status listener. */ public void addParticipantPresenceListener( @@ -153,7 +153,7 @@ public class AdHocChatRoomMsnImpl /** * Registers <tt>listener</tt> so that it would receive events every time a * new message is received on this chat room. - * + * * @param listener a <tt>MessageListener</tt> that would be notified every * time a new message is received on this chat room. */ @@ -169,7 +169,7 @@ public class AdHocChatRoomMsnImpl /** * Removes <tt>listener</tt> so that it won't receive any further message * events from this room. - * + * * @param listener the <tt>MessageListener</tt> to remove from this room */ public void removeMessageListener(ChatRoomMessageListener listener) @@ -182,9 +182,9 @@ public class AdHocChatRoomMsnImpl } /** - * Finds the participant of this ad-hoc chat room corresponding to the + * Finds the participant of this ad-hoc chat room corresponding to the * given address. - * + * * @param address the address to search for. * @return the participant of this chat room corresponding to the given * nick name. @@ -208,13 +208,13 @@ public class AdHocChatRoomMsnImpl } /** - * Creates a <tt>Message</tt> for this ad-hoc chat room containing + * Creates a <tt>Message</tt> for this ad-hoc chat room containing * <tt>text</tt>. - * + * * @param text * @return Message the newly created <tt>Message</tt> */ - public Message createMessage(String text) + public Message createMessage(String text) { Message msg = new MessageMsnImpl(text, @@ -226,20 +226,20 @@ public class AdHocChatRoomMsnImpl /** * Returns the name of this ad-hoc chatroom - * + * * @return String */ - public String getName() + public String getName() { return this.name; } /** * Returns the parent provider - * + * * @return ProtocolProviderService */ - public ProtocolProviderService getParentProvider() + public ProtocolProviderService getParentProvider() { return this.provider; } @@ -247,10 +247,10 @@ public class AdHocChatRoomMsnImpl /** * Returns a list containing all the <tt>Contact</tt>s who participate in * this ad-hoc chat room. - * + * * @return List<Contact> */ - public List<Contact> getParticipants() + public List<Contact> getParticipants() { return new LinkedList<Contact>(this.participants.values()); } @@ -258,7 +258,7 @@ public class AdHocChatRoomMsnImpl /** * Returns the participant of this ad-hoc chat room which corresponds to * the given id. - * + * * @param id ID of the participant * @return Contact the corresponding Contact */ @@ -269,7 +269,8 @@ public class AdHocChatRoomMsnImpl /** * Adds a participant to the participants list. - * + * + * @param id the ID * @param participant The participant (<tt>Contact</tt>) to add. */ public void addAdHocChatRoomParticipant(String id, Contact participant) @@ -283,28 +284,33 @@ public class AdHocChatRoomMsnImpl /** * Removes the participant of this ad-hoc chat room which corresponds to * the given id. - * + * * @param id ID of the participant */ public void removeParticipant(String id) { Contact contact= this.participants.get(id); this.participants.remove(id); - + fireParticipantPresenceEvent(contact, AdHocChatRoomParticipantPresenceChangeEvent.CONTACT_LEFT, null); } /** - * Returns the number of <tt>Contact</tt>s who participate in this ad-hoc + * Returns the number of <tt>Contact</tt>s who participate in this ad-hoc * chat room. */ - public int getParticipantsCount() + public int getParticipantsCount() { return this.participants.size(); } - public String getSubject() + /** + * Returns the subject. + * + * @return null + */ + public String getSubject() { return null; } @@ -312,7 +318,7 @@ public class AdHocChatRoomMsnImpl /** * Invites another user to this room. If we're not joined nothing will * happen. - * + * * @param userAddress the address of the user (email address) to invite to * the room.(one may also invite users not on their contact * list). @@ -362,7 +368,7 @@ public class AdHocChatRoomMsnImpl switchboard = null; } - Iterator<Contact> participantsIter + Iterator<Contact> participantsIter = participants.values().iterator(); while (participantsIter.hasNext()) @@ -378,20 +384,25 @@ public class AdHocChatRoomMsnImpl participants.clear(); } + /** + * Returns if this chatroom is a system ones. + * + * @return false + */ public boolean isSystem() { return false; } /** - * Sends the given message through the participants of this ad-hoc chat + * Sends the given message through the participants of this ad-hoc chat * room. - * + * * @param message the message to delivered - * + * * @throws OperationFailedException if send fails */ - public void sendMessage(Message message) throws OperationFailedException + public void sendMessage(Message message) throws OperationFailedException { if (logger.isInfoEnabled()) logger.info("switchboard="+this.switchboard); @@ -409,7 +420,7 @@ public class AdHocChatRoomMsnImpl /** * Sets the corresponding switchboard. - * + * * @param switchboard Corresponding switchboard. */ public void setSwitchboard(MsnSwitchboard switchboard) @@ -419,9 +430,9 @@ public class AdHocChatRoomMsnImpl /** * Creates the corresponding AdHocChatRoomParticipantPresenceChangeEvent and - * notifies all <tt>AdHocChatRoomParticipantPresenceListener</tt>s that a + * notifies all <tt>AdHocChatRoomParticipantPresenceListener</tt>s that a * participant has joined or left this <tt>AdHocChatRoom</tt>. - * + * * @param participant the <tt>Contact</tt> * @param eventID the identifier of the event * @param eventReason the reason of the event @@ -455,7 +466,7 @@ public class AdHocChatRoomMsnImpl * <tt>AdHocChatRoomMessageDeliveredEvent</tt>, * <tt>AdHocChatRoomMessageReceivedEvent</tt> or a * <tt>AdHocChatRoomMessageDeliveryFailedEvent</tt> has been fired. - * + * * @param evt The specific event */ public void fireMessageEvent(EventObject evt) @@ -495,9 +506,9 @@ public class AdHocChatRoomMsnImpl } /** - * Fills the participants list with all participants inside the switchboard + * Fills the participants list with all participants inside the switchboard * (ad-hoc chat room). - * + * * @param switchboard The corresponding switchboard */ public void updateParticipantsList(MsnSwitchboard switchboard) @@ -508,7 +519,7 @@ public class AdHocChatRoomMsnImpl { if (!this.participants.containsKey(msnContact.getId())) { - // if the member is not inside the members list, create a + // if the member is not inside the members list, create a // contact instance, // add it to the list and fire a member presence event ContactMsnImpl contact @@ -543,7 +554,7 @@ public class AdHocChatRoomMsnImpl /** * Returns the identifier of this ad-hoc chat room. - * + * * @return a <tt>String</tt> containing the identifier of this ad-hoc room */ public String getIdentifier() @@ -553,7 +564,7 @@ public class AdHocChatRoomMsnImpl /** * Removes the given participant presence listener. - * + * * @param listener the listener to remove */ public void removeParticipantPresenceListener( @@ -568,7 +579,7 @@ public class AdHocChatRoomMsnImpl /** * Removes the given message listener. - * + * * @param listener the listener to remove */ public void removeMessageListener(AdHocChatRoomMessageListener listener) diff --git a/src/net/java/sip/communicator/impl/protocol/msn/ContactMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/ContactMsnImpl.java index d412b7f..a978436 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/ContactMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/ContactMsnImpl.java @@ -302,7 +302,7 @@ public class ContactMsnImpl /** * Changes the current status message of this contact. - * + * * @param newStatusMessage the new message. */ public void setStatusMessage(String newStatusMessage) diff --git a/src/net/java/sip/communicator/impl/protocol/msn/mail/utils/MimeUtility.java b/src/net/java/sip/communicator/impl/protocol/msn/mail/utils/MimeUtility.java index 7859e54..493e3c2 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/mail/utils/MimeUtility.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/mail/utils/MimeUtility.java @@ -1,19 +1,19 @@ /* * MimeUtility.java * Copyright (C) 2002, 2004, 2005 The Free Software Foundation - * + * * This file is part of GNU JavaMail, a library. - * + * * GNU JavaMail is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * GNU JavaMail is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA @@ -48,10 +48,11 @@ public class MimeUtility private MimeUtility() { } - + /** * Decodes headers that are defined as '*text' in RFC 822. * @param etext the possibly encoded value + * @return decoded text * @exception UnsupportedEncodingException if the charset conversion failed */ public static String decodeText(String etext) @@ -66,7 +67,7 @@ public class MimeUtility StringBuffer buffer = new StringBuffer(); StringBuffer extra = new StringBuffer(); boolean decoded = false; - while (st.hasMoreTokens()) + while (st.hasMoreTokens()) { String token = st.nextToken(); char c = token.charAt(0); @@ -104,6 +105,7 @@ public class MimeUtility * Decodes the specified string using the RFC 2047 rules for parsing an * "encoded-word". * @param text the possibly encoded value + * @return decoded word * @exception Exception if the string is not an encoded-word * @exception UnsupportedEncodingException if the decoding failed */ diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetAvatarSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetAvatarSipImpl.java index 9f4831c..f437bd3 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetAvatarSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetAvatarSipImpl.java @@ -1,6 +1,6 @@ /* * Jitsi, 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; @@ -10,13 +10,19 @@ import net.java.sip.communicator.service.protocol.*; /** * A simple implementation of the <tt>OperationSetAvatar</tt> interface for the * jabber protocol. - * + * * @author Damian Minkov */ public class OperationSetAvatarSipImpl extends AbstractOperationSetAvatar<ProtocolProviderServiceSipImpl> { + /** + * Constructs a new <tt>OperationSetAvatarSipImpl</tt>. + * + * @param parentProvider parent protocol provider service + * @param accountInfoOpSet account info operation set + */ public OperationSetAvatarSipImpl( ProtocolProviderServiceSipImpl parentProvider, OperationSetServerStoredAccountInfo accountInfoOpSet) diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java index cc909dc..50ad42d 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java @@ -1070,7 +1070,7 @@ public class OperationSetBasicTelephonySipImpl //this is a brand new call (not a transferred one) CallSipImpl call = new CallSipImpl(this); - MediaAwareCallPeer peer = + MediaAwareCallPeer<?,?,?> peer = call.processInvite(sourceProvider, serverTransaction); if(getProtocolProvider().getAccountID() @@ -1081,7 +1081,7 @@ public class OperationSetBasicTelephonySipImpl { // if in paranoia mode and we don't find any encryption // fail peer/call send error with warning explaining why - + peer.setState( CallPeerState.FAILED, "Encryption required!", diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java index ad1b254..9660c38 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java @@ -1949,7 +1949,7 @@ public class ProtocolProviderServiceSipImpl * @param serverTransaction the transaction that we'd like to send an error * response in. * @param errorCode the code that the response should have. - * + * @param header SIP header * @throws OperationFailedException if we failed constructing or sending a * SIP Message. */ diff --git a/src/net/java/sip/communicator/impl/protocol/sip/SipApplicationData.java b/src/net/java/sip/communicator/impl/protocol/sip/SipApplicationData.java index d475918..305117d 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/SipApplicationData.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/SipApplicationData.java @@ -24,7 +24,14 @@ import net.java.sip.communicator.util.*; */ public class SipApplicationData { + /** + * Key service. + */ public static final String KEY_SERVICE = "service"; + + /** + * Key subscriptions. + */ public static final String KEY_SUBSCRIPTIONS = "subscriptions"; /** diff --git a/src/net/java/sip/communicator/impl/protocol/sip/SipStatusEnum.java b/src/net/java/sip/communicator/impl/protocol/sip/SipStatusEnum.java index 303041c..f1375e4 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/SipStatusEnum.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/SipStatusEnum.java @@ -13,8 +13,8 @@ import net.java.sip.communicator.service.protocol.*; /** * The <tt>SipStatusEnum</tt> gives access to presence states for the Sip * protocol. All status icons corresponding to presence states are located with - * the help of the <tt>imagePath</tt> parameter - * + * the help of the <tt>imagePath</tt> parameter + * * @author Emil Ivov * @author Yana Stamcheva */ @@ -95,11 +95,16 @@ public class SipStatusEnum public final List<PresenceStatus> supportedStatusSet = new LinkedList<PresenceStatus>(); + /** + * Constructor. + * + * @param iconPath path of the icon + */ public SipStatusEnum(String iconPath) { this.offlineStatus = new SipPresenceStatus( 0, - OFFLINE, + OFFLINE, loadIcon(iconPath + "/sip16x16-offline.png")); this.busyStatus = new SipPresenceStatus( @@ -137,7 +142,7 @@ public class SipStatusEnum /** * Returns the offline sip status. - * + * * @param statusName the name of the status. * @return the offline sip status. */ @@ -152,7 +157,7 @@ public class SipStatusEnum else if (statusName.equals(ON_THE_PHONE)) return onThePhoneStatus; else if (statusName.equals(AWAY)) - return awayStatus; + return awayStatus; else return unknownStatus; } diff --git a/src/net/java/sip/communicator/impl/protocol/sip/net/ProxyConnection.java b/src/net/java/sip/communicator/impl/protocol/sip/net/ProxyConnection.java index 2deebdf..84d91f3 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/net/ProxyConnection.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/net/ProxyConnection.java @@ -9,7 +9,7 @@ import static net.java.sip.communicator.service.protocol.ProtocolProviderFactory /**
* Abstract class for the determining the address for the SIP proxy.
- *
+ *
* @author Ingo Bauersachs
*/
public abstract class ProxyConnection
@@ -69,7 +69,7 @@ public abstract class ProxyConnection proxyStringBuffer.insert(0, '[');
proxyStringBuffer.append(']');
}
-
+
proxyStringBuffer.append(':');
proxyStringBuffer.append(socketAddress.getPort());
proxyStringBuffer.append('/');
@@ -81,7 +81,7 @@ public abstract class ProxyConnection /**
* Compares an InetAddress against the active outbound proxy. The comparison
* is by reference, not equals.
- *
+ *
* @param addressToTest The addres to test.
* @return True when the InetAddress is the same as the outbound proxy.
*/
@@ -97,10 +97,11 @@ public abstract class ProxyConnection /**
* Retrieves the next address to use from DNS. Duplicate results are
* suppressed.
- *
+ *
* @return True if a new address is available through {@link #getAddress()},
* false if the last address was reached. A new lookup from scratch
* can be started by calling {@link #reset()}.
+ * @throws DnssecException if there is a problem related to DNSSEC
*/
public final boolean getNextAddress() throws DnssecException
{
@@ -126,7 +127,7 @@ public abstract class ProxyConnection /**
* Implementations must use this method to get the next address, but do not
* have to care about duplicate addresses.
- *
+ *
* @return True when a further address was available.
* @throws DnssecException when a DNSSEC validation failure occured.
*/
@@ -145,7 +146,7 @@ public abstract class ProxyConnection /**
* Factory method to create a proxy connection based on the account settings
* of the protocol provider.
- *
+ *
* @param pps the protocol provider that needs a SIP server connection.
* @return An instance of a derived class.
*/
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/sdp/SdpUtils.java b/src/net/java/sip/communicator/impl/protocol/sip/sdp/SdpUtils.java index 9026743..4b200df 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/sdp/SdpUtils.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/sdp/SdpUtils.java @@ -104,6 +104,7 @@ public class SdpUtils * * @return an empty instance of a <tt>SessionDescription</tt> with * preinitialized <tt>s</tt>, <tt>v</tt>, and <tt>t</tt> parameters. + * @throws OperationFailedException if the SDP creation failed */ public static SessionDescription createSessionDescription( InetAddress localAddress) @@ -127,6 +128,7 @@ public class SdpUtils * * @return an empty instance of a <tt>SessionDescription</tt> with * preinitialized <tt>s</tt>, <tt>v</tt>, and <tt>t</tt> parameters. + * @throws OperationFailedException if the SDP creation failed */ public static SessionDescription createSessionDescription( InetAddress localAddress, @@ -213,6 +215,7 @@ public class SdpUtils * * @return a new <tt>SessionDescription</tt> that updates * <tt>descToUpdate</tt>; + * @throws OperationFailedException if the SDP creation failed */ public static SessionDescription createSessionUpdateDescription( SessionDescription descToUpdate, @@ -1557,7 +1560,7 @@ public class SdpUtils * * @param description the <tt>MediaDescription</tt> whose media type we'd * like to extract. - * + * @param attributeName name of the attribute to check * @return the media type (e.g. audio or video) for the specified media * <tt>description</tt>. * diff --git a/src/net/java/sip/communicator/impl/protocol/sip/xcap/XCapException.java b/src/net/java/sip/communicator/impl/protocol/sip/xcap/XCapException.java index 9a9e242..a9209e4 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/xcap/XCapException.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/xcap/XCapException.java @@ -15,6 +15,11 @@ package net.java.sip.communicator.impl.protocol.sip.xcap; public class XCapException extends Exception { /** + * Serial version UID. + */ + private static final long serialVersionUID = 0L; + + /** * Creates a new <code>XCapException</code> instance * which does not give a human-readable explanation why the operation is * not supported. diff --git a/src/net/java/sip/communicator/impl/protocol/sip/xcap/model/ParsingException.java b/src/net/java/sip/communicator/impl/protocol/sip/xcap/model/ParsingException.java index a5f44c8..ed1ee13 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/xcap/model/ParsingException.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/xcap/model/ParsingException.java @@ -15,6 +15,11 @@ package net.java.sip.communicator.impl.protocol.sip.xcap.model; public class ParsingException extends Exception { /** + * Serial versionUID. + */ + private static final long serialVersionUID = 0L; + + /** * Creates a new <code>XCapException</code> instance * which does not give a human-readable explanation why the operation is * not supported. diff --git a/src/net/java/sip/communicator/impl/protocol/sip/xcap/model/XmlUtils.java b/src/net/java/sip/communicator/impl/protocol/sip/xcap/model/XmlUtils.java index 1785806..ad8408d 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/xcap/model/XmlUtils.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/xcap/model/XmlUtils.java @@ -6,7 +6,6 @@ */ package net.java.sip.communicator.impl.protocol.sip.xcap.model; -import static net.java.sip.communicator.util.xml.XMLUtils.*; import org.w3c.dom.*; import java.util.*; diff --git a/src/net/java/sip/communicator/impl/protocol/sip/xcap/model/commonpolicy/CommonPolicyParser.java b/src/net/java/sip/communicator/impl/protocol/sip/xcap/model/commonpolicy/CommonPolicyParser.java index 7d77aa0..1cd10d5 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/xcap/model/commonpolicy/CommonPolicyParser.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/xcap/model/commonpolicy/CommonPolicyParser.java @@ -23,44 +23,104 @@ import java.util.*; */ public final class CommonPolicyParser { + /** + * The namespace of the common-policy. + */ public static String NAMESPACE = "urn:ietf:params:xml:ns:common-policy"; + /** + * The ruleset element name. + */ public static String RULESET_ELEMENT = "ruleset"; + /** + * The rule element name. + */ public static String RULE_ELEMENT = "rule"; + /** + * The rule id attribute element name. + */ public static String RULE_ID_ATTR = "id"; + /** + * The conditions element name. + */ public static String CONDITIONS_ELEMENT = "conditions"; + /** + * The actions element name. + */ public static String ACTIONS_ELEMENT = "actions"; + /** + * The transformations element name. + */ public static String TRANSFORMATIONS_ELEMENT = "transformations"; + /** + * The identify element name. + */ public static String IDENTITY_ELEMENT = "identity"; + /** + * The sphere element name. + */ public static String SPHERE_ELEMENT = "sphere"; + /** + * The sphere value element name. + */ public static String SPHERE_VALUE_ATTR = "value"; + /** + * The validity element name. + */ public static String VALIDITY_ELEMENT = "validity"; + /** + * The validity-from element name. + */ public static String VALIDITY_FROM_ELEMENT = "from"; + /** + * The validity-until element name. + */ public static String VALIDITY_UNTIL_ELEMENT = "until"; + /** + * The one element name. + */ public static String ONE_ELEMENT = "one"; + /** + * The one-id element name. + */ public static String ONE_ID_ATTR = "id"; + /** + * The many element name. + */ public static String MANY_ELEMENT = "many"; + /** + * The many domain element name. + */ public static String MANY_DOMAIN_ATTR = "domain"; + /** + * The except element name. + */ public static String EXCEPT_ELEMENT = "except"; + /** + * The except id element name. + */ public static String EXCEPT_ID_ATTR = "id"; + /** + * The except domain element name. + */ public static String EXCEPT_DOMAIN_ATTR = "domain"; private CommonPolicyParser() diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/ContactSSH.java b/src/net/java/sip/communicator/impl/protocol/ssh/ContactSSH.java index b666160..c609d7f 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/ContactSSH.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/ContactSSH.java @@ -31,15 +31,15 @@ interface ContactSSH * conversation message sent by another contact. */ public static final int CONVERSATION_MESSAGE_RECEIVED = 1; - + /** * An event type indicting that the message being received is a system * message being sent by the server or a system administrator. */ public static final int SYSTEM_MESSAGE_RECEIVED = 2; - + //Following eight function declations to be moved to Contact - + /** * This method is only called when the contact is added to a new * <tt>ContactGroupSSHImpl</tt> by the @@ -49,7 +49,7 @@ interface ContactSSH * parent of this <tt>ContactSSHImpl</tt> */ void setParentGroup (ContactGroupSSHImpl newParentGroup); - + /** * Sets <tt>sshPresenceStatus</tt> as the PresenceStatus that this * contact is currently in. @@ -57,7 +57,7 @@ interface ContactSSH * currently valid for this contact. */ public void setPresenceStatus (PresenceStatus sshPresenceStatus); - + /** * Returns the persistent presence operation set that this contact belongs * to. @@ -67,9 +67,9 @@ interface ContactSSH */ public OperationSetPersistentPresence getParentPresenceOperationSet (); - + /** - * Returns the BasicInstant Messaging operation set that this contact + * Returns the BasicInstant Messaging operation set that this contact * belongs to. * * @return the <tt>OperationSetBasicInstantMessagingSSHImpl</tt> that @@ -77,7 +77,7 @@ interface ContactSSH */ public OperationSetBasicInstantMessaging getParentBasicInstantMessagingOperationSet (); - + /** * Returns the File Transfer operation set that this contact belongs * to. @@ -87,28 +87,28 @@ interface ContactSSH */ public OperationSetFileTransfer getFileTransferOperationSet (); - + /** * Return the type of message received from remote server * * @return messageType */ public int getMessageType (); - + /** * Sets the type of message received from remote server * * @param messageType */ public void setMessageType (int messageType); - + /** * Stores persistent data of the contact. * * @param persistentData of the contact */ public void setPersistentData (String persistentData); - + /** * Makes the contact resolved or unresolved. * @@ -116,7 +116,7 @@ interface ContactSSH * make it unresolved */ public void setResolved (boolean resolved); - + /** * Specifies whether or not this contact is being stored by the server. * Non persistent contacts are common in the case of simple, non-persistent @@ -131,7 +131,7 @@ interface ContactSSH * otherwise. */ public void setPersistent (boolean isPersistent); - + /** * Returns true if a command has been sent whos reply was not received yet * false otherwise @@ -139,7 +139,7 @@ interface ContactSSH * @return commandSent */ public boolean isCommandSent (); - + /** * Set the state of commandSent variable which determines whether a reply * to a command sent is awaited @@ -147,7 +147,7 @@ interface ContactSSH * @param commandSent */ public void setCommandSent (boolean commandSent); - + /** * Initializes the reader and writers associated with shell of this contact * @@ -156,26 +156,26 @@ interface ContactSSH */ void initializeShellIO (InputStream shellInputStream, OutputStream shellOutputStream); - + /** * Closes the readers and writer associated with shell of this contact */ void closeShellIO (); - + /** * Determines whether a connection to a remote server is already underway * * @return connectionInProgress */ public boolean isConnectionInProgress (); - + /** * Sets the status of connection attempt to remote server * * @param connectionInProgress */ public void setConnectionInProgress (boolean connectionInProgress); - + // /** // * Sets the PS1 prompt of the current shell of Contact // * This method is synchronized @@ -190,110 +190,111 @@ interface ContactSSH // * @return sshPrompt // */ // public String getShellPrompt(); - - + + /** * Saves the details of contact in persistentData */ public void savePersistentDetails (); - + /* * Returns the SSHContactInfo associated with this contact * * @return sshConfigurationForm */ public SSHContactInfo getSSHConfigurationForm (); - + /** * Returns the JSch Stack identified associated with this contact * * @return jsch */ JSch getJSch (); - + /** * Starts the timer and its task to periodically update the status of * remote machine */ void startTimerTask (); - + /** * Stops the timer and its task to stop updating the status of * remote machine */ void stopTimerTask (); - + /** * Sets the JSch Stack identified associated with this contact * * @param jsch to be associated */ void setJSch (JSch jsch); - + /** * Returns the Username associated with this contact * * @return userName */ String getUserName (); - + /** * Returns the Hostname associated with this contact * * @return hostName */ String getHostName (); - + /** * Returns the Password associated with this contact * * @return password */ String getPassword (); - + /** * Sets the Password associated with this contact * * @param password */ void setPassword (String password); - + /** * Returns the SSH Session associated with this contact * * @return sshSession */ Session getSSHSession (); - + /** * Sets the SSH Session associated with this contact * * @param sshSession the newly created SSH Session to be associated */ void setSSHSession (Session sshSession); - + /** * Returns the SSH Shell Channel associated with this contact * * @return shellChannel */ Channel getShellChannel (); - + /** * Sets the SSH Shell channel associated with this contact * * @param shellChannel to be associated with SSH Session of this contact */ void setShellChannel (Channel shellChannel); - + /** * Sends a message a line to remote machine via the Shell Writer * * @param message to be sent + * @throws IOException if message failed to be sent */ public void sendLine (String message) - throws IOException; - + throws IOException; + // /** // * Reads a line from the remote machine via the Shell Reader // * @@ -301,14 +302,14 @@ interface ContactSSH // */ // public String getLine() // throws IOException; - + /** * Returns the Input Stream associated with SSH Channel of this contact * * @return shellInputStream associated with SSH Channel of this contact */ public InputStream getShellInputStream (); - + // /** // * Sets the Input Stream associated with SSH Channel of this contact // * @@ -316,14 +317,14 @@ interface ContactSSH // * contact // */ // public void setShellInputStream(InputStream shellInputStream); - + /** * Returns the Output Stream associated with SSH Channel of this contact * * @return shellOutputStream associated with SSH Channel of this contact */ public OutputStream getShellOutputStream (); - + // /** // * Sets the Output Stream associated with SSH Channel of this contact // * @@ -345,14 +346,14 @@ interface ContactSSH // * @param shellReader to be associated with SSH Channel of this contact // */ // public void setShellReader(BufferedReader shellReader); - + /** * Returns the PrintWriter associated with SSH Channel of this contact * * @return shellWriter associated with SSH Channel of this contact */ public PrintWriter getShellWriter (); - + // /** // * Sets the PrintWriter associated with SSH Channel of this contact // * diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/ContactTimerSSHImpl.java b/src/net/java/sip/communicator/impl/protocol/ssh/ContactTimerSSHImpl.java index 33c5c90..4726d2b 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/ContactTimerSSHImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/ContactTimerSSHImpl.java @@ -93,6 +93,8 @@ public class ContactTimerSSHImpl } /** * Creates a new instance of ContactTimerSSHImpl + * + * @param sshContact the <tt>Contact</tt> */ public ContactTimerSSHImpl(ContactSSH sshContact) { diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/OperationSetFileTransferSSHImpl.java b/src/net/java/sip/communicator/impl/protocol/ssh/OperationSetFileTransferSSHImpl.java index 99db4ad..16872f5 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/OperationSetFileTransferSSHImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/OperationSetFileTransferSSHImpl.java @@ -28,26 +28,30 @@ public class OperationSetFileTransferSSHImpl { private static final Logger logger = Logger.getLogger(OperationSetFileTransferSSHImpl.class); - + /** * Currently registered message listeners. */ private Vector<FileTransferListener> fileTransferListeners = new Vector<FileTransferListener>(); - + /** * The protocol provider that created us. */ private ProtocolProviderServiceSSHImpl parentProvider = null; - - - /** Creates a new instance of OperationSetFileTransferSSHImpl */ + + + /** + * Creates a new instance of OperationSetFileTransferSSHImpl + * + * @param parentProvider the parent protocol provider service + */ public OperationSetFileTransferSSHImpl( ProtocolProviderServiceSSHImpl parentProvider) { this.parentProvider = parentProvider; } - + /** * Registers a FileTransferListener with this operation set so that it gets * notifications of start, complete, failure of file transfers @@ -74,7 +78,7 @@ public class OperationSetFileTransferSSHImpl } /** - * Sends a file transfer request to the given <tt>toContact</tt>. + * Sends a file transfer request to the given <tt>toContact</tt>. * @param toContact the contact that should receive the file * @param file the file to send */ diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java b/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java index 35e21f1..ee303d3 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java @@ -34,72 +34,72 @@ public class ProtocolProviderServiceSSHImpl { private static final Logger logger = Logger.getLogger(ProtocolProviderServiceSSHImpl.class); - + /** * The name of this protocol. */ public static final String SSH_PROTOCOL_NAME = ProtocolNames.SSH; - + // /** // * The identifier for SSH Stack // * Java Secure Channel JSch // */ // JSch jsch = new JSch(); - + /** - * The test command given after each command to determine the reply length + * The test command given after each command to determine the reply length * of the command */ - //private final String testCommand = + //private final String testCommand = // Resources.getString("testCommand"); - + /** * A reference to the protocol provider of UIService */ private static ServiceReference ppUIServiceRef; - + /** * Connection timeout to a remote server in milliseconds */ private static int connectionTimeout = 30000; - + /** * A reference to UI Service */ private static UIService uiService; - + /** * The id of the account that this protocol provider represents. */ private AccountID accountID = null; - + /** * We use this to lock access to initialization. */ private final Object initializationLock = new Object(); - + private OperationSetBasicInstantMessagingSSHImpl basicInstantMessaging; - + private OperationSetFileTransferSSHImpl fileTranfer; - + /** * Indicates whether or not the provider is initialized and ready for use. */ private boolean isInitialized = false; - + /** * The logo corresponding to the ssh protocol. */ private ProtocolIconSSHImpl sshIcon = new ProtocolIconSSHImpl(); - + /** * The registration state of SSH Provider is taken to be registered by * default as it doesn't correspond to the state on remote server */ private RegistrationState currentRegistrationState = RegistrationState.REGISTERED; - + /** * The default constructor for the SSH protocol provider. */ @@ -107,7 +107,7 @@ public class ProtocolProviderServiceSSHImpl { if (logger.isTraceEnabled()) logger.trace("Creating a ssh provider."); - + try { // converting to milliseconds @@ -119,7 +119,7 @@ public class ProtocolProviderServiceSSHImpl logger.error("Connection Timeout set to 30 seconds"); } } - + /** * Initializes the service implementation, and puts it in a sate where it * could interoperate with other services. It is strongly recomended that @@ -140,11 +140,11 @@ public class ProtocolProviderServiceSSHImpl synchronized(initializationLock) { this.accountID = accountID; - + //initialize the presence operationset OperationSetPersistentPresenceSSHImpl persistentPresence = new OperationSetPersistentPresenceSSHImpl(this); - + addSupportedOperationSet( OperationSetPersistentPresence.class, persistentPresence); @@ -154,25 +154,25 @@ public class ProtocolProviderServiceSSHImpl addSupportedOperationSet( OperationSetPresence.class, persistentPresence); - + //initialize the IM operation set - basicInstantMessaging = new + basicInstantMessaging = new OperationSetBasicInstantMessagingSSHImpl( this); addSupportedOperationSet( OperationSetBasicInstantMessaging.class, basicInstantMessaging); - + //initialze the file transfer operation set fileTranfer = new OperationSetFileTransferSSHImpl(this); addSupportedOperationSet( OperationSetFileTransfer.class, fileTranfer); - + isInitialized = true; } } - + /** * Determines whether a vaild session exists for the contact of remote * machine. @@ -188,12 +188,12 @@ public class ProtocolProviderServiceSSHImpl if( sshSession != null) if(sshSession.isConnected()) return true; - + // remove reference to an unconnected SSH Session, if any sshContact.setSSHSession(null); return false; } - + /** * Determines whether the contact is connected to shell of remote machine * as a precheck for any further operation @@ -206,22 +206,22 @@ public class ProtocolProviderServiceSSHImpl public boolean isShellConnected(ContactSSH sshContact) { // a test command may also be run here - + if(isSessionValid(sshContact)) { return(sshContact.getShellChannel() != null); } - + /* * Above should be return(sshContact.getShellChannel() != null * && sshContact.getShellChannel().isConnected()); * * but incorrect reply from stack for isConnected() */ - + return false; } - + /** * Creates a shell channel to the remote machine * a new jsch session is also created if the current one is invalid @@ -242,35 +242,35 @@ public class ProtocolProviderServiceSSHImpl OperationSetPersistentPresenceSSHImpl persistentPresence = (OperationSetPersistentPresenceSSHImpl)sshContact .getParentPresenceOperationSet(); - + persistentPresence.changeContactPresenceStatus( sshContact, SSHStatusEnum.CONNECTING); - + try { if(!isSessionValid(sshContact)) createSSHSessionAndLogin(sshContact); - + createShellChannel(sshContact); - + //initializing the reader and writers of ssh contact - + persistentPresence.changeContactPresenceStatus( sshContact, SSHStatusEnum.CONNECTED); - + showWelcomeMessage(sshContact); - + sshContact.setMessageType(ContactSSH .CONVERSATION_MESSAGE_RECEIVED); - + sshContact.setConnectionInProgress(false); - + Thread.sleep(1500); - + sshContact.setCommandSent(true); - + basicInstantMessaging.sendInstantMessage( sshContact, firstMessage); @@ -281,7 +281,7 @@ public class ProtocolProviderServiceSSHImpl persistentPresence.changeContactPresenceStatus( sshContact, SSHStatusEnum.NOT_AVAILABLE); - + ex.printStackTrace(); } finally @@ -290,38 +290,38 @@ public class ProtocolProviderServiceSSHImpl } } })); - + newConnection.start(); } - + /** * Creates a channel for shell type in the current session * channel types = shell, sftp, exec(X forwarding), * direct-tcpip(stream forwarding) etc * * @param sshContact ID of SSH Contact - * + * @throws IOException if the shell channel cannot be created */ public void createShellChannel(ContactSSH sshContact) - throws IOException + throws IOException { try { Channel shellChannel = sshContact.getSSHSession() .openChannel("shell"); - + //initalizing the reader and writers of ssh contact sshContact.initializeShellIO(shellChannel.getInputStream(), shellChannel.getOutputStream()); - + ((ChannelShell)shellChannel).setPtyType( sshContact.getSSHConfigurationForm().getTerminalType()); - + //initializing the shell shellChannel.connect(1000); - + sshContact.setShellChannel(shellChannel); - + sshContact.sendLine("export PS1="); } catch (JSchException ex) @@ -331,11 +331,13 @@ public class ProtocolProviderServiceSSHImpl " server"); } } - + /** * Closes the Shell channel are associated IO Streams * * @param sshContact ID of SSH Contact + * @throws JSchException if something went wrong in JSch + * @throws IOException if I/O exception occurred */ public void closeShellChannel(ContactSSH sshContact) throws JSchException, @@ -345,7 +347,7 @@ public class ProtocolProviderServiceSSHImpl sshContact.getShellChannel().disconnect(); sshContact.setShellChannel(null); } - + /** * Creates a SSH Session with a remote machine and tries to login * according to the details specified by Contact @@ -353,7 +355,7 @@ public class ProtocolProviderServiceSSHImpl * * @param sshContact ID of SSH Contact * - * @throws JSchException if a JSch is unable to create a SSH Session with + * @throws JSchException if a JSch is unable to create a SSH Session with * the remote machine * @throws InterruptedException if the thread is interrupted before session * connected or is timed out @@ -367,10 +369,10 @@ public class ProtocolProviderServiceSSHImpl if (logger.isInfoEnabled()) logger.info("Creating a new SSH Session to " + sshContact.getHostName()); - + // creating a new JSch Stack identifier for contact JSch jsch = new JSch(); - + String knownHosts = accountID.getAccountPropertyString("KNOWN_HOSTS_FILE"); @@ -379,14 +381,14 @@ public class ProtocolProviderServiceSSHImpl String identitiyKey = accountID.getAccountPropertyString("IDENTITY_FILE"); - + String userName = sshContact.getUserName(); - + // use the name of system user if the contact has not supplied SSH // details if(userName.equals("")) userName = System.getProperty("user.name"); - + if(!identitiyKey.equals("Optional")) jsch.addIdentity(identitiyKey); @@ -395,22 +397,22 @@ public class ProtocolProviderServiceSSHImpl userName, sshContact.getHostName(), sshContact.getSSHConfigurationForm().getPort()); - + /** * Creating and associating User Info with the session * User Info passes authentication from sshContact to SSH Stack */ SSHUserInfo sshUserInfo = new SSHUserInfo(sshContact); - + session.setUserInfo(sshUserInfo); - + /** * initializing the session */ session.connect(connectionTimeout); - + int count = 0; - + // wait for session to get connected while(!session.isConnected() && count<=30000) { @@ -420,7 +422,7 @@ public class ProtocolProviderServiceSSHImpl logger.trace("SSH:" + sshContact.getHostName() + ": Sleep zzz .. " ); } - + // if timeout have exceeded if(count>30000) { @@ -429,20 +431,20 @@ public class ProtocolProviderServiceSSHImpl null, "SSH Connection attempt to " + sshContact.getHostName() + " timed out"); - + // error codes are not defined yet throw new OperationFailedException("SSH Connection attempt to " + sshContact.getHostName() + " timed out", 2); } - + sshContact.setJSch(jsch); sshContact.setSSHSession(session); - + if (logger.isInfoEnabled()) logger.info("A new SSH Session to " + sshContact.getHostName() + " Created"); } - + /** * Closes the SSH Session associated with the contact * @@ -453,14 +455,15 @@ public class ProtocolProviderServiceSSHImpl sshContact.getSSHSession().disconnect(); sshContact.setSSHSession(null); } - + /** * Presents the login welcome message to user * * @param sshContact ID of SSH Contact + * @throws IOException if I/O exception occurred */ public void showWelcomeMessage(ContactSSH sshContact) - throws IOException + throws IOException { /* //sending the command sshContact.sendLine(testCommand); @@ -487,7 +490,7 @@ public class ProtocolProviderServiceSSHImpl if (logger.isDebugEnabled()) logger.debug("SSH: Welcome message shown"); } - + /** * Returns a reference to UIServce for accessing UI related services * @@ -497,7 +500,7 @@ public class ProtocolProviderServiceSSHImpl { return uiService; } - + /** * Returns the AccountID that uniquely identifies the account represented * by this instance of the ProtocolProviderService. @@ -508,7 +511,7 @@ public class ProtocolProviderServiceSSHImpl { return accountID; } - + /** * Returns the short name of the protocol that the implementation of this * provider is based upon (like SIP, Jabber, ICQ/AIM, or others for @@ -533,7 +536,7 @@ public class ProtocolProviderServiceSSHImpl { return currentRegistrationState; } - + /** * Starts the registration process. * @@ -549,22 +552,22 @@ public class ProtocolProviderServiceSSHImpl { RegistrationState oldState = currentRegistrationState; currentRegistrationState = RegistrationState.REGISTERED; - + //get a reference to UI Service via its Service Reference ppUIServiceRef = SSHActivator.getBundleContext() .getServiceReference(UIService.class.getName()); - + uiService = (UIService)SSHActivator.getBundleContext() .getService(ppUIServiceRef); - + fireRegistrationStateChanged( oldState , currentRegistrationState , RegistrationStateChangeEvent.REASON_USER_REQUEST , null); - + } - + /** * Makes the service implementation close all open sockets and release * any resources that it might have taken and prepare for @@ -578,7 +581,7 @@ public class ProtocolProviderServiceSSHImpl } if (logger.isTraceEnabled()) logger.trace("Killing the SSH Protocol Provider."); - + if(isRegistered()) { try @@ -595,10 +598,10 @@ public class ProtocolProviderServiceSSHImpl , ex); } } - + isInitialized = false; } - + /** * Ends the registration of this protocol provider with the current * registration service. @@ -612,7 +615,7 @@ public class ProtocolProviderServiceSSHImpl { RegistrationState oldState = currentRegistrationState; currentRegistrationState = RegistrationState.UNREGISTERED; - + fireRegistrationStateChanged( oldState , currentRegistrationState @@ -622,7 +625,7 @@ public class ProtocolProviderServiceSSHImpl /* * (non-Javadoc) - * + * * @see net.java.sip.communicator.service.protocol.ProtocolProviderService# * isSignallingTransportSecure() */ diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/Resources.java b/src/net/java/sip/communicator/impl/protocol/ssh/Resources.java index 238c507..6928794 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/Resources.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/Resources.java @@ -18,8 +18,11 @@ import net.java.sip.communicator.service.resources.*; */ public class Resources { + /** + * The SSH logo imageID. + */ public static ImageID SSH_LOGO = new ImageID("protocolIconSsh"); - + /** * Returns an string corresponding to the given key. * @@ -31,7 +34,7 @@ public class Resources { return SSHActivator.getResources().getI18NString(key); } - + /** * Loads an image from a given image identifier. * @param imageID The identifier of the image. diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/SSHActivator.java b/src/net/java/sip/communicator/impl/protocol/ssh/SSHActivator.java index 509034e..c799077 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/SSHActivator.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/SSHActivator.java @@ -29,26 +29,26 @@ public class SSHActivator { private static final Logger logger = Logger.getLogger(SSHActivator.class); - + /** * A reference to the registration of our SSH protocol provider * factory. */ private ServiceRegistration sshPpFactoryServReg = null; - + /** * A reference to the SSH protocol provider factory. */ private static ProtocolProviderFactorySSHImpl sshProviderFactory = null; - + /** * The currently valid bundle context. */ private static BundleContext bundleContext = null; - + private static ResourceManagementService resourcesService; - + /** * Called when this bundle is started. In here we'll export the * ssh ProtocolProviderFactory implementation so that it could be @@ -63,8 +63,8 @@ public class SSHActivator public void start(BundleContext context) throws Exception { - this.bundleContext = context; - + bundleContext = context; + Hashtable<String, String> hashtable = new Hashtable<String, String>(); hashtable.put(ProtocolProviderFactory.PROTOCOL, "SSH"); @@ -75,11 +75,11 @@ public class SSHActivator ProtocolProviderFactory.class.getName(), sshProviderFactory, hashtable); - + if (logger.isInfoEnabled()) logger.info("SSH protocol implementation [STARTED]."); } - + /** * Returns a reference to the bundle context that we were started with. * @return bundleContext a reference to the BundleContext instance @@ -89,7 +89,7 @@ public class SSHActivator { return bundleContext; } - + /** * Retrurns a reference to the protocol provider factory that we have * registered. @@ -101,8 +101,8 @@ public class SSHActivator { return sshProviderFactory; } - - + + /** * Called when this bundle is stopped so the Framework can perform the * bundle-specific activities necessary to stop the bundle. @@ -116,12 +116,17 @@ public class SSHActivator public void stop(BundleContext context) throws Exception { - this.sshProviderFactory.stop(); + sshProviderFactory.stop(); sshPpFactoryServReg.unregister(); if (logger.isInfoEnabled()) logger.info("SSH protocol implementation [STOPPED]."); } - + + /** + * Returns the <tt>ResourceManagementService</tt>. + * + * @return the <tt>ResourceManagementService</tt>. + */ public static ResourceManagementService getResources() { if (resourcesService == null) diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/SSHContactInfo.java b/src/net/java/sip/communicator/impl/protocol/ssh/SSHContactInfo.java index 9592ce2..1b5f31a 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/SSHContactInfo.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/SSHContactInfo.java @@ -23,15 +23,21 @@ import net.java.sip.communicator.util.swing.*; /** * @author Shobhit Jindal */ -class SSHContactInfo extends SIPCommDialog { +class SSHContactInfo extends SIPCommDialog +{ + /** + * Serial version UID. + */ + private static final long serialVersionUID = 0L; + private ContactSSH sshContact; - + private JPanel mainPanel = new TransparentPanel(); private JPanel machinePanel = new TransparentPanel(); private JPanel detailNamesPanel = new TransparentPanel(); private JPanel detailFieldsPanel = new TransparentPanel(); private JPanel detailsPanel = new TransparentPanel(); - + private JCheckBox addDetailsCheckBox = new SIPCommCheckBox("Add Details"); private JButton doneButton = new JButton("Done"); @@ -42,41 +48,41 @@ class SSHContactInfo extends SIPCommDialog { private JLabel password = new JLabel("Password: "); private JTextField passwordField = new JPasswordField(); private JLabel port = new JLabel("Port: "); - + private JFormattedTextField portField; private JLabel secs = new JLabel("secs"); private JLabel statusUpdate = new JLabel("Update Interval: "); private JLabel terminalType = new JLabel("Terminal Type: "); private JTextField terminalTypeField = new JTextField("SIP Communicator"); private JSpinner updateTimer = new JSpinner(); - + private JPanel emptyPanel1 = new TransparentPanel(); - + private JPanel emptyPanel2 = new TransparentPanel(); - + private JPanel emptyPanel3 = new TransparentPanel(); - + private JPanel emptyPanel4 = new TransparentPanel(); - + private JPanel emptyPanel5 = new TransparentPanel(); - + private JPanel emptyPanel6 = new TransparentPanel(); - + private JPanel emptyPanel7 = new TransparentPanel(); - + private JPanel emptyPanel8 = new TransparentPanel(); - + private JPanel emptyPanel9 = new TransparentPanel(); - + private JPanel emptyPanel10 = new TransparentPanel(); - + private JPanel emptyPanel11 = new TransparentPanel(); - + // private ContactGroup contactGroup = null; - + /** * Creates a new instance of SSHContactInfo - * + * * @param sshContact the concerned contact */ public SSHContactInfo(ContactSSH sshContact) { @@ -84,27 +90,27 @@ class SSHContactInfo extends SIPCommDialog { this.sshContact = sshContact; initForm(); - + this.getContentPane().add(mainPanel); - + this.setSize(370, 325); - + this.setResizable(false); - + this.setTitle("SSH: Account Details of " + sshContact.getDisplayName()); - + Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension screenSize = toolkit.getScreenSize(); - + int x = (screenSize.width - this.getWidth()) / 2; int y = (screenSize.height - this.getHeight()) / 2; - + this.setLocation(x,y); - + // ProtocolProviderServiceSSHImpl.getUIService().getConfigurationWindow(). // addConfigurationForm(this); } - + /** * initialize the form. */ @@ -119,13 +125,13 @@ class SSHContactInfo extends SIPCommDialog { maskFormatter.setAllowsInvalid(false); portField = new JFormattedTextField(maskFormatter); portField.setValue(22); - + userNameField.setEnabled(false); passwordField.setEditable(false); portField.setEnabled(false); terminalTypeField.setEnabled(false); updateTimer.setEnabled(false); - + mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); machinePanel.setLayout(new BoxLayout(machinePanel, BoxLayout.X_AXIS)); detailNamesPanel.setLayout(new BoxLayout(detailNamesPanel, @@ -133,10 +139,10 @@ class SSHContactInfo extends SIPCommDialog { detailFieldsPanel.setLayout(new BoxLayout(detailFieldsPanel, BoxLayout.Y_AXIS)); detailsPanel.setLayout(new BoxLayout(detailsPanel, BoxLayout.X_AXIS)); - + machinePanel.add(machineID); machinePanel.add(machineIDField); - + detailNamesPanel.add(userName); detailNamesPanel.add(emptyPanel1); detailNamesPanel.add(password); @@ -146,7 +152,7 @@ class SSHContactInfo extends SIPCommDialog { detailNamesPanel.add(statusUpdate); detailNamesPanel.add(emptyPanel4); detailNamesPanel.add(terminalType); - + detailFieldsPanel.add(userNameField); detailFieldsPanel.add(emptyPanel5); detailFieldsPanel.add(passwordField); @@ -156,12 +162,12 @@ class SSHContactInfo extends SIPCommDialog { detailFieldsPanel.add(updateTimer); detailFieldsPanel.add(emptyPanel8); detailFieldsPanel.add(terminalTypeField); - + detailsPanel.add(detailNamesPanel); detailsPanel.add(detailFieldsPanel); - + detailsPanel.setBorder(BorderFactory.createTitledBorder("Details")); - + mainPanel.add(emptyPanel9); mainPanel.add(machinePanel); mainPanel.add(addDetailsCheckBox); @@ -169,7 +175,7 @@ class SSHContactInfo extends SIPCommDialog { mainPanel.add(emptyPanel10); mainPanel.add(doneButton); mainPanel.add(emptyPanel11); - + addDetailsCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { addDetailsCheckBox.setEnabled(false); @@ -178,18 +184,18 @@ class SSHContactInfo extends SIPCommDialog { portField.setEnabled(true); terminalTypeField.setEnabled(true); updateTimer.setEnabled(true); - + userNameField.grabFocus(); } }); - + doneButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if(machineIDField.getText().equals("")) { machineIDField.setText("Field needed"); return; } - + sshContact.savePersistentDetails(); //add contact to contact list @@ -200,10 +206,10 @@ class SSHContactInfo extends SIPCommDialog { sshContact); setVisible(false); - } + } }); } - + /** * Return the ssh icon * @@ -223,7 +229,7 @@ class SSHContactInfo extends SIPCommDialog { // { // return this.contactGroup; // } - + /** * Sets the UserName of the dialog * @@ -232,7 +238,7 @@ class SSHContactInfo extends SIPCommDialog { public void setUserNameField(String userName) { this.userNameField.setText(userName); } - + /** * Sets the Password of the dialog * @@ -241,7 +247,7 @@ class SSHContactInfo extends SIPCommDialog { public void setPasswordField(String password) { this.passwordField.setText(password); } - + /** * Return the hostname * @@ -250,7 +256,7 @@ class SSHContactInfo extends SIPCommDialog { public String getHostName() { return this.machineIDField.getText(); } - + /** * Return the username * @@ -259,7 +265,7 @@ class SSHContactInfo extends SIPCommDialog { public String getUserName() { return this.userNameField.getText(); } - + /** * Return the password * @@ -268,7 +274,7 @@ class SSHContactInfo extends SIPCommDialog { public String getPassword() { return this.passwordField.getText(); } - + /** * Return the terminal type * @@ -277,7 +283,7 @@ class SSHContactInfo extends SIPCommDialog { public String getTerminalType() { return this.terminalTypeField.getText(); } - + /** * Return the port * @@ -286,7 +292,7 @@ class SSHContactInfo extends SIPCommDialog { public int getPort() { return Integer.parseInt(this.portField.getText().trim()); } - + /** * Return the update interval * @@ -295,7 +301,7 @@ class SSHContactInfo extends SIPCommDialog { public int getUpdateInterval() { return Integer.parseInt(String.valueOf(this.updateTimer.getValue())); } - + /** * Sets the HostName of the dialog * @@ -304,7 +310,7 @@ class SSHContactInfo extends SIPCommDialog { public void setHostNameField(String hostName) { this.machineIDField.setText(hostName); } - + /** * Sets the Terminal Type of the dialog * @@ -313,7 +319,7 @@ class SSHContactInfo extends SIPCommDialog { public void setTerminalType(String termType) { this.terminalTypeField.setText(termType); } - + /** * Sets the Update Interval of the dialog * @@ -322,7 +328,7 @@ class SSHContactInfo extends SIPCommDialog { public void setUpdateInterval(int interval) { this.updateTimer.setValue(interval); } - + /** * Sets the Port of the dialog * |