public final int asInt(String v) { try { return Integer.parseInt(v); } catch (NumberFormatException e) { throw new ConfigurationException(v+" is not a number"); } }
/** * Performs injection to the given object. */ /*package*/ void inject(Dom dom, Object target) { try { ServiceLocatorUtilities.<ConfigInjector>getService(locator, injector).inject(dom,target); } catch (ConfigurationException e) { e.setLocation(dom.getLocation()); throw e; } }
public final boolean asBoolean(String v) { Boolean b = BOOLEAN_VALUES.get(v); if(b!=null) return b; throw new ConfigurationException(v+" is not a boolean"); }
/** * Performs injection to the given object. */ /*package*/ void inject(Dom dom, Object target) { try { injector.get().inject(dom,target); } catch (ConfigurationException e) { e.setLocation(dom.getLocation()); throw e; } }
public DomDocument parse(URL source, DomDocument document, Dom parent) { InputStream inputStream = null; try { inputStream = source.openStream(); } catch (IOException e) { throw new ConfigurationException("Failed to open "+source,e); } try { parse(xif.createXMLStreamReader(new StreamSource(inputStream)), document, parent); return document; } catch (XMLStreamException e) { throw new ConfigurationException("Failed to parse "+source,e); } finally { try { inputStream.close(); } catch (IOException e) { // ignore } } }
/** * Performs injection to the given object. */ /*package*/ void inject(Dom dom, Object target) { try { ServiceLocatorUtilities.<ConfigInjector>getService(locator, injector).inject(dom,target); } catch (ConfigurationException e) { e.setLocation(dom.getLocation()); throw e; } }
/** * Obtains a {@link ConfigModel} for the given class (Which should have {@link Configured} annotation on it.) */ public ConfigModel buildModel(String fullyQualifiedClassName) { ActiveDescriptor<? extends ConfigInjector<?>> desc; synchronized (cache) { desc = cache.get(fullyQualifiedClassName); if (desc == null) { desc = (ActiveDescriptor<? extends ConfigInjector<?>>) habitat.getBestDescriptor(new InjectionTargetFilter(fullyQualifiedClassName)); if (desc == null) { throw new ConfigurationException("ConfigInjector for %s is not found, is it annotated with @Configured",fullyQualifiedClassName); } cache.put(fullyQualifiedClassName, desc); } } return buildModel(desc); }
/** * Performs injection to the given object. */ /*package*/ void inject(Dom dom, Object target) { try { injector.get().inject(dom,target); } catch (ConfigurationException e) { e.setLocation(dom.getLocation()); throw e; } }
ServiceLocator locator) { if(description==null) throw new ConfigurationException("%s doesn't have any metadata",injector.getImplementation()); throw new ConfigurationException("%s doesn't have the mandatory '%s' metadata", injector.getImplementation(), ConfigMetadata.TARGET); if(key==null ^ indexTypeName==null) throw new ConfigurationException("%s has inconsistent '%s=%s' and '%s=%s' metadata", ConfigMetadata.KEY, key, ConfigMetadata.TARGET, indexTypeName); this.targetTypeName = targetTypeName;
/** * Performs injection to the given object. */ /*package*/ void inject(Dom dom, Object target) { try { ServiceLocatorUtilities.<ConfigInjector>getService(locator, injector).inject(dom,target); } catch (ConfigurationException e) { e.setLocation(dom.getLocation()); throw e; } }
public final int asInt(String v) { try { return Integer.parseInt(v); } catch (NumberFormatException e) { throw new ConfigurationException(v+" is not a number"); } }
public final int asInt(String v) { try { return Integer.parseInt(v); } catch (NumberFormatException e) { throw new ConfigurationException(v+" is not a number"); } }
public final int asInt(String v) { try { return Integer.parseInt(v); } catch (NumberFormatException e) { throw new ConfigurationException(v+" is not a number"); } }
public final boolean asBoolean(String v) { Boolean b = BOOLEAN_VALUES.get(v); if(b!=null) return b; throw new ConfigurationException(v+" is not a boolean"); }
public final int asInt(String v) { try { return Integer.parseInt(v); } catch (NumberFormatException e) { throw new ConfigurationException(v+" is not a number"); } }
public final boolean asBoolean(String v) { Boolean b = BOOLEAN_VALUES.get(v); if(b!=null) return b; throw new ConfigurationException(v+" is not a boolean"); }
public final boolean asBoolean(String v) { Boolean b = BOOLEAN_VALUES.get(v); if(b!=null) return b; throw new ConfigurationException(v+" is not a boolean"); }
public final boolean asBoolean(String v) { Boolean b = BOOLEAN_VALUES.get(v); if(b!=null) return b; throw new ConfigurationException(v+" is not a boolean"); }
public DomDocument parse(URL source, DomDocument document, Dom parent) { InputStream inputStream = null; try { inputStream = source.openStream(); } catch (IOException e) { throw new ConfigurationException("Failed to open "+source,e); } try { parse(xif.createXMLStreamReader(new StreamSource(inputStream)), document, parent); return document; } catch (XMLStreamException e) { throw new ConfigurationException("Failed to parse "+source,e); } finally { try { inputStream.close(); } catch (IOException e) { // ignore } } }
public DomDocument parse(URL source, DomDocument document, Dom parent) { InputStream inputStream = null; try { inputStream = source.openStream(); } catch (IOException e) { throw new ConfigurationException("Failed to open "+source,e); } try { parse(xif.createXMLStreamReader(new StreamSource(inputStream)), document, parent); return document; } catch (XMLStreamException e) { throw new ConfigurationException("Failed to parse "+source,e); } finally { try { inputStream.close(); } catch (IOException e) { // ignore } } }