当前位置: 首页>>代码示例>>Java>>正文


Java XMPPServer.getInstance方法代码示例

本文整理汇总了Java中org.jivesoftware.openfire.XMPPServer.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java XMPPServer.getInstance方法的具体用法?Java XMPPServer.getInstance怎么用?Java XMPPServer.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.openfire.XMPPServer的用法示例。


在下文中一共展示了XMPPServer.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createUser

import org.jivesoftware.openfire.XMPPServer; //导入方法依赖的package包/类
private User createUser(String userName, String password, String displayName)
                          throws UserAlreadyExistsException {
  if (userName.length() >= 64) {
    throw new IllegalArgumentException("user name too long");
  }

  boolean usePlainPassword = JiveGlobals.getBooleanProperty("user.usePlainPassword");
  if (usePlainPassword && password.length() >= 32) {
    throw new IllegalArgumentException("password too long");
  }

  XMPPServer server = XMPPServer.getInstance();
  User user = server.getUserManager().createUser(userName, password,
      displayName, null);
  return user;
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:17,代码来源:MMXAppManager.java

示例2: isAdmin

import org.jivesoftware.openfire.XMPPServer; //导入方法依赖的package包/类
/**
   * Check if the <code>from</code> has admin capability.  Only the escaped
   * node part (userID) is validate.  TODO: it is not clear how the Openfire
   * stores the node as escaped or unescaped JID.
   *
   * @param from A full JID or bare JID.
   * @return
   */
  public static boolean isAdmin(JID from) {
    XMPPServer server = XMPPServer.getInstance();
    if (server.isLocal(from)) {
      String userId = from.getNode();
      for (JID admin : server.getAdmins()) {
//        if (JID.equals(admin.getNode(), userId)) {
//          return true;
//        }
        String adminNode = admin.getNode();
        if (adminNode.equals(userId)) {
          return true;
        }
      }
    }
    return false;
  }
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:25,代码来源:Helper.java

示例3: logout

import org.jivesoftware.openfire.XMPPServer; //导入方法依赖的package包/类
/**
 * Disconnect an XMPP session of a user identified by an oauth token.
 * @param headers
 * @return
 */
@DELETE
@Produces(MediaType.APPLICATION_JSON)
@Path("logout")
public Response logout(@Context HttpHeaders headers) {
  TokenInfo tokenInfo = RestUtils.getAuthTokenInfo(headers);
  if (tokenInfo == null) {
    return RestUtils.getUnauthJAXRSResp();
  }
  
  JID from = RestUtils.createJID(tokenInfo);
  XMPPServer xmppSrv = XMPPServer.getInstance();
  SessionManager sessionMgr = xmppSrv.getSessionManager();
  ClientSession session = sessionMgr.getSession(from);
  if (session == null) {
    ErrorResponse response = new ErrorResponse(ErrorCode.USER_NOT_LOGIN,
        String.format("Session is not found: %s [%s]", from, tokenInfo.getUserName()));
    return RestUtils.getJAXRSResp(Response.Status.GONE, response);
  }
  // Terminate the session now.
  session.close();
  return RestUtils.getOKJAXRSResp();
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:28,代码来源:UserResource.java

示例4: run

import org.jivesoftware.openfire.XMPPServer; //导入方法依赖的package包/类
public void run() {
    // Send the last published items for the contacts on availableSessionJID's roster.
    try {
        final XMPPServer server = XMPPServer.getInstance();
        final Roster roster = server.getRosterManager().getRoster(availableSessionJID.getNode());
        for (final RosterItem item : roster.getRosterItems()) {
            if (server.isLocal(item.getJid()) && (item.getSubStatus() == RosterItem.SUB_BOTH ||
                    item.getSubStatus() == RosterItem.SUB_TO)) {
                PEPService pepService = pepServiceManager.getPEPService(item.getJid().toBareJID());
                if (pepService != null) {
                    pepService.sendLastPublishedItems(availableSessionJID);
                }
            }
        }
    }
    catch (UserNotFoundException e) {
        // Do nothing
    }
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:20,代码来源:IQPEPHandler.java

示例5: enableService

import org.jivesoftware.openfire.XMPPServer; //导入方法依赖的package包/类
public void enableService(boolean enabled, boolean persistent) {
    if (isServiceEnabled() == enabled) {
        // Do nothing if the service status has not changed
        return;
    }
    XMPPServer server = XMPPServer.getInstance();
    if (!enabled) {
        // Disable disco information
        server.getIQDiscoItemsHandler().removeServerItemsProvider(this);
        // Stop the service/module
        stop();
    }
    if (persistent) {
        MUCPersistenceManager.setProperty(chatServiceName, "enabled", Boolean.toString(enabled));
    }
    serviceEnabled = enabled;
    if (enabled) {
        // Start the service/module
        start();
        // Enable disco information
        server.getIQDiscoItemsHandler().addServerItemsProvider(this);
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:24,代码来源:MultiUserChatServiceImpl.java

示例6: initializePlugin

import org.jivesoftware.openfire.XMPPServer; //导入方法依赖的package包/类
public void initializePlugin(PluginManager manager, File pluginDirectory) {
    server = XMPPServer.getInstance();
    userManager = server.getUserManager();

    secret = JiveGlobals.getProperty("plugin.userservice.secret", "");
    // If no secret key has been assigned to the user service yet, assign a random one.
    if (secret.equals("")){
        secret = StringUtils.randomString(8);
        setSecret(secret);
    }
    
    // See if the service is enabled or not.
    enabled = JiveGlobals.getBooleanProperty("plugin.userservice.enabled", false);

    // Get the list of IP addresses that can use this service. An empty list means that this filter is disabled.
    allowedIPs = StringUtils.stringToCollection(JiveGlobals.getProperty("plugin.userservice.allowedIPs", ""));

    // Listen to system property events
    PropertyEventDispatcher.addListener(this);
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:21,代码来源:UserServicePlugin.java

示例7: buildPluginsUpdateList

import org.jivesoftware.openfire.XMPPServer; //导入方法依赖的package包/类
/**
 * Recreate the list of plugins that need to be updated based on the list of
 * available plugins at igniterealtime.org.
 */
private void buildPluginsUpdateList() {
    // Reset list of plugins that need to be updated
    pluginUpdates = new ArrayList<Update>();
    XMPPServer server = XMPPServer.getInstance();
    // Compare local plugins versions with latest ones
    for (Plugin plugin : server.getPluginManager().getPlugins()) {
        String pluginName = server.getPluginManager().getName(plugin);
        AvailablePlugin latestPlugin = availablePlugins.get(pluginName);
        String currentVersion = server.getPluginManager().getVersion(plugin);
        if (latestPlugin != null &&
                latestPlugin.getLatestVersion().compareTo(currentVersion) > 0) {
            // Check if the update can run in the current version of the server
            String serverVersion =
                    XMPPServer.getInstance().getServerInfo().getVersion().getVersionString();
            if (serverVersion.compareTo(latestPlugin.getMinServerVersion()) >= 0) {
                Update update = new Update(pluginName, latestPlugin.getLatestVersion(),
                        latestPlugin.getChangelog(), latestPlugin.getURL());
                pluginUpdates.add(update);
            }
        }
    }
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:27,代码来源:UpdateManager.java

示例8: MainInterceptor

import org.jivesoftware.openfire.XMPPServer; //导入方法依赖的package包/类
public MainInterceptor() {
	Log.info("Created MainInterceptor for GoJara Plugin.");
	server = XMPPServer.getInstance();
	RosterManager rosterManager = server.getRosterManager();

	AbstractRemoteRosterProcessor iqRegisteredProcessor = new DiscoIQRegisteredProcessor();
	AbstractRemoteRosterProcessor iqRosterPayloadProcessor = new IQRosterPayloadProcessor(rosterManager);
	AbstractRemoteRosterProcessor nonPersistantProcessor = new NonPersistantRosterProcessor(rosterManager);
	AbstractRemoteRosterProcessor statisticsProcessor = new StatisticsProcessor();
	AbstractRemoteRosterProcessor updateToComponentProcessor = new ClientToComponentUpdateProcessor(activeTransports);
	AbstractRemoteRosterProcessor whitelistProcessor = new WhitelistProcessor(activeTransports);
	AbstractRemoteRosterProcessor mucfilterProcessor = new MucFilterProcessor();
	AbstractRemoteRosterProcessor gojaraAdminProcessor = new GojaraAdminProcessor();
	packetProcessors.put("sparkIQRegistered", iqRegisteredProcessor);
	packetProcessors.put("iqRosterPayload", iqRosterPayloadProcessor);
	packetProcessors.put("handleNonPersistant", nonPersistantProcessor);
	packetProcessors.put("statisticsProcessor", statisticsProcessor);
	packetProcessors.put("clientToComponentUpdate", updateToComponentProcessor);
	packetProcessors.put("whitelistProcessor", whitelistProcessor);
	packetProcessors.put("mucfilterProcessor", mucfilterProcessor);
	packetProcessors.put("gojaraAdminProcessor", gojaraAdminProcessor);
	frozen = false;

}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:25,代码来源:MainInterceptor.java

示例9: initializePlugin

import org.jivesoftware.openfire.XMPPServer; //导入方法依赖的package包/类
public void initializePlugin(PluginManager manager, File pluginDirectory) {
    server = XMPPServer.getInstance();
    userManager = server.getUserManager();
    rosterManager = server.getRosterManager();

    secret = JiveGlobals.getProperty("plugin.userservice.secret", "");
    // If no secret key has been assigned to the user service yet, assign a random one.
    if (secret.equals("")){
        secret = StringUtils.randomString(8);
        setSecret(secret);
    }

    // See if the service is enabled or not.
    enabled = JiveGlobals.getBooleanProperty("plugin.userservice.enabled", false);

    // Get the list of IP addresses that can use this service. An empty list means that this filter is disabled.
    allowedIPs = StringUtils.stringToCollection(JiveGlobals.getProperty("plugin.userservice.allowedIPs", ""));

    // Listen to system property events
    PropertyEventDispatcher.addListener(this);
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:22,代码来源:UserServicePlugin.java

示例10: destroyPlugin

import org.jivesoftware.openfire.XMPPServer; //导入方法依赖的package包/类
public void destroyPlugin() {
  XMPPServer server = XMPPServer.getInstance();
  IQRouter iqRouter = server.getIQRouter();
  iqRouter.removeHandler(mIQAppRegHandler);
  iqRouter.removeHandler(mIQDevRegHandler);
  iqRouter.removeHandler(mIQUserRegHandler);
  iqRouter.removeHandler(mIQMessageStateHandler);
  iqRouter.removeHandler(mIQPubSubHandler);
  iqRouter.removeHandler(mIQWakeupNSHandler);
  iqRouter.removeHandler(mIQPushNSHandler);
  iqRouter.removeHandler(mIQMsgAckNSHandler);
  InterceptorManager.getInstance().removeInterceptor(mmxPacketInterceptor);
  wakeupExecutionManager.stopWakeupExecution();
  timeoutExecutionManager.stopTimeoutCheck();

  // shutdown geo event dispatcher
  contextDispatcher.shutdown();


  //Teardown the APNS Connection pool
  APNSConnectionPoolImpl.teardown();
  adminAPIServer.stop();
  publicAPIServer.stop();

  // disable the pub/sub wakeup
  server.getPubSubModule().setWakeupProvider(null);

  try {
    ObjectName mbeanName = new ObjectName(MMXServerConstants.MMX_MBEAN_NAME);
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    mbs.unregisterMBean(mbeanName);
  } catch(Exception e) {
    Log.error("destroyPlugin : error unregistering mbean={}", MMXServerConstants.MMX_MBEAN_NAME);
  }
  apnsFeedbackProcessExecutionManager.stop();
  Log.info("App Management Plugin is destroyed");
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:38,代码来源:MMXPlugin.java

示例11: startProxy

import org.jivesoftware.openfire.XMPPServer; //导入方法依赖的package包/类
private void startProxy() {
    connectionManager.processConnections(bindInterface, getProxyPort());
    routingTable.addComponentRoute(getAddress(), this);
    XMPPServer server = XMPPServer.getInstance();

    server.getIQDiscoItemsHandler().addServerItemsProvider(this);
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:8,代码来源:FileTransferProxy.java

示例12: create

import org.jivesoftware.openfire.XMPPServer; //导入方法依赖的package包/类
public PEPService create(JID owner) {
	// Return an error if the packet is from an anonymous, unregistered user
	// or remote user
	if (!XMPPServer.getInstance().isLocal(owner)
			|| !UserManager.getInstance().isRegisteredUser(owner.getNode())) {
		throw new IllegalArgumentException(
				"Request must be initiated by a local, registered user, but is not: "
						+ owner);
	}

	PEPService pepService = null;
	final String bareJID = owner.toBareJID();
	final Lock lock = CacheFactory.getLock(owner, pepServices);
	try {
		lock.lock();

		pepService = pepServices.get(bareJID);
		if (pepService == null) {
			pepService = new PEPService(XMPPServer.getInstance(), bareJID);
			pepServices.put(bareJID, pepService);

			if (Log.isDebugEnabled()) {
				Log.debug("PEPService created for : " + bareJID);
			}
		}
	} finally {
		lock.unlock();
	}

	return pepService;
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:32,代码来源:PEPServiceManager.java

示例13: canSubscribe

import org.jivesoftware.openfire.XMPPServer; //导入方法依赖的package包/类
@Override
public boolean canSubscribe(Node node, JID owner, JID subscriber) {
    // Let node owners and sysadmins always subscribe to the node
    if (node.isAdmin(owner)) {
        return true;
    }
    for (JID nodeOwner : node.getOwners()) {
        if (nodeOwner.equals(owner)) {
            return true;
        }
    }
    // Check that the subscriber is a local user
    XMPPServer server = XMPPServer.getInstance();
    if (server.isLocal(owner)) {
        GroupManager gMgr = GroupManager.getInstance();
        Collection<String> nodeGroups = node.getRosterGroupsAllowed();
        for (String groupName : nodeGroups) {
            try {
                Group group = gMgr.getGroup(groupName);
                // access allowed if the node group is visible to the subscriber
                if (server.getRosterManager().isGroupVisible(group, owner)) {
                    return true;
                }
            } catch (GroupNotFoundException gnfe){ 
                // ignore
            }
        }
    }
    else {
        // Subscriber is a remote user. This should never happen.
        Log.warn("Node with access model Roster has a remote user as subscriber: " +
                node.getNodeID());
    }
    return false;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:36,代码来源:RosterAccess.java

示例14: stopSTUNService

import org.jivesoftware.openfire.XMPPServer; //导入方法依赖的package包/类
private void stopSTUNService() {
    XMPPServer server = XMPPServer.getInstance();
    server.getIQDiscoInfoHandler().removeServerFeature(NAMESPACE);
    if (stunIQHandler != null) {
        server.getIQRouter().removeHandler(stunIQHandler);
        stunIQHandler = null;
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:9,代码来源:STUNService.java

示例15: PacketCopier

import org.jivesoftware.openfire.XMPPServer; //导入方法依赖的package包/类
private PacketCopier() {
    // Add the new instance as a listener of component events. We need to react when
    // a component is no longer valid
    InternalComponentManager.getInstance().addListener(this);
    XMPPServer server = XMPPServer.getInstance();
    serverName = server.getServerInfo().getXMPPDomain();
    routingTable = server.getRoutingTable();

    // Add new instance to the PacketInterceptors list
    InterceptorManager.getInstance().addInterceptor(this);

    // Create a new task and schedule it with the new timeout
    packetsTask = new ProcessPacketsTask();
    timer.schedule(packetsTask, 5000, 5000);
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:16,代码来源:PacketCopier.java


注:本文中的org.jivesoftware.openfire.XMPPServer.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。