• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java KrakenPlugin类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中net.sf.kraken.KrakenPlugin的典型用法代码示例。如果您正苦于以下问题:Java KrakenPlugin类的具体用法?Java KrakenPlugin怎么用?Java KrakenPlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

KrakenPlugin类属于net.sf.kraken包,在下文中一共展示了KrakenPlugin类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: updateRegistration

点赞 3

import net.sf.kraken.KrakenPlugin; //导入依赖的package包/类
/**
 * Updates a registration via the web interface.
 *
 *
 * @param registrationID ID number associated with registration to modify.
 * @param legacyUsername User's updated username on the legacy service.
 * @param legacyPassword User's updated password on the legacy service, null if no change.
 * @param legacyNickname User's updated nickname on the legacy service.
 * @return Error message or null on success.
 */
public String updateRegistration(Integer registrationID, String legacyUsername, String legacyPassword, String legacyNickname) {
    PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
    KrakenPlugin plugin = (KrakenPlugin)pluginManager.getPlugin("kraken");
    try {
        Registration reg = new Registration(registrationID);
        if (!plugin.getTransportInstance(reg.getTransportType().toString()).isEnabled()) {
            return LocaleUtils.getLocalizedString("gateway.web.registrations.notenabled", "kraken");
        }
        reg.setUsername(legacyUsername);
        if (legacyPassword != null) {
            reg.setPassword(legacyPassword);
        }
        reg.setNickname(legacyNickname);
        return null;
    }
    catch (NotFoundException e) {
        // Ok, nevermind.
        Log.error("Not found while editing id "+registrationID, e);
        return LocaleUtils.getLocalizedString("gateway.web.registrations.regnotfound", "kraken");
    }
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:32,
代码来源:ConfigManager.java

示例2: logoutSession

点赞 3

import net.sf.kraken.KrakenPlugin; //导入依赖的package包/类
/**
 * Logs out session via the web interface.
 *
 *
 * @param registrationID ID number associated with registration to log off.
 * @return registration ID on success, -1 on failure (-1 so that js cb_logoutSession knows which Div to edit)
*/

public Integer logoutSession(Integer registrationID)
{
    try
    {
        PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
        KrakenPlugin plugin = (KrakenPlugin)pluginManager.getPlugin("kraken");
        Registration registration = new Registration(registrationID);
        if (!plugin.getTransportInstance(registration.getTransportType().toString()).isEnabled()) {
            return -1;
        }
        JID jid = registration.getJID();
        TransportSession session = plugin.getTransportInstance(registration.getTransportType().toString()).getTransport().getSessionManager().getSession(jid);
        plugin.getTransportInstance(registration.getTransportType().toString()).getTransport().registrationLoggedOut(session);
        return registrationID;
    }
    catch(NotFoundException e)
    {
        return -1;
    }
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:29,
代码来源:ConfigManager.java

示例3: logoutSession

点赞 3

import net.sf.kraken.KrakenPlugin; //导入依赖的package包/类
/**
    * Logs out session via the web interface.
    *
    *
    * @param registrationID ID number associated with registration to log off.
    * @return registration ID on success, -1 on failure (-1 so that js cb_logoutSession knows which Div to edit)
   */

public Integer logoutSession(Integer registrationID)
{
	try
	{
		PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
		KrakenPlugin plugin = (KrakenPlugin)pluginManager.getPlugin("kraken");
		Registration registration = new Registration(registrationID);
		if (!plugin.getTransportInstance(registration.getTransportType().toString()).isEnabled()) {
               return -1;
           }
		JID jid = registration.getJID();
		TransportSession session = plugin.getTransportInstance(registration.getTransportType().toString()).getTransport().getSessionManager().getSession(jid);
		plugin.getTransportInstance(registration.getTransportType().toString()).getTransport().registrationLoggedOut(session);
		return registrationID;
	}
	catch(NotFoundException e)
	{
		return -1;
	}
}
 

开发者ID:coodeer,
项目名称:g3server,
代码行数:29,
代码来源:ConfigManager.java

示例4: getActiveTransports

点赞 2

import net.sf.kraken.KrakenPlugin; //导入依赖的package包/类
/**
 * Retrieve a list of all active/enabled transports.
 *
 * @param password Auth password for making changes
 * @return List of active transports.
 */
public List<String> getActiveTransports(String password) {
    if (!verifyPassword(password)) {
        return Arrays.asList("Authorization failed!");
    }
    PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
    KrakenPlugin plugin = (KrakenPlugin)pluginManager.getPlugin("kraken");
    List<String> activeTransports = new ArrayList<String>();
    for (String transport : plugin.getTransports()) {
        if (plugin.serviceEnabled(transport)) {
            activeTransports.add(transport);
        }
    }
    return activeTransports;
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:21,
代码来源:XMLRPCConduit.java

示例5: toggleTransport

点赞 2

import net.sf.kraken.KrakenPlugin; //导入依赖的package包/类
/**
 * Toggles whether a transport is enabled or disabled.
 *
 * @param transportName Name of the transport to be enabled or disabled (type of transport)
 * @return True or false if the transport is enabled after this call.
 */
public boolean toggleTransport(String transportName) {
    PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
    KrakenPlugin plugin = (KrakenPlugin)pluginManager.getPlugin("kraken");
    if (!plugin.serviceEnabled(transportName)) {
        plugin.enableService(transportName);
        return true;
    }
    else {
        plugin.disableService(transportName);
        return false;
    }
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:19,
代码来源:ConfigManager.java

示例6: leftCluster

点赞 2

import net.sf.kraken.KrakenPlugin; //导入依赖的package包/类
/**
 * @see org.jivesoftware.openfire.cluster.ClusterEventListener#leftCluster(byte[])
 */
public void leftCluster(byte[] leavingNodeID) {
    KrakenPlugin plugin = getPlugin();
    // TODO: Is this correct?  Lets say another node updates an entry before I get to it, will I see the update?
    for (Map.Entry<String,byte[]> entry : sessionLocations.entrySet()) {
        if (Arrays.equals(entry.getValue(), leavingNodeID)) {
            Lock l = CacheFactory.getLock(entry.getKey()+"lc", sessionLocations);
            try {
                l.lock();
                String jid = entry.getKey().substring(0, entry.getKey().lastIndexOf("@"));
                String trType = entry.getKey().substring(entry.getKey().lastIndexOf("@")+1);
                Log.debug("Kraken: Node handling session "+jid+" on "+trType+" lost, taking over session...");
                sessionLocations.remove(jid+"@"+trType);
                TransportInstance trInstance = plugin.getTransportInstance(trType);
                if (trInstance != null) {
                    BaseTransport<? extends TransportBuddy> transport = trInstance.getTransport();
                    if (transport != null) {
                        Collection<ClientSession> sessions = XMPPServer.getInstance().getSessionManager().getSessions(new JID(jid).getNode());
                        for (ClientSession session : sessions) {
                            transport.processPacket(session.getPresence());
                        }
                    }
                }
            }
            finally {
                l.unlock();
            }
        }
    }
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:33,
代码来源:TransportSessionRouter.java

示例7: TransportSessionRouter

点赞 2

import net.sf.kraken.KrakenPlugin; //导入依赖的package包/类
/**
 * Creates a transport session router instance associated with the plugin.
 *
 * @param plugin Kraken plugin instance we are associated with.
 */
public TransportSessionRouter(KrakenPlugin plugin) {
    pluginRef = new WeakReference<KrakenPlugin>(plugin);
    sessionLocations = CacheFactory.createCache(TRANSPORTSESSION_CACHE_NAME);
    ClusterManager.addListener(this);
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:11,
代码来源:TransportSessionRouter.java

示例8: getPlugin

点赞 1

import net.sf.kraken.KrakenPlugin; //导入依赖的package包/类
/**
 * Retrieves the reference to the plugin we are associated with.
 *
 * @return KrakenPlugin instance.
 */
public KrakenPlugin getPlugin() {
    return pluginRef.get();
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:9,
代码来源:TransportSessionRouter.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)