Skip to content

Commit 86cc043

Browse files
committed
Merge branch '1.7.1'
2 parents 1464bdb + bfcdc50 commit 86cc043

File tree

74 files changed

+1222
-919
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1222
-919
lines changed

build.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project basedir="." default="installg" name="orient-ant">
3-
<!-- Copyright (c) 1999-2011 Luca Garulli - LICENSE: Apache 2.0 -->
3+
<!-- Copyright (c) 1999-2013 Orient Technologies LTD - LICENSE: Apache 2.0 -->
44

55
<property environment="env"/>
6-
<property name="vendor" value="NuvolaBase Ltd"/>
6+
<property name="vendor" value="Orient Technologies Ltd"/>
77
<property name="product" value="OrientDB"/>
8-
<property name="version" value="1.7"/>
8+
<property name="version" value="1.7.1"/>
99
<condition property="community.release" value="${releaseHome}/orientdb-community-${version}"
1010
else="../releases/orientdb-community-${version}">
1111
<isset property="releaseHome"/>

client/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<parent>
2525
<groupId>com.orientechnologies</groupId>
2626
<artifactId>orientdb-parent</artifactId>
27-
<version>1.7</version>
27+
<version>1.7.1</version>
2828
<relativePath>../</relativePath>
2929
</parent>
3030

commons/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<parent>
2525
<groupId>com.orientechnologies</groupId>
2626
<artifactId>orientdb-parent</artifactId>
27-
<version>1.7</version>
27+
<version>1.7.1</version>
2828
<relativePath>../</relativePath>
2929
</parent>
3030

commons/src/main/java/com/orientechnologies/common/collection/OMultiValue.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,12 @@ else if (iObject instanceof Iterator<?> || iObject instanceof Iterable<?>) {
197197
: (Iterator<Object>) iObject;
198198
for (int i = 0; it.hasNext(); ++i) {
199199
final Object o = it.next();
200-
if (i == iIndex)
200+
if (i == iIndex) {
201+
if (it instanceof OResettable)
202+
((OResettable) it).reset();
203+
201204
return o;
205+
}
202206
}
203207

204208
if (it instanceof OResettable)

commons/src/main/java/com/orientechnologies/common/io/OFileUtils.java

+38-4
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,19 @@
2020
import java.io.FileOutputStream;
2121
import java.io.IOException;
2222
import java.nio.channels.FileChannel;
23+
import java.nio.file.FileSystem;
24+
import java.nio.file.FileSystems;
25+
import java.nio.file.Files;
26+
import java.nio.file.Path;
2327
import java.util.Locale;
2428

2529
public class OFileUtils {
26-
private static final int KILOBYTE = 1024;
27-
private static final int MEGABYTE = 1048576;
28-
private static final int GIGABYTE = 1073741824;
29-
private static final long TERABYTE = 1099511627776L;
30+
private static final boolean useOldFileAPI = System.getProperty("java.version").startsWith("1.6");
31+
32+
private static final int KILOBYTE = 1024;
33+
private static final int MEGABYTE = 1048576;
34+
private static final int GIGABYTE = 1073741824;
35+
private static final long TERABYTE = 1099511627776L;
3036

3137
public static long getSizeAsNumber(final Object iSize) {
3238
if (iSize == null)
@@ -159,4 +165,32 @@ public static final void copyDirectory(final File source, final File destination
159165
copyDirectory(f, target);
160166
}
161167
}
168+
169+
public static boolean renameFile(File from, File to) throws IOException {
170+
if (useOldFileAPI)
171+
return from.renameTo(to);
172+
173+
final FileSystem fileSystem = FileSystems.getDefault();
174+
175+
final Path fromPath = fileSystem.getPath(from.getAbsolutePath());
176+
final Path toPath = fileSystem.getPath(to.getAbsolutePath());
177+
Files.move(fromPath, toPath);
178+
179+
return true;
180+
}
181+
182+
public static boolean delete(File file) throws IOException {
183+
if (!file.exists())
184+
return true;
185+
186+
if (useOldFileAPI)
187+
return file.delete();
188+
189+
final FileSystem fileSystem = FileSystems.getDefault();
190+
final Path path = fileSystem.getPath(file.getAbsolutePath());
191+
192+
Files.delete(path);
193+
194+
return true;
195+
}
162196
}

core/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<parent>
1818
<groupId>com.orientechnologies</groupId>
1919
<artifactId>orientdb-parent</artifactId>
20-
<version>1.7</version>
20+
<version>1.7.1</version>
2121
<relativePath>../</relativePath>
2222
</parent>
2323

core/src/main/java/com/orientechnologies/orient/core/OConstants.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package com.orientechnologies.orient.core;
1717

1818
public class OConstants {
19-
public static final String ORIENT_VERSION = "1.7";
19+
public static final String ORIENT_VERSION = "1.7.1";
2020

2121
public static final String ORIENT_URL = "www.orientechnologies.com";
2222

core/src/main/java/com/orientechnologies/orient/core/command/script/OScriptDocumentDatabaseWrapper.java

+12-7
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@
1515
*/
1616
package com.orientechnologies.orient.core.command.script;
1717

18-
import java.util.Collection;
19-
import java.util.Iterator;
20-
import java.util.List;
21-
import java.util.Map;
22-
import java.util.Map.Entry;
23-
2418
import com.orientechnologies.orient.core.command.OBasicCommandContext;
2519
import com.orientechnologies.orient.core.db.ODataSegmentStrategy;
2620
import com.orientechnologies.orient.core.db.ODatabase;
@@ -46,11 +40,18 @@
4640
import com.orientechnologies.orient.core.record.ORecordInternal;
4741
import com.orientechnologies.orient.core.record.impl.ODocument;
4842
import com.orientechnologies.orient.core.sql.OCommandSQL;
43+
import com.orientechnologies.orient.core.sql.query.OSQLQuery;
4944
import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery;
5045
import com.orientechnologies.orient.core.storage.ORecordCallback;
5146
import com.orientechnologies.orient.core.tx.OTransaction;
5247
import com.orientechnologies.orient.core.version.ORecordVersion;
5348

49+
import java.util.Collection;
50+
import java.util.Iterator;
51+
import java.util.List;
52+
import java.util.Map;
53+
import java.util.Map.Entry;
54+
5455
/**
5556
* Document Database wrapper class to use from scripts.
5657
*
@@ -84,7 +85,11 @@ public OIdentifiable[] query(final String iText) {
8485
}
8586

8687
public OIdentifiable[] query(final String iText, final Object... iParameters) {
87-
final List<OIdentifiable> res = database.query(new OSQLSynchQuery<Object>(iText), convertParameters(iParameters));
88+
return query(new OSQLSynchQuery<Object>(iText), iParameters);
89+
}
90+
91+
public OIdentifiable[] query(final OSQLQuery iQuery, final Object... iParameters) {
92+
final List<OIdentifiable> res = database.query(iQuery, convertParameters(iParameters));
8893
if (res == null)
8994
return new OIdentifiable[] {};
9095
return res.toArray(new OIdentifiable[res.size()]);

core/src/main/java/com/orientechnologies/orient/core/db/ODatabase.java

+16-12
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
*/
1616
package com.orientechnologies.orient.core.db;
1717

18+
import java.io.Closeable;
19+
import java.util.Collection;
20+
import java.util.Iterator;
21+
import java.util.Map;
22+
import java.util.concurrent.Callable;
23+
1824
import com.orientechnologies.orient.core.cache.OLevel1RecordCache;
1925
import com.orientechnologies.orient.core.cache.OLevel2RecordCache;
2026
import com.orientechnologies.orient.core.exception.ODatabaseException;
@@ -25,12 +31,6 @@
2531
import com.orientechnologies.orient.core.storage.OStorage.CLUSTER_TYPE;
2632
import com.orientechnologies.orient.core.util.OBackupable;
2733

28-
import java.io.Closeable;
29-
import java.util.Collection;
30-
import java.util.Iterator;
31-
import java.util.Map;
32-
import java.util.concurrent.Callable;
33-
3434
/**
3535
* Generic Database interface. Represents the lower level of the Database providing raw API to access to the raw records.<br/>
3636
* Limits:
@@ -116,14 +116,14 @@ public static enum ATTRIBUTES {
116116
public STATUS getStatus();
117117

118118
/**
119-
* Returns the total size of database as the real used space.
119+
* Returns the current status of database.
120120
*/
121-
public long getSize();
121+
public <DB extends ODatabase> DB setStatus(STATUS iStatus);
122122

123123
/**
124-
* Returns the current status of database.
124+
* Returns the total size of database as the real used space.
125125
*/
126-
public <DB extends ODatabase> DB setStatus(STATUS iStatus);
126+
public long getSize();
127127

128128
/**
129129
* Returns the database name.
@@ -444,17 +444,21 @@ public int addCluster(String iType, String iClusterName, int iRequestedId, Strin
444444
/**
445445
* Flush cached storage content to the disk.
446446
*
447-
* After this call users can perform only select queries. All write-related commands will queued till {@link #release()} command
448-
* will be called.
447+
* After this call users can perform only idempotent calls like read records and select/traverse queries. All write-related
448+
* operations will queued till {@link #release()} command will be called.
449449
*
450450
* Given command waits till all on going modifications in indexes or DB will be finished.
451451
*
452452
* IMPORTANT: This command is not reentrant.
453+
*
454+
* @see #release()
453455
*/
454456
public void freeze();
455457

456458
/**
457459
* Allows to execute write-related commands on DB. Called after {@link #freeze()} command.
460+
*
461+
* @see #freeze()
458462
*/
459463
public void release();
460464

0 commit comments

Comments
 (0)