Refine search
@Override public void configure(ODocument iConfiguration, OCommandContext iContext) { super.configure(iConfiguration, iContext); url = iConfiguration.field("url"); if (url == null || url.isEmpty()) throw new OConfigurationException("HTTP Source missing URL"); if (iConfiguration.containsField("method")) method = iConfiguration.field("method"); if (iConfiguration.containsField("headers")) headers = iConfiguration.field("headers"); }
final Object joinRuntimeValue; if (joinFieldName != null) joinRuntimeValue = doc.field(joinFieldName); else if (joinValue != null) joinRuntimeValue = resolve(joinValue); if (lookup != null) { final String[] lookupParts = lookup.split("\\."); final ODocument linkedDoc = new ODocument(lookupParts[0]); linkedDoc.field(lookupParts[1], joinRuntimeValue); linkedDoc.save(); throw new OConfigurationException("Cannot create linked document because target class is unknown. Use 'lookup' field"); break; case ERROR:
protected static OETLProcessor parseConfigAndParameters(String[] args) { final OCommandContext context = createDefaultContext(); ODocument configuration = new ODocument().fromJSON("{}"); for (final String arg : args) { if (arg.charAt(0) != '-') { try { final String config = OIOUtils.readFileAsString(new File(arg)); configuration.merge(new ODocument().fromJSON(config, "noMap"), true, true); // configuration = ; ODocument cfgGlobal = configuration.field("config"); if (cfgGlobal != null) { for (String f : cfgGlobal.fieldNames()) { context.setVariable(f, cfgGlobal.field(f)); } } } catch (IOException e) { throw new OConfigurationException("Error on loading config file: " + arg, e); } } } // override with args passes by command line for (final String arg : args) { if (arg.charAt(0) == '-') { final String[] parts = arg.substring(1).split("="); context.setVariable(parts[0], parts[1]); } } return new OETLProcessor().parse(configuration, context); }
@Override public void begin(ODatabaseDocument db) { super.begin(db); final String[] fieldNames = configuration.fieldNames(); try { String fieldName = fieldNames[0]; block = new OETLComponentFactory().getBlock(fieldName); block.configure(configuration.<ODocument>field(fieldName), context); } catch (Exception e) { throw OException.wrapException(new OConfigurationException("[Block transformer] Error on configuring inner block"), e); } }
@Override public void configure(OETLProcessor iProcessor, final ODocument iConfiguration, OCommandContext iContext) { super.configure(iProcessor, iConfiguration, iContext); final String[] fieldNames = iConfiguration.fieldNames(); try { block = processor.getFactory().getBlock(fieldNames[0]); block.configure(processor, (ODocument) iConfiguration.field(fieldNames[0]), context); } catch (Exception e) { throw new OConfigurationException("[Block transformer] Error on configuring inner block", e); } }
@Override public void configure(OETLProcessor iProcessor, final ODocument iConfiguration, OCommandContext iContext) { super.configure(iProcessor, iConfiguration, iContext); operation = iConfiguration.field("operation"); if (operation == null) throw new OConfigurationException("Flow transformer has not mandatory 'operation' field"); if (!operation.equalsIgnoreCase("halt") && !operation.equalsIgnoreCase("skip")) throw new OConfigurationException("Flow transformer has invalid 'operation' field='" + operation + "', while supported are: 'skip' and 'halt'"); }
private void initCache() { configuration = new ODocument(); configuration.field("enabled", enable); configuration.field("evictStrategy", evictStrategy.toString()); configuration.field("minExecutionTime", minExecutionTime); configuration.field("maxResultsetSize", maxResultsetSize); try { ODocument diskConfig = loadConfiguration(); if (diskConfig != null) { configuration = diskConfig; configure(); } else { updateCfgOnDisk(); } } catch (Exception e) { throw OException.wrapException(new OConfigurationException( "Cannot change Command Cache Cache configuration file '" + CONFIG_FILE + "'. Command Cache will use default settings"), e); } }
@Override public OIndexInternal<?> createIndex(String name, OStorage storage, String indexType, String algorithm, String valueContainerAlgorithm, ODocument metadata, int version) throws OConfigurationException { OAbstractPaginatedStorage pagStorage = (OAbstractPaginatedStorage) storage.getUnderlying(); if (metadata == null) metadata = new ODocument().field("analyzer", StandardAnalyzer.class.getName()); if (FULLTEXT.toString().equalsIgnoreCase(indexType)) { final int binaryFormatVersion = pagStorage.getConfiguration().getBinaryFormatVersion(); OLuceneFullTextIndex index = new OLuceneFullTextIndex(name, indexType, algorithm, version, pagStorage, valueContainerAlgorithm, metadata, binaryFormatVersion); return index; } throw new OConfigurationException("Unsupported type : " + algorithm); }
@Override public OCommandCacheSoftRefs enable() { enable = true; configuration.field("enabled", true); try { updateCfgOnDisk(); } catch (IOException e) { throw OException.wrapException( new OConfigurationException("Cannot write Command Cache Cache configuration to file '" + CONFIG_FILE + "'"), e); } return this; }
clusterId = database.addCluster(name); } else throw new OConfigurationException( "Imported cluster '" + name + "' has id=" + clusterId + " different from the original: " + id + ". To continue the import drop the cluster '" + database.getClusterNameById(clusterId - 1) + "' that has " ODocument indexDocument = new ODocument(); indexDocument.save(OMetadataDefault.CLUSTER_INTERNAL_NAME); database.getStorage().setIndexMgrRecordId(indexDocument.getIdentity().toString());
private ODocument loadConfiguration() { try { final File f = getConfigFile(); if (f != null && f.exists()) { final String configurationContent = OIOUtils.readFileAsString(f); return new ODocument().fromJSON(configurationContent); } } catch (Exception e) { throw OException.wrapException(new OConfigurationException( "Cannot load Command Cache Cache configuration file '" + CONFIG_FILE + "'. Command Cache will use default settings"), e); } return null; }
throw new OConfigurationException( "Index '" + name + "' cannot be rebuilt because has no a valid definition (" + indexDefinition + ")"); OLogManager.instance().error(this, "Exception during index rebuild. Exception was caused by following key/ value pair - key %s, value %s." + " Rebuild will continue from this point", e, fieldValue, doc.getIdentity());
public static synchronized <T extends Object> Iterator<T> lookupProviderWithOrientClassLoader(Class<T> clazz, ClassLoader orientClassLoader) { final ClassLoader origClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(orientClassLoader); try { return ServiceLoader.load(clazz).iterator(); } catch (Exception e) { OLogManager.instance().warn(null, "Cannot lookup in service registry", e); throw OException.wrapException(new OConfigurationException("Cannot lookup in service registry"), e); } finally { Thread.currentThread().setContextClassLoader(origClassLoader); } }
public OScriptDocumentDatabaseWrapper getDatabase() { if (db == null) throw new OConfigurationException("No database instance found in context"); if (db instanceof ODatabaseDocumentInternal) return new OScriptDocumentDatabaseWrapper((ODatabaseDocumentInternal) db); throw new OConfigurationException("No valid database instance found in context: " + db + ", class: " + db.getClass()); } }
final Object joinRuntimeValue; if (joinFieldName != null) joinRuntimeValue = doc.field(joinFieldName); else if (joinValue != null) joinRuntimeValue = resolve(joinValue); if (lookup != null) { final String[] lookupParts = lookup.split("\\."); final ODocument linkedDoc = new ODocument(lookupParts[0]); linkedDoc.field(lookupParts[1], joinRuntimeValue); linkedDoc.save(); throw new OConfigurationException("Cannot create linked document because target class is unknown. Use 'lookup' field"); break; case ERROR:
@Override public void configure(ODocument iConfiguration, OCommandContext iContext) { super.configure(iConfiguration, iContext); driverClass = (String) resolve(iConfiguration.field("driver")); url = (String) resolve(iConfiguration.field("url")); userName = (String) resolve(iConfiguration.field("userName")); userPassword = (String) resolve(iConfiguration.field("userPassword")); query = (String) resolve(iConfiguration.field("query")); queryCount = (String) resolve(iConfiguration.field("queryCount")); if (iConfiguration.containsField("fetchSize")) fetchSize = (Integer) resolve(iConfiguration.field("fetchSize")); try { Class.forName(driverClass).newInstance(); } catch (Exception e) { throw OException.wrapException(new OConfigurationException("[JDBC extractor] JDBC Driver " + driverClass + " not found"), e); } try { conn = DriverManager.getConnection(url, userName, userPassword); } catch (Exception e) { throw OException.wrapException(new OConfigurationException( "[JDBC extractor] error on connecting to JDBC url '" + url + "' using user '" + userName + "' and the password provided"), e); } }
if (iBeginBlocks != null) for (ODocument block : iBeginBlocks) { name = block.fieldNames()[0]; final OBlock b = factory.getBlock(name); beginBlocks.add(b); configureComponent(b, (ODocument) block.field(name), iContext); name = iSource.fieldNames()[0]; source = factory.getSource(name); configureComponent(source, (ODocument) iSource.field(name), iContext); throw new OConfigurationException("Error on creating ETL processor", e);
@Override public void configure(final ODocument iConfiguration, OCommandContext iContext) { super.configure(iConfiguration, iContext); operation = iConfiguration.field("operation"); if (operation == null) throw new OConfigurationException("Flow transformer has not mandatory 'operation' field"); if (!operation.equalsIgnoreCase("halt") && !operation.equalsIgnoreCase("skip")) throw new OConfigurationException( "Flow transformer has invalid 'operation' field='" + operation + "', while supported are: 'skip' and 'halt'"); }
@Override public OIndexInternal<?> createIndex(String name, OStorage storage, String indexType, String algorithm, String valueContainerAlgorithm, ODocument metadata, int version) throws OConfigurationException { OAbstractPaginatedStorage pagStorage = (OAbstractPaginatedStorage) storage.getUnderlying(); OBinarySerializer<?> objectSerializer = storage.getComponentsFactory().binarySerializerFactory .getObjectSerializer(OLuceneMockSpatialSerializer.INSTANCE.getId()); if (objectSerializer == null) { storage.getComponentsFactory().binarySerializerFactory .registerSerializer(OLuceneMockSpatialSerializer.INSTANCE, OType.EMBEDDED); } if (metadata == null) metadata = new ODocument().field("analyzer", StandardAnalyzer.class.getName()); if (OClass.INDEX_TYPE.SPATIAL.toString().equals(indexType)) { final int binaryFormatVersion = pagStorage.getConfiguration().getBinaryFormatVersion(); return new OLuceneSpatialIndex(name, indexType, LUCENE_ALGORITHM, version, pagStorage, valueContainerAlgorithm, metadata, binaryFormatVersion); } throw new OConfigurationException("Unsupported type : " + algorithm); }
@Override public OCommandCacheSoftRefs disable() { enable = false; synchronized (this) { clusters.clear(); cache.clear(); } configuration.field("enabled", true); try { updateCfgOnDisk(); } catch (IOException e) { throw OException.wrapException( new OConfigurationException("Cannot write Command Cache Cache configuration to file '" + CONFIG_FILE + "'"), e); } return this; }