/** * Add a property value. * @param name The name. * @param val The value. */ public void addProperty(String name, Object val) { assert !getComponentAdapter().isExternalThread(); if(properties==null) properties = new HashMap<String, Object>(); properties.put(name, val); }
/** * Get a space of the application. * @param name The name of the space. * @return The space. */ public IExtensionInstance getExtension(final String name) { assert !getComponentAdapter().isExternalThread(); return extensions==null? null: (IExtensionInstance)extensions.get(name); }
/** * Add an extension. * @param name The argument name. * @param value The extension. */ public void addExtension(String name, IExtensionInstance value) { assert !getComponentAdapter().isExternalThread(); if(extensions==null) { extensions = new HashMap<String, IExtensionInstance>(); } extensions.put(name, value); }
/** * Add a default value for a result (if not already present). * Called once for each result during init. * @param name The result name. * @param value The result value. */ public void addDefaultResult(String name, Object value) { assert !getComponentAdapter().isExternalThread(); // System.out.println("add def res: "+name+" "+value); if(results==null) { results = new HashMap<String, Object>(); } results.put(name, value); }
/** * Get a space of the application. * @param name The name of the space. * @return The space. */ public IExtensionInstance[] getExtensions() { // Hack!!! When init fails , terminateExtensions() can not be called on component thread // as component already terminated. assert !getComponentAdapter().isExternalThread() || IComponentDescription.STATE_TERMINATED.equals(getComponentDescription().getState()); return extensions==null? new IExtensionInstance[0]: (IExtensionInstance[])extensions.values().toArray(new IExtensionInstance[extensions.size()]); }
/** * Get the value fetcher. */ public IValueFetcher getFetcher() { assert !getComponentAdapter().isExternalThread(); if(fetcher==null) { fetcher = new InterpreterFetcher(this); } return fetcher; }
/** * Check if threa is allowed. * * There is the problem that a component is already terminated and calls come back later. * In that case we allow the listeners to be called on the wrong thread. */ public void checkAllowedThread() { assert !getComponentAdapter().isExternalThread() || IComponentDescription.STATE_TERMINATED.equals(getComponentDescription().getState()); }
/** * Set a result value. * @param name The result name. * @param value The result value. */ public void setResultValue(String name, Object value) { assert !getComponentAdapter().isExternalThread(); // todo: store results only within listener?! if(results==null) results = new HashMap<String, Object>(); results.put(name, value); if(resultlistener!=null) { resultlistener.intermediateResultAvailable(new Tuple2<String, Object>(name, value)); } }
/** * Create the service container. * @return The service conainer. */ public IServiceContainer createServiceContainer() { assert container==null; return new ComponentServiceContainer(adapter, getComponentAdapter().getDescription().getType(), getInternalAccess(), isRealtime()); }