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


Java ALEApplicationContext类代码示例

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


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

示例1: undefine

import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的package包/类
/**
 * Delete the ROSpec defined on the logical reader, stop the thread and 
 * remove the persisted file. 
 * @param lrSpecName the name of the logical reader
 */

public void undefine(String lrSpecName) throws NoSuchNameException {
	LOG.debug("Undefine ROSPEC for " + lrSpecName);
	if (!lrROSpecMap.containsKey(lrSpecName)) {
		throw new NoSuchNameException("this logical reader doesn't exist");
	}
	ROSpec roSpec = lrROSpecMap.get(lrSpecName);
	if (roSpec != null) {
		// stop the thread and remove it
		LLRPChecking llrpCheck = lrLLRPCheckMap.get(lrSpecName);
		llrpCheck.stop();
		lrLLRPCheckMap.remove(lrSpecName);
		// delete the defined ROSpec and remove it
		 DELETE_ROSPEC deleteRoSpec = new DELETE_ROSPEC();
		 deleteRoSpec.setROSpecID(roSpec.getROSpecID());
		 AdaptorMgmt.sendLLRPMessage(llrpCheck.getReaderName(), deleteRoSpec);
		 // remove the lrSpecName from the HashMap
		 lrROSpecMap.remove(lrSpecName); 
		 //persistence
		 ALEApplicationContext.getBean(RemoveConfig.class).removeROSpec(lrSpecName);
	}
	LOG.debug("End Undefine ROSPEC for " + lrSpecName);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:29,代码来源:LLRPControllerManager.java

示例2: defineAccessSpec

import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的package包/类
/**
 * ORANGE: Add a new AccessSpec
 * @param lrSpecName the logical reader name
 * @param addAccessSpec the ADD_ACCESSSPEC
 */
public void defineAccessSpec (String lrSpecName, ADD_ACCESSSPEC addAccessSpec) 
	throws DuplicateNameException, NoSuchNameException {
	if (addAccessSpec != null) {
	LOG.debug("Define an ADD_ACCESSSPEC for " + lrSpecName);
	
	// init the Connection and the LLRP context :
	// not necessary because it has already be done by the ROSpec
	AdaptorMgmt.initializeLLRPContext();
	String readerName= retrievePhysicalReader(lrSpecName);

	// add and enable the AccessSpec		
	AdaptorMgmt.sendLLRPMessage(readerName, addAccessSpec);
	ENABLE_ACCESSSPEC enableAccessSpec = new ENABLE_ACCESSSPEC();
	UnsignedInteger accessSpecId = addAccessSpec.getAccessSpec().getAccessSpecID();
	enableAccessSpec.setAccessSpecID(accessSpecId);
	AdaptorMgmt.sendLLRPMessage(readerName, enableAccessSpec);
	// init the internal data
	lrAccessSpecMap.put(lrSpecName, addAccessSpec.getAccessSpec());
	// persistence
	ALEApplicationContext.getBean(WriteConfig.class).writeAddAccessSpec(lrSpecName, addAccessSpec);
	LOG.info("End define an ADD_ACCESSSPEC for " + lrSpecName);
	} else {
		LOG.error("ERROR !!!! ADD_ACCESSSPEC is null for " + lrSpecName);
	}
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:31,代码来源:LLRPControllerManager.java

示例3: initializeLLRPContext

import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的package包/类
/**
 * Initialize the LLRP Context.
 * Initialize & set the unique instance of the Adaptor Management.
 * Initialize & set the Remote Adaptor.
 */
public static void  initializeLLRPContext () {
	LOG.debug("InitializeLLRPContext ...");
	String readConfig = null;
	String writeConfig = null;
	boolean commitChanges = false;
	if (!getAdaptorMgmtInitialized()) {
		llrpAdaptorMgmt = AdaptorManagement.getInstance();
		if (!llrpAdaptorMgmt.isInitialized()) {
			//musn't happen when we launch the fc-server in fosstrak
			try {
				llrpAdaptorMgmt.initialize(readConfig, writeConfig, commitChanges, null, null);
			} catch (LLRPRuntimeException e) {
				LOG.error("Error when trying to initialize LLRP Adaptor Management", e);
			}
		}
		setAdaptorMgmtInitialized(true);
		//llrpRemoteAdaptor = llrpAdaptorMgmt.getAdaptorNames().get(0);
		llrpRemoteAdaptor = ALEApplicationContext.getBean(LLRPManager.class).getAdaptor();
		// Register the handlers, so the adaptor management will
		// distribute the LLRP messages automatically and asynchronously. 
		llrpAdaptorMgmt.registerFullHandler(defineMessageHandler());
		llrpAdaptorMgmt.setExceptionHandler(defineExceptionHandler());
	}
	LOG.debug("End initializeLLRPContext.");
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:31,代码来源:AdaptorMgmt.java

示例4: define

import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的package包/类
/**
 * Add a new RoSpec, enable it, launch the thread and persist the ADD_ROSPEC
 * @param lrSpecName the logical reader name
 * @param addRoSpec the ADD_ROSPEC object
 */

public void define(String lrSpecName, ADD_ROSPEC addRoSpec) 
	throws DuplicateNameException, NoSuchNameException {
	if (addRoSpec != null) {
		LOG.debug("Define an ADD_ROSPEC for " + lrSpecName);
		// init the Connection and the LLRP context
		AdaptorMgmt.initializeLLRPContext();
		String readerName= retrievePhysicalReader (lrSpecName);
		getLLRPConfiguration();
		initClientConnection(readerName);
		// add ROSpec
		AdaptorMgmt.sendLLRPMessage(readerName, addRoSpec);
		// enable the ROSpec
		ENABLE_ROSPEC enableROSpec = new ENABLE_ROSPEC();
		UnsignedInteger roSpecId = addRoSpec.getROSpec().getROSpecID();
		enableROSpec.setROSpecID(roSpecId);
		AdaptorMgmt.sendLLRPMessage(readerName, enableROSpec);
		// init the internal data
		lrROSpecMap.put(lrSpecName, addRoSpec.getROSpec());
		physicalLRMap.put(readerName, lrSpecName);
		//TODO: case of composite reader
		lrPhysicalMap.put(lrSpecName, readerName);
		//TODO: case of composite reader
		lrLLRPCheckMap.put(lrSpecName, new LLRPChecking(readerName));
		// persistence
		ALEApplicationContext.getBean(WriteConfig.class).writeAddROSpec(lrSpecName, addRoSpec);
		LOG.debug("End Define an ADD_ROSPEC for " + lrSpecName);
	} else {
		LOG.error("ERROR !!!! ADD_ROSPEC is null for " + lrSpecName);
	}
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:37,代码来源:LLRPControllerManager.java

示例5: initializeLLRPContext

import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的package包/类
/**
 * Initialize the LLRP Context.
 * Initialize & set the unique instance of the Adaptor Management.
 * Initialize & set the Remote Adaptor.
 */
public static void  initializeLLRPContext () {
	LOG.debug("InitializeLLRPContext ...");
	if (!getAdaptorMgmtInitialized()) {
		llrpAdaptorMgmt = AdaptorManagement.getInstance();
		if (!llrpAdaptorMgmt.isInitialized()) {
			//must not happen when we launch the fc-server in fosstrak
			try {
				final boolean commitChanges = false;
				Map<String, Object> config = new HashMap<String, Object> ();
				final String configurationClass = DefaultConfiguration.class.getCanonicalName();
				llrpAdaptorMgmt.initialize(config, config, configurationClass, commitChanges, null, null);
				
			} catch (LLRPRuntimeException e) {
				LOG.error("Error when trying to initialize LLRP Adaptor Management", e);
			}
		}
		setAdaptorMgmtInitialized(true);
		//llrpRemoteAdaptor = llrpAdaptorMgmt.getAdaptorNames().get(0);
		llrpRemoteAdaptor = ALEApplicationContext.getBean(LLRPManager.class).getAdaptor();
		// Register the handlers, so the adaptor management will
		// distribute the LLRP messages automatically and asynchronously. 
		llrpAdaptorMgmt.registerFullHandler(defineMessageHandler());
		llrpAdaptorMgmt.setExceptionHandler(defineExceptionHandler());
	}
	LOG.debug("End initializeLLRPContext.");
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:32,代码来源:AdaptorMgmt.java

示例6: undefine

import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的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

示例7: testGetBeanByName

import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的package包/类
@Test(expected = IllegalStateException.class)
public void testGetBeanByName() {
	ALEApplicationContext.getBeanByName(null);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:5,代码来源:ALEApplicationContextTest.java

示例8: testGetBeanByNameWithClass

import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的package包/类
@Test(expected = IllegalStateException.class)
public void testGetBeanByNameWithClass() {
	ALEApplicationContext.getBeanByName(null, null);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:5,代码来源:ALEApplicationContextTest.java

示例9: testGetBean

import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的package包/类
@Test(expected = IllegalStateException.class)
public void testGetBean() {
	ALEApplicationContext.getBean(null);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:5,代码来源:ALEApplicationContextTest.java

示例10: getManager

import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的package包/类
public LLRPManager getManager() {
	if(manager == null) {
		manager = ALEApplicationContext.getBean(LLRPManager.class);
	}
	return manager;
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:7,代码来源:ReaderInitiatedLLRPIoHandlerAdapter.java

示例11: getInstance

import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的package包/类
public static ALEACImpl getInstance() {
	return ALEApplicationContext.getBean(ALEACImpl.class);
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:4,代码来源:ALEACImpl.java

示例12: EventCycleImpl

import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的package包/类
/**
 * Constructor sets parameter and starts thread.
 * 
 * @param generator to which this event cycle belongs to
 * @throws ImplementationException if an implementation exception occurs
 */
public EventCycleImpl(ReportsGenerator generator) throws ImplementationException {
	this(generator, ALEApplicationContext.getBean(LogicalReaderManager.class));
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:10,代码来源:EventCycleImpl.java

示例13: ReportsGeneratorImpl

import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的package包/类
/**
 * Constructor validates the ec specification and sets some parameters.
 * 
 * @param name of this reports generator
 * @param spec which defines how the reports of this generator should be build
 * @throws ECSpecValidationException if the ec specification is invalid
 * @throws ImplementationException if an implementation exception occurs
 */
public ReportsGeneratorImpl(String name, ECSpec spec) throws ECSpecValidationException, ImplementationException {
	this(name, spec, ALEApplicationContext.getBean(ECSpecValidator.class), ALEApplicationContext.getBean(ECReportsHelper.class));
	
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:13,代码来源:ReportsGeneratorImpl.java

示例14: CommandCycleImpl

import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的package包/类
/**
 * Constructor sets parameter and starts thread.
 * 
 * @param generator to which this command cycle belongs to
 * @throws ImplementationException if an implementation exception occurs
 */
public CommandCycleImpl(ReportsGenerator generator) throws ImplementationException {
	this(generator, ALEApplicationContext.getBean(LogicalReaderManager.class));
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:10,代码来源:CommandCycleImpl.java

示例15: createNewReportGenerator

import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的package包/类
/**
 * creates a new Reports Generator.
 * @param specName the name of the specification.
 * @param spec the specification.
 * @return the new reports generator.
 * @throws ImplementationException internal exception in the implementation.
 * @throws CCSpecValidationException specification is not valid.
 */
public ReportsGenerator createNewReportGenerator(String specName, CCSpec spec) throws CCSpecValidationException, ImplementationException {
	// FIXME: this is far from nice...
	return new ReportsGeneratorImpl(specName, spec, ALEApplicationContext.getBean(CCSpecValidator.class));
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:13,代码来源:ReportsGeneratorsProvider.java


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