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


Java XMPPServerInfo类代码示例

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


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

示例1: initializePlugin

import org.jivesoftware.openfire.XMPPServerInfo; //导入依赖的package包/类
/**
 * Initializes this <tt>Plugin</tt>.
 *
 * @param manager the <tt>PluginManager</tt> which loads and manages this
 * <tt>Plugin</tt>
 * @param pluginDirectory the directory into which this <tt>Plugin</tt> is
 * located
 * @see Plugin#initializePlugin(PluginManager, File)
 */
public void initializePlugin(PluginManager manager, File pluginDirectory)
{
    PropertyEventDispatcher.addListener(this);

    // Let's check for custom configuration
    String maxVal = JiveGlobals.getProperty(MAX_PORT_NUMBER_PROPERTY_NAME);
    String minVal = JiveGlobals.getProperty(MIN_PORT_NUMBER_PROPERTY_NAME);

    if(maxVal != null)
        setIntProperty(
            DefaultStreamConnector.MAX_PORT_NUMBER_PROPERTY_NAME,
            maxVal);
    if(minVal != null)
        setIntProperty(
            DefaultStreamConnector.MIN_PORT_NUMBER_PROPERTY_NAME,
            minVal);

    try
    {
        checkNatives();
    }
    catch ( Exception e )
    {
        Log.warn( "An unexpected error occurred while checking the " +
            "native libraries.", e );
    }

    ComponentManager componentManager
        = ComponentManagerFactory.getComponentManager();
    String subdomain = ComponentImpl.SUBDOMAIN;

    // The ComponentImpl implementation expects to be an External Component,
    // which in the case of an Openfire plugin is untrue. As a result, most
    // of its constructor arguments are unneeded when the instance is
    // deployed as an Openfire plugin. None of the values below are expected
    // to be used (but where possible, valid values are provided for good
    // measure).
    final XMPPServerInfo info = XMPPServer.getInstance().getServerInfo();
    final String hostname = info.getHostname();
    final int port = -1;
    final String domain = info.getXMPPDomain();
    final String secret = null;

    // The ComponentImpl implementation depends on OSGI-based loading of
    // Components, which is prepared for here. Note that a configuration
    // is used that is slightly different from the default configuration
    // for Jitsi Videobridge: the REST API is not loaded.
    final OSGiBundleConfig osgiBundles = new JvbOpenfireBundleConfig();
    OSGi.setBundleConfig(osgiBundles);

    ComponentImpl component =
        new ComponentImpl( hostname, port, domain, subdomain, secret );

    try
    {
        componentManager.addComponent(subdomain, component);
        this.componentManager = componentManager;
        this.component = component;
        this.subdomain = subdomain;
    }
    catch (ComponentException ce)
    {
        Log.error( "An exception occurred when loading the plugin: " +
            "the component could not be added.", ce );
        this.componentManager = null;
        this.component = null;
        this.subdomain = null;
    }
}
 
开发者ID:jitsi,项目名称:jitsi-videobridge-openfire-plugin,代码行数:79,代码来源:PluginImpl.java

示例2: getServerInfo

import org.jivesoftware.openfire.XMPPServerInfo; //导入依赖的package包/类
public XMPPServerInfo getServerInfo() {
    return getXMPPServer().getServerInfo();
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:4,代码来源:WebManager.java

示例3: doConfigClearspace

import org.jivesoftware.openfire.XMPPServerInfo; //导入依赖的package包/类
private synchronized void doConfigClearspace() throws UnauthorizedException {

        Log.debug("Starting Clearspace configuration.");

        List<String> bindInterfaces = getServerInterfaces();
        if (bindInterfaces.size() == 0) {
            // We aren't up and running enough to tell Clearspace what interfaces to bind to.
            Log.debug("No bind interfaces found to config Clearspace");
            throw new IllegalStateException("There are no binding interfaces.");
        }

        try {

            XMPPServerInfo serverInfo = XMPPServer.getInstance().getServerInfo();

            String path = IM_URL_PREFIX + "configureComponent/";

            // Creates the XML with the data
            Document groupDoc = DocumentHelper.createDocument();
            Element rootE = groupDoc.addElement("configureComponent");
            Element domainE = rootE.addElement("domain");
            domainE.setText(serverInfo.getXMPPDomain());
            for (String bindInterface : bindInterfaces) {
                Element hostsE = rootE.addElement("hosts");
                hostsE.setText(bindInterface);
            }
            Element portE = rootE.addElement("port");
            portE.setText(String.valueOf(ExternalComponentManager.getServicePort()));

            Log.debug("Trying to configure Clearspace with: Domain: " + serverInfo.getXMPPDomain() + ", hosts: " +
                    bindInterfaces.toString() + ", port: " + port);

            executeRequest(POST, path, rootE.asXML());

            //Done, Clearspace was configured correctly, clear the task
            Log.debug("Clearspace was configured, stopping the task.");
            TaskEngine.getInstance().cancelScheduledTask(configClearspaceTask);
            configClearspaceTask = null;

        } catch (UnauthorizedException ue) {
            throw ue;
        } catch (Exception e) {
            // It is not supported exception, wrap it into an UnsupportedOperationException
            throw new UnsupportedOperationException("Unexpected error", e);
        }
    }
 
开发者ID:coodeer,项目名称:g3server,代码行数:47,代码来源:ClearspaceManager.java

示例4: start

import org.jivesoftware.openfire.XMPPServerInfo; //导入依赖的package包/类
@Override
public void start() throws IllegalStateException {
       // If the service isn't enabled, return.
       if (!JiveGlobals.getBooleanProperty("multicastDNS.enabled", false) ) {
           return;     
       }
       TimerTask startService = new TimerTask() {
           @Override
		public void run() {
               XMPPServerInfo info = XMPPServer.getInstance().getServerInfo();
               int clientPortNum = -1;
               int componentPortNum = -1;
               for (ServerPort port : info.getServerPorts()) {
                   if (port.isClientPort()) {
                       clientPortNum = port.getPort();
                   }
                   else if (port.isComponentPort()) {
                       componentPortNum = port.getPort();
                   }
               }
               try {
                   if (jmdns == null) {
                       jmdns = new JmDNS();
                   }
                   String serverName = XMPPServer.getInstance().getServerInfo().getXMPPDomain();

                   if (clientPortNum != -1) {
                       ServiceInfo clientService = new ServiceInfo("_xmpp-client._tcp.local.",
                               serverName + "._xmpp-client._tcp.local.", clientPortNum, "XMPP Server");
                       jmdns.registerService(clientService);
                   }
                   if (componentPortNum != -1) {
                       ServiceInfo componentService = new ServiceInfo("_xmpp-component._tcp.local.",
                               serverName +  "._xmpp-component._tcp.local.", componentPortNum, "XMPP Component Server");
                       jmdns.registerService(componentService);
                   }
               }
                catch (IOException ioe) {
                   Log.error(ioe.getMessage(), ioe);
               }
           }
       };
       // Schedule the task to run in 5 seconds, to give Wildire time to start the ports. 
       TaskEngine.getInstance().schedule(startService, 5000);
   }
 
开发者ID:surevine,项目名称:openfire-bespoke,代码行数:46,代码来源:MulticastDNSService.java


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