public QFactory getFactory () { return getServer().getFactory (); }
protected void startService () throws Exception { if (task instanceof Configurable) { Element e = getPersist (); QFactory factory = getServer().getFactory(); ((Configurable)task).setConfiguration ( factory.getConfiguration (e) ); } (thisThread = new Thread(this)).start(); } protected void stopService () throws Exception {
protected void startService () throws Exception { getServer().getFactory().setConfiguration(task, getPersist()); NameRegistrar.register (getName (), task); if (task instanceof Runnable) { new Thread ((Runnable) task).start (); } } protected void stopService () throws Exception {
protected void initService () throws Exception { QFactory factory = getServer().getFactory(); Element e = getPersist (); task = (Runnable) factory.newInstance (e.getChildTextTrim ("class")); factory.setLogger (task, e); } protected void startService () throws Exception {
protected void initService () throws Exception { QFactory factory = getServer().getFactory(); Element e = getPersist (); task = factory.newInstance (e.getChildTextTrim ("class")); factory.setLogger (task, e); } protected void startService () throws Exception {
protected void initService () throws Exception { Element e = getPersist (); QFactory factory = getServer().getFactory(); sm = (SMAdapter) factory.newInstance (getImpl ()); factory.setLogger (sm, e); factory.setConfiguration (sm, e); }
protected void startService () throws Exception { Object obj = getObject(); if (obj instanceof Configurable) { QFactory factory = getServer().getFactory(); Element e = getPersist (); ((Configurable)obj).setConfiguration ( factory.getConfiguration (e) ); } CardAgentLookup.add ((CardAgent) getObject ()); } protected void stopService () throws Exception {
@Test public void testGetFactory() throws Throwable { String[] args = new String[2]; args[0] = "testString"; args[1] = "testString"; QFactory result = new Q2(args).getFactory(); assertNull("result", result); }
protected void initService () throws Exception { Element e = getPersist (); QFactory factory = getServer().getFactory(); ks = (SecureKeyStore) factory.newInstance (getImpl ()); factory.setLogger (ks, e); factory.setConfiguration (ks, e); NameRegistrar.register (getName (), ks); }
private void registerTask (Element e) throws ConfigurationException { QFactory qf = getServer().getFactory(); Object obj = qf.newInstance (e.getChildTextTrim ("class")); if (!(obj instanceof MonitorTask)) { throw new ConfigurationException ( obj.toString() + " is not an instance of MonitorTask" ); } qf.setLogger (obj, e); qf.setConfiguration (obj, e); timer.schedule ( new MonitorTimerTask ( e.getAttributeValue("id"), (MonitorTask) obj), getLong (e.getAttributeValue ("delay")), getLong (e.getAttributeValue ("period")) ); } private long getLong (String l)
private void addListener (Element e) throws ConfigurationException { QFactory factory = getServer().getFactory(); String clazz = e.getAttributeValue ("class"); LogListener listener = (LogListener) factory.newInstance (clazz); if (listener instanceof Configurable) { try { ((Configurable) listener).setConfiguration ( factory.getConfiguration (e) ); } catch (ConfigurationException ex) { throw new ConfigurationException (ex); } } if (listener instanceof XmlConfigurable) { try { ((XmlConfigurable) listener).setConfiguration (e); } catch (ConfigurationException ex) { throw new ConfigurationException (ex); } } logger.addListener (listener); } }
protected void initService () throws Exception { QFactory factory = getServer().getFactory(); dirPoll = createDirPoll(); dirPoll.setPath (getPath ()); dirPoll.setThreadPool (new ThreadPool (1, poolSize)); dirPoll.setPollInterval (pollInterval); if (priorities != null) dirPoll.setPriorities (priorities); dirPoll.setLogger (getLog().getLogger(), getLog().getRealm ()); Configuration cfg = factory.getConfiguration (getPersist()); dirPoll.setConfiguration (cfg); dirPoll.createDirs (); Object dpp = factory.newInstance (getProcessor()); if (dpp instanceof LogSource) { ((LogSource) dpp).setLogger ( getLog().getLogger(), getLog().getRealm () ); } if (dpp instanceof Configurable) { ((Configurable) dpp).setConfiguration (cfg); } dirPoll.setProcessor (dpp); }