Skip to content

Commit

Permalink
Merge pull request #5 from orientechnologies/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Thewall13 committed Sep 24, 2014
2 parents e871f8e + f1c83e8 commit adbb39a
Show file tree
Hide file tree
Showing 731 changed files with 33,971 additions and 29,764 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

Look also at [Presentations](https://github.com/orientechnologies/orientdb/wiki/Presentations) with video and slides introducing OrientDB.

[![Gitter chat](https://badges.gitter.im/orientechnologies/orientdb.png)](https://gitter.im/orientechnologies/orientdb)



## Is OrientDB a Relational DBMS?

No. OrientDB adheres to the [NoSQL](http://en.wikipedia.org/wiki/NoSQL) movement even though it supports a subset of [SQL](https://github.com/orientechnologies/orientdb/wiki/SQL) as query language. In this way it's easy to start using it without having to learn too much new stuff. OrientDB is a [Document Database](http://en.wikipedia.org/wiki/Document-oriented_database) but has the best features of other DBMSs. For example relationships are handled as in [Graph Databases](http://en.wikipedia.org/wiki/Graph_database).
Expand Down
6 changes: 2 additions & 4 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<property environment="env"/>
<property name="vendor" value="Orient Technologies Ltd"/>
<property name="product" value="OrientDB"/>
<property name="version" value="2.0-SNAPSHOT"/>
<property name="version" value="2.0-M2-SNAPSHOT"/>
<condition property="community.release" value="${releaseHome}/orientdb-community-${version}"
else="../releases/orientdb-community-${version}">
<isset property="releaseHome"/>
Expand All @@ -22,17 +22,15 @@
<property name="global.lib" value="../${community.release}/lib"/>
<property name="version" value="${version}"/>

<fileset dir="commons" includes="build.xml"/>
<fileset dir="test-commons" includes="build.xml"/>
<fileset dir="core" includes="build.xml"/>
<fileset dir="nativeos" includes="build.xml"/>
<fileset dir="object" includes="build.xml"/>
<fileset dir="enterprise" includes="build.xml"/>
<fileset dir="client" includes="build.xml"/>
<fileset dir="server" includes="build.xml"/>
<fileset dir="distributed" includes="build.xml"/>
<fileset dir="tools" includes="build.xml"/>
<fileset dir="graphdb" includes="build.xml"/>
<fileset dir="test-commons" includes="build.xml"/>
<fileset dir="tests" includes="build.xml"/>
</subant>

Expand Down
2 changes: 1 addition & 1 deletion client/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- Copyright (c) 1999-2010 Luca Garulli - LICENSE: Apache 2.0 -->
<project basedir="." default="compile" name="orientdb-client">
<property name="project.jar-classpath" value="orientdb-enterprise-${version}.jar" />
<property name="project.jar-deps" value="commons/target/orient-commons-${version}.jar" />
<property name="project.jar-deps" value="core/target/orient-core-${version}.jar" />

<import file="../_base/base-build.xml" />
</project>
2 changes: 1 addition & 1 deletion client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-parent</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0-M2-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
*/
package com.orientechnologies.orient.client.remote;

import java.io.IOException;

import com.orientechnologies.common.concur.lock.OModificationLock;
import com.orientechnologies.orient.core.config.OStorageClusterConfiguration;
import com.orientechnologies.orient.core.conflict.ORecordConflictStrategy;
import com.orientechnologies.orient.core.id.OClusterPosition;
import com.orientechnologies.orient.core.id.OClusterPositionFactory;
import com.orientechnologies.orient.core.storage.OCluster;
Expand All @@ -28,6 +27,8 @@
import com.orientechnologies.orient.core.storage.OStorage;
import com.orientechnologies.orient.core.version.ORecordVersion;

import java.io.IOException;

/**
* Remote cluster implementation
*
Expand Down Expand Up @@ -246,4 +247,9 @@ public String compression() {
public boolean hideRecord(OClusterPosition position) {
throw new UnsupportedOperationException("Operation is not supported for given cluster implementation");
}

@Override
public ORecordConflictStrategy getRecordConflictStrategy() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ public boolean reuseResource(final String iKey, final Object[] iAdditionalArgs,
try {
// RETURN THE RESOURCE
return pool.getResource(iServerURL, timeout, clientConfiguration, iConfiguration, iListener);

} catch (RuntimeException e) {
// ERROR ON RETRIEVING THE INSTANCE FROM THE POOL
connections.remove(iServerURL);
throw e;
} catch (Exception e) {
// ERROR ON RETRIEVING THE INSTANCE FROM THE POOL
OLogManager.instance().error(this, "Error on retrieving the connection from pool: " + iServerURL, e);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
package com.orientechnologies.orient.client.remote;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import com.orientechnologies.common.serialization.types.OBinarySerializer;
import com.orientechnologies.common.serialization.types.OByteSerializer;
import com.orientechnologies.common.serialization.types.OIntegerSerializer;
Expand All @@ -19,6 +13,12 @@
import com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynchClient;
import com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryProtocol;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
* Implementation of {@link OSBTreeBonsai} for remote storage.
*
Expand Down Expand Up @@ -68,7 +68,7 @@ public V get(K key) {
byte[] stream = client.readBytes();
storage.endResponse(client);

final byte serializerId = OByteSerializer.INSTANCE.deserialize(stream, 0);
final byte serializerId = OByteSerializer.INSTANCE.deserializeLiteral(stream, 0);
final OBinarySerializer<V> serializer = (OBinarySerializer<V>) OBinarySerializerFactory.getInstance().getObjectSerializer(
serializerId);
return serializer.deserialize(stream, OByteSerializer.BYTE_SIZE);
Expand Down Expand Up @@ -160,7 +160,7 @@ private List<Map.Entry<K, V>> fetchEntriesMajor(K key, boolean inclusive) {
storage.beginResponse(client);
byte[] stream = client.readBytes();
int offset = 0;
final int count = OIntegerSerializer.INSTANCE.deserialize(stream, 0);
final int count = OIntegerSerializer.INSTANCE.deserializeLiteral(stream, 0);
offset += OIntegerSerializer.INT_SIZE;

List<Map.Entry<K, V>> list = new ArrayList<Map.Entry<K, V>>(count);
Expand Down Expand Up @@ -200,7 +200,7 @@ public K firstKey() {
byte[] stream = client.readBytes();
storage.endResponse(client);

final byte serializerId = OByteSerializer.INSTANCE.deserialize(stream, 0);
final byte serializerId = OByteSerializer.INSTANCE.deserializeLiteral(stream, 0);
final OBinarySerializer<K> serializer = (OBinarySerializer<K>) OBinarySerializerFactory.getInstance().getObjectSerializer(
serializerId);
return serializer.deserialize(stream, OByteSerializer.BYTE_SIZE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand Down Expand Up @@ -55,6 +54,7 @@
import com.orientechnologies.orient.core.config.OContextConfiguration;
import com.orientechnologies.orient.core.config.OGlobalConfiguration;
import com.orientechnologies.orient.core.config.OStorageConfiguration;
import com.orientechnologies.orient.core.conflict.ORecordConflictStrategy;
import com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal;
import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
Expand Down Expand Up @@ -402,11 +402,6 @@ public Object call() throws Exception {
} while (true);
}

@Override
public boolean updateReplica(ORecordId rid, byte[] content, ORecordVersion recordVersion, byte recordType) throws IOException {
throw new UnsupportedOperationException("updateReplica()");
}

@Override
public <V> V callInRecordLock(Callable<V> iCallable, ORID rid, boolean iExclusiveLock) {
throw new UnsupportedOperationException("callInRecordLock()");
Expand Down Expand Up @@ -473,9 +468,9 @@ public OStorageOperationResult<ORawBuffer> readRecord(final ORecordId iRid, fina
final ORawBuffer buffer = new ORawBuffer(network.readBytes(), network.readVersion(), network.readByte());

final ODatabaseRecord database = ODatabaseRecordThreadLocal.INSTANCE.getIfDefined();
ORecordInternal<?> record;
ORecord record;
while (network.readByte() == 2) {
record = (ORecordInternal<?>) OChannelBinaryProtocol.readIdentifiable(network);
record = (ORecord) OChannelBinaryProtocol.readIdentifiable(network);

if (database != null)
// PUT IN THE CLIENT LOCAL CACHE
Expand Down Expand Up @@ -960,7 +955,7 @@ public Object command(final OCommandRequestText iCommand) {

// ASYNCH: READ ONE RECORD AT TIME
while ((status = network.readByte()) > 0) {
final ORecordInternal<?> record = (ORecordInternal<?>) OChannelBinaryProtocol.readIdentifiable(network);
final ORecord record = (ORecord) OChannelBinaryProtocol.readIdentifiable(network);
if (record == null)
continue;

Expand All @@ -987,17 +982,17 @@ public Object command(final OCommandRequestText iCommand) {

case 'r':
result = OChannelBinaryProtocol.readIdentifiable(network);
if (result instanceof ORecord<?>)
database.getLocalCache().updateRecord((ORecordInternal<?>) result);
if (result instanceof ORecord)
database.getLocalCache().updateRecord((ORecord) result);
break;

case 'l':
final int tot = network.readInt();
final Collection<OIdentifiable> list = new ArrayList<OIdentifiable>(tot);
for (int i = 0; i < tot; ++i) {
final OIdentifiable resultItem = OChannelBinaryProtocol.readIdentifiable(network);
if (resultItem instanceof ORecord<?>)
database.getLocalCache().updateRecord((ORecordInternal<?>) resultItem);
if (resultItem instanceof ORecord)
database.getLocalCache().updateRecord((ORecord) resultItem);
list.add(resultItem);
}
result = list;
Expand All @@ -1017,7 +1012,7 @@ public Object command(final OCommandRequestText iCommand) {
// LOAD THE FETCHED RECORDS IN CACHE
byte status;
while ((status = network.readByte()) > 0) {
final ORecordInternal<?> record = (ORecordInternal<?>) OChannelBinaryProtocol.readIdentifiable(network);
final ORecord record = (ORecord) OChannelBinaryProtocol.readIdentifiable(network);
if (record != null && status == 2)
// PUT IN THE CLIENT LOCAL CACHE
database.getLocalCache().updateRecord(record);
Expand Down Expand Up @@ -1123,7 +1118,7 @@ public void commit(final OTransaction iTx, Runnable callback) {

// SET ALL THE RECORDS AS UNDIRTY
for (ORecordOperation txEntry : iTx.getAllRecordEntries())
txEntry.getRecord().unsetDirty();
ORecordInternal.unsetDirty(txEntry.getRecord());

// UPDATE THE CACHE ONLY IF THE ITERATOR ALLOWS IT. USE THE STRATEGY TO ALWAYS REMOVE ALL THE RECORDS SINCE THEY COULD BE
// CHANGED AS CONTENT IN CASE OF TREE AND GRAPH DUE TO CROSS REFERENCES
Expand Down Expand Up @@ -1390,6 +1385,16 @@ public OCluster getClusterByName(final String iClusterName) {
throw new UnsupportedOperationException("getClusterByName()");
}

@Override
public ORecordConflictStrategy getConflictStrategy() {
throw new UnsupportedOperationException("getConflictStrategy");
}

@Override
public void setConflictStrategy(final ORecordConflictStrategy iResolver) {
throw new UnsupportedOperationException("setConflictStrategy");
}

@Override
public String getURL() {
return OEngineRemote.NAME + ":" + url;
Expand Down Expand Up @@ -1873,7 +1878,7 @@ private void commitEntry(final OChannelBinaryAsynchClient iNetwork, final ORecor
iNetwork.writeByte((byte) 1);
iNetwork.writeByte(txEntry.type);
iNetwork.writeRID(txEntry.getRecord().getIdentity());
iNetwork.writeByte(txEntry.getRecord().getRecordType());
iNetwork.writeByte(ORecordInternal.getRecordType(txEntry.getRecord()));

switch (txEntry.type) {
case ORecordOperation.CREATED:
Expand All @@ -1884,7 +1889,7 @@ private void commitEntry(final OChannelBinaryAsynchClient iNetwork, final ORecor
iNetwork.writeVersion(txEntry.getRecord().getRecordVersion());
iNetwork.writeBytes(stream);
if (iNetwork.getSrvProtocolVersion() >= 23)
iNetwork.writeBoolean(txEntry.getRecord().isContentChanged());
iNetwork.writeBoolean(ORecordInternal.isContentChanged(txEntry.getRecord()));
break;

case ORecordOperation.DELETED:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.orientechnologies.orient.client.remote;

import com.orientechnologies.common.log.OLogManager;
import com.orientechnologies.orient.core.record.ORecordInternal;
import com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryProtocol;
import com.orientechnologies.orient.enterprise.channel.binary.ORemoteServerEventListener;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,12 @@
*/
package com.orientechnologies.orient.client.remote;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicInteger;

import com.orientechnologies.common.concur.resource.OSharedResourceAdaptiveExternal;
import com.orientechnologies.orient.core.Orient;
import com.orientechnologies.orient.core.command.OCommandOutputListener;
import com.orientechnologies.orient.core.command.OCommandRequestText;
import com.orientechnologies.orient.core.config.OStorageConfiguration;
import com.orientechnologies.orient.core.conflict.ORecordConflictStrategy;
import com.orientechnologies.orient.core.db.record.OCurrentStorageComponentsFactory;
import com.orientechnologies.orient.core.db.record.ridbag.sbtree.OSBTreeCollectionManager;
import com.orientechnologies.orient.core.id.OClusterPosition;
Expand All @@ -49,6 +41,15 @@
import com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynchClient;
import com.orientechnologies.orient.enterprise.channel.binary.ORemoteServerEventListener;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicInteger;

/**
* Wrapper of OStorageRemote that maintains the sessionId. It's bound to the ODatabase and allow to use the shared OStorageRemote.
*/
Expand Down Expand Up @@ -284,14 +285,13 @@ public OCluster getClusterByName(String clusterName) {
}

@Override
public boolean updateReplica(ORecordId rid, byte[] content, ORecordVersion recordVersion, byte recordType)
throws IOException {
pushSession();
try {
return delegate.updateReplica(rid, content, recordVersion, recordType);
} finally {
popSession();
}
public ORecordConflictStrategy getConflictStrategy() {
throw new UnsupportedOperationException("getConflictStrategy");
}

@Override
public void setConflictStrategy(ORecordConflictStrategy iResolver) {
throw new UnsupportedOperationException("setConflictStrategy");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal;
import com.orientechnologies.orient.core.db.record.ODatabaseRecord;
import com.orientechnologies.orient.core.db.record.ODatabaseRecordInternal;
import com.orientechnologies.orient.core.db.record.OIdentifiable;
import com.orientechnologies.orient.core.db.record.ridbag.sbtree.OBonsaiCollectionPointer;
import com.orientechnologies.orient.core.index.sbtreebonsai.local.OBonsaiBucketPointer;
Expand All @@ -35,7 +36,7 @@ public class OSBTreeCollectionManagerRemoteTest {
@Mock
private OCollectionNetworkSerializer networkSerializerMock;
@Mock
private ODatabaseRecord dbMock;
private ODatabaseRecordInternal dbMock;
@Mock
private OStorageRemote storageMock;
@Mock
Expand Down
1 change: 0 additions & 1 deletion commons/.gitignore

This file was deleted.

29 changes: 0 additions & 29 deletions commons/build.xml

This file was deleted.

Binary file removed commons/lib/testng-5.10-jdk15.jar
Binary file not shown.
Loading

0 comments on commit adbb39a

Please sign in to comment.