org.ogema.core.application.ApplicationManager类的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中org.ogema.core.application.ApplicationManager类的一些代码示例,展示了ApplicationManager类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ApplicationManager类的具体详情如下:
包路径:org.ogema.core.application.ApplicationManager
类名称:ApplicationManager

ApplicationManager介绍

暂无

代码示例

代码示例来源:origin: org.ogema.messaging/message-settings

public EmailTemplate(ResourceList<EmailConfiguration> list, ApplicationManager am,
    DynamicTable<EmailConfiguration> table, Alert alert, WidgetPage<?> page) {
  this.list = list;
  this.table = table;
  this.alert = alert;
  this.page = page;
  this.am = am;
  this.logger = am.getLogger();
  this.ra = am.getResourceAccess();
  this.resMan = am.getResourceManagement();
}

代码示例来源:origin: org.ogema.tools/grafana-base

@Override
public void start(ApplicationManager am) {
  this.am = am;
  String packagePath = "org/ogema/tools/grafana/base/grafana-1.9.1";
  WEB_RES_PATH = am.getWebAccessManager().registerWebResourcePath("", packagePath);
  APP_STARTTIME = am.getFrameworkTime();
  //    	WEB_RES_PATH = am.getWebAccessManager().registerWebResource("/org/ogema/tools/grafana-base" , packagePath);      
  am.getLogger().debug("Grafana base resources registered under " + WEB_RES_PATH);
  am.getWebAccessManager().registerStartUrl(null); // remove app from framework GUI
}

代码示例来源:origin: org.ogema.drivers/remote-rest-connector

@Override
  public void start(ApplicationManager appManager) {
    this.appMan = appManager;
    this.logger = appManager.getLogger();
    this.executor  = Executors.newSingleThreadExecutor();
//        appMan.getResourceAccess().addResourceDemand(RestConnection.class, connectionListener);
    appManager.getResourcePatternAccess().addPatternDemand(RestConnectionPattern.class, this, AccessPriority.PRIO_LOWEST);
    // timing interval will be reset when a connection becomes available
    t = appMan.createTimer(1000000, new TimerListener() {

      @Override
      public void timerElapsed(Timer timer) {
        taskSchedulerStep();
      }

    });
    t.stop();
    //testSetup();

    logger.info("{} started", getClass().getName());
  }

代码示例来源:origin: org.ogema.messaging/message-settings

public XmppTemplate(ResourceList<XmppConfiguration> list, ApplicationManager am,
    DynamicTable<XmppConfiguration> table, Alert alert, WidgetPage<?> page) {
  this.list = list;
  this.table = table;
  this.alert = alert;
  this.page = page;
  this.am = am;
  this.logger = am.getLogger();
  this.ra = am.getResourceAccess();
}

代码示例来源:origin: org.ogema.tools/resource-manipulators

public ResourceManipulatorImpl(ApplicationManager applicationManager) {
    appMan = applicationManager;
    resMan = applicationManager.getResourceManagement();
    resAcc = applicationManager.getResourceAccess();
    logger = applicationManager.getLogger();
//        appId = applicationManager.getAppID().getIDString(); //this is not even invariant under restart with unchanged configuration
    Bundle bdl = applicationManager.getAppID().getBundle();
    appId = bdl.getSymbolicName();
  }

代码示例来源:origin: org.ogema.drivers/hm-hl

channelList = new ArrayList<ChannelConfiguration>(); // UpdateListenerList
commandChannel = new HashMap<String, ChannelConfiguration>();
channelAccess = appManager.getChannelAccess();
resourceManager = appManager.getResourceManagement();
resourceAccess = appManager.getResourceAccess();
this.appManager = appManager;
this.logger = appManager.getLogger();
hm_hlConfig = config;
this.type = config.channelAddress.split(":")[0];

代码示例来源:origin: org.ogema.ref-impl/framework-administration

this.logger = appManager.getLogger();
this.resMan = appManager.getResourceManagement();
this.resAcc = appManager.getResourceAccess();
String aliasHtml = appManager.getWebAccessManager().registerWebResource("/ogema/frameworkadminindex",
    "org/ogema/frameworkadministration/gui");
appManager.getWebAccessManager().registerStartUrl("/ogema/frameworkadminindex/index.html");
String aliasLoggerServlet = appManager.getWebAccessManager().registerWebResource("/apps/ogema/frameworkadmin",
    new FAServletLogger());
String aliasUserServlet = appManager.getWebAccessManager().registerWebResource(
    "/apps/ogema/frameworkadminuser", new FAServletUser());
appStoreServlet.register(appManager.getWebAccessManager());

代码示例来源:origin: org.ogema.drivers/channel-mapper-v2

@SuppressWarnings("unchecked")
@Override
public void start(ApplicationManager appManager) {
  Objects.requireNonNull(ctx);
  this.logger = appManager.getLogger();
  this.appMan = appManager;
  this.ca = appManager.getChannelAccess();
  this.configs = appManager.getResourceManagement().createResource("channelMapperConfigurations", ResourceList.class);
  configs.setElementType(ChannelMapperConfiguration.class);
  configs.activate(false);
  appManager.getResourcePatternAccess().addPatternDemand(ChannelMapperConfigPattern.class, this, AccessPriority.PRIO_LOWEST);
  this.sreg = ctx.registerService(ChannelMapper.class, this, null);
}

代码示例来源:origin: org.ogema.drivers/remote-rest-connector

protected ConnectionTask(RestConnection con, ApplicationManager appman) {
  this.con = con;
  this.appman = appman;
  this.logger = appman.getLogger();
}

代码示例来源:origin: org.smartrplace.apps/smartrplace-util-proposed

/** Overwrite this method to provide a different set of resources
 * 
 * @param req
 * @return
 */
public List<T> getResourcesInTable(OgemaHttpRequest req) {
  return appMan.getResourceAccess().getResources(resourceType);
}

代码示例来源:origin: org.ogema.drivers/knx

@Override
public void start(ApplicationManager appManager) {
  logger = appManager.getLogger();
  final List<KNXAddress> resourcesKNX = appManager.getResourceAccess().getResources(KNXAddress.class);
  appManager.createTimer(3000, timerListener);
  readFromSensor();
  writingToActor();

代码示例来源:origin: org.ogema.widgets/ogema-js-bundle

public WidgetAppImpl(String htmlPath, OgemaGuiService guiService, ApplicationManager am, boolean pageSpecificId) throws IllegalStateException {
    // we do this first, since it throws an exception if an app is already registered under the same url
    Objects.requireNonNull(am);
    Objects.requireNonNull(guiService);
    checkPath(htmlPath);
    this.guiService = guiService;
    this.wam = am.getWebAccessManager();
    this.log = am.getLogger();
    this.appId = am.getAppID();
    this.htmlPath = htmlPath;
//        this.pageSpecificId = pageSpecificId;
//        this.sessions = null;
    this.appVersion = AccessController.doPrivileged(getVersion);
    getWidgetService().addApp(this);
  }

代码示例来源:origin: org.ogema.tools/system-supervision

@Descriptor("Create a new resource")
public Resource createResource(
    @Descriptor("Resource path")
    String path,
    @Descriptor("Full resource type, such as 'org.ogema.model.locations.Room'")
    String type
    ) {
  if (type.isEmpty() || path.isEmpty()) {
    System.out.println("Type and path must not be empty");
    return null;
  }
  final Resource existing = appMan.getResourceAccess().getResource(path);
  if (existing != null) {
    if (existing.exists()) {
      System.out.println("Resource " + path + " already exists: " + existing);
      return null;
    }
  }
  final Class<? extends Resource> resType = loadResourceClass(appMan.getAppID().getBundle().getBundleContext(), type);
  if (resType == null) 
    return null;
  return appMan.getResourceManagement().createResource(path, resType);
}

代码示例来源:origin: org.ogema.drivers/drs485de-driver

this.channelAccess = appManager.getChannelAccess();
this.logger = appManager.getLogger();
ResourceManagement resourceManager = appManager.getResourceManagement();

代码示例来源:origin: org.smartrplace.sim/resource-simulation

ResourceSimulation(ConfigPattern config, ReadOnlyTimeSeries input, ApplicationManager appMan) {
  this.config = config;
  this.resource = config.target.getLocationResource();
  this.input = input;
  this.additive = config.additive.isActive() && config.additive.getValue();
  if (!config.forecast.isActive()) {
    this.forecast = null;
    this.iterator = null;
  } else {
    final String scheduleName = config.forecast.getValue();
    Schedule sched0 = resource.getSubResource(scheduleName);
    if (sched0 == null)
      sched0 = resource.getSubResource(scheduleName, AbsoluteSchedule.class).create();
    this.forecast = sched0;
    sched0.activate(false);
    this.iterator = new CyclicIterator(input, appMan.getFrameworkTime());
  }
  this.timer = appMan.createTimer(10000000, this);
  timerElapsed(timer);
  resource.activate(false);
  LoggingUtils.activateLogging(resource, -2);
  appMan.getLogger().debug("Simulation started for resource {}", resource);
}

代码示例来源:origin: org.ogema.tools/system-supervision

@Override
public void start(final ApplicationManager appManager) {
  this.appMan = appManager;
  appManager.getResourceAccess().addResourceDemand(SystemSupervisionConfig.class, this);
  this.shellInitial = new ShellCommandsInitial(appManager, appManager.getAppID().getBundle().getBundleContext());
}

代码示例来源:origin: org.ogema.tools/resource-manipulators

public ScheduleManagementController(ApplicationManager am) {
  this.am= am;
  this.logger  =am.getLogger();
  this.timer = am.createTimer(10000,this); 
  timer.stop();
}

代码示例来源:origin: org.ogema.tools/resource-utils

/**
 * Get a resource list of the specified element type at the given path, creating it if does not exist yet.
 * @param appMan
 * @param path
 * @param elementType
 * @return
 * @throws ClassCastException if a resource at the given path exists but is not of type ResourceList, or the element type does not match
 * @throws SecurityException if the resource exists and the caller does not have the read permission, or the 
 *         resource does not exist and the caller does not have the write permission
 * @throws NullPointerException if any of the passed arguments is null
 */
@SuppressWarnings("unchecked")
public static <T extends Resource> ResourceList<T> getOrCreateResourceList(ApplicationManager appMan, String path, Class<T> elementType) {
  Objects.requireNonNull(appMan);
  Objects.requireNonNull(path);
  Objects.requireNonNull(elementType);
  ResourceList<T> list = appMan.getResourceAccess().getResource(path);
  if (list == null)
    list = appMan.getResourceManagement().createResource(path, ResourceList.class);
  Class<? extends Resource> type = list.getElementType();
  if (type == null)
    list.setElementType(elementType);
  else if (type != elementType)
    throw new ClassCastException("Resource list exists with different element type " + type + " instead of " + elementType);
  return list;
}

代码示例来源:origin: org.ogema.drivers/remote-rest-connector

/**
 * @return
 *         0, if task is not currently active, active duration in ms otherwise 
 */
public long getExecutionDuration() {
  final Long lastExec = this.lastExec;
  if (lastExec == null)
    return 0;
  return appman.getFrameworkTime() - lastExec;
}

代码示例来源:origin: org.ogema.widgets/widget-extended

@Override
  public P run() {
    try {
      P pattern = type.getConstructor(Resource.class).newInstance(res);
      if (!allowIncompletePattern) {
        boolean satisfied = am.getResourcePatternAccess().isSatisfied(pattern, type);
        if (!satisfied) {
          am.getLogger().info("Page has been initialized with an incomplete pattern - ignoring this: {}",pattern);
          return null;
        }
      }
      return pattern;
    } catch (Exception e) {
      am.getLogger().warn("Could not initalize page with pattern {} of type {}",selected,type.getName(),e);
      return null;
    }
  }
});

相关文章