mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-23 12:32:06 +01:00
Documentation
This commit is contained in:
parent
d61f9a511d
commit
520f77112d
5 changed files with 16 additions and 16 deletions
|
@ -24,25 +24,25 @@ import org.jivesoftware.smack.Manager;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by vanitas on 13.07.17.
|
* Manager for Jingle Encrypted Transfers (XEP-XXXX).
|
||||||
*/
|
*/
|
||||||
public final class JingleEncryptedTransferManager extends Manager {
|
public final class JetManager extends Manager {
|
||||||
|
|
||||||
public static final String NAMESPACE = "urn:xmpp:jingle:jet:0";
|
public static final String NAMESPACE = "urn:xmpp:jingle:jet:0";
|
||||||
|
|
||||||
private static final WeakHashMap<XMPPConnection, JingleEncryptedTransferManager> INSTANCES = new WeakHashMap<>();
|
private static final WeakHashMap<XMPPConnection, JetManager> INSTANCES = new WeakHashMap<>();
|
||||||
|
|
||||||
private static final Map<String, JingleEncryptionMethod> encryptionProviders = new HashMap<>();
|
private static final Map<String, JingleEncryptionMethod> encryptionProviders = new HashMap<>();
|
||||||
|
|
||||||
private JingleEncryptedTransferManager(XMPPConnection connection) {
|
private JetManager(XMPPConnection connection) {
|
||||||
super(connection);
|
super(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JingleEncryptedTransferManager getInstanceFor(XMPPConnection connection) {
|
public static JetManager getInstanceFor(XMPPConnection connection) {
|
||||||
JingleEncryptedTransferManager manager = INSTANCES.get(connection);
|
JetManager manager = INSTANCES.get(connection);
|
||||||
|
|
||||||
if (manager == null) {
|
if (manager == null) {
|
||||||
manager = new JingleEncryptedTransferManager(connection);
|
manager = new JetManager(connection);
|
||||||
INSTANCES.put(connection, manager);
|
INSTANCES.put(connection, manager);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jxmpp.jid.FullJid;
|
import org.jxmpp.jid.FullJid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by vanitas on 13.07.17.
|
* Classes that implement this interface can be used to encrypt Jingle File Transfers.
|
||||||
*/
|
*/
|
||||||
public interface JingleEncryptionMethod {
|
public interface JingleEncryptionMethod {
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by vanitas on 13.07.17.
|
* Manager where JingleEncryptionMethods can register their SecurityKeyTransportProviders.
|
||||||
*/
|
*/
|
||||||
public final class JingleEncryptionMethodManager {
|
public final class JingleEncryptionMethodManager {
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,10 @@ package org.jivesoftware.smackx.jet.element;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
import org.jivesoftware.smackx.jet.JingleEncryptedTransferManager;
|
import org.jivesoftware.smackx.jet.JetManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by vanitas on 13.07.17.
|
* Implementation of the Jingle security element as specified in XEP-XXXX (Jingle Encrypted Transfers).
|
||||||
*/
|
*/
|
||||||
public class SecurityElement implements ExtensionElement {
|
public class SecurityElement implements ExtensionElement {
|
||||||
public static final String ELEMENT = "security";
|
public static final String ELEMENT = "security";
|
||||||
|
@ -53,6 +53,6 @@ public class SecurityElement implements ExtensionElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNamespace() {
|
public String getNamespace() {
|
||||||
return JingleEncryptedTransferManager.NAMESPACE;
|
return JetManager.NAMESPACE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,22 +22,22 @@ import java.util.logging.Logger;
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
import org.jivesoftware.smack.util.Objects;
|
import org.jivesoftware.smack.util.Objects;
|
||||||
import org.jivesoftware.smackx.jet.JingleEncryptedTransferManager;
|
import org.jivesoftware.smackx.jet.JetManager;
|
||||||
import org.jivesoftware.smackx.jet.JingleEncryptionMethodManager;
|
import org.jivesoftware.smackx.jet.JingleEncryptionMethodManager;
|
||||||
import org.jivesoftware.smackx.jet.element.SecurityElement;
|
import org.jivesoftware.smackx.jet.element.SecurityElement;
|
||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by vanitas on 13.07.17.
|
* Provider for the Jingle security element for XEP-XXXX (Jingle Encrypted Transfers).
|
||||||
*/
|
*/
|
||||||
public class SecurityProvider extends ExtensionElementProvider<SecurityElement> {
|
public class SecurityProvider extends ExtensionElementProvider<SecurityElement> {
|
||||||
private static final Logger LOGGER = Logger.getLogger(SecurityProvider.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(SecurityProvider.class.getName());
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SecurityElement parse(XmlPullParser parser, int initialDepth) throws Exception {
|
public SecurityElement parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||||
String name = parser.getAttributeValue(JingleEncryptedTransferManager.NAMESPACE, SecurityElement.ATTR_NAME);
|
String name = parser.getAttributeValue(JetManager.NAMESPACE, SecurityElement.ATTR_NAME);
|
||||||
String type = parser.getAttributeValue(JingleEncryptedTransferManager.NAMESPACE, SecurityElement.ATTR_TYPE);
|
String type = parser.getAttributeValue(JetManager.NAMESPACE, SecurityElement.ATTR_TYPE);
|
||||||
ExtensionElement child;
|
ExtensionElement child;
|
||||||
|
|
||||||
Objects.requireNonNull(type);
|
Objects.requireNonNull(type);
|
||||||
|
|
Loading…
Reference in a new issue