@Override public IConfig createConfig(String key) throws MException { throw new MException("not supported"); }
@Override public void removeConfig(IConfig config) throws MException { throw new MException("not supported"); }
@Override public int moveConfig(IConfig config, int newPos) throws MException { throw new MException("not supported"); }
@Override public int moveConfig(IConfig config, int newPos) throws MException { throw new MException("not supported"); }
@Override public void removeConfig(IConfig config) throws MException { if (!(config instanceof XmlConfig)) throw new MException("not a xmlconfig"); if ( ((XmlConfig)config).element.getParentNode() != element) throw new MException("not child of this config"); element.removeChild(((XmlConfig)config).element); }
public IConfig setConfig(String key, HashConfig child) throws MException { if (child.parent != null) throw new MException("Config already linked"); LinkedList<IConfig> list = children.get(key); if (list == null) { list = new LinkedList<>(); children.put(key, list); } child.parent = this; child.name = key; list.add(child); childrenAll.add(child); return child; }
protected void updateArchiveDataSource() throws InvalidSyntaxException, MException { Collection<ServiceReference<DataSource>> refs = context.getServiceReferences(DataSource.class, "(osgi.jndi.service.name="+archiveDsName+")"); if (refs.size() == 0) throw new MException("datasource not found",archiveDsName); archiveDataSource = context.getService(refs.iterator().next()); archiveDsProvider.setDataSource(archiveDataSource); }
/** {@inheritDoc} */ @Override public DbStatement createStatement(String sql, String language) throws MException { synchronized (this) { if (closed) throw new MException("Connection not valid"); return new JdbcStatement(this, sql, language); } }
public <T extends CaoAspect> CaoCore registerAspectFactory(Class<T> ifc,CaoAspectFactory<T> factory) throws MException { if (aspectFactory.containsKey(ifc)) throw new MException("Aspect already registered",ifc); aspectFactory.put(ifc, factory); factory.doInitialize(this, actionList); return this; }
/** {@inheritDoc} */ @Override public void commit() throws Exception { log().t(poolId,id,"commit"); if (closed) throw new MException(poolId,id,"Connection not valid"); if (!connection.getAutoCommit()) connection.commit(); }
public void save() throws MException { try { if (!canSave()) return; log().t("save config",this); FileOutputStream os = new FileOutputStream(file); properties.store(os, ""); os.close(); } catch (Exception e) { throw new MException(e); } }
protected void updateStorageDataSource() throws InvalidSyntaxException, MException { Collection<ServiceReference<DataSource>> refs = context.getServiceReferences(DataSource.class, "(osgi.jndi.service.name="+storageDsName+")"); if (refs.size() == 0) throw new MException("datasource not found",storageDsName); storageDataSource = context.getService(refs.iterator().next()); storageDsProvider.setDataSource(storageDataSource); try { String driver = storageDataSource.getConnection().getMetaData().getDriverName(); Dialect dialect = Dialect.findDialect(driver); storageDsProvider.setDialect(dialect); } catch (Exception e) { log().e(e); } }
@SuppressWarnings("unchecked") @Override public <F> F get(Object object, String name) throws MException { try { return (F) table.getField(name).get(object); } catch (Throwable t) { throw new MException(name,t); } }
@Override public boolean getBoolean(String name) throws MException { Object out = getProperty(name); if (out == null) throw new MException("value not found"); return MCast.toboolean(out, false); }
@Override public void set(Object object, String name, Object v) throws MException { try { table.getField(name).set(object, v); } catch (Throwable t) { throw new MException(name,t); } }
/** {@inheritDoc} */ @Override public DbStatement getStatement(String name) throws MException { synchronized (this) { if (closed) throw new MException("Connection not valid"); String[] query = provider.getQuery(name); if (query == null) return null; return new JdbcStatement(this, query[1],query[0]); } }
public void save() throws MException { try { if (!canSave()) return; log().t("save config",this); FileOutputStream os = new FileOutputStream(file); write(os); os.close(); } catch (Exception e) { throw new MException(e); } }
public void save() throws MException { try { if (!canSave()) return; log().t("save config",this); FileOutputStream os = new FileOutputStream(file); MXml.trim(element); MXml.saveXml(element, os); os.close(); } catch (Exception e) { throw new MException(e); } }
@Override public Object createSchemaObject(String registryName) throws Exception { reloadLock.waitWithException(MAX_LOCK); Table table = cIndex.get(registryName); if (table == null) throw new MException("class definition not found in schema",registryName); return schema.createObject(table.getClazz(), table.getRegistryName(), null, this, false); }
@Override public void removeConfig(IConfig config) throws MException { if (!(config instanceof JsonConfig)) return; // find array node, to append new config JsonNode array = node.get(config.getName()); if (array == null) return; int pos = findPosOf((ArrayNode)array,(JsonConfig)config); if (pos < 0) throw new MException("could not find child"); ((ArrayNode)array).remove( pos ); }