mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-21 22:02:06 +01:00
Enable OSGi compliance via 'DynamicImport-Package: *'
on package layer instead of Declarative Service (DS) approach. Restructuring and cleanup of initialization process to ensure that all internal config files are found by the corresponding bundle classloaders. SMACK-343
This commit is contained in:
parent
1f38e4ca0d
commit
665e7914f2
38 changed files with 46 additions and 191 deletions
20
build.gradle
20
build.gradle
|
@ -272,26 +272,6 @@ subprojects {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
['smack-extensions', 'smack-experimental', 'smack-legacy'].each { name ->
|
|
||||||
project(":$name") {
|
|
||||||
jar {
|
|
||||||
manifest {
|
|
||||||
instruction 'Service-Component', "org.jivesoftware.smackx/$name-components.xml"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
['smack-resolver-javax', 'smack-resolver-dnsjava', 'smack-resolver-minidns', 'smack-sasl-javax', 'smack-sasl-provided', 'smack-java7'] .each { name ->
|
|
||||||
project(":$name") {
|
|
||||||
jar {
|
|
||||||
manifest {
|
|
||||||
instruction 'Service-Component', "org.jivesoftware.smack/$name-components.xml"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
subprojects*.jar {
|
subprojects*.jar {
|
||||||
manifest {
|
manifest {
|
||||||
from sharedManifest
|
from sharedManifest
|
||||||
|
|
|
@ -20,13 +20,13 @@ import java.util.List;
|
||||||
|
|
||||||
import org.apache.http.conn.ssl.StrictHostnameVerifier;
|
import org.apache.http.conn.ssl.StrictHostnameVerifier;
|
||||||
import org.jivesoftware.smack.SmackConfiguration;
|
import org.jivesoftware.smack.SmackConfiguration;
|
||||||
import org.jivesoftware.smack.initializer.SimpleSmackInitializer;
|
import org.jivesoftware.smack.initializer.SmackInitializer;
|
||||||
import org.jivesoftware.smack.util.stringencoder.Base64;
|
import org.jivesoftware.smack.util.stringencoder.Base64;
|
||||||
import org.jivesoftware.smack.util.stringencoder.Base64UrlSafeEncoder;
|
import org.jivesoftware.smack.util.stringencoder.Base64UrlSafeEncoder;
|
||||||
import org.jivesoftware.smack.util.stringencoder.android.AndroidBase64Encoder;
|
import org.jivesoftware.smack.util.stringencoder.android.AndroidBase64Encoder;
|
||||||
import org.jivesoftware.smack.util.stringencoder.android.AndroidBase64UrlSafeEncoder;
|
import org.jivesoftware.smack.util.stringencoder.android.AndroidBase64UrlSafeEncoder;
|
||||||
|
|
||||||
public class AndroidSmackInitializer extends SimpleSmackInitializer {
|
public class AndroidSmackInitializer implements SmackInitializer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Exception> initialize() {
|
public List<Exception> initialize() {
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
// Note that this is also declared in the main build.gradle for
|
||||||
|
// subprojects, but since evaluationDependsOnChildren is enabled we
|
||||||
|
// need to declare it here too
|
||||||
|
apply plugin: 'osgi'
|
||||||
|
|
||||||
description = """\
|
description = """\
|
||||||
Smack core components."""
|
Smack core components."""
|
||||||
|
|
||||||
|
@ -32,3 +37,9 @@ task createVersionResource(type: CreateFileTask) {
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava.dependsOn(createVersionResource)
|
compileJava.dependsOn(createVersionResource)
|
||||||
|
|
||||||
|
jar {
|
||||||
|
manifest {
|
||||||
|
instruction 'DynamicImport-Package', '*'
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,31 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright 2014 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.initializer;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public abstract class SimpleSmackInitializer implements SmackInitializer {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public abstract List<Exception> initialize();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Exception> initialize(ClassLoader classLoader) {
|
|
||||||
return initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright 2014 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.initializer;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public abstract class SmackAndOsgiInitializer implements SmackInitializer {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A simple wrapper around {@link #initialize} for OSGi, as the activate method of a component
|
|
||||||
* must have a void return type.
|
|
||||||
*/
|
|
||||||
public final void activate() {
|
|
||||||
initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Exception> initialize(ClassLoader classLoader) {
|
|
||||||
return initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -31,5 +31,4 @@ import org.jivesoftware.smack.SmackConfiguration;
|
||||||
*/
|
*/
|
||||||
public interface SmackInitializer {
|
public interface SmackInitializer {
|
||||||
public List<Exception> initialize();
|
public List<Exception> initialize();
|
||||||
public List<Exception> initialize(ClassLoader classLoader);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,17 +34,13 @@ import org.jivesoftware.smack.util.FileUtils;
|
||||||
*
|
*
|
||||||
* @author Florian Schmaus
|
* @author Florian Schmaus
|
||||||
*/
|
*/
|
||||||
public abstract class UrlInitializer extends SmackAndOsgiInitializer {
|
public abstract class UrlInitializer implements SmackInitializer {
|
||||||
private static final Logger LOGGER = Logger.getLogger(UrlInitializer.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(UrlInitializer.class.getName());
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Exception> initialize() {
|
public List<Exception> initialize() {
|
||||||
return initialize(this.getClass().getClassLoader());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Exception> initialize(ClassLoader classLoader) {
|
|
||||||
InputStream is;
|
InputStream is;
|
||||||
|
final ClassLoader classLoader = this.getClass().getClassLoader();
|
||||||
final List<Exception> exceptions = new LinkedList<Exception>();
|
final List<Exception> exceptions = new LinkedList<Exception>();
|
||||||
final String providerUrl = getProvidersUrl();
|
final String providerUrl = getProvidersUrl();
|
||||||
if (providerUrl != null) {
|
if (providerUrl != null) {
|
||||||
|
|
|
@ -11,10 +11,10 @@
|
||||||
<className>org.jivesoftware.smack.util.dns.javax.JavaxResolver</className>
|
<className>org.jivesoftware.smack.util.dns.javax.JavaxResolver</className>
|
||||||
<className>org.jivesoftware.smack.util.dns.minidns.MiniDnsResolver</className>
|
<className>org.jivesoftware.smack.util.dns.minidns.MiniDnsResolver</className>
|
||||||
<className>org.jivesoftware.smack.util.dns.dnsjava.DNSJavaResolver</className>
|
<className>org.jivesoftware.smack.util.dns.dnsjava.DNSJavaResolver</className>
|
||||||
<className>org.jivesoftware.smack.initializer.extensions.ExtensionsInitializer</className>
|
<className>org.jivesoftware.smack.extensions.ExtensionsInitializer</className>
|
||||||
<className>org.jivesoftware.smack.initializer.experimental.ExperimentalInitializer</className>
|
<className>org.jivesoftware.smack.experimental.ExperimentalInitializer</className>
|
||||||
<className>org.jivesoftware.smack.initializer.legacy.LegacyInitializer</className>
|
<className>org.jivesoftware.smack.legacy.LegacyInitializer</className>
|
||||||
<className>org.jivesoftware.smack.initializer.tcp.SmackTcpSmackInitializer</className>
|
<className>org.jivesoftware.smack.tcp.TCPInitializer</className>
|
||||||
<className>org.jivesoftware.smack.sasl.javax.SASLJavaXSmackInitializer</className>
|
<className>org.jivesoftware.smack.sasl.javax.SASLJavaXSmackInitializer</className>
|
||||||
<className>org.jivesoftware.smack.sasl.provided.SASLProvidedSmackInitializer</className>
|
<className>org.jivesoftware.smack.sasl.provided.SASLProvidedSmackInitializer</className>
|
||||||
<className>org.jivesoftware.smack.android.AndroidSmackInitializer</className>
|
<className>org.jivesoftware.smack.android.AndroidSmackInitializer</className>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smack.initializer.experimental;
|
package org.jivesoftware.smack.experimental;
|
||||||
|
|
||||||
import org.jivesoftware.smack.initializer.UrlInitializer;
|
import org.jivesoftware.smack.initializer.UrlInitializer;
|
||||||
|
|
||||||
|
@ -27,11 +27,11 @@ public class ExperimentalInitializer extends UrlInitializer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getProvidersUrl() {
|
protected String getProvidersUrl() {
|
||||||
return "classpath:org.jivesoftware.smackx/experimental.providers";
|
return "classpath:org.jivesoftware.smack.experimental/experimental.providers";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getConfigUrl() {
|
protected String getConfigUrl() {
|
||||||
return "classpath:org.jivesoftware.smackx/experimental.xml";
|
return "classpath:org.jivesoftware.smack.experimental/experimental.xml";
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.2.0"
|
|
||||||
enabled="true" immediate="true" name="Smack Experimental API">
|
|
||||||
<implementation
|
|
||||||
class="org.jivesoftware.smack.initializer.experimental.ExperimentalInitializer" />
|
|
||||||
</scr:component>
|
|
|
@ -20,7 +20,7 @@ import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.initializer.experimental.ExperimentalInitializer;
|
import org.jivesoftware.smack.experimental.ExperimentalInitializer;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class ExperimentalInitializerTest {
|
public class ExperimentalInitializerTest {
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smack.initializer.extensions;
|
package org.jivesoftware.smack.extensions;
|
||||||
|
|
||||||
import org.jivesoftware.smack.initializer.UrlInitializer;
|
import org.jivesoftware.smack.initializer.UrlInitializer;
|
||||||
|
|
||||||
|
@ -27,11 +27,11 @@ public class ExtensionsInitializer extends UrlInitializer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getProvidersUrl() {
|
protected String getProvidersUrl() {
|
||||||
return "classpath:org.jivesoftware.smackx/extensions.providers";
|
return "classpath:org.jivesoftware.smack.extensions/extensions.providers";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getConfigUrl() {
|
protected String getConfigUrl() {
|
||||||
return "classpath:org.jivesoftware.smackx/extensions.xml";
|
return "classpath:org.jivesoftware.smack.extensions/extensions.xml";
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.2.0"
|
|
||||||
enabled="true" immediate="true" name="Smack Extensions API">
|
|
||||||
<implementation
|
|
||||||
class="org.jivesoftware.smack.initializer.extensions.ExtensionsInitializer" />
|
|
||||||
</scr:component>
|
|
|
@ -20,7 +20,7 @@ import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.initializer.extensions.ExtensionsInitializer;
|
import org.jivesoftware.smack.extensions.ExtensionsInitializer;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class ExtensionsInitializerTest {
|
public class ExtensionsInitializerTest {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx;
|
package org.jivesoftware.smackx;
|
||||||
|
|
||||||
import org.jivesoftware.smack.initializer.extensions.ExtensionsInitializer;
|
import org.jivesoftware.smack.extensions.ExtensionsInitializer;
|
||||||
|
|
||||||
public class InitExtensions {
|
public class InitExtensions {
|
||||||
|
|
||||||
|
|
|
@ -19,13 +19,13 @@ package org.jivesoftware.smack.java7;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackConfiguration;
|
import org.jivesoftware.smack.SmackConfiguration;
|
||||||
import org.jivesoftware.smack.initializer.SmackAndOsgiInitializer;
|
import org.jivesoftware.smack.initializer.SmackInitializer;
|
||||||
import org.jivesoftware.smack.util.stringencoder.Base64;
|
import org.jivesoftware.smack.util.stringencoder.Base64;
|
||||||
import org.jivesoftware.smack.util.stringencoder.Base64UrlSafeEncoder;
|
import org.jivesoftware.smack.util.stringencoder.Base64UrlSafeEncoder;
|
||||||
import org.jivesoftware.smack.util.stringencoder.java7.Java7Base64Encoder;
|
import org.jivesoftware.smack.util.stringencoder.java7.Java7Base64Encoder;
|
||||||
import org.jivesoftware.smack.util.stringencoder.java7.Java7Base64UrlSafeEncoder;
|
import org.jivesoftware.smack.util.stringencoder.java7.Java7Base64UrlSafeEncoder;
|
||||||
|
|
||||||
public class Java7SmackInitializer extends SmackAndOsgiInitializer {
|
public class Java7SmackInitializer implements SmackInitializer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Exception> initialize() {
|
public List<Exception> initialize() {
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.2.0"
|
|
||||||
enabled="true" immediate="true" name="Smack Java7 API">
|
|
||||||
<implementation
|
|
||||||
class="org.jivesoftware.smack.java7.Java7SmackInitializer" />
|
|
||||||
</scr:component>
|
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smack.initializer.legacy;
|
package org.jivesoftware.smack.legacy;
|
||||||
|
|
||||||
import org.jivesoftware.smack.initializer.UrlInitializer;
|
import org.jivesoftware.smack.initializer.UrlInitializer;
|
||||||
|
|
||||||
|
@ -22,6 +22,6 @@ public class LegacyInitializer extends UrlInitializer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getProvidersUrl() {
|
protected String getProvidersUrl() {
|
||||||
return "classpath:org.jivesoftware.smackx/legacy.providers";
|
return "classpath:org.jivesoftware.smack.legacy/legacy.providers";
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.2.0"
|
|
||||||
enabled="true" immediate="true" name="Smack Legacy API">
|
|
||||||
<implementation
|
|
||||||
class="org.jivesoftware.smack.initializer.legacy.LegacyInitializer" />
|
|
||||||
</scr:component>
|
|
|
@ -20,7 +20,7 @@ import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.initializer.legacy.LegacyInitializer;
|
import org.jivesoftware.smack.legacy.LegacyInitializer;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class LegacyInitializerTest {
|
public class LegacyInitializerTest {
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smack.util.dns.dnsjava;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.initializer.SmackAndOsgiInitializer;
|
import org.jivesoftware.smack.initializer.SmackInitializer;
|
||||||
import org.jivesoftware.smack.util.DNSUtil;
|
import org.jivesoftware.smack.util.DNSUtil;
|
||||||
import org.jivesoftware.smack.util.dns.DNSResolver;
|
import org.jivesoftware.smack.util.dns.DNSResolver;
|
||||||
import org.jivesoftware.smack.util.dns.SRVRecord;
|
import org.jivesoftware.smack.util.dns.SRVRecord;
|
||||||
|
@ -32,7 +32,7 @@ import org.xbill.DNS.Type;
|
||||||
* This implementation uses the <a href="http://www.dnsjava.org/">dnsjava</a> implementation for resolving DNS addresses.
|
* This implementation uses the <a href="http://www.dnsjava.org/">dnsjava</a> implementation for resolving DNS addresses.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DNSJavaResolver extends SmackAndOsgiInitializer implements DNSResolver {
|
public class DNSJavaResolver implements SmackInitializer, DNSResolver {
|
||||||
|
|
||||||
private static DNSJavaResolver instance = new DNSJavaResolver();
|
private static DNSJavaResolver instance = new DNSJavaResolver();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.2.0"
|
|
||||||
enabled="true" immediate="true" name="Smack Resolver JavaX API">
|
|
||||||
<implementation
|
|
||||||
class="org.jivesoftware.smack.util.dns.dnsjava.DNSJavaResolver" />
|
|
||||||
</scr:component>
|
|
|
@ -27,7 +27,7 @@ import javax.naming.directory.Attributes;
|
||||||
import javax.naming.directory.DirContext;
|
import javax.naming.directory.DirContext;
|
||||||
import javax.naming.directory.InitialDirContext;
|
import javax.naming.directory.InitialDirContext;
|
||||||
|
|
||||||
import org.jivesoftware.smack.initializer.SmackAndOsgiInitializer;
|
import org.jivesoftware.smack.initializer.SmackInitializer;
|
||||||
import org.jivesoftware.smack.util.DNSUtil;
|
import org.jivesoftware.smack.util.DNSUtil;
|
||||||
import org.jivesoftware.smack.util.dns.DNSResolver;
|
import org.jivesoftware.smack.util.dns.DNSResolver;
|
||||||
import org.jivesoftware.smack.util.dns.SRVRecord;
|
import org.jivesoftware.smack.util.dns.SRVRecord;
|
||||||
|
@ -38,7 +38,7 @@ import org.jivesoftware.smack.util.dns.SRVRecord;
|
||||||
* @author Florian Schmaus
|
* @author Florian Schmaus
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class JavaxResolver extends SmackAndOsgiInitializer implements DNSResolver {
|
public class JavaxResolver implements SmackInitializer, DNSResolver {
|
||||||
|
|
||||||
private static JavaxResolver instance;
|
private static JavaxResolver instance;
|
||||||
private static DirContext dirContext;
|
private static DirContext dirContext;
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.2.0"
|
|
||||||
enabled="true" immediate="true" name="Smack Resolver JavaX API">
|
|
||||||
<implementation
|
|
||||||
class="org.jivesoftware.smack.util.dns.javax.JavaxResolver" />
|
|
||||||
</scr:component>
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smack.util.dns.minidns;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.initializer.SmackAndOsgiInitializer;
|
import org.jivesoftware.smack.initializer.SmackInitializer;
|
||||||
import org.jivesoftware.smack.util.DNSUtil;
|
import org.jivesoftware.smack.util.DNSUtil;
|
||||||
import org.jivesoftware.smack.util.dns.DNSResolver;
|
import org.jivesoftware.smack.util.dns.DNSResolver;
|
||||||
import org.jivesoftware.smack.util.dns.SRVRecord;
|
import org.jivesoftware.smack.util.dns.SRVRecord;
|
||||||
|
@ -39,7 +39,7 @@ import de.measite.minidns.record.SRV;
|
||||||
* This implementation uses the <a href="https://github.com/rtreffer/minidns/">minidns</a> implementation for
|
* This implementation uses the <a href="https://github.com/rtreffer/minidns/">minidns</a> implementation for
|
||||||
* resolving DNS addresses.
|
* resolving DNS addresses.
|
||||||
*/
|
*/
|
||||||
public class MiniDnsResolver extends SmackAndOsgiInitializer implements DNSResolver {
|
public class MiniDnsResolver implements SmackInitializer, DNSResolver {
|
||||||
|
|
||||||
private static final long ONE_DAY = 24*60*60*1000;
|
private static final long ONE_DAY = 24*60*60*1000;
|
||||||
private static final MiniDnsResolver instance = new MiniDnsResolver();
|
private static final MiniDnsResolver instance = new MiniDnsResolver();
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.2.0"
|
|
||||||
enabled="true" immediate="true" name="Smack Resolver JavaX API">
|
|
||||||
<implementation
|
|
||||||
class="org.jivesoftware.smack.util.dns.minidns.MiniDnsResolver" />
|
|
||||||
</scr:component>
|
|
|
@ -19,9 +19,9 @@ package org.jivesoftware.smack.sasl.javax;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SASLAuthentication;
|
import org.jivesoftware.smack.SASLAuthentication;
|
||||||
import org.jivesoftware.smack.initializer.SmackAndOsgiInitializer;
|
import org.jivesoftware.smack.initializer.SmackInitializer;
|
||||||
|
|
||||||
public class SASLJavaXSmackInitializer extends SmackAndOsgiInitializer {
|
public class SASLJavaXSmackInitializer implements SmackInitializer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Exception> initialize() {
|
public List<Exception> initialize() {
|
||||||
|
@ -34,9 +34,4 @@ public class SASLJavaXSmackInitializer extends SmackAndOsgiInitializer {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Exception> initialize(ClassLoader classLoader) {
|
|
||||||
return initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.2.0"
|
|
||||||
enabled="true" immediate="true" name="Smack Resolver JavaX API">
|
|
||||||
<implementation
|
|
||||||
class="org.jivesoftware.smack.sasl.javax.SASLJavaXSmackInitializer" />
|
|
||||||
</scr:component>
|
|
|
@ -19,9 +19,9 @@ package org.jivesoftware.smack.sasl.provided;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SASLAuthentication;
|
import org.jivesoftware.smack.SASLAuthentication;
|
||||||
import org.jivesoftware.smack.initializer.SmackAndOsgiInitializer;
|
import org.jivesoftware.smack.initializer.SmackInitializer;
|
||||||
|
|
||||||
public class SASLProvidedSmackInitializer extends SmackAndOsgiInitializer {
|
public class SASLProvidedSmackInitializer implements SmackInitializer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Exception> initialize() {
|
public List<Exception> initialize() {
|
||||||
|
@ -31,9 +31,4 @@ public class SASLProvidedSmackInitializer extends SmackAndOsgiInitializer {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Exception> initialize(ClassLoader classLoader) {
|
|
||||||
return initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.2.0"
|
|
||||||
enabled="true" immediate="true" name="Smack Resolver JavaX API">
|
|
||||||
<implementation
|
|
||||||
class="org.jivesoftware.smack.sasl.provided.SASLProvidedSmackInitializer" />
|
|
||||||
</scr:component>
|
|
|
@ -14,15 +14,15 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smack.initializer.tcp;
|
package org.jivesoftware.smack.tcp;
|
||||||
|
|
||||||
import org.jivesoftware.smack.initializer.UrlInitializer;
|
import org.jivesoftware.smack.initializer.UrlInitializer;
|
||||||
|
|
||||||
public class SmackTcpSmackInitializer extends UrlInitializer {
|
public class TCPInitializer extends UrlInitializer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getProvidersUrl() {
|
protected String getProvidersUrl() {
|
||||||
return "classpath:org.jivesoftware.smack/smacktcp.providers";
|
return "classpath:org.jivesoftware.smack.tcp/smacktcp.providers";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue