亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? messagelayerconfiguration.java

?? 關于 RFID 讀寫器的相關內容
?? JAVA
字號:
/*
 * Copyright (C) 2007 ETH Zurich
 *
 * This file is part of Fosstrak (www.fosstrak.org).
 *
 * Fosstrak is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 2.1, as published by the Free Software Foundation.
 *
 * Fosstrak is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with Fosstrak; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301  USA
 */

package org.fosstrak.reader.rprm.core.msg;

import java.net.URL;

import org.fosstrak.reader.rprm.core.ReaderDevice;
import org.fosstrak.reader.rprm.core.util.ResourceLocator;

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.XMLConfiguration;
import org.apache.log4j.Logger;

/**
 * Loads the configuration properties for the MessageLayer from the property
 * file.
 * 
 * @author Andreas F黵er, ETH Zurich Switzerland, Winter 2005/06
 * 
 */
public final class MessageLayerConfiguration {

	/** The logger. */
	private static Logger log = Logger
			.getLogger(MessageLayerConfiguration.class);

	/** The path of the property file. */
	private static final String msgLayerPropFile = ReaderDevice.PROPERTIES_FILE;
   private static final String msgLayerDefaultPropFile = ReaderDevice.DEFAULT_PROPERTIES_FILE;

	/** Key for the thread pool size property. */
	private static final String THREAD_POOL_SIZE = "threadPoolSize";

	/** Default value for the thread pool size. */
	public static final String THREAD_POOL_SIZE_DEFAULT = "16";

	/** Key for the TCP server connection property. */
	private static final String TCP_SERVER_CONNECTION = "tcpServerConnection";

	/** Key for the TCP port property. */
	private static final String TCP_PORT = "tcpPort";

	/** Key for the HTTP server connection property. */
	private static final String HTTP_SERVER_CONNECTION = "httpServerConnection";

	/** Key for the HTTP port property. */
	private static final String HTTP_PORT = "httpPort";

	/** Key for the notification timeout property. */
	private static final String NOTIFICATION_LISTEN_TIMEOUT = "notificationListenTimeout";

	/** Default value for the notification timeout. */
	public static final String NOTIFICATION_LISTEN_TIMEOUT_DEFAULT = "0";

	/** The properties. */
	private static XMLConfiguration configuration;

	/** The singleton configuration instance. */
	private static MessageLayerConfiguration instance;

	/**
	 * Private constructor to construct the hide the default constructor.
	 */
	private MessageLayerConfiguration() {
		configuration = getProperties();
	}

	/**
	 * Gets the singleton instance.
	 * 
	 * @return the singleton instance
	 */
	public static MessageLayerConfiguration getInstance() {
		if (instance == null) {
			instance = new MessageLayerConfiguration();
		}
		return instance;
	}

   /**
    * Singleton implementation of properties file accessor.
    * 
    * @return properties instance
    */
   private static XMLConfiguration getProperties() {
      return getProperties(msgLayerPropFile, msgLayerDefaultPropFile);
   }

	/**
	 * Singleton implementation of properties file accessor.
	 * 
	 * @return properties instance
	 */
	private static XMLConfiguration getProperties(final String propFile,
         final String defaultPropFile) {
		if (configuration == null) {
	      // properties
		   configuration = new XMLConfiguration();
	      try {
            // load resource from where this class is located
            Exception ex = new Exception();
            StackTraceElement[] sTrace = ex.getStackTrace();
            String className = sTrace[0].getClassName();
            Class c = Class.forName(className);
            URL fileurl = ResourceLocator.getURL(propFile, defaultPropFile, c);
	         configuration.load(fileurl);
	      } catch (ConfigurationException e) {
	         log.error("Could not find properties file: " + propFile);
	      } catch (ClassNotFoundException cnfe) {
            log.error("Could not find properties file: " + propFile);
         }
	   }
		return configuration;
	}

	/**
	 * Gets the number of workers for the thread pool.
	 * 
	 * @return The number of workers or <code>THREAD_POOL_SIZE_DEFAULT</code>
	 *         if the property isn't specified in the property file.
	 * @throws NumberFormatException
	 *             If the pool size couldn't be converted into an
	 *             <code>int</code>.
	 */
	public int getThreadPoolSize() throws NumberFormatException {
      return Integer.parseInt(configuration.getString(
            THREAD_POOL_SIZE, THREAD_POOL_SIZE_DEFAULT));
	}

	/**
	 * Should a TCP server be openend?
	 * 
	 * @return the value of <code>tcpServerConnection</code> or
	 *         <code>false</code> if the value is not specified. Also if the
	 *         TCP port is not specified it returns <code>false</code>.
	 */
	public boolean hasTcpServerConnection() {
		String tcpConn = configuration.getString(TCP_SERVER_CONNECTION);
		if (tcpConn != null && tcpConn.equalsIgnoreCase("true")
				&& getTcpPort() != -1) {
			return true;
		} else {
			return false;
		}
	}

	/**
	 * Gets the port on which the TCP server should listen.
	 * 
	 * @return the TCP port or <code>-1</code> if there is no TCP port
	 *         specified.
	 * @throws NumberFormatException
	 *             If the value couldn't be converted into an <code>int</code>.
	 */
	public int getTcpPort() throws NumberFormatException {
		String tcpPort = configuration.getString(TCP_PORT);
		if (tcpPort != null) {
			return Integer.parseInt(tcpPort);
		} else {
			return -1;
		}
	}

	/**
	 * Should a HTTP server be openend?
	 * 
	 * @return the value of <code>httpServerConnection</code> or
	 *         <code>false</code> if the value is not specified. Also if the
	 *         HTTP port is not specified it returns <code>false</code>.
	 */
	public boolean hasHttpServerConnection() {
		String httpConn = configuration.getString(HTTP_SERVER_CONNECTION);
		if (httpConn != null && httpConn.equalsIgnoreCase("true")
				&& getHttpPort() != -1) {
			return true;
		} else {
			return false;
		}
	}

	/**
	 * Gets the port on which the HTTP server should listen.
	 * 
	 * @return the HTTP port or <code>-1</code> if there is no HTTP port
	 *         specified.
	 * @throws NumberFormatException
	 *             If the value couldn't be converted into an <code>int</code>.
	 */
	public int getHttpPort() throws NumberFormatException {
		String httpPort = configuration.getString(HTTP_PORT);
		if (httpPort != null) {
			return Integer.parseInt(httpPort);
		} else {
			return -1;
		}
	}

	/**
	 * Returns the timeout in ms which a NotificationChannel in listen mode is
	 * waiting for a connection from the client. A value of 0 indicates an
	 * infinite waiting time.
	 * 
	 * @return the timeout time or 0 if the property isn't specified.
	 * @throws NumberFormatException
	 *             If the value couldn't be converted into an <code>int</code>.
	 */
	public int getNotificationListenTimeout() throws NumberFormatException {
		return Integer.parseInt(configuration.getString(
				NOTIFICATION_LISTEN_TIMEOUT,
				NOTIFICATION_LISTEN_TIMEOUT_DEFAULT));
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩精品一区二区三区视频 | 久久er99热精品一区二区| 国产精品一区在线观看乱码 | 中文字幕av一区二区三区| 亚洲午夜三级在线| 岛国精品在线观看| 日韩欧美一卡二卡| 亚洲丰满少妇videoshd| av亚洲精华国产精华精华| 欧美不卡一二三| 亚洲国产综合视频在线观看| 成人国产亚洲欧美成人综合网 | 国产日产欧美一区| 免费在线看成人av| 欧美三级在线视频| 综合自拍亚洲综合图不卡区| 国产成人免费视频网站| 日韩一区二区三区视频在线观看| 一区二区三区加勒比av| 91在线免费播放| 亚洲国产电影在线观看| 国产成人一级电影| 久久亚洲免费视频| 精品一区二区日韩| 日韩欧美一级二级| 久久精品国产亚洲高清剧情介绍| 欧美卡1卡2卡| 日日夜夜一区二区| 欧美午夜精品久久久久久孕妇| 亚洲欧美一区二区三区孕妇| 99vv1com这只有精品| 亚洲欧美激情插| 91成人免费在线| 亚洲一区二区四区蜜桃| 欧美日韩五月天| 午夜激情一区二区| 欧美一区在线视频| 麻豆极品一区二区三区| 久久综合视频网| 国产剧情一区二区| 国产精品无圣光一区二区| 国产suv精品一区二区三区| 久久久www免费人成精品| 成人午夜在线播放| 国产精品成人免费精品自在线观看| 不卡高清视频专区| 悠悠色在线精品| 91麻豆精品国产自产在线 | 亚洲欧美日韩国产综合在线| 色欧美乱欧美15图片| 午夜伦欧美伦电影理论片| 欧美一区二区国产| 国产精品一区2区| 中文字幕中文字幕一区| 91久久久免费一区二区| 亚洲777理论| 精品久久久久久久久久久久久久久| 国产酒店精品激情| 国产欧美视频一区二区三区| 91在线国产福利| 亚洲综合成人在线视频| 欧美精品自拍偷拍| 国产乱子轮精品视频| 亚洲欧美综合网| 欧美日韩一区二区三区四区| 国内精品久久久久影院薰衣草| 亚洲欧洲色图综合| 日韩欧美在线123| 粉嫩在线一区二区三区视频| 午夜欧美电影在线观看| 久久久久久久久久久黄色| 色婷婷一区二区| 久久99精品久久久久久国产越南 | 91精品国产综合久久久久久| 国产精品伊人色| 一区二区三区日本| 久久在线免费观看| 91福利资源站| 成人深夜视频在线观看| 午夜精品久久久久影视| 国产人久久人人人人爽| 欧美日韩国产a| 成人av免费网站| 奇米精品一区二区三区四区| 亚洲欧洲日产国产综合网| 欧美电影免费观看高清完整版在线| 99久久国产综合精品色伊| 毛片不卡一区二区| 亚洲国产毛片aaaaa无费看| 久久蜜桃香蕉精品一区二区三区| 欧美在线观看禁18| 99国产精品国产精品毛片| 国产一区二区三区不卡在线观看 | 美国欧美日韩国产在线播放| 亚洲欧美国产77777| 久久久国产精品午夜一区ai换脸| 7777精品伊人久久久大香线蕉超级流畅| 国产一区二区免费在线| 天堂av在线一区| 一级做a爱片久久| 国产精品嫩草影院com| 久久人人爽爽爽人久久久| 日韩一二三四区| 欧美高清视频www夜色资源网| aaa欧美色吧激情视频| 国产99久久久国产精品潘金网站| 久久精品99久久久| 青青青伊人色综合久久| 亚洲高清视频在线| 亚洲影院久久精品| 亚洲欧美日韩国产一区二区三区| 国产精品二三区| 中文字幕一区二区三区在线播放| 欧美国产丝袜视频| 国产精品免费网站在线观看| 国产亚洲一区二区三区四区| 亚洲精品一区二区在线观看| 精品国产亚洲在线| 精品国产91洋老外米糕| 欧美草草影院在线视频| 久久综合久久鬼色中文字| 亚洲精品综合在线| 一区二区三区加勒比av| 亚洲一二三区视频在线观看| 亚洲电影中文字幕在线观看| 午夜视频在线观看一区二区| 亚洲成a人片在线观看中文| 石原莉奈在线亚洲三区| 日韩成人免费看| 毛片一区二区三区| 国产麻豆视频精品| 盗摄精品av一区二区三区| 99精品欧美一区二区三区小说 | 欧美韩日一区二区三区| 国产精品蜜臀av| 亚洲欧洲国产专区| 一区二区三区久久久| 五月激情综合网| 麻豆久久久久久久| 国产福利一区二区三区视频在线 | 久久综合久久综合久久| 中文一区在线播放| 亚洲少妇屁股交4| 亚洲成国产人片在线观看| 麻豆一区二区在线| 成人av资源在线| 欧美日韩你懂的| 国产日韩欧美一区二区三区乱码| 久久国产视频网| 国产成人免费视频网站 | 成人免费视频视频在线观看免费| voyeur盗摄精品| 欧美日韩在线不卡| 亚洲精品一区二区精华| 亚洲人成精品久久久久久 | 欧美本精品男人aⅴ天堂| 国产丝袜在线精品| 一区二区三区在线观看网站| 麻豆成人久久精品二区三区小说| 成人国产精品免费观看动漫 | jlzzjlzz亚洲女人18| 欧美精品久久久久久久久老牛影院| 久久亚洲精品国产精品紫薇| 亚洲黄色小说网站| 国产一区二区视频在线播放| 欧美在线观看视频一区二区三区| 久久久精品黄色| 亚洲国产欧美一区二区三区丁香婷| 国精产品一区一区三区mba视频| 欧美在线视频你懂得| 国产亚洲人成网站| 日韩精品电影在线| 91视视频在线直接观看在线看网页在线看| 欧美高清精品3d| 亚洲男人都懂的| 成人午夜又粗又硬又大| 欧美不卡视频一区| 午夜精品久久久久久久久久久 | 国产精品一区一区三区| 欧美日韩国产精品自在自线| 欧美国产精品中文字幕| 激情综合色播激情啊| 这里只有精品视频在线观看| 亚洲男同1069视频| 成人黄页在线观看| 国产午夜亚洲精品理论片色戒| 日韩精品一区第一页| 欧美综合亚洲图片综合区| 1024亚洲合集| 丁香婷婷综合色啪| 久久久久久久久岛国免费| 国产综合成人久久大片91| 91精品国产全国免费观看| 亚洲国产精品人人做人人爽| 色婷婷av一区二区三区之一色屋| 国产精品私人影院| 成人av电影在线网| 国产精品日日摸夜夜摸av| 国产精品羞羞答答xxdd | 欧美大片在线观看|