@Override public Object set(ATTRIBUTES attribute, Object value) throws IOException { if (attribute == null) throw new IllegalArgumentException("attribute is null"); final String stringValue = value != null ? value.toString() : null; switch (attribute) { case STATUS: { if (stringValue == null) throw new IllegalStateException("Value of attribute is null."); return storageLocal.setClusterStatus(id, OStorageClusterConfiguration.STATUS .valueOf(stringValue.toUpperCase(storageLocal.getConfiguration().getLocaleInstance()))); } default: throw new IllegalArgumentException( "Runtime change of attribute '" + attribute + " is not supported on Offline cluster " + getName()); } }
private void setRecordGrowFactorInternal(final String stringValue) { try { final float growFactor = Float.parseFloat(stringValue); if (growFactor < 1) { throw new OPaginatedClusterException(ATTRIBUTES.RECORD_GROW_FACTOR + " cannot be less than 1", this); } config.recordGrowFactor = growFactor; ((OStorageConfigurationImpl) storageLocal.getConfiguration()).update(); } catch (final NumberFormatException nfe) { throw OException.wrapException(new OPaginatedClusterException( "Invalid value for cluster attribute " + OCluster.ATTRIBUTES.RECORD_GROW_FACTOR + " was passed [" + stringValue + "]", this), nfe); } }
private void setRecordGrowFactorInternal(final String stringValue) { try { final float growFactor = Float.parseFloat(stringValue); if (growFactor < 1) { throw new OPaginatedClusterException(ATTRIBUTES.RECORD_GROW_FACTOR + " cannot be less than 1", this); } config.recordGrowFactor = growFactor; ((OStorageConfigurationImpl) storageLocal.getConfiguration()).update(); } catch (final NumberFormatException nfe) { throw OException.wrapException(new OPaginatedClusterException( "Invalid value for cluster attribute " + ATTRIBUTES.RECORD_GROW_FACTOR + " was passed [" + stringValue + "]", this), nfe); } }
private void setRecordOverflowGrowFactorInternal(final String stringValue) { try { final float growFactor = Float.parseFloat(stringValue); if (growFactor < 1) { throw new OPaginatedClusterException(ATTRIBUTES.RECORD_OVERFLOW_GROW_FACTOR + " cannot be less than 1", this); } config.recordOverflowGrowFactor = growFactor; ((OStorageConfigurationImpl) storageLocal.getConfiguration()).update(); } catch (final NumberFormatException nfe) { throw OException.wrapException(new OPaginatedClusterException( "Invalid value for cluster attribute " + OCluster.ATTRIBUTES.RECORD_OVERFLOW_GROW_FACTOR + " was passed [" + stringValue + "]", this), nfe); } }
private void setRecordOverflowGrowFactorInternal(final String stringValue) { try { final float growFactor = Float.parseFloat(stringValue); if (growFactor < 1) { throw new OPaginatedClusterException(ATTRIBUTES.RECORD_OVERFLOW_GROW_FACTOR + " cannot be less than 1", this); } config.recordOverflowGrowFactor = growFactor; ((OStorageConfigurationImpl) storageLocal.getConfiguration()).update(); } catch (final NumberFormatException nfe) { throw OException.wrapException(new OPaginatedClusterException( "Invalid value for cluster attribute " + ATTRIBUTES.RECORD_OVERFLOW_GROW_FACTOR + " was passed [" + stringValue + "]", this), nfe); } }
private OIndexInternal<?> createShardedIndex(final String name, final String indexType, final String valueContainerAlgorithm, final ODocument metadata, final OAbstractPaginatedStorage storage, final int version) { final int binaryFormatVersion = storage.getConfiguration().getBinaryFormatVersion(); if (OClass.INDEX_TYPE.UNIQUE.toString().equals(indexType)) { return new OIndexUnique(name, indexType, AUTOSHARDING_ALGORITHM, version, storage, valueContainerAlgorithm, metadata, binaryFormatVersion); } else if (OClass.INDEX_TYPE.NOTUNIQUE.toString().equals(indexType)) { return new OIndexNotUnique(name, indexType, AUTOSHARDING_ALGORITHM, version, storage, valueContainerAlgorithm, metadata, binaryFormatVersion); } throw new OConfigurationException("Unsupported type: " + indexType); }
private void setRecordConflictStrategy(final String stringValue) { recordConflictStrategy = Orient.instance().getRecordConflictStrategy().getStrategy(stringValue); config.conflictStrategy = stringValue; ((OStorageConfigurationImpl) storageLocal.getConfiguration()).update(); }
private void setEncryptionInternal(final String iMethod, final String iKey) { try { encryption = OEncryptionFactory.INSTANCE.getEncryption(iMethod, iKey); config.encryption = iMethod; ((OStorageConfigurationImpl) storageLocal.getConfiguration()).update(); } catch (final IllegalArgumentException e) { throw OException .wrapException(new OPaginatedClusterException("Invalid value for " + ATTRIBUTES.ENCRYPTION + " attribute", this), e); } }
private void setRecordConflictStrategy(final String stringValue) { recordConflictStrategy = Orient.instance().getRecordConflictStrategy().getStrategy(stringValue); config.conflictStrategy = stringValue; ((OStorageConfigurationImpl) storageLocal.getConfiguration()).update(); }
private void setEncryptionInternal(final String iMethod, final String iKey) { try { encryption = OEncryptionFactory.INSTANCE.getEncryption(iMethod, iKey); config.encryption = iMethod; ((OStorageConfigurationImpl) storageLocal.getConfiguration()).update(); } catch (final IllegalArgumentException e) { throw OException .wrapException(new OPaginatedClusterException("Invalid value for " + ATTRIBUTES.ENCRYPTION + " attribute", this), e); } }
private static OIndexInternal<?> createSBTreeIndex(String name, String indexType, String valueContainerAlgorithm, ODocument metadata, OAbstractPaginatedStorage storage, int version, String algorithm) { final int binaryFormatVersion = storage.getConfiguration().getBinaryFormatVersion(); if (OClass.INDEX_TYPE.UNIQUE.toString().equals(indexType)) { return new OIndexUnique(name, indexType, algorithm, version, storage, valueContainerAlgorithm, metadata, binaryFormatVersion); } else if (OClass.INDEX_TYPE.NOTUNIQUE.toString().equals(indexType)) { return new OIndexNotUnique(name, indexType, algorithm, version, storage, valueContainerAlgorithm, metadata, binaryFormatVersion); } else if (OClass.INDEX_TYPE.FULLTEXT.toString().equals(indexType)) { return new OIndexFullText(name, indexType, algorithm, version, storage, valueContainerAlgorithm, metadata, binaryFormatVersion); } else if (OClass.INDEX_TYPE.DICTIONARY.toString().equals(indexType)) { return new OIndexDictionary(name, indexType, algorithm, version, storage, valueContainerAlgorithm, metadata, binaryFormatVersion); } throw new OConfigurationException("Unsupported type: " + indexType); }
@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); }
private void setNameInternal(final String newName) throws IOException { writeCache.renameFile(fileId, newName + getExtension()); clusterPositionMap.rename(newName); config.name = newName; storageLocal.renameCluster(getName(), newName); setName(newName); ((OStorageConfigurationImpl) storageLocal.getConfiguration()).update(); }
private void setNameInternal(final String newName) throws IOException { writeCache.renameFile(fileId, newName + getExtension()); clusterPositionMap.rename(newName); config.name = newName; storageLocal.renameCluster(getName(), newName); setName(newName); ((OStorageConfigurationImpl) storageLocal.getConfiguration()).update(); }
@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); }
.valueOf(stringValue.toUpperCase(storageLocal.getConfiguration().getLocaleInstance())));
.valueOf(stringValue.toUpperCase(storageLocal.getConfiguration().getLocaleInstance())));
.create(storage.getConfiguration().getBinaryFormatVersion());