protected void checkOpenness() { if (ownerPool == null) throw new ODatabaseException( "Database instance has been released to the pool. Get another database instance from the pool with the right username and password"); // super.checkOpenness(); } }
protected ODatabaseDocumentInternal getDatabase() { if (database == null) { throw new ODatabaseException("Database is closed"); } return (ODatabaseDocumentInternal) database; }
private void checkClusterLimits() { if (clusterId < -2) throw new ODatabaseException("RecordId cannot support negative cluster id. Found: " + clusterId); if (clusterId > CLUSTER_MAX) throw new ODatabaseException("RecordId cannot support cluster id major than 32767. Found: " + clusterId); }
private void checkClusterLimits(int clusterId) { if (clusterId < -2) throw new ODatabaseException("RecordId cannot support negative cluster id. Found: " + clusterId); if (clusterId > CLUSTER_MAX) throw new ODatabaseException("RecordId cannot support cluster id major than 32767. Found: " + clusterId); }
private void checkOpen() { if (!open) throw new ODatabaseException("OrientDB Instance is closed"); }
@Override public OSharedContext call() throws Exception { throw new ODatabaseException("Accessing to the database context before the database has bean initialized"); } });
@Override public Object execute(Object iThis, OIdentifiable iCurrentRecord, Object iCurrentResult, final Object[] iParams, OCommandContext iContext) { final String candidate = iParams[0].toString(); final String format = iParams[1].toString(); if (OSQLFunctionEncode.FORMAT_BASE64.equalsIgnoreCase(format)) { return Base64.getDecoder().decode(candidate); } else { throw new ODatabaseException("unknowned format :" + format); } }
protected void checkOpenness() { if (status == STATUS.CLOSED) throw new ODatabaseException("Database '" + getURL() + "' is closed"); }
@Override public void remove() { try { sbTree.remove(currentEntry.getKey()); } catch (IOException e) { throw OException.wrapException(new ODatabaseException("Error during removal of element of tree"), e); } currentEntry = null; } }
public void delete() { try { tree.delete(); } catch (IOException e) { throw OException.wrapException(new ODatabaseException("Error during deletion index container"), e); } }
/** * Should be used only by console commands */ protected void checkForDatabase() { if (currentDatabase == null) throw new OSystemException("Database not selected. Use 'connect <url> <user> <password>' to connect to a database."); if (currentDatabase.isClosed()) throw new ODatabaseException("Database '" + currentDatabaseName + "' is closed"); }
protected void checkOpenness() { if (isClosed()) throw new ODatabaseException("Database '" + getURL() + "' is closed"); } }
@Override public boolean add(OIdentifiable oIdentifiable) { try { return this.tree.put(oIdentifiable, Boolean.TRUE); } catch (IOException e) { throw OException.wrapException(new ODatabaseException("Error during addition of element in index container"), e); } }
public void restore(String name, InputStream in, Map<String, Object> options, Callable<Object> callable, OCommandOutputListener iListener) { try { OAbstractPaginatedStorage storage; synchronized (this) { storage = getOrInitStorage(name); storages.put(name, storage); } storage.restore(in, options, callable, iListener); } catch (Exception e) { throw OException.wrapException(new ODatabaseException("Cannot create database '" + name + "'"), e); } }
public void makeActive() { if (database == null) { throw new ODatabaseException("Database is closed"); } activeGraph.set(this); final ODatabaseDocument tlDb = ODatabaseRecordThreadLocal.instance().getIfDefined(); if (tlDb != database) ODatabaseRecordThreadLocal.instance().set(getDatabase()); }
@Override public boolean hide(ORID rid) { checkOpenness(); checkIfActive(); if (currentTx.isActive()) throw new ODatabaseException("This operation can be executed only in non transaction mode"); return executeHideRecord(rid, OPERATION_MODE.SYNCHRONOUS); }
public void initScheduleRecord(ODocument doc) { String name = doc.field(OScheduledEvent.PROP_NAME); final OScheduledEvent event = getEvent(name); if (event != null && event.getDocument() != doc) { throw new ODatabaseException("Scheduled event with name '" + name + "' already exists in database"); } doc.field(OScheduledEvent.PROP_STATUS, OScheduler.STATUS.STOPPED.name()); }
@Override public void reload() { checkIfActive(); if (this.isClosed()) throw new ODatabaseException("Cannot reload a closed db"); metadata.reload(); getStorage().reload(); }
@Override public long getClusterRecordSizeById(final int clusterId) { checkIfActive(); try { return getStorage().getClusterById(clusterId).getRecordsSize(); } catch (Exception e) { throw OException .wrapException(new ODatabaseException("Error on reading records size for cluster with id '" + clusterId + "'"), e); } }
@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); } }