Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/mvn-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
server-password: MAVEN_PASSWORD

- name: Publish to central
run: mvn -Pdocker --batch-mode --errors --fail-at-end --show-version --file pom.xml deploy
run: mvn -Pdocker --batch-mode --errors --fail-at-end --show-version --file pom.xml verify
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
Expand Down
16 changes: 7 additions & 9 deletions console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@
<groupId>com.arcadedb</groupId>
<artifactId>arcadedb-parent</artifactId>
<version>21.9.1-SNAPSHOT</version>
<relativePath>../</relativePath>
<relativePath>../pom.xml</relativePath>
</parent>

<properties>
<jline-terminal.version>3.20.0</jline-terminal.version>
<univocity-parsers.version>2.9.1</univocity-parsers.version>
</properties>

<artifactId>arcadedb-console</artifactId>
Expand All @@ -59,6 +58,12 @@
<version>${project.parent.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.arcadedb</groupId>
<artifactId>arcadedb-importer</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline-terminal</artifactId>
Expand All @@ -69,12 +74,5 @@
<artifactId>jline-reader</artifactId>
<version>${jline-terminal.version}</version>
</dependency>
<dependency>
<groupId>com.univocity</groupId>
<artifactId>univocity-parsers</artifactId>
<version>${univocity-parsers.version}</version>
<type>jar</type>
</dependency>
</dependencies>

</project>
2 changes: 1 addition & 1 deletion engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<groupId>com.arcadedb</groupId>
<artifactId>arcadedb-parent</artifactId>
<version>21.9.1-SNAPSHOT</version>
<relativePath>../</relativePath>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>com.arcadedb</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import com.arcadedb.exception.TimeoutException;

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand All @@ -43,118 +44,118 @@
*/
public interface ExecutionStepInternal extends ExecutionStep {

static String getIndent(int depth, int indent) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < depth; i++) {
for (int j = 0; j < indent; j++) {
result.append(" ");
}
}
return result.toString();
static String getIndent(int depth, int indent) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < depth; i++) {
for (int j = 0; j < indent; j++) {
result.append(" ");
}
}
return result.toString();
}

static ResultInternal basicSerialize(ExecutionStepInternal step) {
ResultInternal result = new ResultInternal();
result.setProperty(InternalExecutionPlan.JAVA_TYPE, step.getClass().getName());
if (step.getSubSteps() != null && step.getSubSteps().size() > 0) {
List<Result> serializedSubsteps = new ArrayList<>();
for (ExecutionStep substep : step.getSubSteps()) {
serializedSubsteps.add(((ExecutionStepInternal) substep).serialize());
}
result.setProperty("subSteps", serializedSubsteps);
}

static ResultInternal basicSerialize(ExecutionStepInternal step) {
ResultInternal result = new ResultInternal();
result.setProperty(InternalExecutionPlan.JAVA_TYPE, step.getClass().getName());
if (step.getSubSteps() != null && step.getSubSteps().size() > 0) {
List<Result> serializedSubsteps = new ArrayList<>();
for (ExecutionStep substep : step.getSubSteps()) {
serializedSubsteps.add(((ExecutionStepInternal) substep).serialize());
}
result.setProperty("subSteps", serializedSubsteps);
}

if (step.getSubExecutionPlans() != null && step.getSubExecutionPlans().size() > 0) {
List<Result> serializedSubPlans = new ArrayList<>();
for (ExecutionPlan substep : step.getSubExecutionPlans()) {
serializedSubPlans.add(((InternalExecutionPlan) substep).serialize());
}
result.setProperty("subExecutionPlans", serializedSubPlans);
}
return result;
if (step.getSubExecutionPlans() != null && step.getSubExecutionPlans().size() > 0) {
List<Result> serializedSubPlans = new ArrayList<>();
for (ExecutionPlan substep : step.getSubExecutionPlans()) {
serializedSubPlans.add(((InternalExecutionPlan) substep).serialize());
}
result.setProperty("subExecutionPlans", serializedSubPlans);
}
return result;
}

static void basicDeserialize(Result serialized, ExecutionStepInternal step)
throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
List<Result> serializedSubsteps = serialized.getProperty("subSteps");
if (serializedSubsteps != null) {
for (Result serializedSub : serializedSubsteps) {
String className = serializedSub.getProperty(InternalExecutionPlan.JAVA_TYPE);
ExecutionStepInternal subStep = (ExecutionStepInternal) Class.forName(className).getConstructor().newInstance();
subStep.deserialize(serializedSub);
step.getSubSteps().add(subStep);
}
}

static void basicDeserialize(Result serialized, ExecutionStepInternal step)
throws ClassNotFoundException, IllegalAccessException, InstantiationException {
List<Result> serializedSubsteps = serialized.getProperty("subSteps");
if (serializedSubsteps != null) {
for (Result serializedSub : serializedSubsteps) {
String className = serializedSub.getProperty(InternalExecutionPlan.JAVA_TYPE);
ExecutionStepInternal subStep = (ExecutionStepInternal) Class.forName(className).newInstance();
subStep.deserialize(serializedSub);
step.getSubSteps().add(subStep);
}
}

List<Result> serializedPlans = serialized.getProperty("subExecutionPlans");
if (serializedSubsteps != null) {
for (Result serializedSub : serializedPlans) {
String className = serializedSub.getProperty(InternalExecutionPlan.JAVA_TYPE);
InternalExecutionPlan subStep = (InternalExecutionPlan) Class.forName(className).newInstance();
subStep.deserialize(serializedSub);
step.getSubExecutionPlans().add(subStep);
}
}
List<Result> serializedPlans = serialized.getProperty("subExecutionPlans");
if (serializedSubsteps != null) {
for (Result serializedSub : serializedPlans) {
String className = serializedSub.getProperty(InternalExecutionPlan.JAVA_TYPE);
InternalExecutionPlan subStep = (InternalExecutionPlan) Class.forName(className).getConstructor().newInstance();
subStep.deserialize(serializedSub);
step.getSubExecutionPlans().add(subStep);
}
}
}

ResultSet syncPull(CommandContext ctx, int nRecords) throws TimeoutException;
ResultSet syncPull(CommandContext ctx, int nRecords) throws TimeoutException;

void sendTimeout();
void sendTimeout();

boolean isTimedOut();
boolean isTimedOut();

void setPrevious(ExecutionStepInternal step);
void setPrevious(ExecutionStepInternal step);

void setNext(ExecutionStepInternal step);
void setNext(ExecutionStepInternal step);

void close();
void close();

default String prettyPrint(int depth, int indent) {
String spaces = getIndent(depth, indent);
return spaces + getClass().getSimpleName();
}
default String prettyPrint(int depth, int indent) {
String spaces = getIndent(depth, indent);
return spaces + getClass().getSimpleName();
}

default String getName() {
return getClass().getSimpleName();
}
default String getName() {
return getClass().getSimpleName();
}

default String getType() {
return getClass().getSimpleName();
}
default String getType() {
return getClass().getSimpleName();
}

default String getDescription() {
return prettyPrint(0, 3);
}
default String getDescription() {
return prettyPrint(0, 3);
}

default String getTargetNode() {
return "<local>";
}
default String getTargetNode() {
return "<local>";
}

default List<ExecutionStep> getSubSteps() {
return Collections.emptyList();
}
default List<ExecutionStep> getSubSteps() {
return Collections.emptyList();
}

default List<ExecutionPlan> getSubExecutionPlans() {
return Collections.emptyList();
}
default List<ExecutionPlan> getSubExecutionPlans() {
return Collections.emptyList();
}

default void reset() {
//do nothing
}
default void reset() {
//do nothing
}

default Result serialize() {
throw new UnsupportedOperationException();
}
default Result serialize() {
throw new UnsupportedOperationException();
}

default void deserialize(Result fromResult) {
throw new UnsupportedOperationException();
}
default void deserialize(Result fromResult) {
throw new UnsupportedOperationException();
}

default ExecutionStep copy(CommandContext ctx) {
throw new UnsupportedOperationException();
}
default ExecutionStep copy(CommandContext ctx) {
throw new UnsupportedOperationException();
}

default boolean canBeCached() {
return false;
}
default boolean canBeCached() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void deserialize(Result serializedExecutionPlan) {
for (Result serializedStep : serializedSteps) {
try {
String className = serializedStep.getProperty(JAVA_TYPE);
ExecutionStepInternal step = (ExecutionStepInternal) Class.forName(className).newInstance();
ExecutionStepInternal step = (ExecutionStepInternal) Class.forName(className).getConstructor().newInstance();
step.deserialize(serializedStep);
chain(step);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public Result serialize() {

public void deserialize(Result fromResult) {
try {
operator = (BinaryCompareOperator) Class.forName(String.valueOf(fromResult.getProperty("operator"))).newInstance();
operator = (BinaryCompareOperator) Class.forName(String.valueOf(fromResult.getProperty("operator"))).getConstructor().newInstance();
} catch (Exception e) {
throw new CommandExecutionException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public class JsonSerializer {
public JSONObject serializeRecord(final Document record) {
final JSONObject object = new JSONObject();

object.put("@rid", record.getIdentity().toString());
object.put("@type", record.getTypeName());

for (String p : record.getPropertyNames()) {
Object value = record.get(p);

Expand All @@ -57,6 +60,12 @@ else if (value instanceof Collection) {
public JSONObject serializeResult(final Result record) {
final JSONObject object = new JSONObject();

if (record.isElement()) {
final Document document = record.toElement();
object.put("@rid", document.getIdentity().toString());
object.put("@type", document.getTypeName());
}

for (String p : record.getPropertyNames()) {
Object value = record.getProperty(p);

Expand Down
2 changes: 1 addition & 1 deletion gremlin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<groupId>com.arcadedb</groupId>
<artifactId>arcadedb-parent</artifactId>
<version>21.9.1-SNAPSHOT</version>
<relativePath>../</relativePath>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>com.arcadedb</groupId>
Expand Down
57 changes: 57 additions & 0 deletions importer/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2021 Arcade Data Ltd
~
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.arcadedb</groupId>
<artifactId>arcadedb-parent</artifactId>
<version>21.9.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<properties>
<univocity-parsers.version>2.9.1</univocity-parsers.version>
</properties>

<artifactId>arcadedb-importer</artifactId>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>com.arcadedb</groupId>
<artifactId>arcadedb-engine</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.univocity</groupId>
<artifactId>univocity-parsers</artifactId>
<version>${univocity-parsers.version}</version>
<type>jar</type>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
package com.arcadedb.importer;

import com.arcadedb.database.Database;
import com.arcadedb.importer.format.FormatImporter;
import com.arcadedb.index.IndexCursor;

public abstract class AbstractContentImporter implements ContentImporter {
public abstract class AbstractFormatImporter implements FormatImporter {
private static final char[] STRING_CONTENT_SKIP = new char[] { '\'', '\'', '"', '"' };

protected IndexCursor lookupRecord(final Database database, final String typeName, final String typeIdProperty, final Object id) {
Expand Down
Loading