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


Java LogicalReaderManager类代码示例

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


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

示例1: initializeApplication

import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入依赖的package包/类
private void initializeApplication(ServletContext servletContext) {
   	LOG.debug("initializing application ...");
	try {
		LogicalReaderManager lrm = getBean(LogicalReaderManager.class);
		LOG.debug("instantiated LogicalReaderManager: " + lrm.getClass().getCanonicalName());
		ALE ale = getBean(ALE.class);
		LOG.debug("instantiated ALE: " + ale.getClass().getCanonicalName());
		PersistenceInit persistence = getBean(PersistenceInit.class);
		LOG.debug("instantiated Persistence: " + persistence.getClass().getCanonicalName());
		persistence.init(servletContext);
	} catch (Exception ex) {
		LOG.error("caught exception during setup of the critical components.", ex);
		throw new IllegalStateException("caught exception during setup of the critical components.", ex);
	}
   	LOG.debug("... initialization done.");
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:17,代码来源:ALEApplicationContext.java

示例2: shutdown

import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入依赖的package包/类
@PreDestroy
public void shutdown() {
	LOG.info("======================================== shutdown hook received. ========================================");
	try {
		// stop all the readers
		LOG.info("shutting down all the readers.");
		LogicalReaderManager lrm = applicationContext.getBean(LogicalReaderManager.class);
		if (null != lrm) {
			for (LogicalReader logicalReader : lrm.getLogicalReaders()) {
				LOG.info("Stopping reader: " + logicalReader.getName());
				logicalReader.stop();
			}
		}
		LOG.info("shutting down all reports generators and event cycles.");
		ALE ale = applicationContext.getBean(ALE.class);
		if (null != ale) {
			for (ReportsGenerator generator : ale.getReportGenerators().values()) {
				LOG.info("Setting reports generator state to unrequested for generator: " + generator.getName());
				generator.setStateUnRequested();
			}
		}
	} catch (Exception ex) {
		LOG.error("caught exception in shutdown hook: ", ex);
	}
	LOG.info("======================================== shutdown hook over. ========================================");
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:27,代码来源:ALEApplicationContext.java

示例3: initializeApplication

import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入依赖的package包/类
private void initializeApplication(ServletContext servletContext) {
   	LOG.debug("initializing application ...");
	try {
		LogicalReaderManager lrm = getBean(LogicalReaderManager.class);
		LOG.debug("instantiated LogicalReaderManager: " + lrm.getClass().getCanonicalName());
		ALE ale = getBean(ALE.class);
		LOG.debug("instantiated ALE: " + ale.getClass().getCanonicalName());
		PersistenceInit persistence = getBean(PersistenceInit.class);
		LOG.debug("instantiated Persistence: " + persistence.getClass().getCanonicalName());
		persistence.init(servletContext);
		
		//LogicalReaderAcceptor acceptor = getBean(LogicalReaderAcceptor.class);//new LogicalReaderAcceptor();
		
		ALECC alecc = getBean(ALECC.class);
		LOG.debug("instantiated ALECC: " + alecc.getClass().getCanonicalName());
		
		ALESettings settings = getBean(ALESettings.class);
		
	} catch (Exception ex) {
		LOG.error("caught exception during setup of the critical components.", ex);
		throw new IllegalStateException("caught exception during setup of the critical components.", ex);
	}
   	LOG.debug("... initialization done.");
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:25,代码来源:ALEApplicationContext.java

示例4: checkReadersAvailable

import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入依赖的package包/类
/**
 * verifies that the spec contains some readers and that those readers are available in the ALE.
 * @param logicalReaders the logical reader definition from the ECSpec.
 * @param readerManager handle to the logical reader manager.
 * @return true if OK, throws exception otherwise.
 * @throws ECSpecValidationException if no reader specified or the specified readers do not exist in the ALE.
 */
public boolean checkReadersAvailable(LogicalReaders logicalReaders, LogicalReaderManager readerManager) throws ECSpecValidationException {
	if ((null == logicalReaders) || (logicalReaders.getLogicalReader().size() == 0)) {
		throw logAndCreateECSpecValidationException("ECSpec does not specify at least one reader"); 
	}
	for (String logicalReaderName : logicalReaders.getLogicalReader()) {
		if (!readerManager.contains(logicalReaderName)) {
			throw logAndCreateECSpecValidationException("LogicalReader '" + logicalReaderName + "' is unknown.");
		}
	}
	return true;
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:19,代码来源:ECSpecValidator.java

示例5: testReadLRSpec

import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入依赖的package包/类
/**
 * test the loading of the logical readers.
 * @throws Exception test failure.
 */
@Test
public void testReadLRSpec() throws Exception {
	tempFolder.create();
	File f = tempFolder.newFile("LogicalReader1.xml");
	final String fileName = f.getName();
	// absolute path encodes the filename, thus remove it.
	final String path = f.getAbsolutePath().replace(fileName, "");
	FileOutputStream fos = new FileOutputStream(f);
	BufferedOutputStream bfos = new BufferedOutputStream(fos);
	bfos.write("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><ns3:LRSpec xmlns:ns2=\"urn:epcglobal:ale:wsdl:1\" xmlns:ns3=\"urn:epcglobal:ale:xsd:1\"><isComposite>false</isComposite><readers/><properties><property><name>ReaderType</name><value>org.fosstrak.ale.server.readers.hal.HALAdaptor</value></property><property><name>Description</name><value>My first HAL device reader</value></property><property><name>PhysicalReaderName</name><value>MyReader1</value></property><property><name>ReadTimeInterval</name><value>1000</value></property><property><name>PropertiesFile</name><value>/props/SimulatorController.xml</value></property></properties></ns3:LRSpec>".getBytes());
	bfos.close();
	
	FileUtils fileUtils = EasyMock.createMock(FileUtils.class);
	EasyMock.expect(fileUtils.getFilesName(path, FileUtils.FILE_ENDING_XML)).andReturn(Arrays.asList(new String[] { fileName } ));
	EasyMock.replay(fileUtils);
	
	PersistenceConfig persistenceConfig = EasyMock.createMock(PersistenceConfig.class);
	EasyMock.expect(persistenceConfig.getRealPathLRSpecDir()).andReturn(path).atLeastOnce();
	EasyMock.replay(persistenceConfig);
	
	LogicalReaderManager logicalReaderManager = EasyMock.createMock(LogicalReaderManager.class);
	logicalReaderManager.define(EasyMock.eq("LogicalReader1"), EasyMock.isA(LRSpec.class));
	EasyMock.replay(logicalReaderManager);
	
	ReadConfigImpl readConfig = new ReadConfigImpl();
	readConfig.setFileUtils(fileUtils);
	readConfig.setPersistenceConfig(persistenceConfig);
	readConfig.setLogicalReaderManager(logicalReaderManager);
	
	// TEST
	readConfig.readLRSpecs();
	
	EasyMock.verify(fileUtils);
	EasyMock.verify(persistenceConfig);
	EasyMock.verify(logicalReaderManager);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:41,代码来源:ReadConfigTest.java

示例6: testCheckReadersAvailableNoReaderInALE

import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入依赖的package包/类
/**
 * no reader specified or null as input.
 * @throws ECSpecValidationException expected test result.
 */
@Test(expected = ECSpecValidationException.class)
public void testCheckReadersAvailableNoReaderInALE() throws ECSpecValidationException {
	LogicalReaderManager manager = EasyMock.createMock(LogicalReaderManager.class);
	EasyMock.expect(manager.contains("logicalReader1")).andReturn(true);
	EasyMock.expect(manager.contains("logicalReader2")).andReturn(false);
	EasyMock.replay(manager);
	LogicalReaders logicalReaders = new LogicalReaders();
	logicalReaders.getLogicalReader().add("logicalReader1");
	logicalReaders.getLogicalReader().add("logicalReader2");
	
	validator.checkReadersAvailable(logicalReaders, manager);		
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:17,代码来源:ECSpecValidatorTest.java

示例7: testCheckReadersAvailable

import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入依赖的package包/类
/**
 * readers must be all set and present in the ALE.
 * @throws ECSpecValidationException test failure.
 */
@Test
public void testCheckReadersAvailable() throws ECSpecValidationException {
	LogicalReaderManager manager = EasyMock.createMock(LogicalReaderManager.class);
	EasyMock.expect(manager.contains("logicalReader1")).andReturn(true);
	EasyMock.expect(manager.contains("logicalReader2")).andReturn(true);
	EasyMock.replay(manager);
	LogicalReaders logicalReaders = new LogicalReaders();
	logicalReaders.getLogicalReader().add("logicalReader1");
	logicalReaders.getLogicalReader().add("logicalReader2");
	
	Assert.assertTrue(validator.checkReadersAvailable(logicalReaders, manager));
	
	EasyMock.verify(manager);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:19,代码来源:ECSpecValidatorTest.java

示例8: testComplexSpec

import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入依赖的package包/类
/**
 * test with a complex ECSpec.
 */
@Test
public void testComplexSpec() throws Exception {
	LogicalReaderManager manager = EasyMock.createMock(LogicalReaderManager.class);
	EasyMock.expect(manager.contains("LogicalReader1")).andReturn(true);
	EasyMock.replay(manager);
	
	ECSpec ecspec = DeserializerUtil.deserializeECSpec(ECSpecValidatorTest.class.getResourceAsStream("/ecspecs/complexSpecAdditionsDeletionsCurrent.xml"));
	validator.setLogicalReaderManager(manager);
	validator.validateSpec(ecspec);
	
	EasyMock.verify(manager);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:16,代码来源:ECSpecValidatorTest.java

示例9: undefine

import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入依赖的package包/类
@Override
public void undefine(String specName) throws NoSuchNameException {		

	throwNoSuchNameExceptionIfNoSuchSpec(specName);
	
	CCSpec ccspec = reportGeneratorsProvider.get(specName).getCCSpec();
	LogicalReaderManager logicalReaderManager = ALEApplicationContext.getBean(LogicalReaderManager.class);
	
	
	LOG.debug("Recovery ACCESSSPEC of logicalReaders");

	// get LogicalReaderStubs
	if (ccspec.getLogicalReaders() != null) {
		List<String> logicalReaderNames = ccspec.getLogicalReaders().getLogicalReader();
		for (String logicalReaderName : logicalReaderNames) {
			//LOG.debug("retrieving logicalReader " + logicalReaderName);
			LogicalReader logicalReader = logicalReaderManager.getLogicalReader(logicalReaderName);
			
			if (logicalReader != null) {
				LOG.debug("Delete ACCESSSPEC from logicalReader : " + logicalReader.getName());
				logicalReader.DELETEACCESSSPEC();
				logicalReader.recoveryACCESSSPEC3();
			}
		}
	} else {
		LOG.error("CCSpec contains no readers");
	}
	
	reportGeneratorsProvider.remove(specName);
	//persistenceRemoveAPI.removeECSpec(specName);
	//TODO: wdyoon
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:33,代码来源:ALECCImpl.java

示例10: checkReadersAvailable

import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入依赖的package包/类
/**
 * verifies that the spec contains some readers and that those readers are available in the ALE.
 * @param logicalReaders the logical reader definition from the CCSpec.
 * @param readerManager handle to the logical reader manager.
 * @return true if OK, throws exception otherwise.
 * @throws CCSpecValidationException if no reader specified or the specified readers do not exist in the ALE.
 */
public boolean checkReadersAvailable(LogicalReaders logicalReaders, LogicalReaderManager readerManager) throws CCSpecValidationException {
	if ((null == logicalReaders) || (logicalReaders.getLogicalReader().size() == 0)) {
		throw logAndCreateCCSpecValidationException("CCSpec does not specify at least one reader"); 
	}
	for (String logicalReaderName : logicalReaders.getLogicalReader()) {
		if (!readerManager.contains(logicalReaderName)) {
			throw logAndCreateCCSpecValidationException("LogicalReader '" + logicalReaderName + "' is unknown.");
		}
	}
	return true;
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:19,代码来源:CCSpecValidator.java

示例11: beforeClass

import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {

	LOG.info("Initializing Spring context.");
       
       ApplicationContext applicationContext = new ClassPathXmlApplicationContext("/applicationContext.xml");
       
       LOG.info("Spring context initialized.");
       
       aleac = (ALEACImpl) applicationContext.getBean("aleac");
       aleac.login("admin", "1111");
       
       ale = (ALE) applicationContext.getBean("ale");
       alecc = (ALECC) applicationContext.getBean("alecc");
       alelr = (LogicalReaderManager) applicationContext.getBean("logicalReaderManager");
       aletm = (ALETM) applicationContext.getBean("aletm");
       
       LRSpec lrspec = DeserializerUtil.deserializeLRSpec(ALEACConformanceTest.class.getResourceAsStream("/lrspecs/LRSpec_A.xml"));
       
       System.out.println("Please connect reader... (timeout: 5000ms)");
       Thread.sleep(5000);
       
       alelr.define("LogicalReader1", lrspec);
       
       for(String permName : aleac.getPermissionNames()) {
       	aleac.undefinePermission(permName);
       }
       for(String roleName : aleac.getRoleNames()) {
       	aleac.undefineRole(roleName);
       }
       for(String userId : aleac.getClientIdentityNames()) {
       	if(!userId.equalsIgnoreCase("admin")) {
       		aleac.undefineClientIdentity(userId);
       	}
       }
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:37,代码来源:ALEACConformanceTest.java

示例12: setLogicalReaderManager

import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入依赖的package包/类
/**
 * inject a handle to the logical reader manager.
 * @param ale the logical reader manager to use.
 */
@Autowired
public void setLogicalReaderManager(LogicalReaderManager logicalReaderManager) {
	this.logicalReaderManager = logicalReaderManager;
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:9,代码来源:ReadConfigImpl.java

示例13: setLogicalReaderManager

import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入依赖的package包/类
/**
 * inject the autowired bean logical reader manager into the static utility class.
 * @param lrm
 */
@Autowired
public void setLogicalReaderManager(LogicalReaderManager lrm) {
	LOG.debug("setting logical reader manager" + lrm.getClass().getCanonicalName());
	logicalReaderManager = lrm;
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:10,代码来源:ECSpecValidator.java

示例14: testInitializeAddReaders

import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入依赖的package包/类
/**
 * test the initialization method complete with all steps.
 * @throws ImplementationException failure.
 */
@Test
public void testInitializeAddReaders() throws ImplementationException {
	final String propertyName = "propertyName";
	final String propertyValue = "propertyValue";
	
	LRSpec.Properties properties = new LRSpec.Properties();
	LRProperty p = EasyMock.createMock(LRProperty.class);
	EasyMock.expect(p.getName()).andReturn(propertyName);
	EasyMock.expect(p.getValue()).andReturn(propertyValue);
	EasyMock.replay(p);
	
	properties.getProperty().add(p);
	
	final String logicalReaderName1 = "logicalReader1";
	LRSpec.Readers readers = new LRSpec.Readers();
	readers.getReader().add(logicalReaderName1);
	
	CompositeReader compositeReader = new CompositeReader();
	LRSpec spec = EasyMock.createMock(LRSpec.class);
	EasyMock.expect(spec.getProperties()).andReturn(properties).atLeastOnce();
	EasyMock.expect(spec.getReaders()).andReturn(readers).atLeastOnce();
	EasyMock.replay(spec);

	LogicalReader logicalReader = EasyMock.createMock(LogicalReader.class);
	EasyMock.expect(logicalReader.getName()).andReturn(logicalReaderName1).atLeastOnce();
	logicalReader.addObserver(compositeReader);
	EasyMock.expectLastCall();
	logicalReader.deleteObserver(compositeReader);
	EasyMock.expectLastCall();
	EasyMock.replay(logicalReader);		
	
	LogicalReaderManager lrm = EasyMock.createMock(LogicalReaderManager.class);
	EasyMock.expect(lrm.getLogicalReader(logicalReaderName1)).andReturn(logicalReader);
	EasyMock.replay(lrm);		
	
	compositeReader.setLogicalReaderManager(lrm);
	compositeReader.initialize("compositeReader", spec);
	
	compositeReader.unregisterAsObserver();
	
	LRProperty p2 = compositeReader.getProperties().get(0);
	Assert.assertEquals(p, p2);
	
	EasyMock.verify(spec);
	EasyMock.verify(p);
	EasyMock.verify(lrm);
	EasyMock.verify(logicalReader);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:53,代码来源:CompositeReaderTest.java

示例15: beforeClass

import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {

	LOG.info("Initializing Spring context.");

	ApplicationContext applicationContext = new ClassPathXmlApplicationContext("/applicationContext.xml");

	LOG.info("Spring context initialized.");

	aletm = (ALETM) applicationContext.getBean("aletm");
	lrm = (LogicalReaderManager) applicationContext.getBean("logicalReaderManager");
	alecc = (ALECC) applicationContext.getBean("alecc");
	ale = (ALE) applicationContext.getBean("ale");

	LRSpec lrspec = DeserializerUtil.deserializeLRSpec(ALETMConformanceTest.class.getResourceAsStream("/lrspecs/LRSpec_W.xml"));

	System.out.println("Please connect reader... (timeout: 5000ms)");
	Thread.sleep(5000);

	lrm.define("LogicalReader1", lrspec);

	System.out.println("Waiting for reader initialization...");
	Thread.sleep(5000);
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:25,代码来源:ALECCConformanceTest.java


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