本文整理汇总了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);
}
示例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);
}
}
示例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.");
}
示例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);
}
}
示例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.");
}
示例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
}
示例7: testGetBeanByName
import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的package包/类
@Test(expected = IllegalStateException.class)
public void testGetBeanByName() {
ALEApplicationContext.getBeanByName(null);
}
示例8: testGetBeanByNameWithClass
import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的package包/类
@Test(expected = IllegalStateException.class)
public void testGetBeanByNameWithClass() {
ALEApplicationContext.getBeanByName(null, null);
}
示例9: testGetBean
import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的package包/类
@Test(expected = IllegalStateException.class)
public void testGetBean() {
ALEApplicationContext.getBean(null);
}
示例10: getManager
import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的package包/类
public LLRPManager getManager() {
if(manager == null) {
manager = ALEApplicationContext.getBean(LLRPManager.class);
}
return manager;
}
示例11: getInstance
import org.fosstrak.ale.server.ALEApplicationContext; //导入依赖的package包/类
public static ALEACImpl getInstance() {
return ALEApplicationContext.getBean(ALEACImpl.class);
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}