mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 03:52:06 +01:00
Move Stream Management code into o.j.smack.sm
from o.jsmack.tcp.sm, as XEP-198 Stream Management is not an "XMPP over TCP" exclusive feature. It could also be use together with the Websocket binding of XMPP, so we may have a smack-streammangement in the future. This change prepares for that by moving the SM code out of the XMPP TCP package namespace.
This commit is contained in:
parent
79fe40bf97
commit
4c218c96f6
17 changed files with 72 additions and 39 deletions
|
@ -89,10 +89,9 @@ public class Chat {
|
|||
* </pre>
|
||||
*
|
||||
* @param text the text to send.
|
||||
* @throws XMPPException if sending the message fails.
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public void sendMessage(String text) throws XMPPException, NotConnectedException {
|
||||
public void sendMessage(String text) throws NotConnectedException {
|
||||
Message message = new Message();
|
||||
message.setBody(text);
|
||||
sendMessage(message);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smack.tcp.sm;
|
||||
package org.jivesoftware.smack.sm;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smack.tcp.sm;
|
||||
package org.jivesoftware.smack.sm;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smack.tcp.sm.packet;
|
||||
package org.jivesoftware.smack.sm.packet;
|
||||
|
||||
import org.jivesoftware.smack.packet.FullStreamElement;
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
|
@ -14,7 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smack.tcp.sm.predicates;
|
||||
package org.jivesoftware.smack.sm.predicates;
|
||||
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
|
@ -14,7 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smack.tcp.sm.predicates;
|
||||
package org.jivesoftware.smack.sm.predicates;
|
||||
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.packet.Message;
|
|
@ -14,7 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smack.tcp.sm.predicates;
|
||||
package org.jivesoftware.smack.sm.predicates;
|
||||
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
|
@ -14,7 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smack.tcp.sm.predicates;
|
||||
package org.jivesoftware.smack.sm.predicates;
|
||||
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
|
@ -14,7 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smack.tcp.sm.predicates;
|
||||
package org.jivesoftware.smack.sm.predicates;
|
||||
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
|
@ -14,7 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smack.tcp.sm.predicates;
|
||||
package org.jivesoftware.smack.sm.predicates;
|
||||
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smack.tcp.sm.predicates;
|
||||
package org.jivesoftware.smack.sm.predicates;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashSet;
|
|
@ -14,16 +14,16 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smack.tcp.sm.provider;
|
||||
package org.jivesoftware.smack.sm.provider;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smack.tcp.sm.packet.StreamManagement.AckAnswer;
|
||||
import org.jivesoftware.smack.tcp.sm.packet.StreamManagement.AckRequest;
|
||||
import org.jivesoftware.smack.tcp.sm.packet.StreamManagement.Enabled;
|
||||
import org.jivesoftware.smack.tcp.sm.packet.StreamManagement.Failed;
|
||||
import org.jivesoftware.smack.tcp.sm.packet.StreamManagement.Resumed;
|
||||
import org.jivesoftware.smack.sm.packet.StreamManagement.AckAnswer;
|
||||
import org.jivesoftware.smack.sm.packet.StreamManagement.AckRequest;
|
||||
import org.jivesoftware.smack.sm.packet.StreamManagement.Enabled;
|
||||
import org.jivesoftware.smack.sm.packet.StreamManagement.Failed;
|
||||
import org.jivesoftware.smack.sm.packet.StreamManagement.Resumed;
|
||||
import org.jivesoftware.smack.util.ParserUtils;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
|
@ -14,10 +14,10 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smack.tcp.sm.provider;
|
||||
package org.jivesoftware.smack.sm.provider;
|
||||
|
||||
import org.jivesoftware.smack.provider.PacketExtensionProvider;
|
||||
import org.jivesoftware.smack.tcp.sm.packet.StreamManagement.StreamManagementFeature;
|
||||
import org.jivesoftware.smack.sm.packet.StreamManagement.StreamManagementFeature;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
||||
public class StreamManagementStreamFeatureProvider extends PacketExtensionProvider<StreamManagementFeature> {
|
|
@ -51,23 +51,23 @@ import org.jivesoftware.smack.sasl.packet.SaslStreamElements;
|
|||
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.Challenge;
|
||||
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure;
|
||||
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.Success;
|
||||
import org.jivesoftware.smack.sm.SMUtils;
|
||||
import org.jivesoftware.smack.sm.StreamManagementException;
|
||||
import org.jivesoftware.smack.sm.StreamManagementException.StreamIdDoesNotMatchException;
|
||||
import org.jivesoftware.smack.sm.StreamManagementException.StreamManagementNotEnabledException;
|
||||
import org.jivesoftware.smack.sm.packet.StreamManagement;
|
||||
import org.jivesoftware.smack.sm.packet.StreamManagement.AckAnswer;
|
||||
import org.jivesoftware.smack.sm.packet.StreamManagement.AckRequest;
|
||||
import org.jivesoftware.smack.sm.packet.StreamManagement.Enable;
|
||||
import org.jivesoftware.smack.sm.packet.StreamManagement.Enabled;
|
||||
import org.jivesoftware.smack.sm.packet.StreamManagement.Failed;
|
||||
import org.jivesoftware.smack.sm.packet.StreamManagement.Resume;
|
||||
import org.jivesoftware.smack.sm.packet.StreamManagement.Resumed;
|
||||
import org.jivesoftware.smack.sm.packet.StreamManagement.StreamManagementFeature;
|
||||
import org.jivesoftware.smack.sm.predicates.Predicate;
|
||||
import org.jivesoftware.smack.sm.provider.ParseStreamManagement;
|
||||
import org.jivesoftware.smack.packet.PlainStreamElement;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smack.tcp.sm.SMUtils;
|
||||
import org.jivesoftware.smack.tcp.sm.StreamManagementException;
|
||||
import org.jivesoftware.smack.tcp.sm.StreamManagementException.StreamManagementNotEnabledException;
|
||||
import org.jivesoftware.smack.tcp.sm.StreamManagementException.StreamIdDoesNotMatchException;
|
||||
import org.jivesoftware.smack.tcp.sm.packet.StreamManagement;
|
||||
import org.jivesoftware.smack.tcp.sm.packet.StreamManagement.AckAnswer;
|
||||
import org.jivesoftware.smack.tcp.sm.packet.StreamManagement.AckRequest;
|
||||
import org.jivesoftware.smack.tcp.sm.packet.StreamManagement.Enable;
|
||||
import org.jivesoftware.smack.tcp.sm.packet.StreamManagement.Enabled;
|
||||
import org.jivesoftware.smack.tcp.sm.packet.StreamManagement.Failed;
|
||||
import org.jivesoftware.smack.tcp.sm.packet.StreamManagement.Resume;
|
||||
import org.jivesoftware.smack.tcp.sm.packet.StreamManagement.Resumed;
|
||||
import org.jivesoftware.smack.tcp.sm.packet.StreamManagement.StreamManagementFeature;
|
||||
import org.jivesoftware.smack.tcp.sm.predicates.Predicate;
|
||||
import org.jivesoftware.smack.tcp.sm.provider.ParseStreamManagement;
|
||||
import org.jivesoftware.smack.util.ArrayBlockingQueueWithShutdown;
|
||||
import org.jivesoftware.smack.util.Async;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
@ -1424,7 +1424,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
* Add a predicate for Stream Management acknowledgment requests.
|
||||
* <p>
|
||||
* Those predicates are used to determine when a Stream Management acknowledgement request is send to the server.
|
||||
* Some pre-defined predicates are found in the <code>org.jivesoftware.smack.tcp.sm.predicates</code> package.
|
||||
* Some pre-defined predicates are found in the <code>org.jivesoftware.smack.sm.predicates</code> package.
|
||||
* </p>
|
||||
* <p>
|
||||
* If not predicate is configured, the {@link Predicate#forMessagesOrAfter5Stanzas()} will be used.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<streamFeatureProvider>
|
||||
<elementName>sm</elementName>
|
||||
<namespace>urn:xmpp:sm:3</namespace>
|
||||
<className>org.jivesoftware.smack.tcp.sm.provider.StreamManagementStreamFeatureProvider</className>
|
||||
<className>org.jivesoftware.smack.sm.provider.StreamManagementStreamFeatureProvider</className>
|
||||
</streamFeatureProvider>
|
||||
|
||||
</smackProviders>
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
*/
|
||||
|
||||
|
||||
package org.jivesoftware.smack.tcp.sm.provider;
|
||||
package org.jivesoftware.smack.sm.provider;
|
||||
|
||||
import com.jamesmurty.utils.XMLBuilder;
|
||||
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smack.tcp.sm.packet.StreamManagement;
|
||||
import org.jivesoftware.smack.sm.packet.StreamManagement;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
import org.junit.Test;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2015 Florian Schmaus
|
||||
*
|
||||
* 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.smack.tcp;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class TcpInitializerTest {
|
||||
|
||||
@Test
|
||||
public void testExtensionInitializer() {
|
||||
TCPInitializer initializer = new TCPInitializer();
|
||||
List<Exception> exceptions = initializer.initialize();
|
||||
assertTrue(exceptions.size() == 0);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue