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


Java ServiceEvent.getName方法代码示例

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


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

示例1: serviceResolved

import javax.jmdns.ServiceEvent; //导入方法依赖的package包/类
/**
 * A service has been resolved. Its details are now available in the ServiceInfo record.<br/>
 * <b>Note:</b>This call back will never be called if the service does not resolve.<br/>
 * 
 * @param event
 *            The ServiceEvent providing the name, the fully qualified type of the service, and the service info record.
 */
synchronized void serviceResolved(ServiceEvent event) {
    ServiceInfo info = event.getInfo();
    if ((info != null) && (info.hasData())) {
        String qualifiedName = event.getName() + "." + event.getType();
        ServiceInfo previousServiceInfo = _addedServices.get(qualifiedName);
        if (!_sameInfo(info, previousServiceInfo)) {
            if (null == previousServiceInfo) {
                if (null == _addedServices.putIfAbsent(qualifiedName, info.clone())) {
                    this.getListener().serviceResolved(event);
                }
            } else {
                if (_addedServices.replace(qualifiedName, previousServiceInfo, info.clone())) {
                    this.getListener().serviceResolved(event);
                }
            }
        } else {
            logger.finer("Service Resolved called for a service already resolved: " + event);
        }
    } else {
        logger.warning("Service Resolved called for an unresolved event: " + event);

    }
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:31,代码来源:ListenerStatus.java

示例2: serviceAdded

import javax.jmdns.ServiceEvent; //导入方法依赖的package包/类
/**
 * A service has been added.<br/>
 * <b>Note:</b>This event is only the service added event. The service info associated with this event does not include resolution information.<br/>
 * To get the full resolved information you need to listen to {@link #serviceResolved(javax.jmdns.ServiceEvent)} or call {@link javax.jmdns.JmDNS#getServiceInfo(String, String, long)}
 *
 * <pre>
 *  ServiceInfo info = event.getDNS().getServiceInfo(event.getType(), event.getName())
 * </pre>
 * <p>
 * Please note that service resolution may take a few second to resolve.
 * </p>
 *
 * @param event
 *            The ServiceEvent providing the name and fully qualified type of the service.
 */
void serviceAdded(ServiceEvent event)
{
    String qualifiedName = event.getName() + "." + event.getType();
    if (null == _addedServices.putIfAbsent(qualifiedName, (ServiceInfo) event.getInfo().clone()))
    {
        this.getListener().serviceAdded(event);
        ServiceInfo info = event.getInfo();
        if ((info != null) && (info.hasData()))
        {
            this.getListener().serviceResolved(event);
        }
    }
    else
    {
        logger.finer("Service Added called for a service already added: " + event);
    }
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:33,代码来源:ListenerStatus.java

示例3: serviceAdded

import javax.jmdns.ServiceEvent; //导入方法依赖的package包/类
@Override
public void serviceAdded(final ServiceEvent event) {
    log.info("Service added Called - Requesting service info");

    final String type = event.getType();
    final String name = event.getName();
    log.info("Service added: type= " + type + ", name: " + name);

    Thread thread = new Thread() {
        @Override
        public void run() {
            try {
                // needs to be in it's own thread as it blocks
                log.info("Service added: Requesting service info");
                jmdns.requestServiceInfo(type, name);
            }
            catch (Throwable ex) {
                ex.printStackTrace();
                log.error("Error requesting service info", ex);
            }
        }
    };
    thread.start();
}
 
开发者ID:DrivenLogic,项目名称:droid-holiday,代码行数:25,代码来源:MdnsScanner.java

示例4: serviceRemoved

import javax.jmdns.ServiceEvent; //导入方法依赖的package包/类
@Override
public void serviceRemoved(ServiceEvent event) {
    final String name = event.getName();
    final ServiceInfo service_info = event.getInfo();
    ZeroconfDiscoveryHandler callback = listener_callbacks.get(service_info.getType());
    if ( callback != null ) {
        callback.serviceRemoved(toDiscoveredService(service_info));
    } else {
        logger.println("[-] Service         : " + name);
    }
}
 
开发者ID:rosalfred,项目名称:smarthome_network_zeroconf,代码行数:12,代码来源:Zeroconf.java

示例5: serviceRemoved

import javax.jmdns.ServiceEvent; //导入方法依赖的package包/类
/**
 * A service has been removed.
 * 
 * @param event
 *            The ServiceEvent providing the name and fully qualified type of the service.
 */
void serviceRemoved(ServiceEvent event) {
    String qualifiedName = event.getName() + "." + event.getType();
    if (_addedServices.remove(qualifiedName, _addedServices.get(qualifiedName))) {
        this.getListener().serviceRemoved(event);
    } else {
        logger.finer("Service Removed called for a service already removed: " + event);
    }
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:15,代码来源:ListenerStatus.java

示例6: serviceRemoved

import javax.jmdns.ServiceEvent; //导入方法依赖的package包/类
/**
 * A service has been removed.
 *
 * @param event
 *            The ServiceEvent providing the name and fully qualified type of the service.
 */
void serviceRemoved(ServiceEvent event)
{
    String qualifiedName = event.getName() + "." + event.getType();
    if (_addedServices.remove(qualifiedName, _addedServices.get(qualifiedName)))
    {
        this.getListener().serviceRemoved(event);
    }
    else
    {
        logger.finer("Service Removed called for a service already removed: " + event);
    }
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:19,代码来源:ListenerStatus.java

示例7: serviceResolved

import javax.jmdns.ServiceEvent; //导入方法依赖的package包/类
/**
 * A service has been resolved. Its details are now available in the ServiceInfo record.<br/>
 * <b>Note:</b>This call back will never be called if the service does not resolve.<br/>
 *
 * @param event
 *            The ServiceEvent providing the name, the fully qualified type of the service, and the service info record.
 */
synchronized void serviceResolved(ServiceEvent event)
{
    ServiceInfo info = event.getInfo();
    if ((info != null) && (info.hasData()))
    {
        String qualifiedName = event.getName() + "." + event.getType();
        ServiceInfo previousServiceInfo = _addedServices.get(qualifiedName);
        if (!_sameInfo(info, previousServiceInfo))
        {
            if (null == previousServiceInfo)
            {
                if (null == _addedServices.putIfAbsent(qualifiedName, (ServiceInfo) info.clone()))
                {
                    this.getListener().serviceResolved(event);
                }
            }
            else
            {
                if (_addedServices.replace(qualifiedName, previousServiceInfo, (ServiceInfo) info.clone()))
                {
                    this.getListener().serviceResolved(event);
                }
            }
        }
        else
        {
            logger.finer("Service Resolved called for a service already resolved: " + event);
        }
    }
    else
    {
        logger.warning("Service Resolved called for an unresolved event: " + event);

    }
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:43,代码来源:ListenerStatus.java

示例8: serviceAdded

import javax.jmdns.ServiceEvent; //导入方法依赖的package包/类
@Override
public void serviceAdded(ServiceEvent event) {
    final String name = event.getName();

    System.out.println("ADD: " + name);
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            insertSorted(services, name);
        }
    });
}
 
开发者ID:josephw,项目名称:jmdns,代码行数:13,代码来源:Browser.java

示例9: serviceRemoved

import javax.jmdns.ServiceEvent; //导入方法依赖的package包/类
@Override
public void serviceRemoved(ServiceEvent event) {
    final String name = event.getName();

    System.out.println("REMOVE: " + name);
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            services.removeElement(name);
        }
    });
}
 
开发者ID:josephw,项目名称:jmdns,代码行数:13,代码来源:Browser.java

示例10: serviceResolved

import javax.jmdns.ServiceEvent; //导入方法依赖的package包/类
@Override
public void serviceResolved(ServiceEvent event) {
    final String name = event.getName();

    System.out.println("RESOLVED: " + name);
    if (name.equals(serviceList.getSelectedValue())) {
        ServiceInfo[] serviceInfos = this.jmmdns.getServiceInfos(type, name);
        this.dislayInfo(serviceInfos);
        // this.dislayInfo(new ServiceInfo[] { event.getInfo() });
    }
}
 
开发者ID:josephw,项目名称:jmdns,代码行数:12,代码来源:Browser.java

示例11: generateId

import javax.jmdns.ServiceEvent; //导入方法依赖的package包/类
private static String generateId(ServiceEvent event){
    return event.getType()+event.getName();
}
 
开发者ID:ibaton,项目名称:zeroconf-scanner,代码行数:4,代码来源:Scanner.java

示例12: serviceAdded

import javax.jmdns.ServiceEvent; //导入方法依赖的package包/类
/**
 * A service has been added.<br/>
 * <b>Note:</b>This event is only the service added event. The service info associated with this event does not include resolution information.<br/>
 * To get the full resolved information you need to listen to {@link #serviceResolved(ServiceEvent)} or call {@link JmDNS#getServiceInfo(String, String, long)}
 * 
 * <pre>
 *  ServiceInfo info = event.getDNS().getServiceInfo(event.getType(), event.getName())
 * </pre>
 * <p>
 * Please note that service resolution may take a few second to resolve.
 * </p>
 * 
 * @param event
 *            The ServiceEvent providing the name and fully qualified type of the service.
 */
void serviceAdded(ServiceEvent event) {
    String qualifiedName = event.getName() + "." + event.getType();
    if (null == _addedServices.putIfAbsent(qualifiedName, event.getInfo().clone())) {
        this.getListener().serviceAdded(event);
        ServiceInfo info = event.getInfo();
        if ((info != null) && (info.hasData())) {
            this.getListener().serviceResolved(event);
        }
    } else {
        logger.finer("Service Added called for a service already added: " + event);
    }
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:28,代码来源:ListenerStatus.java


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