From 3c455c8367f5be4b2f37d8ed2ed4b61a0a793601 Mon Sep 17 00:00:00 2001 From: Thiago Camargo Date: Sat, 3 Mar 2007 05:20:17 +0000 Subject: [PATCH] Code Refactoring and Fixes git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7363 b35dd754-fafc-0310-a699-88a17e54d16e --- .../smackx/jingle/IncomingJingleSession.java | 1 + .../smackx/jingle/JingleManager.java | 9 +++-- .../smackx/jingle/JingleNegotiator.java | 19 ++++++++++ .../smackx/jingle/JingleSession.java | 5 +-- .../smackx/jingle/JingleSessionRequest.java | 19 ++++++++++ .../smackx/jingle/OutgoingJingleSession.java | 1 + .../CreatedJingleSessionListener.java | 10 +++--- .../jingle/listeners/JingleListener.java | 2 +- .../listeners/JingleMediaInfoListener.java | 1 + .../jingle/listeners/JingleMediaListener.java | 1 + .../listeners/JingleSessionListener.java | 1 + .../listeners/JingleSessionStateListener.java | 2 ++ .../listeners/JingleTransportListener.java | 2 ++ .../smackx/jingle/media/MediaNegotiator.java | 1 - .../smackx/jingle/media/PayloadType.java | 19 ++++++++++ .../smackx/jingle/nat/BasicResolver.java | 20 +++++++++++ .../smackx/jingle/nat/BridgedResolver.java | 19 ++++++++++ .../jingle/nat/BridgedTransportManager.java | 17 +++++---- .../smackx/jingle/nat/DatagramListener.java | 19 ++++++++++ .../smackx/jingle/nat/FixedResolver.java | 19 ++++++++++ .../jingle/nat/JingleTransportManager.java | 19 ++++++++++ .../jivesoftware/smackx/jingle/nat/STUN.java | 19 ++++++++++ .../smackx/jingle/nat/STUNResolver.java | 21 ++++++++++- .../jingle/nat/STUNTransportManager.java | 7 ++-- .../jingle/nat/TransportNegotiator.java | 20 +++++++++++ .../jingle/nat/TransportResolverListener.java | 19 ++++++++++ .../packet/JingleContentDescription.java | 19 ++++++++++ .../smackx/packet/JingleContentInfo.java | 19 ++++++++++ .../smackx/packet/JingleError.java | 35 +++++++++++++++++++ .../smackx/packet/JingleTransport.java | 19 ++++++++++ .../JingleContentDescriptionProvider.java | 19 ++++++++++ .../provider/JingleContentInfoProvider.java | 19 ++++++++++ .../provider/JingleTransportProvider.java | 19 ++++++++++ .../smackx/jingle/JingleManagerTest.java | 1 + .../smackx/jingle/nat/STUNResolverTest.java | 2 +- jingle/media/test/JingleMediaTest.java | 5 ++- 36 files changed, 420 insertions(+), 29 deletions(-) diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/IncomingJingleSession.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/IncomingJingleSession.java index 6f51b210f..b6dd0293b 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/IncomingJingleSession.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/IncomingJingleSession.java @@ -80,6 +80,7 @@ import java.util.List; * JingleManager class, that will create the appropiate instance... * * @author Alvaro Saurin + * @author Thiago Camargo */ public class IncomingJingleSession extends JingleSession { diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleManager.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleManager.java index 7cc154af1..dab5b833b 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleManager.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleManager.java @@ -25,7 +25,9 @@ import org.jivesoftware.smack.filter.PacketFilter; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Packet; import org.jivesoftware.smack.packet.Presence; +import org.jivesoftware.smack.packet.PacketExtension; import org.jivesoftware.smack.provider.ProviderManager; +import org.jivesoftware.smack.provider.PacketExtensionProvider; import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smackx.ServiceDiscoveryManager; import org.jivesoftware.smackx.jingle.listeners.CreatedJingleSessionListener; @@ -40,6 +42,8 @@ import org.jivesoftware.smackx.jingle.nat.TransportCandidate; import org.jivesoftware.smackx.jingle.nat.TransportResolver; import org.jivesoftware.smackx.packet.DiscoverInfo; import org.jivesoftware.smackx.packet.Jingle; +import org.jivesoftware.smackx.packet.JingleError; +import org.xmlpull.v1.XmlPullParser; import java.util.ArrayList; import java.util.Collection; @@ -267,8 +271,7 @@ public class JingleManager implements JingleSessionListener { JingleSession aux = null; for (JingleSession jingleSession : jingleSessions) { if (jingleSession.getInitiator().equals(xmppAddress) || - jingleSession.getResponder().equals(xmppAddress)) - { + jingleSession.getResponder().equals(xmppAddress)) { aux = jingleSession; } } @@ -673,7 +676,7 @@ public class JingleManager implements JingleSessionListener { if (jingleMediaManager != null) return createIncomingJingleSession(request, jingleMediaManager.getPayloads()); - return createIncomingJingleSession(request,null); + return createIncomingJingleSession(request, null); } /** diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleNegotiator.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleNegotiator.java index b8b219b85..2409b3b9f 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleNegotiator.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleNegotiator.java @@ -1,3 +1,22 @@ +/** + * $RCSfile$ + * $Revision: 7329 $ + * $Date: 2007-02-28 20:59:28 -0300 (qua, 28 fev 2007) $ + * + * Copyright 2003-2005 Jive Software. + * + * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jivesoftware.smackx.jingle; import org.jivesoftware.smack.XMPPConnection; diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleSession.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleSession.java index f84ab9efc..f7f06f380 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleSession.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleSession.java @@ -501,7 +501,6 @@ public abstract class JingleSession extends JingleNegotiator { // Notify the session end and close everything... triggerSessionClosedOnError(e); - close(); } } @@ -558,6 +557,7 @@ public abstract class JingleSession extends JingleNegotiator { perror.addExtension(error); getConnection().sendPacket(perror); + System.err.println(error.toXML()); } return perror; } @@ -1022,6 +1022,7 @@ public abstract class JingleSession extends JingleNegotiator { sli.sessionClosed(reason, this); } } + close(); if (jingleMediaSession != null) { jingleMediaSession.stopTrasmit(); jingleMediaSession.stopReceive(); @@ -1041,6 +1042,7 @@ public abstract class JingleSession extends JingleNegotiator { sli.sessionClosedOnError(exc, this); } } + close(); if (jingleMediaSession != null) { jingleMediaSession.stopTrasmit(); jingleMediaSession.stopReceive(); @@ -1125,7 +1127,6 @@ public abstract class JingleSession extends JingleNegotiator { jout.setType(IQ.Type.SET); sendFormattedJingle(jout); triggerSessionClosed("Closed Locally"); - close(); } /** diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleSessionRequest.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleSessionRequest.java index 3bcde73f5..c692f33f2 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleSessionRequest.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleSessionRequest.java @@ -1,3 +1,22 @@ +/** + * $RCSfile$ + * $Revision: $ + * $Date: 15/11/2006 + * + * Copyright 2003-2006 Jive Software. + * + * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jivesoftware.smackx.jingle; import org.jivesoftware.smack.XMPPException; diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/OutgoingJingleSession.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/OutgoingJingleSession.java index 73684f107..4e36c43b2 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/OutgoingJingleSession.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/OutgoingJingleSession.java @@ -78,6 +78,7 @@ import java.util.List; * JingleManager class, that will create the appropiate instance... * * @author Alvaro Saurin + * @author Thiago Camargo */ public class OutgoingJingleSession extends JingleSession { diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/CreatedJingleSessionListener.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/CreatedJingleSessionListener.java index 961078527..8748dc776 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/CreatedJingleSessionListener.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/CreatedJingleSessionListener.java @@ -1,7 +1,3 @@ -package org.jivesoftware.smackx.jingle.listeners; - -import org.jivesoftware.smackx.jingle.JingleSession; - /** * $RCSfile$ * $Revision: $ @@ -22,8 +18,14 @@ import org.jivesoftware.smackx.jingle.JingleSession; * limitations under the License. */ +package org.jivesoftware.smackx.jingle.listeners; + +import org.jivesoftware.smackx.jingle.JingleSession; + /** * Inteface used to dispatch a event when a Jingle session is created. + * + * @author Thiago Camargo */ public interface CreatedJingleSessionListener { diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleListener.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleListener.java index 275fecfe4..975e1dff7 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleListener.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleListener.java @@ -32,7 +32,7 @@ package org.jivesoftware.smackx.jingle.listeners; * sessionRequested() of the listener will be executed, and the listener * will be able to accept() or decline() the invitation. * - * @author Alvaro Saurin + * @author Thiago Camargo */ public interface JingleListener { diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleMediaInfoListener.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleMediaInfoListener.java index 393011584..edbd562ad 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleMediaInfoListener.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleMediaInfoListener.java @@ -21,6 +21,7 @@ package org.jivesoftware.smackx.jingle.listeners; /** * Interface for listening to jmf info events. + * @author Thiago Camargo */ public interface JingleMediaInfoListener extends JingleListener { /** diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleMediaListener.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleMediaListener.java index 39efb35e0..36a15da60 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleMediaListener.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleMediaListener.java @@ -24,6 +24,7 @@ import org.jivesoftware.smackx.jingle.media.PayloadType; /** * Interface for listening to jmf events. + * @author Thiago Camargo */ public interface JingleMediaListener extends JingleListener { /** diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleSessionListener.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleSessionListener.java index f4aece244..de8b7ac62 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleSessionListener.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleSessionListener.java @@ -26,6 +26,7 @@ import org.jivesoftware.smackx.jingle.nat.TransportCandidate; /** * Interface for listening for session events. + * @author Thiago Camargo */ public interface JingleSessionListener extends JingleListener { /** diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleSessionStateListener.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleSessionStateListener.java index cfc9c5377..693726b28 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleSessionStateListener.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleSessionStateListener.java @@ -24,6 +24,8 @@ import org.jivesoftware.smackx.jingle.JingleNegotiator; /** * Used to Listen for Jingle Session State Changes + * + * @author Thiago Camargo */ public interface JingleSessionStateListener { diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleTransportListener.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleTransportListener.java index 15239bb57..673fd1beb 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleTransportListener.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/listeners/JingleTransportListener.java @@ -24,6 +24,8 @@ import org.jivesoftware.smackx.jingle.nat.TransportCandidate; /** * Interface for listening to transport events. + * + * @author Thiago Camargo */ public interface JingleTransportListener extends JingleListener { diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/media/MediaNegotiator.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/media/MediaNegotiator.java index 7869ea1a4..d82d9d875 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/media/MediaNegotiator.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/media/MediaNegotiator.java @@ -41,7 +41,6 @@ import java.util.List; * This class is responsible for managing the descriptor negotiation process, * handling all the xmpp packets interchange and the stage control. * - * @author Alvaro Saurin * @author Thiago Camargo */ public class MediaNegotiator extends JingleNegotiator { diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/media/PayloadType.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/media/PayloadType.java index 0bfa80142..6bf6dfa2a 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/media/PayloadType.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/media/PayloadType.java @@ -1,3 +1,22 @@ +/** + * $RCSfile$ + * $Revision: 7329 $ + * $Date: 2007-02-28 20:59:28 -0300 (qua, 28 fev 2007) $ + * + * Copyright 2003-2005 Jive Software. + * + * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jivesoftware.smackx.jingle.media; /** diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/BasicResolver.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/BasicResolver.java index bc4689662..903da8d9e 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/BasicResolver.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/BasicResolver.java @@ -1,3 +1,23 @@ +/** + * $RCSfile$ + * $Revision: 7329 $ + * $Date: 2007-02-28 20:59:28 -0300 (qua, 28 fev 2007) $ + * + * Copyright 2003-2005 Jive Software. + * + * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.jivesoftware.smackx.jingle.nat; import org.jivesoftware.smack.XMPPException; diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/BridgedResolver.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/BridgedResolver.java index 0c7e95530..5573d6103 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/BridgedResolver.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/BridgedResolver.java @@ -1,3 +1,22 @@ +/** + * $RCSfile$ + * $Revision: 7329 $ + * $Date: 2007-02-28 20:59:28 -0300 (qua, 28 fev 2007) $ + * + * Copyright 2003-2005 Jive Software. + * + * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jivesoftware.smackx.jingle.nat; import org.jivesoftware.smack.XMPPConnection; diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/BridgedTransportManager.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/BridgedTransportManager.java index e9d083397..2b68d4243 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/BridgedTransportManager.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/BridgedTransportManager.java @@ -1,12 +1,3 @@ -package org.jivesoftware.smackx.jingle.nat; - -import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smackx.jingle.JingleSession; -import org.jivesoftware.smackx.jingle.listeners.CreatedJingleSessionListener; -import org.jivesoftware.smackx.jingle.listeners.JingleSessionListener; -import org.jivesoftware.smackx.jingle.media.PayloadType; - /** * $RCSfile$ * $Revision: $ @@ -26,6 +17,14 @@ import org.jivesoftware.smackx.jingle.media.PayloadType; * See the License for the specific language governing permissions and * limitations under the License. */ +package org.jivesoftware.smackx.jingle.nat; + +import org.jivesoftware.smack.XMPPConnection; +import org.jivesoftware.smack.XMPPException; +import org.jivesoftware.smackx.jingle.JingleSession; +import org.jivesoftware.smackx.jingle.listeners.CreatedJingleSessionListener; +import org.jivesoftware.smackx.jingle.listeners.JingleSessionListener; +import org.jivesoftware.smackx.jingle.media.PayloadType; /** * A Jingle Transport Manager implementation to be used for NAT Networks. diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/DatagramListener.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/DatagramListener.java index dc8c0a7ed..e5711ceea 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/DatagramListener.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/DatagramListener.java @@ -1,3 +1,22 @@ +/** + * $RCSfile$ + * $Revision: $ + * $Date: 15/11/2006 + * + * Copyright 2003-2006 Jive Software. + * + * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jivesoftware.smackx.jingle.nat; import java.net.DatagramPacket; diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/FixedResolver.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/FixedResolver.java index 78479c04b..b97ec7624 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/FixedResolver.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/FixedResolver.java @@ -1,3 +1,22 @@ +/** + * $RCSfile$ + * $Revision: $ + * $Date: 15/11/2006 + * + * Copyright 2003-2006 Jive Software. + * + * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jivesoftware.smackx.jingle.nat; import org.jivesoftware.smack.XMPPException; diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/JingleTransportManager.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/JingleTransportManager.java index 3eb3d9f68..287c8d9be 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/JingleTransportManager.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/JingleTransportManager.java @@ -1,3 +1,22 @@ +/** + * $RCSfile$ + * $Revision: $ + * $Date: 15/11/2006 + * + * Copyright 2003-2006 Jive Software. + * + * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jivesoftware.smackx.jingle.nat; import org.jivesoftware.smack.XMPPException; diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/STUN.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/STUN.java index c255775ab..c78e828fa 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/STUN.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/STUN.java @@ -1,3 +1,22 @@ +/** + * $RCSfile$ + * $Revision: $ + * $Date: 15/11/2006 + * + * Copyright 2003-2006 Jive Software. + * + * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jivesoftware.smackx.jingle.nat; import org.jivesoftware.smack.PacketCollector; diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/STUNResolver.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/STUNResolver.java index 8e77dfbc1..c07b8403f 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/STUNResolver.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/STUNResolver.java @@ -1,3 +1,22 @@ +/** + * $RCSfile$ + * $Revision: $ + * $Date: 15/11/2006 + * + * Copyright 2003-2006 Jive Software. + * + * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jivesoftware.smackx.jingle.nat; import de.javawi.jstun.test.BindingLifetimeTest; @@ -21,7 +40,7 @@ import java.util.Enumeration; * * The goal of this resolver is to take possible to establish and manage out-of-band connections between two XMPP entities, even if they are behind Network Address Translators (NATs) or firewalls. * - * @author Alvaro Saurin + * @author Thiago Camargo */ public class STUNResolver extends TransportResolver { diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/STUNTransportManager.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/STUNTransportManager.java index e519beac4..8775f1ad7 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/STUNTransportManager.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/STUNTransportManager.java @@ -1,7 +1,3 @@ -package org.jivesoftware.smackx.jingle.nat; - -import org.jivesoftware.smack.XMPPException; - /** * $RCSfile$ * $Revision: $ @@ -21,6 +17,9 @@ import org.jivesoftware.smack.XMPPException; * See the License for the specific language governing permissions and * limitations under the License. */ +package org.jivesoftware.smackx.jingle.nat; + +import org.jivesoftware.smack.XMPPException; /** * A Jingle Transport Manager implementation to be used on NAT networks with STUN Service NOT Blocked. diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportNegotiator.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportNegotiator.java index 3a2d30700..188d9e4eb 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportNegotiator.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportNegotiator.java @@ -1,3 +1,23 @@ +/** + * $RCSfile$ + * $Revision: $ + * $Date: 15/11/2006 + * + * Copyright 2003-2006 Jive Software. + * + * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.jivesoftware.smackx.jingle.nat; import org.jivesoftware.smack.XMPPException; diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportResolverListener.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportResolverListener.java index d75ca7a69..263d7d07e 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportResolverListener.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportResolverListener.java @@ -1,3 +1,22 @@ +/** + * $RCSfile$ + * $Revision: $ + * $Date: 15/11/2006 + * + * Copyright 2003-2006 Jive Software. + * + * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jivesoftware.smackx.jingle.nat; /** diff --git a/jingle/extension/source/org/jivesoftware/smackx/packet/JingleContentDescription.java b/jingle/extension/source/org/jivesoftware/smackx/packet/JingleContentDescription.java index c82df9017..86020117c 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/packet/JingleContentDescription.java +++ b/jingle/extension/source/org/jivesoftware/smackx/packet/JingleContentDescription.java @@ -1,3 +1,22 @@ +/** + * $RCSfile$ + * $Revision: 7329 $ + * $Date: 2007-02-28 20:59:28 -0300 (qua, 28 fev 2007) $ + * + * Copyright 2003-2005 Jive Software. + * + * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jivesoftware.smackx.packet; import org.jivesoftware.smack.packet.PacketExtension; diff --git a/jingle/extension/source/org/jivesoftware/smackx/packet/JingleContentInfo.java b/jingle/extension/source/org/jivesoftware/smackx/packet/JingleContentInfo.java index 66604f2b7..6002a89f5 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/packet/JingleContentInfo.java +++ b/jingle/extension/source/org/jivesoftware/smackx/packet/JingleContentInfo.java @@ -1,3 +1,22 @@ +/** + * $RCSfile$ + * $Revision: 7329 $ + * $Date: 2007-02-28 20:59:28 -0300 (qua, 28 fev 2007) $ + * + * Copyright 2003-2005 Jive Software. + * + * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jivesoftware.smackx.packet; import org.jivesoftware.smack.packet.PacketExtension; diff --git a/jingle/extension/source/org/jivesoftware/smackx/packet/JingleError.java b/jingle/extension/source/org/jivesoftware/smackx/packet/JingleError.java index 7d92f76d7..0d9ed282e 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/packet/JingleError.java +++ b/jingle/extension/source/org/jivesoftware/smackx/packet/JingleError.java @@ -21,6 +21,9 @@ package org.jivesoftware.smackx.packet; import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smackx.jingle.media.ContentInfo; +import org.xmlpull.v1.XmlPullParser; public class JingleError implements PacketExtension { @@ -119,4 +122,36 @@ public class JingleError implements PacketExtension { public String getNamespace() { return NAMESPACE; } + + public static class Provider implements PacketExtensionProvider { + + private PacketExtension audioInfo; + + /** + * Empty constructor. + */ + public Provider() { + } + + /** + * Parse a JingleContentDescription.Audio extension. + */ + public PacketExtension parseExtension(final XmlPullParser parser) + throws Exception { + PacketExtension result = null; + + if (audioInfo != null) { + result = audioInfo; + } else { + String elementName = parser.getName(); + + // Try to get an Audio content info + ContentInfo mi = ContentInfo.Audio.fromString(elementName); + if (mi != null) { + result = new JingleContentInfo.Audio(mi); + } + } + return result; + } + } } diff --git a/jingle/extension/source/org/jivesoftware/smackx/packet/JingleTransport.java b/jingle/extension/source/org/jivesoftware/smackx/packet/JingleTransport.java index 4d4eeabb0..ce99ed332 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/packet/JingleTransport.java +++ b/jingle/extension/source/org/jivesoftware/smackx/packet/JingleTransport.java @@ -1,3 +1,22 @@ +/** + * $RCSfile$ + * $Revision: 7329 $ + * $Date: 2007-02-28 20:59:28 -0300 (qua, 28 fev 2007) $ + * + * Copyright 2003-2005 Jive Software. + * + * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jivesoftware.smackx.packet; import org.jivesoftware.smack.packet.PacketExtension; diff --git a/jingle/extension/source/org/jivesoftware/smackx/provider/JingleContentDescriptionProvider.java b/jingle/extension/source/org/jivesoftware/smackx/provider/JingleContentDescriptionProvider.java index 6a0d4a174..dc97ac2fd 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/provider/JingleContentDescriptionProvider.java +++ b/jingle/extension/source/org/jivesoftware/smackx/provider/JingleContentDescriptionProvider.java @@ -1,3 +1,22 @@ +/** + * $RCSfile$ + * $Revision: 7329 $ + * $Date: 2007-02-28 20:59:28 -0300 (qua, 28 fev 2007) $ + * + * Copyright 2003-2005 Jive Software. + * + * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jivesoftware.smackx.provider; import org.jivesoftware.smack.packet.PacketExtension; diff --git a/jingle/extension/source/org/jivesoftware/smackx/provider/JingleContentInfoProvider.java b/jingle/extension/source/org/jivesoftware/smackx/provider/JingleContentInfoProvider.java index e6e79ffc0..ab2512bf9 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/provider/JingleContentInfoProvider.java +++ b/jingle/extension/source/org/jivesoftware/smackx/provider/JingleContentInfoProvider.java @@ -1,3 +1,22 @@ +/** + * $RCSfile$ + * $Revision: 7329 $ + * $Date: 2007-02-28 20:59:28 -0300 (qua, 28 fev 2007) $ + * + * Copyright 2003-2005 Jive Software. + * + * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jivesoftware.smackx.provider; import org.jivesoftware.smack.packet.PacketExtension; diff --git a/jingle/extension/source/org/jivesoftware/smackx/provider/JingleTransportProvider.java b/jingle/extension/source/org/jivesoftware/smackx/provider/JingleTransportProvider.java index 7b91bd9dd..4598500f7 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/provider/JingleTransportProvider.java +++ b/jingle/extension/source/org/jivesoftware/smackx/provider/JingleTransportProvider.java @@ -1,3 +1,22 @@ +/** + * $RCSfile$ + * $Revision: 7329 $ + * $Date: 2007-02-28 20:59:28 -0300 (qua, 28 fev 2007) $ + * + * Copyright 2003-2005 Jive Software. + * + * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jivesoftware.smackx.provider; import org.jivesoftware.smack.packet.PacketExtension; diff --git a/jingle/extension/test/org/jivesoftware/smackx/jingle/JingleManagerTest.java b/jingle/extension/test/org/jivesoftware/smackx/jingle/JingleManagerTest.java index 526d417ef..0ca56dd4f 100644 --- a/jingle/extension/test/org/jivesoftware/smackx/jingle/JingleManagerTest.java +++ b/jingle/extension/test/org/jivesoftware/smackx/jingle/JingleManagerTest.java @@ -81,6 +81,7 @@ import java.util.List; *

* * @author Alvaro Saurin + * @author Thiago Camargo */ public class JingleManagerTest extends SmackTestCase { diff --git a/jingle/extension/test/org/jivesoftware/smackx/jingle/nat/STUNResolverTest.java b/jingle/extension/test/org/jivesoftware/smackx/jingle/nat/STUNResolverTest.java index cdd656b09..ea463dd39 100644 --- a/jingle/extension/test/org/jivesoftware/smackx/jingle/nat/STUNResolverTest.java +++ b/jingle/extension/test/org/jivesoftware/smackx/jingle/nat/STUNResolverTest.java @@ -18,7 +18,7 @@ import java.util.ArrayList; /** * Test the STUN IP resolver. * - * @author alvaro + * @author Thiago Camargo */ public class STUNResolverTest extends SmackTestCase { diff --git a/jingle/media/test/JingleMediaTest.java b/jingle/media/test/JingleMediaTest.java index 681cb40d1..b836f723a 100644 --- a/jingle/media/test/JingleMediaTest.java +++ b/jingle/media/test/JingleMediaTest.java @@ -129,11 +129,10 @@ public class JingleMediaTest extends SmackTestCase { x1, new BasicTransportManager()); MultiMediaManager jingleMediaManager0 = new MultiMediaManager(); - jingleMediaManager0.addMediaManager(new SpeexMediaManager()); - jingleMediaManager0.addMediaManager(new JmfMediaManager()); +// jingleMediaManager0.addMediaManager(new SpeexMediaManager()); jingleMediaManager0.addMediaManager(new JmfMediaManager()); MultiMediaManager jingleMediaManager1 = new MultiMediaManager(); - jingleMediaManager1.addMediaManager(new JmfMediaManager()); +// jingleMediaManager1.addMediaManager(new JmfMediaManager()); jingleMediaManager1.addMediaManager(new SpeexMediaManager()); jm0.setMediaManager(jingleMediaManager0);