當前位置: 首頁>>代碼示例>>Java>>正文


Java ProviderManager.addExtensionProvider方法代碼示例

本文整理匯總了Java中org.jivesoftware.smack.provider.ProviderManager.addExtensionProvider方法的典型用法代碼示例。如果您正苦於以下問題:Java ProviderManager.addExtensionProvider方法的具體用法?Java ProviderManager.addExtensionProvider怎麽用?Java ProviderManager.addExtensionProvider使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jivesoftware.smack.provider.ProviderManager的用法示例。


在下文中一共展示了ProviderManager.addExtensionProvider方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: XMPPConnector

import org.jivesoftware.smack.provider.ProviderManager; //導入方法依賴的package包/類
/**
 * The constructor for the XMPP bot.
 *
 * @param host
 *            The server the bot should login.
 * @param port
 *            The hosts port.
 * @param login
 *            The bots login name.
 * @param password
 *            The bots login password.
 * @param resource
 *            The bots resource (i.e. Work or Home). Can be null.
 * @throws IllegalArgumentException
 *             Throws an {@link IllegalArgumentException} if some of the parameters are in an
 *             invalid format.
 */
public XMPPConnector(String host, String port, String login, String password, String resource)
        throws IllegalArgumentException {
    checkParameters(host, port, login, password, resource);
    int numericalPort = port == null ? DEFAULT_XMPP_PORT : Integer.parseInt(port);
    this.sender = login + "@" + host + "/" + resource;
    SmackConfiguration.DEBUG_ENABLED = Boolean.parseBoolean(ApplicationPropertyXmpp.DEBUG
            .getValue());
    ProviderManager.addExtensionProvider(AliasPacketExtension.ALIAS_ELEMENT_NAME,
            AliasPacketExtension.ALIAS_NAMESPACE, AliasPacketExtension.class);
    ConnectionConfiguration config = new ConnectionConfiguration(host, numericalPort);
    connection = new XMPPTCPConnection(config);
    connect(login, password, resource);
    sendPriorityPresence();
    if (connection.isConnected()) {
        LOG.info(ResourceBundleManager.instance().getText("xmpp.connection.started",
                Locale.ENGLISH));
        connection.addConnectionListener(new XMPPConnectionStatusLogger());
    } else {
        LOG.info("The XMPP connection wasn't established.");
    }
}
 
開發者ID:Communote,項目名稱:communote-server,代碼行數:39,代碼來源:XMPPConnector.java

示例2: configure

import org.jivesoftware.smack.provider.ProviderManager; //導入方法依賴的package包/類
@Override
public void configure(ProviderManager pm) throws RemoteException {
	super.configure(pm);
	
	String pgpKey = getCoreService().requestPreference(ResourceUtils.KEY_PRIVATEKEY_FILE);
	String pgpKeyPassword = getCoreService().requestPreference(ResourceUtils.KEY_PRIVATEKEY_PASSWORD);
	
	EncryptedDataProvider edProvider;
	if (pgpKey != null && pgpKeyPassword != null){
		edProvider = new EncryptedDataProvider();
		edProvider.setMyKey(pgpKey);
		edProvider.setMyKeyPw(pgpKeyPassword);
		pm.addExtensionProvider("x", "jabber:x:signed", edProvider);
		pm.addExtensionProvider("x", "jabber:x:encrypted", edProvider);		
		
		Security.addProvider(edProvider.getProvider());			
	} else {
		edProvider = null;
		pm.removeExtensionProvider("x", "jabber:x:signed");
		pm.removeExtensionProvider("x", "jabber:x:encrypted");
	}
	
	((XMPPCryptoEntityAdapter)getEntityAdapter()).setEdProvider(edProvider);
}
 
開發者ID:snuk182,項目名稱:aceim,代碼行數:25,代碼來源:XMPPService.java

示例3: connect

import org.jivesoftware.smack.provider.ProviderManager; //導入方法依賴的package包/類
public void connect() throws IOException, XMPPException, SmackException {
    ProviderManager.addExtensionProvider(ReadReceipt.ELEMENT, ReadReceipt.NAMESPACE, new ReadReceipt.Provider());
    receiptReceivedListener = (fromJid, toJid, receiptId, receipt) -> {
        // TODO Handle read event
    };
    ReadReceiptManager.getInstanceFor(groupChatConnection).addReadReceivedListener(receiptReceivedListener);
    initGroupConnection();
    groupChatConnection.connect();
    groupChatConnection.login();
}
 
開發者ID:ukevgen,項目名稱:BizareChat,代碼行數:11,代碼來源:QuickbloxGroupXmppConnection.java

示例4: initPrivateConnection

import org.jivesoftware.smack.provider.ProviderManager; //導入方法依賴的package包/類
private void initPrivateConnection() {
    long currentUserId = CurrentUser.getInstance().getCurrentUserId();
    String currentUserPassword = CurrentUser.getInstance().getCurrentPassword();
    String userName = currentUserId + "-" + ApiConstants.APP_ID;
    XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder();
    configBuilder.setUsernameAndPassword(userName, currentUserPassword);
    configBuilder.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
    configBuilder.setServiceName(ApiConstants.CHAT_END_POINT);
    configBuilder.setHost(ApiConstants.CHAT_END_POINT);
    configBuilder.setDebuggerEnabled(true);

    privateChatConnection = new XMPPTCPConnection(configBuilder.build());
    privateChatConnection.addConnectionListener(this);

    ReconnectionManager manager = ReconnectionManager.getInstanceFor(privateChatConnection);
    manager.enableAutomaticReconnection();
    manager.setReconnectionPolicy(ReconnectionManager.ReconnectionPolicy.FIXED_DELAY);
    manager.setFixedDelay(15);

    ProviderManager.addExtensionProvider(Displayed.ELEMENT, Displayed.NAMESPACE, new Displayed.Provider());
    DisplayedManager.getInstanceFor(privateChatConnection).addDisplayedListener(
            (fromJid, toJid, receiptId, receipt) -> {
                messageService.get().processDisplayed(fromJid, toJid, receiptId, receipt);
            });

    ProviderManager.addExtensionProvider(Received.ELEMENT, Received.NAMESPACE, new Received.Provider());
    ReceivedManager.getInstanceFor(privateChatConnection).addReceivedListener(
            (fromJid, toJid, receiptId, receipt) -> {
                messageService.get().processReceived(fromJid, toJid, receiptId, receipt);
            });
}
 
開發者ID:ukevgen,項目名稱:BizareChat,代碼行數:32,代碼來源:QuickbloxPrivateXmppConnection.java

示例5: CcsClient

import org.jivesoftware.smack.provider.ProviderManager; //導入方法依賴的package包/類
private CcsClient() {
	// Add FCMPacketExtension
	ProviderManager.addExtensionProvider(Util.FCM_ELEMENT_NAME, Util.FCM_NAMESPACE,
			new ExtensionElementProvider<FcmPacketExtension>() {
				@Override
				public FcmPacketExtension parse(XmlPullParser parser, int initialDepth) 
						throws XmlPullParserException, IOException, SmackException {
					final String json = parser.nextText();
					return new FcmPacketExtension(json);
				}
			});
}
 
開發者ID:carlosCharz,項目名稱:fcmxmppserverv2,代碼行數:13,代碼來源:CcsClient.java

示例6: registerSmackProviders

import org.jivesoftware.smack.provider.ProviderManager; //導入方法依賴的package包/類
static void registerSmackProviders() {
	ProviderManager pm = ProviderManager.getInstance();
	// add IQ handling
	pm.addIQProvider("query", "http://jabber.org/protocol/disco#info",
			new DiscoverInfoProvider());
	// add delayed delivery notifications
	pm.addExtensionProvider("delay", "urn:xmpp:delay",
			new DelayInfoProvider());
	pm.addExtensionProvider("x", "jabber:x:delay", new DelayInfoProvider());
	// add carbons and forwarding
	pm.addExtensionProvider("forwarded", Forwarded.NAMESPACE,
			new Forwarded.Provider());
	pm.addExtensionProvider("sent", Carbon.NAMESPACE, new Carbon.Provider());
	pm.addExtensionProvider("received", Carbon.NAMESPACE,
			new Carbon.Provider());
	// add delivery receipts
	pm.addExtensionProvider(DeliveryReceipt.ELEMENT,
			DeliveryReceipt.NAMESPACE, new DeliveryReceipt.Provider());
	pm.addExtensionProvider(DeliveryReceiptRequest.ELEMENT,
			DeliveryReceipt.NAMESPACE,
			new DeliveryReceiptRequest.Provider());
	// add XMPP Ping (XEP-0199)
	pm.addIQProvider("ping", "urn:xmpp:ping", new PingProvider());

	ServiceDiscoveryManager.setIdentityName(XMPP_IDENTITY_NAME);
	ServiceDiscoveryManager.setIdentityType(XMPP_IDENTITY_TYPE);
}
 
開發者ID:victoryckl,項目名稱:XmppTest,代碼行數:28,代碼來源:SmackImpl.java

示例7: addSimplePacketExtension

import org.jivesoftware.smack.provider.ProviderManager; //導入方法依賴的package包/類
private static void addSimplePacketExtension(final String name, final String namespace) {
    ProviderManager.addExtensionProvider(name, namespace,
            new DataPacketProvider.PacketExtensionProvider() {
                public Stanza parseExtension(XmlPullParser parser) throws Exception {
                    StreamHandlingPacket packet = new StreamHandlingPacket(name, namespace);
                    int attributeCount = parser.getAttributeCount();
                    for (int i = 0; i < attributeCount; i++) {
                        packet.addAttribute(parser.getAttributeName(i),
                                parser.getAttributeValue(i));
                    }
                    return packet;
                }
            });
}
 
開發者ID:zom,項目名稱:Zom-Android,代碼行數:15,代碼來源:XmppStreamHandler.java

示例8: initializeRegistration

import org.jivesoftware.smack.provider.ProviderManager; //導入方法依賴的package包/類
/**
 * Initializes Smack for registration.
 */
public static void initializeRegistration() {
    disableSmackDefault();
    // not moving these into configuration since they are not loaded often
    ProviderManager.addIQProvider("query", "jabber:iq:register", new RegistrationProvider());
    ProviderManager.addExtensionProvider("x", "jabber:x:data", new DataFormProvider());
    ProviderManager.addExtensionProvider(Account.ELEMENT_NAME, Account.NAMESPACE, new Account.Provider());
}
 
開發者ID:kontalk,項目名稱:androidclient,代碼行數:11,代碼來源:SmackInitializer.java

示例9: initializeProviderManager

import org.jivesoftware.smack.provider.ProviderManager; //導入方法依賴的package包/類
/**
 * Adds all IQProvider to the ProviderManager so receiving datapackages will be parsed correctly.
 */
public static void initializeProviderManager(){
       /* These rows creates the provider manager that handles different extensions for XMPP
        * basically this tells smack how to handle different XML objects.
        */
       ProviderManager pm = ProviderManager.getInstance();
	pm.addIQProvider("spaces", NamespaceConfig.SPACES_SERVICE, new SpacesProvider());
       pm.addIQProvider("pubsub", NamespaceConfig.XMPP_PUBSUB, new PubSubProvider());
       pm.addIQProvider("pubsub", NamespaceConfig.XMPP_PUBSUB + "#owner", new PubSubProvider());
       pm.addExtensionProvider("subscription", NamespaceConfig.XMPP_PUBSUB, new SubscriptionProvider());
       pm.addExtensionProvider("subscriptions", NamespaceConfig.XMPP_PUBSUB, new SubscriptionsProvider());
       pm.addExtensionProvider("subscriptions", NamespaceConfig.XMPP_PUBSUB + "#owner", new SubscriptionsProvider());
       pm.addExtensionProvider("affiliations", NamespaceConfig.XMPP_PUBSUB, new AffiliationsProvider());
       pm.addExtensionProvider("affiliation", NamespaceConfig.XMPP_PUBSUB, new AffiliationProvider());
       pm.addExtensionProvider("options", NamespaceConfig.XMPP_PUBSUB, new FormNodeProvider());
       pm.addExtensionProvider("options", NamespaceConfig.XMPP_PUBSUB + "#event", new FormNodeProvider());
       pm.addExtensionProvider("configure", NamespaceConfig.XMPP_PUBSUB + "#owner", new FormNodeProvider());
       pm.addExtensionProvider("default", NamespaceConfig.XMPP_PUBSUB + "#owner", new FormNodeProvider());
       pm.addExtensionProvider("event", NamespaceConfig.XMPP_PUBSUB + "#event", new EventProvider());
       pm.addExtensionProvider("configuration", NamespaceConfig.XMPP_PUBSUB + "#event", new ConfigEventProvider());
       pm.addExtensionProvider("delete", NamespaceConfig.XMPP_PUBSUB + "#event", new SimpleNodeProvider());
       pm.addExtensionProvider("create", NamespaceConfig.XMPP_PUBSUB, new SimpleNodeProvider());
       pm.addExtensionProvider("retract", NamespaceConfig.XMPP_PUBSUB + "#event", new RetractEventProvider());
       pm.addExtensionProvider("purge", NamespaceConfig.XMPP_PUBSUB + "#event", new SimpleNodeProvider());
       pm.addExtensionProvider("items", NamespaceConfig.XMPP_PUBSUB, new ItemsProvider());
       pm.addExtensionProvider("items", NamespaceConfig.XMPP_PUBSUB + "#event", new ItemsProvider());
       pm.addExtensionProvider("item", NamespaceConfig.XMPP_PUBSUB, new ItemProvider());
       pm.addExtensionProvider("item", NamespaceConfig.XMPP_PUBSUB + "#event", new ItemProvider());
       pm.addExtensionProvider("item", "", new ItemProvider());
       
       pm.addExtensionProvider("headers", "http://jabber.org/protocol/shim", new HeadersProvider());
       pm.addExtensionProvider("header", "http://jabber.org/protocol/shim", new HeaderProvider());
       
       pm.addExtensionProvider("x", "jabber:x:data", new DataFormProvider());
       
       pm.addIQProvider("query", "http://jabber.org/protocol/disco#items", new DiscoverItemsProvider());
       pm.addIQProvider("query", "http://jabber.org/protocol/disco#info", new DiscoverInfoProvider());
       pm.addIQProvider("query", NamespaceConfig.PERSISTENCE_SERVICE, new PersistenceServiceQueryProvider());
       pm.addIQProvider("delete", NamespaceConfig.PERSISTENCE_SERVICE, new PersistenceServiceDeleteProvider());
}
 
開發者ID:MirrorIP,項目名稱:msf-spaces-sdk-android,代碼行數:43,代碼來源:ProviderInitializer.java

示例10: configure

import org.jivesoftware.smack.provider.ProviderManager; //導入方法依賴的package包/類
private void configure() {
    ProviderManager.addIQProvider(Ping.ELEMENT_NAME, Ping.NAMESPACE, new Ping.Provider());
    ProviderManager.addIQProvider(UploadInfo.ELEMENT_NAME, UploadInfo.NAMESPACE, new UploadInfo.Provider());
    ProviderManager.addIQProvider(VCard4.ELEMENT_NAME, VCard4.NAMESPACE, new VCard4.Provider());
    ProviderManager.addIQProvider(BlockingCommand.BLOCKLIST, BlockingCommand.NAMESPACE, new BlockingCommand.Provider());
    ProviderManager.addExtensionProvider(StanzaGroupExtension.ELEMENT_NAME, StanzaGroupExtension.NAMESPACE, new StanzaGroupExtension.Provider());
    ProviderManager.addExtensionProvider(SentServerReceipt.ELEMENT_NAME, SentServerReceipt.NAMESPACE, new SentServerReceipt.Provider());
    ProviderManager.addExtensionProvider(ReceivedServerReceipt.ELEMENT_NAME, ReceivedServerReceipt.NAMESPACE, new ReceivedServerReceipt.Provider());
    ProviderManager.addExtensionProvider(ServerReceiptRequest.ELEMENT_NAME, ServerReceiptRequest.NAMESPACE, new ServerReceiptRequest.Provider());
    ProviderManager.addExtensionProvider(AckServerReceipt.ELEMENT_NAME, AckServerReceipt.NAMESPACE, new AckServerReceipt.Provider());
    ProviderManager.addExtensionProvider(OutOfBandData.ELEMENT_NAME, OutOfBandData.NAMESPACE, new OutOfBandData.Provider());
    ProviderManager.addExtensionProvider(BitsOfBinary.ELEMENT_NAME, BitsOfBinary.NAMESPACE, new BitsOfBinary.Provider());
    ProviderManager.addExtensionProvider(SubscribePublicKey.ELEMENT_NAME, SubscribePublicKey.NAMESPACE, new SubscribePublicKey.Provider());
    ProviderManager.addExtensionProvider(E2EEncryption.ELEMENT_NAME, E2EEncryption.NAMESPACE, new E2EEncryption.Provider());
}
 
開發者ID:ShadiNachat,項目名稱:Chatting-App-,代碼行數:16,代碼來源:MessageCenterService.java

示例11: PresenceListener

import org.jivesoftware.smack.provider.ProviderManager; //導入方法依賴的package包/類
public PresenceListener(Roster roster, RosterHandler handler) {
    mRoster = roster;
    mHandler = handler;

    ProviderManager.addExtensionProvider(
            PublicKeyPresence.ELEMENT_NAME,
            PublicKeyPresence.NAMESPACE,
            new PublicKeyPresence.Provider());

    ProviderManager.addExtensionProvider(
            PresenceSignature.ELEMENT_NAME,
            PresenceSignature.NAMESPACE,
            new PresenceSignature.Provider());
}
 
開發者ID:kontalk,項目名稱:desktopclient-java,代碼行數:15,代碼來源:PresenceListener.java

示例12: registerSmackProviders

import org.jivesoftware.smack.provider.ProviderManager; //導入方法依賴的package包/類
static void registerSmackProviders() {
	ProviderManager pm = ProviderManager.getInstance();
	// add IQ handling
	pm.addIQProvider("query","http://jabber.org/protocol/disco#info", new DiscoverInfoProvider());
	pm.addIQProvider("query","http://jabber.org/protocol/disco#items", new DiscoverItemsProvider());
	// add delayed delivery notifications
	pm.addExtensionProvider("delay","urn:xmpp:delay", new DelayInfoProvider());
	pm.addExtensionProvider("x","jabber:x:delay", new DelayInfoProvider());
	// add XEP-0092 Software Version
	pm.addIQProvider("query", Version.NAMESPACE, new Version.Provider());

	// add carbons and forwarding
	pm.addExtensionProvider("forwarded", Forwarded.NAMESPACE, new Forwarded.Provider());
	pm.addExtensionProvider("sent", Carbon.NAMESPACE, new Carbon.Provider());
	pm.addExtensionProvider("received", Carbon.NAMESPACE, new Carbon.Provider());
	// add delivery receipts
	pm.addExtensionProvider(DeliveryReceipt.ELEMENT, DeliveryReceipt.NAMESPACE, new DeliveryReceipt.Provider());
	pm.addExtensionProvider(DeliveryReceiptRequest.ELEMENT, DeliveryReceipt.NAMESPACE, new DeliveryReceiptRequest.Provider());
	// add XMPP Ping (XEP-0199)
	pm.addIQProvider("ping","urn:xmpp:ping", new PingProvider());

	ServiceDiscoveryManager.setDefaultIdentity(YAXIM_IDENTITY);
	
	// XEP-0115 Entity Capabilities
	pm.addExtensionProvider("c", "http://jabber.org/protocol/caps", new CapsExtensionProvider());

	XmppStreamHandler.addExtensionProviders();
}
 
開發者ID:ufo22940268,項目名稱:maven-yaxim,代碼行數:29,代碼來源:SmackableImp.java

示例13: addExtensionProviders

import org.jivesoftware.smack.provider.ProviderManager; //導入方法依賴的package包/類
static void addExtensionProviders() {
    ProviderManager pm = ProviderManager.getInstance();
    // add IQ handling
    pm.addIQProvider("query", "http://jabber.org/protocol/disco#info",
            new DiscoverInfoProvider());
    // add delivery receipts
    pm.addExtensionProvider("received", NAMESPACE, new DeliveryReceiptProvider());
}
 
開發者ID:prive,項目名稱:prive-android,代碼行數:9,代碼來源:DeliveryReceipts.java

示例14: configureProviderManager

import org.jivesoftware.smack.provider.ProviderManager; //導入方法依賴的package包/類
public static void configureProviderManager() {
    ProviderManager pm = ProviderManager.getInstance();

    //  Service Discovery # Items
    pm.addIQProvider("query","http://jabber.org/protocol/disco#items", new DiscoverItemsProvider());
    //  Service Discovery # Info
    pm.addIQProvider("query","http://jabber.org/protocol/disco#info", new DiscoverInfoProvider());
    //  Data Forms
    pm.addExtensionProvider("x","jabber:x:data", new DataFormProvider());
    // XEP-0199 XMPP Ping
    pm.addIQProvider("ping", "urn:xmpp:ping", new PingProvider());

    // XEP-0115 Entity Capabilities
    pm.addExtensionProvider("c", "http://jabber.org/protocol/caps", new CapsExtensionProvider());
}
 
開發者ID:xtang,項目名稱:asmack-mini,代碼行數:16,代碼來源:ConfigureProviderManager.java

示例15: addExtensions

import org.jivesoftware.smack.provider.ProviderManager; //導入方法依賴的package包/類
private void addExtensions() {
    // Microblogging
    ProviderManager.addExtensionProvider(PostEntryExtension.ELEMENT, PostEntryExtension.NAMESPACE, new PostEntryProvider());
}
 
開發者ID:esl,項目名稱:mangosta-android,代碼行數:5,代碼來源:XMPPSession.java


注:本文中的org.jivesoftware.smack.provider.ProviderManager.addExtensionProvider方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。