@Override public String getName() { return getStorage() != null ? getStorage().getName() : url; }
@Override public String getURL() { return url != null ? url : getStorage().getURL(); }
@Override public boolean isClosed() { return status == STATUS.CLOSED || getStorage().isClosed(); }
@Override public void internalCommit(OTransactionInternal transaction) { this.getStorage().commit(transaction); }
/** * {@inheritDoc} */ public OSBTreeCollectionManager getSbTreeCollectionManager() { return getStorage().getSBtreeCollectionManager(); }
@Override public boolean existsCluster(final String iClusterName) { checkIfActive(); return getStorage().getClusterNames().contains(iClusterName.toLowerCase(Locale.ENGLISH)); }
@Override public int getClusterIdByName(final String iClusterName) { if (iClusterName == null) return -1; checkIfActive(); return getStorage().getClusterIdByName(iClusterName.toLowerCase(Locale.ENGLISH)); }
@Override public OContextConfiguration getConfiguration() { checkIfActive(); if (getStorage() != null) return getStorage().getConfiguration().getContextConfiguration(); return null; }
/** * Deprecated since v2.2 */ @Deprecated public void setDefaultClusterIdInternal(final int iDefClusterId) { checkIfActive(); getStorage().setDefaultClusterId(iDefClusterId); }
@Override public int getClusters() { checkIfActive(); return getStorage().getClusters(); }
@Override public long getSize() { checkIfActive(); return getStorage().getSize(); }
@Override public int addCluster(final String iClusterName, final Object... iParameters) { checkIfActive(); return getStorage().addCluster(iClusterName, iParameters); }
public ODatabaseDocumentAbstract setConflictStrategy(final ORecordConflictStrategy iResolver) { checkIfActive(); getStorage().setConflictStrategy(iResolver); return this; }
@Override public ORecordMetadata getRecordMetadata(final ORID rid) { checkIfActive(); return getStorage().getRecordMetadata(rid); }
@Override public boolean isFrozen() { if (!(getStorage() instanceof OFreezableStorageComponent)) return false; final OFreezableStorageComponent storage = getFreezableStorage(); if (storage != null) return storage.isFrozen(); return false; }
private OFreezableStorageComponent getFreezableStorage() { OStorage s = getStorage(); if (s instanceof OFreezableStorageComponent) return (OFreezableStorageComponent) s; else { OLogManager.instance().error(this, "Storage of type " + s.getType() + " does not support freeze operation", null); return null; } }
/** * {@inheritDoc} */ @Override public long countClusterElements(final String iClusterName) { checkSecurity(ORule.ResourceGeneric.CLUSTER, ORole.PERMISSION_READ, iClusterName); checkIfActive(); final int clusterId = getClusterIdByName(iClusterName); if (clusterId < 0) throw new IllegalArgumentException("Cluster '" + iClusterName + "' was not found"); return getStorage().count(clusterId); }
@Override public void restore(final InputStream in, final Map<String, Object> options, final Callable<Object> callable, final OCommandOutputListener iListener) throws IOException { checkOpenness(); getStorage().restore(in, options, callable, iListener); if (!isClosed()) { loadMetadata(); sharedContext = null; } }
public ODatabaseDocumentAbstract setConflictStrategy(final String iStrategyName) { checkIfActive(); getStorage().setConflictStrategy(Orient.instance().getRecordConflictStrategy().getStrategy(iStrategyName)); return this; }
@Override public long getClusterRecordSizeByName(final String clusterName) { checkIfActive(); try { return getStorage().getClusterById(getClusterIdByName(clusterName)).getRecordsSize(); } catch (Exception e) { throw OException.wrapException(new ODatabaseException("Error on reading records size for cluster '" + clusterName + "'"), e); } }