@Override public Meter createMeterMetric(String name) { return getDelegate().createMeterMetric(name); }
@Override public Timer createTimerMetric(String name) { return getDelegate().createTimerMetric(name); }
@Override public IMicroserviceTenantEngine getTenantEngine() { return getDelegate().getTenantEngine(); } }
@Override public void setTenantEngine(IMicroserviceTenantEngine tenantEngine) { getDelegate().setTenantEngine(tenantEngine); }
@Override public void initializeNestedComponent(ILifecycleComponent component, ILifecycleProgressMonitor monitor, boolean require) throws SiteWhereException { if (component instanceof ITenantEngineLifecycleComponent) { ((ITenantEngineLifecycleComponent) component).setTenantEngine(getTenantEngine()); } super.initializeNestedComponent(component, monitor, require); }
@Override public void startNestedComponent(ILifecycleComponent component, ILifecycleProgressMonitor monitor, boolean require) throws SiteWhereException { if (component instanceof ITenantEngineLifecycleComponent) { ((ITenantEngineLifecycleComponent) component).setTenantEngine(getTenantEngine()); } super.startNestedComponent(component, monitor, require); }
/** * Resolve variable expressions within a value. * * @param value * @param context * @return * @throws SiteWhereException */ public static String resolve(String value, ILifecycleComponent context) throws SiteWhereException { IMicroserviceTenantEngine engine = (context instanceof ITenantEngineLifecycleComponent) ? ((ITenantEngineLifecycleComponent) context).getTenantEngine() : null; if ((engine == null) && (value.indexOf(asVariable(TENANT_ID)) != -1)) { throw new SiteWhereException("Unable to resolve reference to tenant id in a global component."); } String result = value; Map<String, String> variables = new HashMap<String, String>(); if (engine != null) { variables.put(TENANT_ID, engine.getTenant().getToken()); } for (String key : variables.keySet()) { result = result.replace(asVariable(key), variables.get(key)); } return result; }