From 38a3531ec6070aa90360ab3009719e6353fde478 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 15 Feb 2014 22:35:38 +0100 Subject: [PATCH] Move privacy lists from core to extensions --- .../smack/initializer/CoreInitializer.java | 14 -------------- .../org.jivesoftware.smack/core.providers | 12 ------------ .../org.jivesoftware.smack/smack-config.xml | 2 -- .../smack/initializer/CoreInitializerTest.java | 17 ----------------- documentation/extensions/intro.html | 5 +++++ documentation/{ => extensions}/privacy.html | 2 +- documentation/extensions/toc.html | 1 + documentation/index.html | 1 - .../smackx/privacy}/PrivacyList.java | 8 ++++---- .../smackx/privacy}/PrivacyListListener.java | 4 ++-- .../smackx/privacy}/PrivacyListManager.java | 12 +++++++++--- .../smackx/privacy}/packet/Privacy.java | 8 +++++--- .../smackx/privacy}/packet/PrivacyItem.java | 2 +- .../privacy}/provider/PrivacyProvider.java | 11 ++++++----- .../extensions.providers | 7 +++++++ .../org.jivesoftware.smackx/extensions.xml | 1 + 16 files changed, 42 insertions(+), 65 deletions(-) delete mode 100644 core/src/main/java/org/jivesoftware/smack/initializer/CoreInitializer.java delete mode 100644 core/src/main/resources/org.jivesoftware.smack/core.providers delete mode 100644 core/src/test/java/org/jivesoftware/smack/initializer/CoreInitializerTest.java rename documentation/{ => extensions}/privacy.html (96%) rename {core/src/main/java/org/jivesoftware/smack => extensions/src/main/java/org/jivesoftware/smackx/privacy}/PrivacyList.java (89%) rename {core/src/main/java/org/jivesoftware/smack => extensions/src/main/java/org/jivesoftware/smackx/privacy}/PrivacyListListener.java (90%) rename {core/src/main/java/org/jivesoftware/smack => extensions/src/main/java/org/jivesoftware/smackx/privacy}/PrivacyListManager.java (94%) rename {core/src/main/java/org/jivesoftware/smack => extensions/src/main/java/org/jivesoftware/smackx/privacy}/packet/Privacy.java (95%) rename {core/src/main/java/org/jivesoftware/smack => extensions/src/main/java/org/jivesoftware/smackx/privacy}/packet/PrivacyItem.java (96%) rename {core/src/main/java/org/jivesoftware/smack => extensions/src/main/java/org/jivesoftware/smackx/privacy}/provider/PrivacyProvider.java (92%) diff --git a/core/src/main/java/org/jivesoftware/smack/initializer/CoreInitializer.java b/core/src/main/java/org/jivesoftware/smack/initializer/CoreInitializer.java deleted file mode 100644 index c821192f4..000000000 --- a/core/src/main/java/org/jivesoftware/smack/initializer/CoreInitializer.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jivesoftware.smack.initializer; - - -/** - * Loads the default provider file for the Smack core on initialization. - * - * @author Robin Collier - * - */ -public class CoreInitializer extends UrlProviderFileInitializer implements SmackInitializer { - protected String getFilePath() { - return "classpath:org.jivesoftware.smack/core.providers"; - } -} diff --git a/core/src/main/resources/org.jivesoftware.smack/core.providers b/core/src/main/resources/org.jivesoftware.smack/core.providers deleted file mode 100644 index 6af31515f..000000000 --- a/core/src/main/resources/org.jivesoftware.smack/core.providers +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - query - jabber:iq:privacy - org.jivesoftware.smack.provider.PrivacyProvider - - - diff --git a/core/src/main/resources/org.jivesoftware.smack/smack-config.xml b/core/src/main/resources/org.jivesoftware.smack/smack-config.xml index 85c788546..b475bbb1d 100644 --- a/core/src/main/resources/org.jivesoftware.smack/smack-config.xml +++ b/core/src/main/resources/org.jivesoftware.smack/smack-config.xml @@ -19,9 +19,7 @@ - org.jivesoftware.smack.initializer.CoreInitializer org.jivesoftware.smack.initializer.VmArgInitializer - org.jivesoftware.smack.PrivacyListManager org.jivesoftware.smack.ReconnectionManager diff --git a/core/src/test/java/org/jivesoftware/smack/initializer/CoreInitializerTest.java b/core/src/test/java/org/jivesoftware/smack/initializer/CoreInitializerTest.java deleted file mode 100644 index 7f8fe9211..000000000 --- a/core/src/test/java/org/jivesoftware/smack/initializer/CoreInitializerTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jivesoftware.smack.initializer; - -import static org.junit.Assert.assertTrue; - -import org.jivesoftware.smack.initializer.CoreInitializer; -import org.junit.Test; - -public class CoreInitializerTest { - - @Test - public void testCoreInitializer() { - CoreInitializer ci = new CoreInitializer(); - ci.initialize(); - assertTrue(ci.getExceptions().size() == 0); - } - -} diff --git a/documentation/extensions/intro.html b/documentation/extensions/intro.html index 227c2a14f..85e45a17a 100644 --- a/documentation/extensions/intro.html +++ b/documentation/extensions/intro.html @@ -80,6 +80,11 @@ XEP-0115 Generic publish and subscribe functionality. + + Privacy Lists + XEP-0016 + Enabling or disabling communication with other entities. + diff --git a/documentation/privacy.html b/documentation/extensions/privacy.html similarity index 96% rename from documentation/privacy.html rename to documentation/extensions/privacy.html index 9e0f76d35..1e50f1314 100644 --- a/documentation/privacy.html +++ b/documentation/extensions/privacy.html @@ -153,7 +153,7 @@ The listener becomes notified after performing:

References

diff --git a/documentation/extensions/toc.html b/documentation/extensions/toc.html index 98113ae58..b3fbbd048 100644 --- a/documentation/extensions/toc.html +++ b/documentation/extensions/toc.html @@ -23,6 +23,7 @@ File Transfer
PubSub
Entity Capabilities
+Privacy

diff --git a/documentation/index.html b/documentation/index.html index 34b67f810..b80133915 100644 --- a/documentation/index.html +++ b/documentation/index.html @@ -22,7 +22,6 @@
  • Provider Architecture
  • Packet Properties
  • Debugging with Smack -
  • Privacy

  • Smack Extensions Manual diff --git a/core/src/main/java/org/jivesoftware/smack/PrivacyList.java b/extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyList.java similarity index 89% rename from core/src/main/java/org/jivesoftware/smack/PrivacyList.java rename to extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyList.java index 430b22f86..ebde91c81 100644 --- a/core/src/main/java/org/jivesoftware/smack/PrivacyList.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyList.java @@ -12,17 +12,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smack; - -import org.jivesoftware.smack.packet.PrivacyItem; +package org.jivesoftware.smackx.privacy; +import org.jivesoftware.smackx.privacy.packet.PrivacyItem; + import java.util.List; /** * A privacy list represents a list of contacts that is a read only class used to represent a set of allowed or blocked communications. * Basically it can: diff --git a/core/src/main/java/org/jivesoftware/smack/PrivacyListListener.java b/extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListListener.java similarity index 90% rename from core/src/main/java/org/jivesoftware/smack/PrivacyListListener.java rename to extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListListener.java index 4911b98eb..a6a8143b4 100644 --- a/core/src/main/java/org/jivesoftware/smack/PrivacyListListener.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListListener.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.jivesoftware.smack; +package org.jivesoftware.smackx.privacy; -import org.jivesoftware.smack.packet.PrivacyItem; +import org.jivesoftware.smackx.privacy.packet.PrivacyItem; import java.util.List; diff --git a/core/src/main/java/org/jivesoftware/smack/PrivacyListManager.java b/extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java similarity index 94% rename from core/src/main/java/org/jivesoftware/smack/PrivacyListManager.java rename to extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java index 900c341c7..9de101694 100644 --- a/core/src/main/java/org/jivesoftware/smack/PrivacyListManager.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java @@ -15,13 +15,19 @@ * limitations under the License. */ -package org.jivesoftware.smack; +package org.jivesoftware.smackx.privacy; +import org.jivesoftware.smack.Connection; +import org.jivesoftware.smack.ConnectionCreationListener; +import org.jivesoftware.smack.PacketCollector; +import org.jivesoftware.smack.PacketListener; +import org.jivesoftware.smack.SmackConfiguration; +import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.filter.*; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Packet; -import org.jivesoftware.smack.packet.Privacy; -import org.jivesoftware.smack.packet.PrivacyItem; +import org.jivesoftware.smackx.privacy.packet.Privacy; +import org.jivesoftware.smackx.privacy.packet.PrivacyItem; import java.lang.ref.WeakReference; import java.util.*; diff --git a/core/src/main/java/org/jivesoftware/smack/packet/Privacy.java b/extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/Privacy.java similarity index 95% rename from core/src/main/java/org/jivesoftware/smack/packet/Privacy.java rename to extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/Privacy.java index b0e809faa..0391ec2ed 100644 --- a/core/src/main/java/org/jivesoftware/smack/packet/Privacy.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/Privacy.java @@ -15,13 +15,15 @@ * limitations under the License. */ -package org.jivesoftware.smack.packet; +package org.jivesoftware.smackx.privacy.packet; import java.util.*; +import org.jivesoftware.smack.packet.IQ; + /** - * A Privacy IQ Packet, is used by the {@link org.jivesoftware.smack.PrivacyListManager} - * and {@link org.jivesoftware.smack.provider.PrivacyProvider} to allow and block + * A Privacy IQ Packet, is used by the {@link org.jivesoftware.smackx.privacy.PrivacyListManager} + * and {@link org.jivesoftware.smackx.privacy.provider.PrivacyProvider} to allow and block * communications from other users. It contains the appropriate structure to suit * user-defined privacy lists. Different configured Privacy packages are used in the * server & manager communication in order to: diff --git a/core/src/main/java/org/jivesoftware/smack/packet/PrivacyItem.java b/extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/PrivacyItem.java similarity index 96% rename from core/src/main/java/org/jivesoftware/smack/packet/PrivacyItem.java rename to extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/PrivacyItem.java index e3d284cc7..2b54e30b2 100644 --- a/core/src/main/java/org/jivesoftware/smack/packet/PrivacyItem.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/PrivacyItem.java @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smack.packet; +package org.jivesoftware.smackx.privacy.packet; /** * A privacy item acts a rule that when matched defines if a packet should be blocked or not. diff --git a/core/src/main/java/org/jivesoftware/smack/provider/PrivacyProvider.java b/extensions/src/main/java/org/jivesoftware/smackx/privacy/provider/PrivacyProvider.java similarity index 92% rename from core/src/main/java/org/jivesoftware/smack/provider/PrivacyProvider.java rename to extensions/src/main/java/org/jivesoftware/smackx/privacy/provider/PrivacyProvider.java index d29fda3f7..7689aa85b 100644 --- a/core/src/main/java/org/jivesoftware/smack/provider/PrivacyProvider.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/privacy/provider/PrivacyProvider.java @@ -12,21 +12,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smack.provider; +package org.jivesoftware.smackx.privacy.provider; import org.jivesoftware.smack.packet.DefaultPacketExtension; import org.jivesoftware.smack.packet.IQ; -import org.jivesoftware.smack.packet.Privacy; -import org.jivesoftware.smack.packet.PrivacyItem; +import org.jivesoftware.smack.provider.IQProvider; +import org.jivesoftware.smackx.privacy.packet.Privacy; +import org.jivesoftware.smackx.privacy.packet.PrivacyItem; import org.xmlpull.v1.XmlPullParser; - + import java.util.ArrayList; /** * The PrivacyProvider parses {@link Privacy} packets. {@link Privacy} * Parses the query sub-document and creates an instance of {@link Privacy}. * For each item in the list element, it creates an instance - * of {@link PrivacyItem} and {@link org.jivesoftware.smack.packet.PrivacyItem.PrivacyRule}. + * of {@link PrivacyItem} and {@link org.jivesoftware.smackx.privacy.packet.PrivacyItem.PrivacyRule}. * * @author Francisco Vives */ diff --git a/extensions/src/main/resources/org.jivesoftware.smackx/extensions.providers b/extensions/src/main/resources/org.jivesoftware.smackx/extensions.providers index 1dcb2183d..2d2e60d6f 100644 --- a/extensions/src/main/resources/org.jivesoftware.smackx/extensions.providers +++ b/extensions/src/main/resources/org.jivesoftware.smackx/extensions.providers @@ -449,4 +449,11 @@ org.jivesoftware.smackx.ping.provider.PingProvider + + + query + jabber:iq:privacy + org.jivesoftware.smackx.privacy.provider.PrivacyProvider + + diff --git a/extensions/src/main/resources/org.jivesoftware.smackx/extensions.xml b/extensions/src/main/resources/org.jivesoftware.smackx/extensions.xml index 497d27470..d573c7fcb 100644 --- a/extensions/src/main/resources/org.jivesoftware.smackx/extensions.xml +++ b/extensions/src/main/resources/org.jivesoftware.smackx/extensions.xml @@ -9,5 +9,6 @@ org.jivesoftware.smackx.iqlast.LastActivityManager org.jivesoftware.smackx.commands.AdHocCommandManager org.jivesoftware.smackx.ping.PingManager + org.jivesoftware.smackx.privacy.PrivacyListManager \ No newline at end of file