private String get (String prop) throws ConfigurationException { String value = cfg.get (prop); if (value == null) throw new ConfigurationException ("null property "+prop); return value; } }
public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; serviceName = cfg.get ("channel", null); if (serviceName == null) throw new ConfigurationException ("property 'channel' is null"); } }
private void initJDBC() throws ConfigurationException { try { Class.forName(cfg.get("jdbc.driver")).newInstance(); } catch (Exception e) { throw new ConfigurationException (e); } } public synchronized Connection getConnection() {
public void setConfiguration (Configuration cfg) throws ConfigurationException { try { String log_priority = cfg.get("priority"); if ( log_priority != null && !log_priority.trim().equals("") && levels.containsKey(log_priority) ) { priority = log_priority; } } catch (Exception e) { throw new ConfigurationException (e); } }
public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; try { InitialContext ctx = new InitialContext (); ctx.rebind (cfg.get ("name"), stub); } catch (NamingException e) { throw new ConfigurationException (e); } } public Set getKeySet () {
private boolean hasFunction (String functionName) throws ConfigurationException { try { js.invokeFunction(functionName, 0L, new Context()); return true; } catch (NoSuchMethodException e) { return false; } catch (ScriptException e) { throw new ConfigurationException (e); } }
public void configureQBean(MBeanServer server, ObjectName objectName, Element e) throws ConfigurationException { try { AttributeList attributeList = getAttributeList(e); for (Object anAttributeList : attributeList) server.setAttribute(objectName, (Attribute) anAttributeList); } catch (Exception e1) { throw new ConfigurationException(e1); } } public AttributeList getAttributeList(Element e)
public Object newInstance (String clazz) throws ConfigurationException { try { MBeanServer mserver = q2.getMBeanServer(); return mserver.instantiate (clazz, loaderName); } catch (Exception e) { throw new ConfigurationException (clazz, e); } }
private LocalSpace grabSpace (Element e) throws ConfigurationException { String uri = e != null ? e.getText() : ""; Space sp = SpaceFactory.getSpace (uri); if (sp instanceof LocalSpace) { return (LocalSpace) sp; } throw new ConfigurationException ("Invalid space " + uri); }
private LocalSpace grabSpace (Element e) throws ConfigurationException { String uri = e != null ? e.getText() : ""; Space sp = SpaceFactory.getSpace (uri); if (sp instanceof LocalSpace) { return (LocalSpace) sp; } throw new ConfigurationException ("Invalid space " + uri); }
public void setConfiguration(Element e) throws ConfigurationException { super.setConfiguration(e); try { selectMethod = BSHMethod.createBshMethod(e.getChild("select")); } catch (Exception ex) { throw new ConfigurationException(ex.getMessage(), ex); } }
/** * @param cfg Configuration object * @throws ConfigurationException */ @Override public void setConfiguration(Configuration cfg) throws ConfigurationException { this.cfg = cfg; queueName = cfg.get("queue", null); if (queueName == null) throw new ConfigurationException("'queue' property not configured"); timeout = cfg.getLong("timeout", timeout); frozen = cfg.getBoolean("frozen", true); }
public void setConfiguration (Configuration cfg) throws ConfigurationException { sp = SpaceFactory.getSpace(cfg.get ("space", "")); queue = cfg.get ("queue", null); if (queue == null) throw new ConfigurationException ("Unspecified queue"); timeout = cfg.getLong ("timeout", 60000L); } }
public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; try { mux = (SpaceMUX) NameRegistrar.get (cfg.get ("mux")); } catch (NotFoundException e) { throw new ConfigurationException (e); } timeout = cfg.getLong ("timeout", 120000); pool = new ThreadPool (1, cfg.getInt ("pool", 100)); }
public void setConfiguration(Element e) throws ConfigurationException { try { prepareMethod = BSHMethod.createBshMethod(e.getChild("prepare")); prepareForAbortMethod = BSHMethod.createBshMethod(e.getChild("prepare-for-abort")); commitMethod = BSHMethod.createBshMethod(e.getChild("commit")); abortMethod = BSHMethod.createBshMethod(e.getChild("abort")); trace = "yes".equals (e.getAttributeValue ("trace")); } catch (Exception ex) { throw new ConfigurationException(ex.getMessage(), ex); } }
@Override public void setConfiguration (Configuration cfg) throws ConfigurationException { super.setConfiguration(cfg); queueName = cfg.get("queue", null); if (queueName == null) throw new ConfigurationException("'queue' property not configured"); sp = SpaceFactory.getSpace(cfg.get("space")); timeout = cfg.getLong("timeout", timeout); } }
private void newChannel () throws ConfigurationException { Element persist = getPersist (); Element e = persist.getChild ("channel"); if (e == null) { throw new ConfigurationException ("channel element missing"); } ChannelAdaptor adaptor = new ChannelAdaptor (); channel = adaptor.newChannel (e, getFactory ()); }
@Test public void testConstructor() throws Throwable { Throwable nested = new ConfigurationException(); ConfigurationException configurationException = new ConfigurationException("testConfigurationExceptionDetail", nested); assertEquals("configurationException.getMessage()", "testConfigurationExceptionDetail", configurationException.getMessage()); assertSame("configurationException.getNested()", nested, configurationException.getNested()); }
@Test public void testConstructor3() throws Throwable { ConfigurationException configurationException = new ConfigurationException(); assertNull("configurationException.getNested()", configurationException.getNested()); }
@Test public void testConstructor2() throws Throwable { ConfigurationException configurationException = new ConfigurationException("testConfigurationExceptionDetail"); assertEquals("configurationException.getMessage()", "testConfigurationExceptionDetail", configurationException.getMessage()); assertNull("configurationException.getNested()", configurationException.getNested()); }