You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@giraph.apache.org by di...@apache.org on 2020/05/08 22:21:58 UTC
[giraph] branch trunk updated: GIRAPH-1235
This is an automated email from the ASF dual-hosted git repository.
dionysios pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/giraph.git
The following commit(s) were added to refs/heads/trunk by this push:
new e213461 GIRAPH-1235
e213461 is described below
commit e213461033331bd2fdcb5cb6b6c51558fab6e2c0
Author: Dionysios Logothetis <dl...@gmail.com>
AuthorDate: Fri May 8 15:21:39 2020 -0700
GIRAPH-1235
closes #121
---
giraph-dist/pom.xml | 4 -
giraph-gora/conf/edge.avsc | 12 -
giraph-gora/conf/edge_result.avsc | 12 -
giraph-gora/conf/gora-cassandra-mapping.xml | 42 -
giraph-gora/conf/gora-hbase-mapping.xml | 63 --
giraph-gora/conf/gora.properties | 29 -
giraph-gora/conf/vertex.avsc | 10 -
giraph-gora/conf/vertex_result.avsc | 10 -
giraph-gora/conf/zoo.cfg | 4 -
giraph-gora/pom.xml | 146 ----
giraph-gora/src/main/assembly/compile.xml | 39 -
.../apache/giraph/io/gora/GoraEdgeInputFormat.java | 411 ----------
.../giraph/io/gora/GoraEdgeOutputFormat.java | 283 -------
.../giraph/io/gora/GoraGEdgeEdgeInputFormat.java | 91 ---
.../giraph/io/gora/GoraGEdgeEdgeOutputFormat.java | 75 --
.../io/gora/GoraGVertexVertexInputFormat.java | 98 ---
.../io/gora/GoraGVertexVertexOutputFormat.java | 82 --
.../giraph/io/gora/GoraVertexInputFormat.java | 416 ----------
.../giraph/io/gora/GoraVertexOutputFormat.java | 299 -------
.../io/gora/constants/GiraphGoraConstants.java | 80 --
.../giraph/io/gora/constants/package-info.java | 21 -
.../org/apache/giraph/io/gora/generated/GEdge.java | 904 --------------------
.../giraph/io/gora/generated/GEdgeResult.java | 909 ---------------------
.../apache/giraph/io/gora/generated/GVertex.java | 665 ---------------
.../giraph/io/gora/generated/GVertexResult.java | 668 ---------------
.../giraph/io/gora/generated/package-info.java | 21 -
.../org/apache/giraph/io/gora/package-info.java | 21 -
.../giraph/io/gora/utils/DefaultKeyFactory.java | 45 -
.../giraph/io/gora/utils/ExtraGoraInputFormat.java | 177 ----
.../org/apache/giraph/io/gora/utils/GoraUtils.java | 178 ----
.../apache/giraph/io/gora/utils/KeyFactory.java | 54 --
.../apache/giraph/io/gora/utils/package-info.java | 21 -
.../giraph/io/gora/GoraTestEdgeInputFormat.java | 130 ---
.../giraph/io/gora/GoraTestEdgeOutputFormat.java | 118 ---
.../giraph/io/gora/GoraTestVertexInputFormat.java | 126 ---
.../giraph/io/gora/GoraTestVertexOutputFormat.java | 113 ---
.../giraph/io/gora/TestGoraEdgeInputFormat.java | 122 ---
.../giraph/io/gora/TestGoraEdgeOutputFormat.java | 93 ---
.../giraph/io/gora/TestGoraVertexInputFormat.java | 121 ---
.../giraph/io/gora/TestGoraVertexOutputFormat.java | 74 --
pom.xml | 47 +-
41 files changed, 45 insertions(+), 6789 deletions(-)
diff --git a/giraph-dist/pom.xml b/giraph-dist/pom.xml
index ecdd8a4..d6e9f69 100644
--- a/giraph-dist/pom.xml
+++ b/giraph-dist/pom.xml
@@ -105,9 +105,5 @@
<groupId>org.apache.giraph</groupId>
<artifactId>giraph-examples</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.giraph</groupId>
- <artifactId>giraph-gora</artifactId>
- </dependency>
</dependencies>
</project>
diff --git a/giraph-gora/conf/edge.avsc b/giraph-gora/conf/edge.avsc
deleted file mode 100644
index c5caeb1..0000000
--- a/giraph-gora/conf/edge.avsc
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "type": "record",
- "name": "GEdge",
- "namespace": "org.apache.giraph.gora.generated",
- "fields" : [
- {"name": "edgeId", "type": "string"},
- {"name": "edgeWeight", "type": "float"},
- {"name": "vertexInId", "type": "string"},
- {"name": "vertexOutId", "type": "string"},
- {"name": "label", "type": "string"}
- ]
-}
diff --git a/giraph-gora/conf/edge_result.avsc b/giraph-gora/conf/edge_result.avsc
deleted file mode 100644
index 9319fa1..0000000
--- a/giraph-gora/conf/edge_result.avsc
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "type": "record",
- "name": "GEdgeResult",
- "namespace": "org.apache.giraph.io.gora.generated",
- "fields" : [
- {"name": "edgeId", "type": "string"},
- {"name": "edgeWeight", "type": "float"},
- {"name": "vertexInId", "type": "string"},
- {"name": "vertexOutId", "type": "string"},
- {"name": "label", "type": "string"}
- ]
-}
diff --git a/giraph-gora/conf/gora-cassandra-mapping.xml b/giraph-gora/conf/gora-cassandra-mapping.xml
deleted file mode 100644
index 85079dd..0000000
--- a/giraph-gora/conf/gora-cassandra-mapping.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<gora-orm>
-
- <keyspace name="graphGiraph" host="localhost" cluster="Test Cluster">
- <family name="vertices"/>
- </keyspace>
-
- <class name="org.apache.giraph.io.gora.generated.GVertex" keyClass="java.lang.String" keyspace="graphGiraph">
- <field name="vertexId" family="vertices" qualifier="vertexId"/>
- <field name="value" family="vertices" qualifier="value"/>
- <field name="edges" family="vertices" qualifier="edges"/>
- </class>
-
- <keyspace name="graphGiraphResults" host="localhost" cluster="Test Cluster">
- <family name="vertices"/>
- </keyspace>
-
- <class name="org.apache.giraph.io.gora.generated.GVertexResult" keyClass="java.lang.String" keyspace="graphGiraphResults">
- <field name="vertexId" family="vertices" qualifier="vertexId"/>
- <field name="value" family="vertices" qualifier="value"/>
- <field name="edges" family="vertices" qualifier="edges"/>
- </class>
-
-</gora-orm>
diff --git a/giraph-gora/conf/gora-hbase-mapping.xml b/giraph-gora/conf/gora-hbase-mapping.xml
deleted file mode 100644
index fd40e30..0000000
--- a/giraph-gora/conf/gora-hbase-mapping.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<gora-orm>
-
- <table name="graphGiraph">
- <family name="vertices"/>
- </table>
-
- <class name="org.apache.giraph.io.gora.generated.GVertex" keyClass="java.lang.String" table="graphGiraph">
- <field name="vertexId" family="vertices" qualifier="vertexId"/>
- <field name="value" family="vertices" qualifier="value"/>
- <field name="edges" family="vertices" qualifier="edges"/>
- </class>
-
- <table name="graphGiraphResults">
- <family name="vertices"/>
- </table>
-
- <class name="org.apache.giraph.io.gora.generated.GVertexResult" keyClass="java.lang.String" table="graphGiraphResults">
- <field name="vertexId" family="vertices" qualifier="vertexId"/>
- <field name="value" family="vertices" qualifier="value"/>
- <field name="edges" family="vertices" qualifier="edges"/>
- </class>
-
- <table name="graphGiraphEdges">
- <family name="edges"/>
- </table>
- <class name="org.apache.giraph.io.gora.generated.GEdge" keyClass="java.lang.String" table="graphGiraphEdges">
- <field name="edgeId" family="edges" qualifier="edgeId"/>
- <field name="edgeWeight" family="edges" qualifier="edgeWeight"/>
- <field name="label" family="edges" qualifier="label"/>
- <field name="vertexInId" family="edges" qualifier="vertexInId"/>
- <field name="vertexOutId" family="edges" qualifier="vertexOutId"/>
- </class>
-
- <table name="graphGiraphResultEdges">
- <family name="edges"/>
- </table>
- <class name="org.apache.giraph.io.gora.generated.GEdgeResult" keyClass="java.lang.String" table="graphGiraphResultEdges">
- <field name="edgeId" family="edges" qualifier="edgeId"/>
- <field name="edgeWeight" family="edges" qualifier="edgeWeight"/>
- <field name="label" family="edges" qualifier="label"/>
- <field name="vertexInId" family="edges" qualifier="vertexInId"/>
- <field name="vertexOutId" family="edges" qualifier="vertexOutId"/>
- </class>
-</gora-orm>
\ No newline at end of file
diff --git a/giraph-gora/conf/gora.properties b/giraph-gora/conf/gora.properties
deleted file mode 100644
index d59faad..0000000
--- a/giraph-gora/conf/gora.properties
+++ /dev/null
@@ -1,29 +0,0 @@
-# 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.
-
-# FOR HBASE DATASTORE
-gora.datastore.default=org.apache.gora.hbase.store.HBaseStore
-
-# FOR CASSANDRA DATASTORE
-#gora.datastore.default=org.apache.gora.cassandra.CassandraStore
-
-# FOR DYNAMO DATASTORE
-#gora.datastore.default=org.apache.gora.dynamodb.store.DynamoDBStore
-#gora.datastore.autocreateschema=true
-
-#preferred.schema.name=person
-#gora.dynamodb.client=sync
-#gora.dynamodb.consistent.reads=true
-#gora.dynamodb.endpoint=http://dynamodb.us-east-1.amazonaws.com/
\ No newline at end of file
diff --git a/giraph-gora/conf/vertex.avsc b/giraph-gora/conf/vertex.avsc
deleted file mode 100644
index 88d4234..0000000
--- a/giraph-gora/conf/vertex.avsc
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "type": "record",
- "name": "GVertex",
- "namespace": "org.apache.giraph.io.gora.generated",
- "fields" : [
- {"name": "vertexId", "type": "string"},
- {"name": "vertexValue", "type": "float"},
- {"name": "edges", "type": {"type": "map", "values": "string"}}
- ]
-}
\ No newline at end of file
diff --git a/giraph-gora/conf/vertex_result.avsc b/giraph-gora/conf/vertex_result.avsc
deleted file mode 100644
index b594ca9..0000000
--- a/giraph-gora/conf/vertex_result.avsc
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "type": "record",
- "name": "GVertexResult",
- "namespace": "org.apache.giraph.io.gora.generated",
- "fields" : [
- {"name": "vertexId", "type": "string"},
- {"name": "vertexValue", "type": "float"},
- {"name": "edges", "type": {"type": "map", "values": "string"}}
- ]
-}
\ No newline at end of file
diff --git a/giraph-gora/conf/zoo.cfg b/giraph-gora/conf/zoo.cfg
deleted file mode 100644
index f4cec32..0000000
--- a/giraph-gora/conf/zoo.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-tickTime=20000
-dataDir=/var/zookeeper
-clientPort=2181
-maxClientCnxns=300
\ No newline at end of file
diff --git a/giraph-gora/pom.xml b/giraph-gora/pom.xml
deleted file mode 100644
index a92f1e8..0000000
--- a/giraph-gora/pom.xml
+++ /dev/null
@@ -1,146 +0,0 @@
-<!-- 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/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.giraph</groupId>
- <artifactId>giraph-parent</artifactId>
- <version>1.3.0-SNAPSHOT</version>
- </parent>
- <artifactId>giraph-gora</artifactId>
- <packaging>jar</packaging>
-
- <name>Apache Giraph Gora I/O</name>
- <url>http://gora.apache.org/giraph-gora/</url>
- <description>Giraph Gora input/output classes</description>
-
- <properties>
- <top.dir>${project.basedir}/..</top.dir>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-site-plugin</artifactId>
- <configuration>
- <siteDirectory>${project.basedir}/src/site</siteDirectory>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.6</version>
- <configuration>
- <systemProperties>
- <property>
- <name>prop.jarLocation</name>
- <value>${top.dir}/giraph-core/target/giraph-${project.version}-${forHadoop}-jar-with-dependencies.jar</value>
- </property>
- </systemProperties>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <basedir>${project.basedir}/..</basedir>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <!-- compile dependencies. sorted lexicographically. -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.giraph</groupId>
- <artifactId>giraph-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.gora</groupId>
- <artifactId>gora-core</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-core-asl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-mapper-asl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.gora</groupId>
- <artifactId>gora-shims-distribution</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.avro</groupId>
- <artifactId>avro</artifactId>
- <version>${dep.avro.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-core-asl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-mapper-asl</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- </dependency>
-
- <!-- runtime dependency -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>runtime</scope>
- </dependency>
-
- <!-- test dependencies. sorted lexicographically. -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/giraph-gora/src/main/assembly/compile.xml b/giraph-gora/src/main/assembly/compile.xml
deleted file mode 100644
index 6acf679..0000000
--- a/giraph-gora/src/main/assembly/compile.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<!--
- 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.
--->
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
- <id>jar-with-dependencies</id>
- <formats>
- <format>jar</format>
- </formats>
- <includeBaseDirectory>false</includeBaseDirectory>
-
- <dependencySets>
- <dependencySet>
- <useProjectArtifact>true</useProjectArtifact>
- <outputDirectory>/</outputDirectory>
- <unpackOptions>
- <excludes>
- <exclude>META-INF/LICENSE</exclude>
- </excludes>
- </unpackOptions>
- <unpack>true</unpack>
- <scope>runtime</scope>
- </dependencySet>
- </dependencySets>
-</assembly>
\ No newline at end of file
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraEdgeInputFormat.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraEdgeInputFormat.java
deleted file mode 100644
index 333871d..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraEdgeInputFormat.java
+++ /dev/null
@@ -1,411 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora;
-
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_DATASTORE_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_END_KEY;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_KEYS_FACTORY_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_KEY_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_PERSISTENT_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_START_KEY;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.giraph.edge.Edge;
-import org.apache.giraph.io.EdgeInputFormat;
-import org.apache.giraph.io.EdgeReader;
-import org.apache.giraph.io.gora.utils.ExtraGoraInputFormat;
-import org.apache.giraph.io.gora.utils.GoraUtils;
-import org.apache.giraph.io.gora.utils.KeyFactory;
-import org.apache.gora.persistency.Persistent;
-import org.apache.gora.query.Result;
-import org.apache.gora.query.impl.QueryBase;
-import org.apache.gora.store.DataStore;
-import org.apache.gora.util.GoraException;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.io.WritableComparable;
-import org.apache.hadoop.mapreduce.InputSplit;
-import org.apache.hadoop.mapreduce.JobContext;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-import org.apache.log4j.Logger;
-
-/**
- * Class which wraps the GoraInputFormat. It's designed
- * as an extension point to EdgeInputFormat subclasses who wish
- * to read from Gora data sources.
- *
- * Works with
- * {@link GoraVertexOutputFormat}
- *
- * @param <I> vertex id type
- * @param <E> edge type
- */
-public abstract class GoraEdgeInputFormat
- <I extends WritableComparable, E extends Writable>
- extends EdgeInputFormat<I, E> {
-
- /** Start key for querying Gora data store. */
- private static Object START_KEY;
-
- /** End key for querying Gora data store. */
- private static Object END_KEY;
-
- /** Logger for Gora's vertex input format. */
- private static final Logger LOG =
- Logger.getLogger(GoraEdgeInputFormat.class);
-
- /** KeyClass used for getting data. */
- private static Class<?> KEY_CLASS;
-
- /** The vertex itself will be used as a value inside Gora. */
- private static Class<? extends Persistent> PERSISTENT_CLASS;
-
- /** Data store class to be used as backend. */
- private static Class<? extends DataStore> DATASTORE_CLASS;
-
- /** Class used to transform strings into Keys */
- private static Class<?> KEY_FACTORY_CLASS;
-
- /** Data store used for querying data. */
- private static DataStore DATA_STORE;
-
- /** counter for iinput records */
- private static int RECORD_COUNTER = 0;
-
- /** Delegate Gora input format */
- private static ExtraGoraInputFormat GORA_INPUT_FORMAT =
- new ExtraGoraInputFormat();
-
- /**
- * @param conf configuration parameters
- */
- public void checkInputSpecs(Configuration conf) {
- String sDataStoreType =
- GIRAPH_GORA_DATASTORE_CLASS.get(getConf());
- String sKeyType =
- GIRAPH_GORA_KEY_CLASS.get(getConf());
- String sPersistentType =
- GIRAPH_GORA_PERSISTENT_CLASS.get(getConf());
- String sKeyFactoryClass =
- GIRAPH_GORA_KEYS_FACTORY_CLASS.get(getConf());
- try {
- Class<?> keyClass = Class.forName(sKeyType);
- Class<?> persistentClass = Class.forName(sPersistentType);
- Class<?> dataStoreClass = Class.forName(sDataStoreType);
- Class<?> keyFactoryClass = Class.forName(sKeyFactoryClass);
- setKeyClass(keyClass);
- setPersistentClass((Class<? extends Persistent>) persistentClass);
- setDatastoreClass((Class<? extends DataStore>) dataStoreClass);
- setKeyFactoryClass(keyFactoryClass);
- setDataStore(createDataStore(getConf()));
- GORA_INPUT_FORMAT.setDataStore(getDataStore());
- } catch (ClassNotFoundException e) {
- LOG.error("Error while reading Gora Input parameters");
- e.printStackTrace();
- }
- }
-
- /**
- * Gets the splits for a data store.
- * @param context JobContext
- * @param minSplitCountHint Hint for a minimum split count
- * @return A list of splits
- */
- @Override
- public List<InputSplit> getSplits(JobContext context, int minSplitCountHint)
- throws IOException, InterruptedException {
- KeyFactory kFact = null;
- try {
- kFact = (KeyFactory) getKeyFactoryClass().newInstance();
- } catch (InstantiationException e) {
- LOG.error("Key factory was not instantiated. Please verify.");
- LOG.error(e.getMessage());
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- LOG.error("Key factory was not instantiated. Please verify.");
- LOG.error(e.getMessage());
- e.printStackTrace();
- }
- String sKey = GIRAPH_GORA_START_KEY.get(getConf());
- String eKey = GIRAPH_GORA_END_KEY.get(getConf());
- if (sKey == null || sKey.isEmpty()) {
- LOG.warn("No start key has been defined.");
- LOG.warn("Querying all the data store.");
- sKey = null;
- eKey = null;
- }
- kFact.setDataStore(getDataStore());
- setStartKey(kFact.buildKey(sKey));
- setEndKey(kFact.buildKey(eKey));
- QueryBase tmpQuery = GoraUtils.getQuery(
- getDataStore(), getStartKey(), getEndKey());
- tmpQuery.setConf(context.getConfiguration());
- GORA_INPUT_FORMAT.setQuery(tmpQuery);
- List<InputSplit> splits = GORA_INPUT_FORMAT.getSplits(context);
- return splits;
- }
-
- @Override
- public abstract GoraEdgeReader createEdgeReader(InputSplit split,
- TaskAttemptContext context) throws IOException;
-
- /**
- * Abstract class to be implemented by the user based on their specific
- * vertex input. Easiest to ignore the key value separator and only use
- * key instead.
- */
- protected abstract class GoraEdgeReader extends EdgeReader<I, E> {
- /** current edge obtained from Rexster */
- private Edge<I, E> edge;
- /** Results gotten from Gora data store. */
- private Result readResults;
-
- @Override
- public void initialize(InputSplit inputSplit, TaskAttemptContext context)
- throws IOException, InterruptedException {
- getResults();
- RECORD_COUNTER = 0;
- }
-
- /**
- * Gets the next edge from Gora data store.
- * @return true/false depending on the existence of vertices.
- * @throws IOException exceptions passed along.
- * @throws InterruptedException exceptions passed along.
- */
- @Override
- // CHECKSTYLE: stop IllegalCatch
- public boolean nextEdge() throws IOException, InterruptedException {
- boolean flg = false;
- try {
- flg = this.getReadResults().next();
- this.edge = transformEdge(this.getReadResults().get());
- RECORD_COUNTER++;
- } catch (Exception e) {
- LOG.debug("Error transforming vertices.");
- flg = false;
- }
- LOG.debug(RECORD_COUNTER + " were transformed.");
- return flg;
- }
- // CHECKSTYLE: resume IllegalCatch
-
- /**
- * Gets the progress of reading results from Gora.
- * @return the progress of reading results from Gora.
- */
- @Override
- public float getProgress() throws IOException, InterruptedException {
- float progress = 0.0f;
- if (getReadResults() != null) {
- progress = getReadResults().getProgress();
- }
- return progress;
- }
-
- /**
- * Gets current edge.
- *
- * @return The edge object represented by a Gora object
- */
- @Override
- public Edge<I, E> getCurrentEdge()
- throws IOException, InterruptedException {
- return this.edge;
- }
-
- /**
- * Parser for a single Gora object
- *
- * @param goraObject vertex represented as a GoraObject
- * @return The edge object represented by a Gora object
- */
- protected abstract Edge<I, E> transformEdge(Object goraObject);
-
- /**
- * Performs a range query to a Gora data store.
- */
- protected void getResults() {
- setReadResults(GoraUtils.getRequest(getDataStore(),
- getStartKey(), getEndKey()));
- }
-
- /**
- * Finishes the reading process.
- * @throws IOException
- */
- @Override
- public void close() throws IOException {
- }
-
- /**
- * Gets the results read.
- * @return results read.
- */
- Result getReadResults() {
- return readResults;
- }
-
- /**
- * Sets the results read.
- * @param readResults results read.
- */
- void setReadResults(Result readResults) {
- this.readResults = readResults;
- }
- }
-
- /**
- * Gets the data store object initialized.
- * @param conf Configuration
- * @return DataStore created
- */
- public DataStore createDataStore(Configuration conf) {
- DataStore dsCreated = null;
- try {
- dsCreated = GoraUtils.createSpecificDataStore(conf, getDatastoreClass(),
- getKeyClass(), getPersistentClass());
- } catch (GoraException e) {
- LOG.error("Error creating data store.");
- e.printStackTrace();
- }
- return dsCreated;
- }
-
- /**
- * Gets the persistent Class
- * @return persistentClass used
- */
- static Class<? extends Persistent> getPersistentClass() {
- return PERSISTENT_CLASS;
- }
-
- /**
- * Sets the persistent Class
- * @param persistentClassUsed to be set
- */
- static void setPersistentClass
- (Class<? extends Persistent> persistentClassUsed) {
- PERSISTENT_CLASS = persistentClassUsed;
- }
-
- /**
- * Gets the key class used.
- * @return the key class used.
- */
- static Class<?> getKeyClass() {
- return KEY_CLASS;
- }
-
- /**
- * Sets the key class used.
- * @param keyClassUsed key class used.
- */
- static void setKeyClass(Class<?> keyClassUsed) {
- KEY_CLASS = keyClassUsed;
- }
-
- /**
- * @return Class the DATASTORE_CLASS
- */
- public static Class<? extends DataStore> getDatastoreClass() {
- return DATASTORE_CLASS;
- }
-
- /**
- * @param dataStoreClass the dataStore class to set
- */
- public static void setDatastoreClass(
- Class<? extends DataStore> dataStoreClass) {
- DATASTORE_CLASS = dataStoreClass;
- }
-
- /**
- * Gets the start key for querying.
- * @return the start key.
- */
- public Object getStartKey() {
- return START_KEY;
- }
-
- /**
- * Gets the start key for querying.
- * @param startKey start key.
- */
- public static void setStartKey(Object startKey) {
- START_KEY = startKey;
- }
-
- /**
- * Gets the end key for querying.
- * @return the end key.
- */
- static Object getEndKey() {
- return END_KEY;
- }
-
- /**
- * Sets the end key for querying.
- * @param pEndKey start key.
- */
- static void setEndKey(Object pEndKey) {
- END_KEY = pEndKey;
- }
-
- /**
- * Gets the key factory class.
- * @return the kEY_FACTORY_CLASS
- */
- static Class<?> getKeyFactoryClass() {
- return KEY_FACTORY_CLASS;
- }
-
- /**
- * Sets the key factory class.
- * @param keyFactoryClass the keyFactoryClass to set.
- */
- static void setKeyFactoryClass(Class<?> keyFactoryClass) {
- KEY_FACTORY_CLASS = keyFactoryClass;
- }
-
- /**
- * Gets the data store.
- * @return DataStore
- */
- public static DataStore getDataStore() {
- return DATA_STORE;
- }
-
- /**
- * Sets the data store
- * @param dStore the dATA_STORE to set
- */
- public static void setDataStore(DataStore dStore) {
- DATA_STORE = dStore;
- }
-
- /**
- * Returns a logger.
- * @return the log for the output format.
- */
- public static Logger getLogger() {
- return LOG;
- }
-}
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraEdgeOutputFormat.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraEdgeOutputFormat.java
deleted file mode 100644
index d030d70..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraEdgeOutputFormat.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora;
-
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_OUTPUT_DATASTORE_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_OUTPUT_KEY_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_OUTPUT_PERSISTENT_CLASS;
-
-import java.io.IOException;
-
-import org.apache.giraph.edge.Edge;
-import org.apache.giraph.io.EdgeOutputFormat;
-import org.apache.giraph.io.EdgeWriter;
-import org.apache.giraph.io.gora.utils.GoraUtils;
-import org.apache.gora.persistency.Persistent;
-import org.apache.gora.store.DataStore;
-import org.apache.gora.util.GoraException;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.io.WritableComparable;
-import org.apache.hadoop.mapreduce.JobContext;
-import org.apache.hadoop.mapreduce.OutputCommitter;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-import org.apache.log4j.Logger;
-
-/**
- * Class which wraps the GoraInputFormat. It's designed
- * as an extension point to EdgeOutputFormat subclasses who wish
- * to write to Gora data sources.
- *
- * Works with
- * {@link GoraEdgeInputFormat}
- *
- * @param <I> edge id type
- * @param <V> vertex type
- * @param <E> edge type
- */
-public abstract class GoraEdgeOutputFormat<I extends WritableComparable,
- V extends Writable, E extends Writable>
- extends EdgeOutputFormat<I, V, E> {
-
- /** Logger for Gora's vertex input format. */
- private static final Logger LOG =
- Logger.getLogger(GoraEdgeOutputFormat.class);
-
- /** KeyClass used for getting data. */
- private static Class<?> KEY_CLASS;
-
- /** The vertex itself will be used as a value inside Gora. */
- private static Class<? extends Persistent> PERSISTENT_CLASS;
-
- /** Data store class to be used as backend. */
- private static Class<? extends DataStore> DATASTORE_CLASS;
-
- /** Data store used for querying data. */
- private static DataStore DATA_STORE;
-
- /**
- * checkOutputSpecs
- *
- * @param context information about the job
- * @throws IOException
- * @throws InterruptedException
- */
- @Override
- public void checkOutputSpecs(JobContext context)
- throws IOException, InterruptedException {
- }
-
- /**
- * Gets the data store object initialized.
- * @param conf Configuration
- * @return DataStore created
- */
- public DataStore createDataStore(Configuration conf) {
- DataStore dsCreated = null;
- try {
- dsCreated = GoraUtils.createSpecificDataStore(conf, getDatastoreClass(),
- getKeyClass(), getPersistentClass());
- } catch (GoraException e) {
- getLogger().error("Error creating data store.");
- e.printStackTrace();
- }
- return dsCreated;
- }
-
- @Override
- public abstract GoraEdgeWriter
- createEdgeWriter(TaskAttemptContext context)
- throws IOException, InterruptedException;
-
- /**
- * getOutputCommitter
- *
- * @param context the task context
- * @return OutputCommitter
- * @throws IOException
- * @throws InterruptedException
- */
- @Override
- public OutputCommitter getOutputCommitter(TaskAttemptContext context)
- throws IOException, InterruptedException {
- return new NullOutputCommitter();
- }
-
- /**
- * Empty output commiter for hadoop.
- */
- private static class NullOutputCommitter extends OutputCommitter {
- @Override
- public void abortTask(TaskAttemptContext arg0) throws IOException { }
-
- @Override
- public void commitTask(TaskAttemptContext arg0) throws IOException { }
-
- @Override
- public boolean needsTaskCommit(TaskAttemptContext arg0) throws IOException {
- return false;
- }
-
- @Override
- public void setupJob(JobContext arg0) throws IOException { }
-
- @Override
- public void setupTask(TaskAttemptContext arg0) throws IOException { }
- }
-
- /**
- * Abstract class to be implemented by the user based on their specific
- * vertex/edges output.
- */
- protected abstract class GoraEdgeWriter extends EdgeWriter<I, V, E> {
- @Override
- public void initialize(TaskAttemptContext context) throws IOException,
- InterruptedException {
- String sDataStoreType =
- GIRAPH_GORA_OUTPUT_DATASTORE_CLASS.get(getConf());
- String sKeyType =
- GIRAPH_GORA_OUTPUT_KEY_CLASS.get(getConf());
- String sPersistentType =
- GIRAPH_GORA_OUTPUT_PERSISTENT_CLASS.get(getConf());
- try {
- Class<?> keyClass = Class.forName(sKeyType);
- Class<?> persistentClass = Class.forName(sPersistentType);
- Class<?> dataStoreClass = Class.forName(sDataStoreType);
- setKeyClass(keyClass);
- setPersistentClass((Class<? extends Persistent>) persistentClass);
- setDatastoreClass((Class<? extends DataStore>) dataStoreClass);
- setDataStore(createDataStore(context.getConfiguration()));
- if (getDataStore() != null) {
- getLogger().debug("The data store has been created.");
- }
- } catch (ClassNotFoundException e) {
- getLogger().error("Error while reading Gora Output parameters");
- e.printStackTrace();
- }
- }
-
- @Override
- public void close(TaskAttemptContext context)
- throws IOException, InterruptedException {
- getDataStore().flush();
- getDataStore().close();
- }
-
- @Override
- public void writeEdge(I srcId, V srcValue, Edge<I, E> edge)
- throws IOException, InterruptedException {
- Persistent goraEdge = null;
- Object goraKey = getGoraKey(srcId, srcValue, edge);
- goraEdge = getGoraEdge(srcId, srcValue, edge);
- getDataStore().put(goraKey, goraEdge);
- }
-
- /**
- * Each edge needs to be transformed into a Gora object to be sent to
- * a specific data store.
- *
- * @param edge edge to be transformed into a Gora object
- * @param srcId source vertex id
- * @param srcValue source vertex value
- * @return Gora representation of the vertex
- */
- protected abstract Persistent getGoraEdge
- (I srcId, V srcValue, Edge<I, E> edge);
-
- /**
- * Gets the correct key from a computed vertex.
- * @param edge edge to extract the key from.
- * @param srcId source vertex id
- * @param srcValue source vertex value
- * @return The key representing such edge.
- */
- protected abstract Object getGoraKey(I srcId, V srcValue, Edge<I, E> edge);
- }
-
- /**
- * Gets the data store.
- * @return DataStore
- */
- public static DataStore getDataStore() {
- return DATA_STORE;
- }
-
- /**
- * Sets the data store
- * @param dStore the dATA_STORE to set
- */
- public static void setDataStore(DataStore dStore) {
- DATA_STORE = dStore;
- }
-
- /**
- * Gets the persistent Class
- * @return persistentClass used
- */
- static Class<? extends Persistent> getPersistentClass() {
- return PERSISTENT_CLASS;
- }
-
- /**
- * Sets the persistent Class
- * @param persistentClassUsed to be set
- */
- static void setPersistentClass
- (Class<? extends Persistent> persistentClassUsed) {
- PERSISTENT_CLASS = persistentClassUsed;
- }
-
- /**
- * Gets the key class used.
- * @return the key class used.
- */
- static Class<?> getKeyClass() {
- return KEY_CLASS;
- }
-
- /**
- * Sets the key class used.
- * @param keyClassUsed key class used.
- */
- static void setKeyClass(Class<?> keyClassUsed) {
- KEY_CLASS = keyClassUsed;
- }
-
- /**
- * @return Class the DATASTORE_CLASS
- */
- public static Class<? extends DataStore> getDatastoreClass() {
- return DATASTORE_CLASS;
- }
-
- /**
- * @param dataStoreClass the dataStore class to set
- */
- public static void setDatastoreClass(
- Class<? extends DataStore> dataStoreClass) {
- DATASTORE_CLASS = dataStoreClass;
- }
-
- /**
- * Gets the logger for the class.
- * @return the log of the class.
- */
- public static Logger getLogger() {
- return LOG;
- }
-}
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraGEdgeEdgeInputFormat.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraGEdgeEdgeInputFormat.java
deleted file mode 100644
index dd06b43..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraGEdgeEdgeInputFormat.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora;
-
-import java.io.IOException;
-
-import org.apache.giraph.edge.Edge;
-import org.apache.giraph.edge.EdgeFactory;
-import org.apache.giraph.io.gora.generated.GEdge;
-import org.apache.hadoop.io.FloatWritable;
-import org.apache.hadoop.io.LongWritable;
-import org.apache.hadoop.mapreduce.InputSplit;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-
-/**
- * Example implementation of a specific reader for a generated data bean.
- */
-public class GoraGEdgeEdgeInputFormat
- extends GoraEdgeInputFormat<LongWritable, FloatWritable> {
-
- /**
- * Default constructor
- */
- public GoraGEdgeEdgeInputFormat() {
- }
-
- /**
- * Creates specific vertex reader to be used inside Hadoop.
- * @param split split to be read.
- * @param context JobContext to be used.
- * @return GoraEdgeReader Edge reader to be used by Hadoop.
- */
- @Override
- public GoraEdgeReader createEdgeReader(
- InputSplit split, TaskAttemptContext context) throws IOException {
- return new GoraGEdgeEdgeReader();
- }
-
- /**
- * Gora edge reader
- */
- protected class GoraGEdgeEdgeReader extends GoraEdgeReader {
-
- /** source vertex of the edge */
- private LongWritable sourceId;
-
- /**
- * Transforms a GoraObject into an Edge object.
- * @param goraObject Object from Gora to be translated.
- * @return Edge Result from transforming the gora object.
- */
- @Override
- protected Edge<LongWritable, FloatWritable> transformEdge
- (Object goraObject) {
- Edge<LongWritable, FloatWritable> edge = null;
- GEdge goraEdge = (GEdge) goraObject;
- this.sourceId = new LongWritable();
- this.sourceId.set(Long.parseLong(goraEdge.getVertexInId().toString()));
- edge = EdgeFactory.create(
- new LongWritable(
- Long.parseLong(goraEdge.getVertexOutId().toString())),
- new FloatWritable(goraEdge.getEdgeWeight()));
- return edge;
- }
-
- /**
- * Gets the currentSourceId for the edge.
- * @return LongWritable currentSourceId for the edge.
- */
- @Override
- public LongWritable getCurrentSourceId() throws IOException,
- InterruptedException {
- return this.sourceId;
- }
- }
-}
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraGEdgeEdgeOutputFormat.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraGEdgeEdgeOutputFormat.java
deleted file mode 100644
index 82b02d0..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraGEdgeEdgeOutputFormat.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora;
-
-import java.io.IOException;
-
-import org.apache.giraph.edge.Edge;
-import org.apache.giraph.io.gora.generated.GEdgeResult;
-import org.apache.gora.persistency.Persistent;
-import org.apache.hadoop.io.DoubleWritable;
-import org.apache.hadoop.io.FloatWritable;
-import org.apache.hadoop.io.LongWritable;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-
-/**
- * Implementation of a specific writer for a generated data bean.
- */
-public class GoraGEdgeEdgeOutputFormat
- extends GoraEdgeOutputFormat<LongWritable, DoubleWritable,
- FloatWritable> {
-
- /**
- * Default constructor
- */
- public GoraGEdgeEdgeOutputFormat() {
- }
-
- @Override
- public GoraEdgeWriter createEdgeWriter(
- TaskAttemptContext context) throws IOException, InterruptedException {
- return new GoraGEdgeEdgeWriter();
- }
-
- /**
- * Gora edge writer.
- */
- protected class GoraGEdgeEdgeWriter
- extends GoraEdgeWriter {
-
- @Override
- protected Persistent getGoraEdge(LongWritable srcId,
- DoubleWritable srcValue, Edge<LongWritable, FloatWritable> edge) {
- GEdgeResult tmpGEdge = new GEdgeResult();
- tmpGEdge.setEdgeId(srcId.toString());
- tmpGEdge.setEdgeWeight(edge.getValue().get());
- tmpGEdge.setVertexOutId(edge.getTargetVertexId().toString());
- getLogger().debug("GoraObject created: " + tmpGEdge.toString());
- return tmpGEdge;
- }
-
- @Override
- protected Object getGoraKey(LongWritable srcId,
- DoubleWritable srcValue, Edge<LongWritable, FloatWritable> edge) {
- String goraKey = String.valueOf(
- edge.getTargetVertexId().get() + edge.getValue().get());
- return goraKey;
- }
-
- }
-}
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraGVertexVertexInputFormat.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraGVertexVertexInputFormat.java
deleted file mode 100644
index 34ba7ec..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraGVertexVertexInputFormat.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora;
-
-import java.io.IOException;
-import java.util.Set;
-
-import org.apache.giraph.edge.Edge;
-import org.apache.giraph.edge.EdgeFactory;
-import org.apache.giraph.graph.Vertex;
-import org.apache.giraph.io.gora.generated.GVertex;
-import org.apache.hadoop.io.DoubleWritable;
-import org.apache.hadoop.io.FloatWritable;
-import org.apache.hadoop.io.LongWritable;
-import org.apache.hadoop.mapreduce.InputSplit;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-
-/**
- * Example implementation of a specific reader for a generated data bean.
- */
-public class GoraGVertexVertexInputFormat
- extends GoraVertexInputFormat<LongWritable, DoubleWritable,
- FloatWritable> {
-
- /**
- * DEfault constructor
- */
- public GoraGVertexVertexInputFormat() {
- }
-
- /**
- * Creates specific vertex reader to be used inside Hadoop.
- * @param split split to be read.
- * @param context JobContext to be used.
- * @return GoraVertexReader Vertex reader to be used by Hadoop.
- */
- @Override
- public GoraVertexReader createVertexReader(
- InputSplit split, TaskAttemptContext context) throws IOException {
- return new GoraGVertexVertexReader();
- }
-
- /**
- * Gora vertex reader
- */
- protected class GoraGVertexVertexReader extends GoraVertexReader {
-
- /**
- * Transforms a GoraObject into a Vertex object.
- * @param goraObject Object from Gora to be translated.
- * @return Vertex Result from transforming the gora object.
- */
- @Override
- protected Vertex<LongWritable, DoubleWritable, FloatWritable>
- transformVertex(Object goraObject) {
- Vertex<LongWritable, DoubleWritable, FloatWritable> vertex;
- /* create the actual vertex */
- vertex = getConf().createVertex();
- GVertex tmpGVertex = (GVertex) goraObject;
-
- LongWritable vrtxId = new LongWritable(
- Long.parseLong(tmpGVertex.getVertexId().toString()));
- DoubleWritable vrtxValue = new DoubleWritable(
- tmpGVertex.getVertexValue());
- vertex.initialize(vrtxId, vrtxValue);
- if (tmpGVertex.getEdges() != null && !tmpGVertex.getEdges().isEmpty()) {
- Set<CharSequence> keyIt = tmpGVertex.getEdges().keySet();
- for (CharSequence key : keyIt) {
- String keyVal = key.toString();
- String valVal = tmpGVertex.getEdges().get(key).toString();
- Edge<LongWritable, FloatWritable> edge;
- if (!keyVal.contains("vertexId") && !keyVal.contains("value")) {
- edge = EdgeFactory.create(
- new LongWritable(Long.parseLong(keyVal)),
- new FloatWritable(Float.parseFloat(valVal)));
- vertex.addEdge(edge);
- }
- }
- }
- return vertex;
- }
- }
-}
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraGVertexVertexOutputFormat.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraGVertexVertexOutputFormat.java
deleted file mode 100644
index 4a9c229..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraGVertexVertexOutputFormat.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora;
-
-import java.io.IOException;
-import java.util.Iterator;
-
-import org.apache.giraph.edge.Edge;
-import org.apache.giraph.graph.Vertex;
-import org.apache.giraph.io.VertexWriter;
-import org.apache.giraph.io.gora.generated.GVertexResult;
-import org.apache.gora.persistency.Persistent;
-import org.apache.hadoop.io.DoubleWritable;
-import org.apache.hadoop.io.FloatWritable;
-import org.apache.hadoop.io.LongWritable;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-
-/**
- * Implementation of a specific reader for a generated data bean.
- */
-public class GoraGVertexVertexOutputFormat
- extends GoraVertexOutputFormat<LongWritable, DoubleWritable,
- FloatWritable> {
-
- /**
- * DEfault constructor
- */
- public GoraGVertexVertexOutputFormat() {
- }
-
- @Override
- public VertexWriter<LongWritable, DoubleWritable, FloatWritable>
- createVertexWriter(TaskAttemptContext context)
- throws IOException, InterruptedException {
- return new GoraGVertexVertexWriter();
- }
-
- /**
- * Gora vertex writer.
- */
- protected class GoraGVertexVertexWriter extends GoraVertexWriter {
-
- @Override
- protected Persistent getGoraVertex(
- Vertex<LongWritable, DoubleWritable, FloatWritable> vertex) {
- GVertexResult tmpGVertex = new GVertexResult();
- tmpGVertex.setVertexId(vertex.getId().toString());
- tmpGVertex.setVertexValue(Float.parseFloat(vertex.getValue().toString()));
- Iterator<Edge<LongWritable, FloatWritable>> it =
- vertex.getEdges().iterator();
- while (it.hasNext()) {
- Edge<LongWritable, FloatWritable> edge = it.next();
- tmpGVertex.getEdges().put(
- edge.getTargetVertexId().toString(),
- edge.getValue().toString());
- }
- return tmpGVertex;
- }
-
- @Override
- protected Object getGoraKey(
- Vertex<LongWritable, DoubleWritable, FloatWritable> vertex) {
- String goraKey = String.valueOf(vertex.getId());
- return goraKey;
- }
- }
-}
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraVertexInputFormat.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraVertexInputFormat.java
deleted file mode 100644
index 0892849..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraVertexInputFormat.java
+++ /dev/null
@@ -1,416 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora;
-
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_DATASTORE_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_END_KEY;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_KEYS_FACTORY_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_KEY_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_PERSISTENT_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_START_KEY;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.giraph.graph.Vertex;
-import org.apache.giraph.io.VertexInputFormat;
-import org.apache.giraph.io.VertexReader;
-import org.apache.giraph.io.gora.utils.ExtraGoraInputFormat;
-import org.apache.giraph.io.gora.utils.GoraUtils;
-import org.apache.giraph.io.gora.utils.KeyFactory;
-import org.apache.gora.persistency.Persistent;
-import org.apache.gora.query.Result;
-import org.apache.gora.query.impl.QueryBase;
-import org.apache.gora.store.DataStore;
-import org.apache.gora.util.GoraException;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.io.WritableComparable;
-import org.apache.hadoop.mapreduce.InputSplit;
-import org.apache.hadoop.mapreduce.JobContext;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-import org.apache.log4j.Logger;
-
-/**
- * Class which wraps the GoraInputFormat. It's designed
- * as an extension point to VertexInputFormat subclasses who wish
- * to read from Gora data sources.
- *
- * Works with
- * {@link GoraVertexOutputFormat}
- *
- * @param <I> vertex id type
- * @param <V> vertex value type
- * @param <E> edge type
- */
-public abstract class GoraVertexInputFormat<
- I extends WritableComparable,
- V extends Writable,
- E extends Writable>
- extends VertexInputFormat<I, V, E> {
-
- /** Start key for querying Gora data store. */
- private static Object START_KEY;
-
- /** End key for querying Gora data store. */
- private static Object END_KEY;
-
- /** Logger for Gora's vertex input format. */
- private static final Logger LOG =
- Logger.getLogger(GoraVertexInputFormat.class);
-
- /** KeyClass used for getting data. */
- private static Class<?> KEY_CLASS;
-
- /** The vertex itself will be used as a value inside Gora. */
- private static Class<? extends Persistent> PERSISTENT_CLASS;
-
- /** Data store class to be used as backend. */
- private static Class<? extends DataStore> DATASTORE_CLASS;
-
- /** Class used to transform strings into Keys */
- private static Class<?> KEY_FACTORY_CLASS;
-
- /** Data store used for querying data. */
- private static DataStore DATA_STORE;
-
- /** counter for iinput records */
- private static int RECORD_COUNTER = 0;
-
- /** Delegate Gora input format */
- private static ExtraGoraInputFormat GORA_INPUT_FORMAT =
- new ExtraGoraInputFormat();
-
- /** @param conf configuration parameters */
- public void checkInputSpecs(Configuration conf) {
- String sDataStoreType =
- GIRAPH_GORA_DATASTORE_CLASS.get(getConf());
- String sKeyType =
- GIRAPH_GORA_KEY_CLASS.get(getConf());
- String sPersistentType =
- GIRAPH_GORA_PERSISTENT_CLASS.get(getConf());
- String sKeyFactoryClass =
- GIRAPH_GORA_KEYS_FACTORY_CLASS.get(getConf());
- try {
- Class<?> keyClass = Class.forName(sKeyType);
- Class<?> persistentClass = Class.forName(sPersistentType);
- Class<?> dataStoreClass = Class.forName(sDataStoreType);
- Class<?> keyFactoryClass = Class.forName(sKeyFactoryClass);
- setKeyClass(keyClass);
- setPersistentClass((Class<? extends Persistent>) persistentClass);
- setDatastoreClass((Class<? extends DataStore>) dataStoreClass);
- setKeyFactoryClass(keyFactoryClass);
- setDataStore(createDataStore(conf));
- GORA_INPUT_FORMAT.setDataStore(getDataStore());
- } catch (ClassNotFoundException e) {
- LOG.error("Error while reading Gora Input parameters");
- e.printStackTrace();
- }
- }
-
- /**
- * Create a vertex reader for a given split. Guaranteed to have been
- * configured with setConf() prior to use. The framework will also call
- * {@link VertexReader#initialize(InputSplit, TaskAttemptContext)} before
- * the split is used.
- *
- * @param split the split to be read
- * @param context the information about the task
- * @return a new record reader
- * @throws IOException
- */
- public abstract GoraVertexReader createVertexReader(InputSplit split,
- TaskAttemptContext context) throws IOException;
-
- /**
- * Gets the splits for a data store.
- * @param context JobContext
- * @param minSplitCountHint Hint for a minimum split count
- * @return A list of splits
- */
- @Override
- public List<InputSplit> getSplits(JobContext context, int minSplitCountHint)
- throws IOException, InterruptedException {
- KeyFactory kFact = null;
- try {
- kFact = (KeyFactory) getKeyFactoryClass().newInstance();
- kFact.setDataStore(getDataStore());
- } catch (InstantiationException e) {
- LOG.error("Key factory was not instantiated. Please verify.");
- LOG.error(e.getMessage());
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- LOG.error("Key factory was not instantiated. Please verify.");
- LOG.error(e.getMessage());
- e.printStackTrace();
- }
- String sKey = GIRAPH_GORA_START_KEY.get(getConf());
- String eKey = GIRAPH_GORA_END_KEY.get(getConf());
- if (sKey == null || sKey.isEmpty()) {
- LOG.warn("No start key has been defined.");
- LOG.warn("Querying all the data store.");
- sKey = null;
- eKey = null;
- } else {
- setStartKey(kFact.buildKey(sKey));
- setEndKey(kFact.buildKey(eKey));
- }
- QueryBase tmpQuery = GoraUtils.getQuery(
- getDataStore(), getStartKey(), getEndKey());
- tmpQuery.setConf(getConf());
- GORA_INPUT_FORMAT.setQuery(tmpQuery);
- List<InputSplit> splits = GORA_INPUT_FORMAT.getSplits(context);
- return splits;
- }
-
- /**
- * Gets the data store object initialized.
- * @param conf Configuration
- * @return DataStore created
- */
- public DataStore createDataStore(Configuration conf) {
- DataStore dsCreated = null;
- try {
- dsCreated = GoraUtils.createSpecificDataStore(conf, getDatastoreClass(),
- getKeyClass(), getPersistentClass());
- } catch (GoraException e) {
- LOG.error("Error creating data store.");
- e.printStackTrace();
- }
- return dsCreated;
- }
-
- /**
- * Abstract class to be implemented by the user based on their specific
- * vertex input. Easiest to ignore the key value separator and only use
- * key instead.
- */
- protected abstract class GoraVertexReader extends VertexReader<I, V, E> {
- /** Current vertex */
- private Vertex<I, V, E> vertex;
- /** Results gotten from Gora data store. */
- private Result readResults;
-
- @Override
- public void initialize(InputSplit inputSplit, TaskAttemptContext context)
- throws IOException, InterruptedException {
- getResults();
- RECORD_COUNTER = 0;
- }
-
- /**
- * Gets the next vertex from Gora data store.
- * @return true/false depending on the existence of vertices.
- * @throws IOException exceptions passed along.
- * @throws InterruptedException exceptions passed along.
- */
- @Override
- // CHECKSTYLE: stop IllegalCatch
- public boolean nextVertex() throws IOException, InterruptedException {
- boolean flg = false;
- try {
- flg = this.getReadResults().next();
- this.vertex = transformVertex(this.getReadResults().get());
- RECORD_COUNTER++;
- } catch (Exception e) {
- LOG.error("Error transforming vertices.");
- LOG.error(e.getMessage());
- flg = false;
- }
- LOG.debug(RECORD_COUNTER + " were transformed.");
- return flg;
- }
- // CHECKSTYLE: resume IllegalCatch
-
- /**
- * Gets the progress of reading results from Gora.
- * @return the progress of reading results from Gora.
- */
- @Override
- public float getProgress() throws IOException, InterruptedException {
- float progress = 0.0f;
- if (getReadResults() != null) {
- progress = getReadResults().getProgress();
- }
- return progress;
- }
-
- /**
- * Gets current vertex.
- *
- * @return The vertex object represented by a Gora object
- */
- @Override
- public Vertex<I, V, E> getCurrentVertex()
- throws IOException, InterruptedException {
- return this.vertex;
- }
-
- /**
- * Parser for a single Gora object
- *
- * @param goraObject vertex represented as a GoraObject
- * @return The vertex object represented by a Gora object
- */
- protected abstract Vertex<I, V, E> transformVertex(Object goraObject);
-
- /**
- * Performs a range query to a Gora data store.
- */
- protected void getResults() {
- setReadResults(GoraUtils.getRequest(getDataStore(),
- getStartKey(), getEndKey()));
- }
-
- /**
- * Finishes the reading process.
- * @throws IOException
- */
- @Override
- public void close() throws IOException {
- }
-
- /**
- * Gets the results read.
- * @return results read.
- */
- Result getReadResults() {
- return readResults;
- }
-
- /**
- * Sets the results read.
- * @param readResults results read.
- */
- void setReadResults(Result readResults) {
- this.readResults = readResults;
- }
- }
-
- /**
- * Gets the persistent Class
- * @return persistentClass used
- */
- static Class<? extends Persistent> getPersistentClass() {
- return PERSISTENT_CLASS;
- }
-
- /**
- * Sets the persistent Class
- * @param persistentClassUsed to be set
- */
- static void setPersistentClass
- (Class<? extends Persistent> persistentClassUsed) {
- PERSISTENT_CLASS = persistentClassUsed;
- }
-
- /**
- * Gets the key class used.
- * @return the key class used.
- */
- static Class<?> getKeyClass() {
- return KEY_CLASS;
- }
-
- /**
- * Sets the key class used.
- * @param keyClassUsed key class used.
- */
- static void setKeyClass(Class<?> keyClassUsed) {
- KEY_CLASS = keyClassUsed;
- }
-
- /**
- * @return Class the DATASTORE_CLASS
- */
- public static Class<? extends DataStore> getDatastoreClass() {
- return DATASTORE_CLASS;
- }
-
- /**
- * @param dataStoreClass the dataStore class to set
- */
- public static void setDatastoreClass(
- Class<? extends DataStore> dataStoreClass) {
- DATASTORE_CLASS = dataStoreClass;
- }
-
- /**
- * Gets the start key for querying.
- * @return the start key.
- */
- public Object getStartKey() {
- return START_KEY;
- }
-
- /**
- * Gets the start key for querying.
- * @param startKey start key.
- */
- public static void setStartKey(Object startKey) {
- START_KEY = startKey;
- }
-
- /**
- * Gets the end key for querying.
- * @return the end key.
- */
- static Object getEndKey() {
- return END_KEY;
- }
-
- /**
- * Sets the end key for querying.
- * @param pEndKey start key.
- */
- static void setEndKey(Object pEndKey) {
- END_KEY = pEndKey;
- }
-
- /**
- * Gets the key factory class.
- * @return the kEY_FACTORY_CLASS
- */
- static Class<?> getKeyFactoryClass() {
- return KEY_FACTORY_CLASS;
- }
-
- /**
- * Sets the key factory class.
- * @param keyFactoryClass the keyFactoryClass to set.
- */
- static void setKeyFactoryClass(Class<?> keyFactoryClass) {
- KEY_FACTORY_CLASS = keyFactoryClass;
- }
-
- /**
- * Gets the data store.
- * @return DataStore
- */
- public static DataStore getDataStore() {
- return DATA_STORE;
- }
-
- /**
- * Sets the data store
- * @param dStore the dATA_STORE to set
- */
- public static void setDataStore(DataStore dStore) {
- DATA_STORE = dStore;
- }
-}
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraVertexOutputFormat.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraVertexOutputFormat.java
deleted file mode 100644
index 93143da..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/GoraVertexOutputFormat.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora;
-
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_OUTPUT_DATASTORE_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_OUTPUT_KEY_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_OUTPUT_PERSISTENT_CLASS;
-
-import java.io.IOException;
-
-import org.apache.giraph.graph.Vertex;
-import org.apache.giraph.io.VertexOutputFormat;
-import org.apache.giraph.io.VertexWriter;
-import org.apache.giraph.io.gora.utils.GoraUtils;
-import org.apache.gora.persistency.Persistent;
-import org.apache.gora.store.DataStore;
-import org.apache.gora.util.GoraException;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.io.WritableComparable;
-import org.apache.hadoop.mapreduce.JobContext;
-import org.apache.hadoop.mapreduce.OutputCommitter;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-import org.apache.log4j.Logger;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.Watcher.Event.EventType;
-/**
- *
- * Class which wraps the GoraOutputFormat. It's designed
- * as an extension point to VertexOutputFormat subclasses who wish
- * to write vertices back to an Accumulo table.
- *
- * Works with
- * {@link GoraVertexInputFormat}
- *
- *
- * @param <I> vertex id type
- * @param <V> vertex value type
- * @param <E> edge type
- */
-public abstract class GoraVertexOutputFormat<
- I extends WritableComparable,
- V extends Writable,
- E extends Writable>
- extends VertexOutputFormat<I, V, E> {
-
- /** Logger for Gora's vertex input format. */
- private static final Logger LOG =
- Logger.getLogger(GoraVertexOutputFormat.class);
-
- /** KeyClass used for getting data. */
- private static Class<?> KEY_CLASS;
-
- /** The vertex itself will be used as a value inside Gora. */
- private static Class<? extends Persistent> PERSISTENT_CLASS;
-
- /** Data store class to be used as backend. */
- private static Class<? extends DataStore> DATASTORE_CLASS;
-
- /** Data store used for querying data. */
- private static DataStore DATA_STORE;
-
- /**
- * checkOutputSpecs
- *
- * @param context information about the job
- * @throws IOException
- * @throws InterruptedException
- */
- @Override
- public void checkOutputSpecs(JobContext context)
- throws IOException, InterruptedException {
- }
-
- /**
- * Gets the data store object initialized.
- * @param conf Configuration.
- * @return DataStore created
- */
- public DataStore createDataStore(Configuration conf) {
- DataStore dsCreated = null;
- try {
- dsCreated = GoraUtils.createSpecificDataStore(conf, getDatastoreClass(),
- getKeyClass(), getPersistentClass());
- } catch (GoraException e) {
- getLogger().error("Error creating data store.");
- e.printStackTrace();
- }
- return dsCreated;
- }
-
- /**
- * getOutputCommitter
- *
- * @param context the task context
- * @return OutputCommitter
- * @throws IOException
- * @throws InterruptedException
- */
- @Override
- public OutputCommitter getOutputCommitter(TaskAttemptContext context)
- throws IOException, InterruptedException {
- return new NullOutputCommitter();
- }
-
- /**
- * Empty output commiter for hadoop.
- */
- private static class NullOutputCommitter extends OutputCommitter {
- @Override
- public void abortTask(TaskAttemptContext arg0) throws IOException { }
-
- @Override
- public void commitTask(TaskAttemptContext arg0) throws IOException { }
-
- @Override
- public boolean needsTaskCommit(TaskAttemptContext arg0) throws IOException {
- return false;
- }
-
- @Override
- public void setupJob(JobContext arg0) throws IOException { }
-
- @Override
- public void setupTask(TaskAttemptContext arg0) throws IOException { }
- }
-
- /**
- * Abstract class to be implemented by the user based on their specific
- * vertex/edges output. Easiest to ignore the key value separator and only
- * use key instead.
- */
- protected abstract class GoraVertexWriter
- extends VertexWriter<I, V, E>
- implements Watcher {
- /** lock for management of the barrier */
- private final Object lock = new Object();
-
- @Override
- public void initialize(TaskAttemptContext context)
- throws IOException, InterruptedException {
- String sDataStoreType =
- GIRAPH_GORA_OUTPUT_DATASTORE_CLASS.get(getConf());
- String sKeyType =
- GIRAPH_GORA_OUTPUT_KEY_CLASS.get(getConf());
- String sPersistentType =
- GIRAPH_GORA_OUTPUT_PERSISTENT_CLASS.get(getConf());
- try {
- Class<?> keyClass = Class.forName(sKeyType);
- Class<?> persistentClass = Class.forName(sPersistentType);
- Class<?> dataStoreClass = Class.forName(sDataStoreType);
- setKeyClass(keyClass);
- setPersistentClass((Class<? extends Persistent>) persistentClass);
- setDatastoreClass((Class<? extends DataStore>) dataStoreClass);
- setDataStore(createDataStore(context.getConfiguration()));
- if (getDataStore() != null) {
- getLogger().info("The output data store has been created.");
- }
- } catch (ClassNotFoundException e) {
- getLogger().error("Error while reading Gora Output parameters");
- e.printStackTrace();
- }
- }
-
- @Override
- public void close(TaskAttemptContext context)
- throws IOException, InterruptedException {
- getDataStore().flush();
- getDataStore().close();
- }
-
- @Override
- public void writeVertex(Vertex<I, V, E> vertex)
- throws IOException, InterruptedException {
- Persistent goraVertex = null;
- Object goraKey = getGoraKey(vertex);
- goraVertex = getGoraVertex(vertex);
- getDataStore().put(goraKey, goraVertex);
- }
-
- @Override
- public void process(WatchedEvent event) {
- EventType type = event.getType();
- if (type == EventType.NodeChildrenChanged) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("signal: number of children changed.");
- }
- synchronized (lock) {
- lock.notify();
- }
- }
- }
-
- /**
- * Each vertex needs to be transformed into a Gora object to be sent to
- * a specific data store.
- *
- * @param vertex vertex to be transformed into a Gora object
- * @return Gora representation of the vertex
- */
- protected abstract Persistent getGoraVertex(Vertex<I, V, E> vertex);
-
- /**
- * Gets the correct key from a computed vertex.
- * @param vertex vertex to extract the key from.
- * @return The key representing such vertex
- */
- protected abstract Object getGoraKey(Vertex<I, V, E> vertex);
-
- }
-
- /**
- * Gets the data store.
- * @return DataStore
- */
- public static DataStore getDataStore() {
- return DATA_STORE;
- }
-
- /**
- * Sets the data store
- * @param dStore the dATA_STORE to set
- */
- public static void setDataStore(DataStore dStore) {
- DATA_STORE = dStore;
- }
-
- /**
- * Gets the persistent Class
- * @return persistentClass used
- */
- static Class<? extends Persistent> getPersistentClass() {
- return PERSISTENT_CLASS;
- }
-
- /**
- * Sets the persistent Class
- * @param persistentClassUsed to be set
- */
- static void setPersistentClass
- (Class<? extends Persistent> persistentClassUsed) {
- PERSISTENT_CLASS = persistentClassUsed;
- }
-
- /**
- * Gets the key class used.
- * @return the key class used.
- */
- static Class<?> getKeyClass() {
- return KEY_CLASS;
- }
-
- /**
- * Sets the key class used.
- * @param keyClassUsed key class used.
- */
- static void setKeyClass(Class<?> keyClassUsed) {
- KEY_CLASS = keyClassUsed;
- }
-
- /**
- * @return Class the DATASTORE_CLASS
- */
- public static Class<? extends DataStore> getDatastoreClass() {
- return DATASTORE_CLASS;
- }
-
- /**
- * @param dataStoreClass the dataStore class to set
- */
- public static void setDatastoreClass(
- Class<? extends DataStore> dataStoreClass) {
- DATASTORE_CLASS = dataStoreClass;
- }
-
- /**
- * Returns a logger.
- * @return the log for the output format.
- */
- public static Logger getLogger() {
- return LOG;
- }
-}
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/constants/GiraphGoraConstants.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/constants/GiraphGoraConstants.java
deleted file mode 100644
index 187bf59..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/constants/GiraphGoraConstants.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora.constants;
-
-import org.apache.giraph.conf.StrConfOption;
-
-/**
- * Constants used all over Giraph for configuration specific for Gora
- */
-// CHECKSTYLE: stop InterfaceIsTypeCheck
-public interface GiraphGoraConstants {
- /** Gora data store class which provides data access. */
- StrConfOption GIRAPH_GORA_DATASTORE_CLASS =
- new StrConfOption("giraph.gora.datastore.class", null,
- "Gora DataStore class to access to data from. " +
- "- required");
-
- /** Gora key class to query the data store. */
- StrConfOption GIRAPH_GORA_KEY_CLASS =
- new StrConfOption("giraph.gora.key.class", null,
- "Gora Key class to query the datastore. " +
- "- required");
-
- /** Gora persistent class to query the data store. */
- StrConfOption GIRAPH_GORA_PERSISTENT_CLASS =
- new StrConfOption("giraph.gora.persistent.class", null,
- "Gora Persistent class to read objects from Gora. " +
- "- required");
-
- /** Gora start key to query the datastore. */
- StrConfOption GIRAPH_GORA_START_KEY =
- new StrConfOption("giraph.gora.start.key", null,
- "Gora start key to query the datastore. ");
-
- /** Gora end key to query the datastore. */
- StrConfOption GIRAPH_GORA_END_KEY =
- new StrConfOption("giraph.gora.end.key", null,
- "Gora end key to query the datastore. ");
-
- /** Gora data store class which provides data access. */
- StrConfOption GIRAPH_GORA_KEYS_FACTORY_CLASS =
- new StrConfOption("giraph.gora.keys.factory.class", null,
- "Keys factory to convert strings into desired keys" +
- "- required");
-
- // OUTPUT
- /** Gora data store class which provides data access. */
- StrConfOption GIRAPH_GORA_OUTPUT_DATASTORE_CLASS =
- new StrConfOption("giraph.gora.output.datastore.class", null,
- "Gora DataStore class to write data to. " +
- "- required");
-
- /** Gora key class to query the data store. */
- StrConfOption GIRAPH_GORA_OUTPUT_KEY_CLASS =
- new StrConfOption("giraph.gora.output.key.class", null,
- "Gora Key class to write to datastore. " +
- "- required");
-
- /** Gora persistent class to query the data store. */
- StrConfOption GIRAPH_GORA_OUTPUT_PERSISTENT_CLASS =
- new StrConfOption("giraph.gora.output.persistent.class", null,
- "Gora Persistent class to write to Gora. " +
- "- required");
-}
-// CHECKSTYLE: resume InterfaceIsTypeCheck
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/constants/package-info.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/constants/package-info.java
deleted file mode 100644
index 3a8b96f..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/constants/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.
- */
-/**
- * Constants for Gora Input/Output formats
- */
-package org.apache.giraph.io.gora.constants;
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/generated/GEdge.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/generated/GEdge.java
deleted file mode 100644
index c8b0667..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/generated/GEdge.java
+++ /dev/null
@@ -1,904 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora.generated;
-
-/**
- * Example class for defining a Giraph-Edge.
- */
-@SuppressWarnings("all")
-public class GEdge extends org.apache.gora.persistency.impl.PersistentBase
- implements org.apache.avro.specific.SpecificRecord,
- org.apache.gora.persistency.Persistent {
-
- /**
- * Schema used for the class.
- */
- public static final org.apache.avro.Schema SCHEMAS =
- new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\"," +
- "\"name\":\"GEdge\"," +
- "\"namespace\":\"org.apache.giraph.gora.generated\"," +
- "\"fields\":[{\"name\":\"edgeId\",\"type\":\"string\"}," +
- "{\"name\":\"edgeWeight\",\"type\":\"float\"}," +
- "{\"name\":\"vertexInId\",\"type\":\"string\"}," +
- "{\"name\":\"vertexOutId\",\"type\":\"string\"}," +
- "{\"name\":\"label\",\"type\":\"string\"}]}");
-
- /** Enum containing all data bean's fields. */
- public static enum Field {
- /**
- * Edge id.
- */
- EDGE_ID(0, "edgeId"),
-
- /**
- * Edge weight.
- */
- EDGE_WEIGHT(1, "edgeWeight"),
-
- /**
- * Edge vertex source id.
- */
- VERTEX_IN_ID(2, "vertexInId"),
-
- /**
- * Edge vertex end id.
- */
- VERTEX_OUT_ID(3, "vertexOutId"),
-
- /**
- * Edge label.
- */
- LABEL(4, "label");
-
- /**
- * Field's index.
- */
- private int index;
-
- /**
- * Field's name.
- */
- private String name;
-
- /**
- * Field's constructor
- * @param index field's index.
- * @param name field's name.
- */
- Field(int index, String name) {
- this.index = index;
- this.name = name;
- }
-
- /**
- * Gets field's index.
- * @return int field's index.
- */
- public int getIndex() {
- return index;
- }
-
- /**
- * Gets field's name.
- * @return String field's name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Gets field's attributes to string.
- * @return String field's attributes to string.
- */
- public String toString() {
- return name;
- }
- };
-
- /**
- * Array containing all fields/
- */
- private static final String[] ALL_FIELDS = {
- "edgeId", "edgeWeight", "vertexInId", "vertexOutId", "label"};
-
- /**
- * Tombstone.
- */
- private static final Tombstone TOMBSTONE = new Tombstone();
-
- /**
- * edgeId.
- */
- private java.lang.CharSequence edgeId;
-
- /**
- * edgeWeight.
- */
- private float edgeWeight;
-
- /**
- * vertexInId.
- */
- private java.lang.CharSequence vertexInId;
-
- /**
- * vertexOutId.
- */
- private java.lang.CharSequence vertexOutId;
-
- /**
- * label.
- */
- private java.lang.CharSequence label;
-
- /**
- * Gets the total field count.
- * @return int field count
- */
- public int getFieldsCount() {
- return GEdge.ALL_FIELDS.length;
- }
-
- /**
- * Gets the schema
- * @return Schema
- */
- public org.apache.avro.Schema getSchema() {
- return SCHEMAS;
- }
-
- /**
- * Gets field
- * @param field index field.
- * @return Object from an index.
- */
- public java.lang.Object get(int field) {
- switch (field) {
- case 0:
- return edgeId;
- case 1:
- return edgeWeight;
- case 2:
- return vertexInId;
- case 3:
- return vertexOutId;
- case 4:
- return label;
- default:
- throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
-
- /**
- * Puts a value into a field.
- * @param field index of field used.
- * @param value value of field used.
- */
- @SuppressWarnings(value = "unchecked")
- public void put(int field, java.lang.Object value) {
- switch (field) {
- case 0:
- edgeId = (java.lang.CharSequence) value;
- break;
- case 1:
- edgeWeight = (java.lang.Float) value;
- break;
- case 2:
- vertexInId = (java.lang.CharSequence) value;
- break;
- case 3:
- vertexOutId = (java.lang.CharSequence) value;
- break;
- case 4:
- label = (java.lang.CharSequence) value;
- break;
- default:
- throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
-
- /**
- * Gets the value of the 'edgeId' field.
- * @return CharSequence.
- */
- public java.lang.CharSequence getEdgeId() {
- return edgeId;
- }
-
- /**
- * Sets the value of the 'edgeId' field.
- * @param value the value to set.
- */
- public void setEdgeId(java.lang.CharSequence value) {
- this.edgeId = value;
- setDirty(0);
- }
-
- /**
- * Checks the dirty status of the 'edgeId' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isEdgeIdDirty(java.lang.CharSequence value) {
- return isDirty(0);
- }
-
- /**
- * Gets the value of the 'edgeWeight' field.
- * @return Float
- */
- public java.lang.Float getEdgeWeight() {
- return edgeWeight;
- }
-
- /**
- * Sets the value of the 'edgeWeight' field.
- * @param value the value to set.
- */
- public void setEdgeWeight(java.lang.Float value) {
- this.edgeWeight = value;
- setDirty(1);
- }
-
- /**
- * Checks the dirty status of the 'edgeWeight' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isEdgeWeightDirty(java.lang.Float value) {
- return isDirty(1);
- }
-
- /**
- * Gets the value of the 'vertexInId' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getVertexInId() {
- return vertexInId;
- }
-
- /**
- * Sets the value of the 'vertexInId' field.
- * @param value the value to set.
- */
- public void setVertexInId(java.lang.CharSequence value) {
- this.vertexInId = value;
- setDirty(2);
- }
-
- /**
- * Checks the dirty status of the 'vertexInId' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isVertexInIdDirty(java.lang.CharSequence value) {
- return isDirty(2);
- }
-
- /**
- * Gets the value of the 'vertexOutId' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getVertexOutId() {
- return vertexOutId;
- }
-
- /**
- * Sets the value of the 'vertexOutId' field.
- * @param value the value to set.
- */
- public void setVertexOutId(java.lang.CharSequence value) {
- this.vertexOutId = value;
- setDirty(3);
- }
-
- /**
- * Checks the dirty status of the 'vertexOutId' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isVertexOutIdDirty(java.lang.CharSequence value) {
- return isDirty(3);
- }
-
- /**
- * Gets the value of the 'label' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getLabel() {
- return label;
- }
-
- /**
- * Sets the value of the 'label' field.
- * @param value the value to set.
- */
- public void setLabel(java.lang.CharSequence value) {
- this.label = value;
- setDirty(4);
- }
-
- /**
- * Checks the dirty status of the 'label' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isLabelDirty(java.lang.CharSequence value) {
- return isDirty(4);
- }
-
- /**
- * Creates a new GEdge RecordBuilder.
- * @return GEdge.Builder
- */
- public static org.apache.giraph.io.gora.generated.GEdge.Builder newBuilder() {
- return new org.apache.giraph.io.gora.generated.GEdge.Builder();
- }
-
- /**
- * Creates a new GEdge RecordBuilder by copying an existing Builder
- * @param other GEdge.Builder
- * @return org.apache.giraph.io.gora.generated.GEdge.Builder
- */
- public static org.apache.giraph.io.gora.generated.GEdge.Builder newBuilder(
- org.apache.giraph.io.gora.generated.GEdge.Builder other) {
- return new org.apache.giraph.io.gora.generated.GEdge.Builder(other);
- }
-
- /**
- * Creates a new GEdge RecordBuilder by copying an existing GEdge instance.
- * @param other GEdge
- * @return org.apache.giraph.io.gora.generated.GEdge.Builder
- */
- public static org.apache.giraph.io.gora.generated.GEdge.Builder newBuilder(
- org.apache.giraph.io.gora.generated.GEdge other) {
- return new org.apache.giraph.io.gora.generated.GEdge.Builder(other);
- }
-
- /**
- * Makes a deep copy from a bytebuffer.
- * @param input ByteBuffer
- * @return ByteBuffer
- */
- private static java.nio.ByteBuffer deepCopyToReadOnlyBuffer(
- java.nio.ByteBuffer input) {
- java.nio.ByteBuffer copy = java.nio.ByteBuffer.allocate(input.capacity());
- int position = input.position();
- input.reset();
- int mark = input.position();
- int limit = input.limit();
- input.rewind();
- input.limit(input.capacity());
- copy.put(input);
- input.rewind();
- copy.rewind();
- input.position(mark);
- input.mark();
- copy.position(mark);
- copy.mark();
- input.position(position);
- copy.position(position);
- input.limit(limit);
- copy.limit(limit);
- return copy.asReadOnlyBuffer();
- }
-
- /**
- * RecordBuilder for GEdge instances.
- */
- public static class Builder extends
- org.apache.avro.specific.SpecificRecordBuilderBase<GEdge> implements
- org.apache.avro.data.RecordBuilder<GEdge> {
-
- /**
- * edgeId.
- */
- private java.lang.CharSequence edgeId;
-
- /**
- * edgeWeight.
- */
- private float edgeWeight;
-
- /**
- * vertexInId
- */
- private java.lang.CharSequence vertexInId;
-
- /**
- * vertexOutId.
- */
- private java.lang.CharSequence vertexOutId;
-
- /**
- * label.
- */
- private java.lang.CharSequence label;
-
- /**
- * Creates a new Builder
- */
- private Builder() {
- super(org.apache.giraph.io.gora.generated.GEdge.SCHEMAS);
- }
-
- /**
- * Creates a Builder by copying an existing Builder.
- * @param other GEdge.Builder
- */
- private Builder(org.apache.giraph.io.gora.generated.GEdge.Builder other) {
- super(other);
- }
-
- /**
- * Creates a Builder by copying an existing GEdge instance.
- * @param other GEdge
- */
- // CHECKSTYLE: stop Indentation
- private Builder(org.apache.giraph.io.gora.generated.GEdge other) {
- super(org.apache.giraph.io.gora.generated.GEdge.SCHEMAS);
- if (isValidValue(fields()[0], other.edgeId)) {
- this.edgeId = (java.lang.CharSequence) data().deepCopy(
- fields()[0].schema(), other.edgeId);
- fieldSetFlags()[0] = true;
- }
- if (isValidValue(fields()[1], other.edgeWeight)) {
- this.edgeWeight = (java.lang.Float) data().deepCopy(
- fields()[1].schema(), other.edgeWeight);
- fieldSetFlags()[1] = true;
- }
- if (isValidValue(fields()[2], other.vertexInId)) {
- this.vertexInId = (java.lang.CharSequence) data().deepCopy(
- fields()[2].schema(), other.vertexInId);
- fieldSetFlags()[2] = true;
- }
- if (isValidValue(fields()[3], other.vertexOutId)) {
- this.vertexOutId = (java.lang.CharSequence) data().deepCopy(
- fields()[3].schema(), other.vertexOutId);
- fieldSetFlags()[3] = true;
- }
- if (isValidValue(fields()[4], other.label)) {
- this.label = (java.lang.CharSequence) data().deepCopy(
- fields()[4].schema(), other.label);
- fieldSetFlags()[4] = true;
- }
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Gets the value of the 'edgeId' field
- * @return CharSequence
- */
- public java.lang.CharSequence getEdgeId() {
- return edgeId;
- }
-
- /**
- * Sets the value of the 'edgeId' field
- * @param value CharSequence
- * @return GEdge.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdge.Builder setEdgeId(
- java.lang.CharSequence value) {
- validate(fields()[0], value);
- this.edgeId = value;
- fieldSetFlags()[0] = true;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Checks whether the 'edgeId' field has been set.
- * @return boolean.
- */
- public boolean hasEdgeId() {
- return fieldSetFlags()[0];
- }
-
- /**
- * Clears the value of the 'edgeId' field.
- * @return GEdge.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdge.Builder clearEdgeId() {
- edgeId = null;
- fieldSetFlags()[0] = false;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Gets the value of the 'edgeWeight' field.
- * @return Float
- */
- public java.lang.Float getEdgeWeight() {
- return edgeWeight;
- }
-
- /**
- * Sets the value of the 'edgeWeight' field
- * @param value float
- * @return GEdge.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdge.Builder setEdgeWeight(
- float value) {
- validate(fields()[1], value);
- this.edgeWeight = value;
- fieldSetFlags()[1] = true;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Checks whether the 'edgeWeight' field has been set.
- * @return boolean
- */
- public boolean hasEdgeWeight() {
- return fieldSetFlags()[1];
- }
-
- /**
- * Clears the value of the 'edgeWeight' field.
- * @return GEdge.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdge.Builder clearEdgeWeight() {
- fieldSetFlags()[1] = false;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Gets the value of the 'vertexInId' field
- * @return CharSequence
- */
- public java.lang.CharSequence getVertexInId() {
- return vertexInId;
- }
-
- /**
- * Sets the value of the 'vertexInId' field.
- * @param value CharSequence
- * @return value
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdge.Builder setVertexInId(
- java.lang.CharSequence value) {
- validate(fields()[2], value);
- this.vertexInId = value;
- fieldSetFlags()[2] = true;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Checks whether the 'vertexInId' field has been set.
- * @return boolean
- */
- public boolean hasVertexInId() {
- return fieldSetFlags()[2];
- }
-
- /**
- * Clears the value of the 'vertexInId' field.
- * @return GEdge.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdge.Builder
- clearVertexInId() {
- vertexInId = null;
- fieldSetFlags()[2] = false;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Gets the value of the 'vertexOutId' field.
- * @return java.lang.CharSequence
- */
- public java.lang.CharSequence getVertexOutId() {
- return vertexOutId;
- }
-
- /**
- * Sets the value of the 'vertexOutId' field.
- * @param value CharSequence
- * @return GEdge.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdge.Builder setVertexOutId(
- java.lang.CharSequence value) {
- validate(fields()[3], value);
- this.vertexOutId = value;
- fieldSetFlags()[3] = true;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Checks whether the 'vertexOutId' field has been set.
- * @return boolean
- */
- public boolean hasVertexOutId() {
- return fieldSetFlags()[3];
- }
-
- /**
- * Clears the value of the 'vertexOutId' field.
- * @return GEdge.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdge.Builder
- clearVertexOutId() {
- vertexOutId = null;
- fieldSetFlags()[3] = false;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Gets the value of the 'label' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getLabel() {
- return label;
- }
-
- /**
- * Sets the value of the 'label' field.
- * @param value CharSequence
- * @return GEdge.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdge.Builder setLabel(
- java.lang.CharSequence value) {
- validate(fields()[4], value);
- this.label = value;
- fieldSetFlags()[4] = true;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Checks whether the 'label' field has been set.
- * @return boolean
- */
- public boolean hasLabel() {
- return fieldSetFlags()[4];
- }
-
- /**
- * Clears the value of the 'label' field.
- * @return GEdge.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdge.Builder clearLabel() {
- label = null;
- fieldSetFlags()[4] = false;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- @Override
- /**
- * Builds a GEdge.
- * @return GEdge
- */
- // CHECKSTYLE: stop IllegalCatch
- public GEdge build() {
- try {
- GEdge record = new GEdge();
- record.edgeId = fieldSetFlags()[0] ? this.edgeId :
- (java.lang.CharSequence) defaultValue(fields()[0]);
- record.edgeWeight = fieldSetFlags()[1] ? this.edgeWeight :
- (java.lang.Float) defaultValue(fields()[1]);
- record.vertexInId = fieldSetFlags()[2] ? this.vertexInId :
- (java.lang.CharSequence) defaultValue(fields()[2]);
- record.vertexOutId = fieldSetFlags()[3] ? this.vertexOutId :
- (java.lang.CharSequence) defaultValue(fields()[3]);
- record.label = fieldSetFlags()[4] ? this.label :
- (java.lang.CharSequence) defaultValue(fields()[4]);
- return record;
- } catch (Exception e) {
- throw new org.apache.avro.AvroRuntimeException(e);
- }
- }
- // CHECKSTYLE: resume IllegalCatch
- }
-
- /**
- * Gets a tombstone
- * @return GEdge.Tombstone
- */
- public GEdge.Tombstone getTombstone() {
- return TOMBSTONE;
- }
-
- /**
- * Gets a new instance
- * @return GEdge.
- */
- public GEdge newInstance() {
- return newBuilder().build();
- }
-
- /**
- * Tombstone class.
- */
- public static final class Tombstone extends GEdge implements
- org.apache.gora.persistency.Tombstone {
-
- /**
- * Default constructor.
- */
- private Tombstone() {
- }
-
- /**
- * Gets the value of the 'edgeId' field.
- * @return java.lang.CharSequence
- */
- public java.lang.CharSequence getEdgeId() {
- throw new java.lang.UnsupportedOperationException(
- "Get is not supported on tombstones");
- }
-
- /**
- * Sets the value of the 'edgeId' field.
- * @param value the value to set.
- */
- public void setEdgeId(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "Set is not supported on tombstones");
- }
-
- /**
- * Checks the dirty status of the 'edgeId' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isEdgeIdDirty(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "IsDirty is not supported on tombstones");
- }
-
- /**
- * Gets the value of the 'edgeWeight' field.
- * @return Float
- */
- public java.lang.Float getEdgeWeight() {
- throw new java.lang.UnsupportedOperationException(
- "Get is not supported on tombstones");
- }
-
- /**
- * Sets the value of the 'edgeWeight' field.
- * @param value the value to set.
- */
- public void setEdgeWeight(java.lang.Float value) {
- throw new java.lang.UnsupportedOperationException(
- "Set is not supported on tombstones");
- }
-
- /**
- * Checks the dirty status of the 'edgeWeight' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isEdgeWeightDirty(java.lang.Float value) {
- throw new java.lang.UnsupportedOperationException(
- "IsDirty is not supported on tombstones");
- }
-
- /**
- * Gets the value of the 'vertexInId' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getVertexInId() {
- throw new java.lang.UnsupportedOperationException(
- "Get is not supported on tombstones");
- }
-
- /**
- * Sets the value of the 'vertexInId' field.
- * @param value the value to set.
- */
- public void setVertexInId(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "Set is not supported on tombstones");
- }
-
- /**
- * Checks the dirty status of the 'vertexInId' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isVertexInIdDirty(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "IsDirty is not supported on tombstones");
- }
-
- /**
- * Gets the value of the 'vertexOutId' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getVertexOutId() {
- throw new java.lang.UnsupportedOperationException(
- "Get is not supported on tombstones");
- }
-
- /**
- * Sets the value of the 'vertexOutId' field.
- * @param value the value to set.
- */
- public void setVertexOutId(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "Set is not supported on tombstones");
- }
-
- /**
- * Checks the dirty status of the 'vertexOutId' field. A field is dirty if
- * it represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isVertexOutIdDirty(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "IsDirty is not supported on tombstones");
- }
-
- /**
- * Gets the value of the 'label' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getLabel() {
- throw new java.lang.UnsupportedOperationException(
- "Get is not supported on tombstones");
- }
-
- /**
- * Sets the value of the 'label' field.
- * @param value the value to set.
- */
- public void setLabel(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "Set is not supported on tombstones");
- }
-
- /**
- * Checks the dirty status of the 'label' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isLabelDirty(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "IsDirty is not supported on tombstones");
- }
- }
-}
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/generated/GEdgeResult.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/generated/GEdgeResult.java
deleted file mode 100644
index c54e40e..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/generated/GEdgeResult.java
+++ /dev/null
@@ -1,909 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora.generated;
-
-/**
- * Example class for defining a Giraph-Edge result.
- */
-@SuppressWarnings("all")
-public class GEdgeResult extends
- org.apache.gora.persistency.impl.PersistentBase implements
- org.apache.avro.specific.SpecificRecord,
- org.apache.gora.persistency.Persistent {
-
- /**
- * Schema used for the class.
- */
- public static final org.apache.avro.Schema SCHEMAS =
- new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\"," +
- "\"name\":\"GEdgeResult\"," +
- "\"namespace\":\"org.apache.giraph.io.gora.generated\"," +
- "\"fields\":[{\"name\":\"edgeId\",\"type\":\"string\"}," +
- "{\"name\":\"edgeWeight\",\"type\":\"float\"}," +
- "{\"name\":\"vertexInId\",\"type\":\"string\"}," +
- "{\"name\":\"vertexOutId\",\"type\":\"string\"}," +
- "{\"name\":\"label\",\"type\":\"string\"}]}");
-
- /** Enum containing all data bean's fields. */
- public static enum Field {
- /**
- * Edge id.
- */
- EDGE_ID(0, "edgeId"),
-
- /**
- * Edge weight.
- */
- EDGE_WEIGHT(1, "edgeWeight"),
-
- /**
- * Edge vertex source id.
- */
- VERTEX_IN_ID(2, "vertexInId"),
-
- /**
- * Edge vertex end id.
- */
- VERTEX_OUT_ID(3, "vertexOutId"),
-
- /**
- * Edge label.
- */
- LABEL(4, "label");
-
- /**
- * Field's index.
- */
- private int index;
-
- /**
- * Field's name.
- */
- private String name;
-
- /**
- * Field's constructor
- * @param index field's index.
- * @param name field's name.
- */
- Field(int index, String name) {
- this.index = index;
- this.name = name;
- }
-
- /**
- * Gets field's index.
- * @return int field's index.
- */
- public int getIndex() {
- return index;
- }
-
- /**
- * Gets field's name.
- * @return String field's name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Gets field's attributes to string.
- * @return String field's attributes to string.
- */
- public String toString() {
- return name;
- }
- };
-
- /**
- * Array containing all fields/
- */
- private static final String[] ALL_FIELDS = {
- "edgeId", "edgeWeight", "vertexInId", "vertexOutId", "label"};
-
- /**
- * Tombstone.
- */
- private static final Tombstone TOMBSTONE = new Tombstone();
-
- /**
- * edgeId.
- */
- private java.lang.CharSequence edgeId;
-
- /**
- * edgeWeight.
- */
- private float edgeWeight;
-
- /**
- * vertexInId.
- */
- private java.lang.CharSequence vertexInId;
-
- /**
- * vertexOutId.
- */
- private java.lang.CharSequence vertexOutId;
-
- /**
- * label.
- */
- private java.lang.CharSequence label;
-
- /**
- * Gets the total field count.
- * @return int field count
- */
- public int getFieldsCount() {
- return GEdgeResult.ALL_FIELDS.length;
- }
-
- /**
- * Gets the schema
- * @return Schema
- */
- public org.apache.avro.Schema getSchema() {
- return SCHEMAS;
- }
-
- /**
- * Gets field
- * @param field index field.
- * @return Object from an index.
- */
- public java.lang.Object get(int field) {
- switch (field) {
- case 0:
- return edgeId;
- case 1:
- return edgeWeight;
- case 2:
- return vertexInId;
- case 3:
- return vertexOutId;
- case 4:
- return label;
- default:
- throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
-
- /**
- * Puts a value into a field.
- * @param field index of field used.
- * @param value value of field used.
- */
- @SuppressWarnings(value = "unchecked")
- public void put(int field, java.lang.Object value) {
- switch (field) {
- case 0:
- edgeId = (java.lang.CharSequence) value;
- break;
- case 1:
- edgeWeight = (java.lang.Float) value;
- break;
- case 2:
- vertexInId = (java.lang.CharSequence) value;
- break;
- case 3:
- vertexOutId = (java.lang.CharSequence) value;
- break;
- case 4:
- label = (java.lang.CharSequence) value;
- break;
- default:
- throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
-
- /**
- * Gets the value of the 'edgeId' field.
- * @return CharSequence.
- */
- public java.lang.CharSequence getEdgeId() {
- return edgeId;
- }
-
- /**
- * Sets the value of the 'edgeId' field.
- * @param value the value to set.
- */
- public void setEdgeId(java.lang.CharSequence value) {
- this.edgeId = value;
- setDirty(0);
- }
-
- /**
- * Checks the dirty status of the 'edgeId' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isEdgeIdDirty(java.lang.CharSequence value) {
- return isDirty(0);
- }
-
- /**
- * Gets the value of the 'edgeWeight' field.
- * @return Float
- */
- public java.lang.Float getEdgeWeight() {
- return edgeWeight;
- }
-
- /**
- * Sets the value of the 'edgeWeight' field.
- * @param value the value to set.
- */
- public void setEdgeWeight(java.lang.Float value) {
- this.edgeWeight = value;
- setDirty(1);
- }
-
- /**
- * Checks the dirty status of the 'edgeWeight' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isEdgeWeightDirty(java.lang.Float value) {
- return isDirty(1);
- }
-
- /**
- * Gets the value of the 'vertexInId' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getVertexInId() {
- return vertexInId;
- }
-
- /**
- * Sets the value of the 'vertexInId' field.
- * @param value the value to set.
- */
- public void setVertexInId(java.lang.CharSequence value) {
- this.vertexInId = value;
- setDirty(2);
- }
-
- /**
- * Checks the dirty status of the 'vertexInId' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isVertexInIdDirty(java.lang.CharSequence value) {
- return isDirty(2);
- }
-
- /**
- * Gets the value of the 'vertexOutId' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getVertexOutId() {
- return vertexOutId;
- }
-
- /**
- * Sets the value of the 'vertexOutId' field.
- * @param value the value to set.
- */
- public void setVertexOutId(java.lang.CharSequence value) {
- this.vertexOutId = value;
- setDirty(3);
- }
-
- /**
- * Checks the dirty status of the 'vertexOutId' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isVertexOutIdDirty(java.lang.CharSequence value) {
- return isDirty(3);
- }
-
- /**
- * Gets the value of the 'label' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getLabel() {
- return label;
- }
-
- /**
- * Sets the value of the 'label' field.
- * @param value the value to set.
- */
- public void setLabel(java.lang.CharSequence value) {
- this.label = value;
- setDirty(4);
- }
-
- /**
- * Checks the dirty status of the 'label' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isLabelDirty(java.lang.CharSequence value) {
- return isDirty(4);
- }
-
- /**
- * Creates a new GEdgeResult RecordBuilder.
- * @return GEdge.Builder
- */
- public static org.apache.giraph.io.gora.generated.GEdgeResult.Builder
- newBuilder() {
- return new org.apache.giraph.io.gora.generated.GEdgeResult.Builder();
- }
-
- /**
- * Creates a new GEdgeResult RecordBuilder by copying an existing Builder.
- * @param other GEdgeResult.Builder
- * @return GEdge.Builder
- */
- public static org.apache.giraph.io.gora.generated.GEdgeResult.Builder
- newBuilder(org.apache.giraph.io.gora.generated.GEdgeResult.Builder other) {
- return new org.apache.giraph.io.gora.generated.GEdgeResult.Builder(other);
- }
-
- /**
- * Creates a new GEdgeResult RecordBuilder by copying an existing GEdgeResult
- * instance
- * @param other GEdgeResult
- * @return GEdge.Builder
- */
- public static org.apache.giraph.io.gora.generated.GEdgeResult.Builder
- newBuilder(org.apache.giraph.io.gora.generated.GEdgeResult other) {
- return new org.apache.giraph.io.gora.generated.GEdgeResult.Builder(other);
- }
-
- /**
- * Makes a deep copy from a bytebuffer.
- * @param input ByteBuffer
- * @return ByteBuffer
- */
- private static java.nio.ByteBuffer deepCopyToReadOnlyBuffer(
- java.nio.ByteBuffer input) {
- java.nio.ByteBuffer copy = java.nio.ByteBuffer.allocate(input.capacity());
- int position = input.position();
- input.reset();
- int mark = input.position();
- int limit = input.limit();
- input.rewind();
- input.limit(input.capacity());
- copy.put(input);
- input.rewind();
- copy.rewind();
- input.position(mark);
- input.mark();
- copy.position(mark);
- copy.mark();
- input.position(position);
- copy.position(position);
- input.limit(limit);
- copy.limit(limit);
- return copy.asReadOnlyBuffer();
- }
-
- /**
- * RecordBuilder for GEdgeResult instances.
- */
- public static class Builder extends
- org.apache.avro.specific.SpecificRecordBuilderBase<GEdgeResult> implements
- org.apache.avro.data.RecordBuilder<GEdgeResult> {
-
- /**
- * edgeId.
- */
- private java.lang.CharSequence edgeId;
-
- /**
- * edgeWeight.
- */
- private float edgeWeight;
-
- /**
- * vertexInId
- */
- private java.lang.CharSequence vertexInId;
-
- /**
- * vertexOutId.
- */
- private java.lang.CharSequence vertexOutId;
-
- /**
- * label.
- */
- private java.lang.CharSequence label;
-
- /** Creates a new Builder */
- private Builder() {
- super(org.apache.giraph.io.gora.generated.GEdgeResult.SCHEMAS);
- }
-
- /**
- * Creates a Builder by copying an existing Builder.
- * @param other GEdgeResult.Builder
- */
- private Builder(
- org.apache.giraph.io.gora.generated.GEdgeResult.Builder other) {
- super(other);
- }
-
- /**
- * Creates a Builder by copying an existing GEdgeResult instance.
- * @param other GEdgeResult
- */
- // CHECKSTYLE: stop Indentation
- private Builder(org.apache.giraph.io.gora.generated.GEdgeResult other) {
- super(org.apache.giraph.io.gora.generated.GEdgeResult.SCHEMAS);
- if (isValidValue(fields()[0], other.edgeId)) {
- this.edgeId = (java.lang.CharSequence) data().deepCopy(
- fields()[0].schema(), other.edgeId);
- fieldSetFlags()[0] = true;
- }
- if (isValidValue(fields()[1], other.edgeWeight)) {
- this.edgeWeight = (java.lang.Float) data().deepCopy(
- fields()[1].schema(), other.edgeWeight);
- fieldSetFlags()[1] = true;
- }
- if (isValidValue(fields()[2], other.vertexInId)) {
- this.vertexInId = (java.lang.CharSequence) data().deepCopy(
- fields()[2].schema(), other.vertexInId);
- fieldSetFlags()[2] = true;
- }
- if (isValidValue(fields()[3], other.vertexOutId)) {
- this.vertexOutId = (java.lang.CharSequence) data().deepCopy(
- fields()[3].schema(), other.vertexOutId);
- fieldSetFlags()[3] = true;
- }
- if (isValidValue(fields()[4], other.label)) {
- this.label = (java.lang.CharSequence) data().deepCopy(
- fields()[4].schema(), other.label);
- fieldSetFlags()[4] = true;
- }
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Gets the value of the 'edgeId' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getEdgeId() {
- return edgeId;
- }
-
- /**
- * Sets the value of the 'edgeId' field.
- * @param value CharSequence
- * @return GEdgeResult.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdgeResult.Builder setEdgeId(
- java.lang.CharSequence value) {
- validate(fields()[0], value);
- this.edgeId = value;
- fieldSetFlags()[0] = true;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Checks whether the 'edgeId' field has been set.
- * @return boolean
- */
- public boolean hasEdgeId() {
- return fieldSetFlags()[0];
- }
-
- /**
- * Clears the value of the 'edgeId' field.
- * @return GEdgeResult.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdgeResult.Builder
- clearEdgeId() {
- edgeId = null;
- fieldSetFlags()[0] = false;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Gets the value of the 'edgeWeight' field.
- * @return Float
- */
- public java.lang.Float getEdgeWeight() {
- return edgeWeight;
- }
-
- /**
- * Sets the value of the 'edgeWeight' field.
- * @param value float
- * @return GEdgeResult.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdgeResult.Builder
- setEdgeWeight(float value) {
- validate(fields()[1], value);
- this.edgeWeight = value;
- fieldSetFlags()[1] = true;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Checks whether the 'edgeWeight' field has been set.
- * @return boolean
- */
- public boolean hasEdgeWeight() {
- return fieldSetFlags()[1];
- }
-
- /**
- * Clears the value of the 'edgeWeight' field.
- * @return GEdgeResult.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdgeResult.Builder
- clearEdgeWeight() {
- fieldSetFlags()[1] = false;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Gets the value of the 'vertexInId' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getVertexInId() {
- return vertexInId;
- }
-
- /**
- * Sets the value of the 'vertexInId' field.
- * @param value CharSequence
- * @return GEdgeResult.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdgeResult.Builder
- setVertexInId(java.lang.CharSequence value) {
- validate(fields()[2], value);
- this.vertexInId = value;
- fieldSetFlags()[2] = true;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Checks whether the 'vertexInId' field has been set.
- * @return boolean.
- */
- public boolean hasVertexInId() {
- return fieldSetFlags()[2];
- }
-
- /**
- * Clears the value of the 'vertexInId' field.
- * @return GEdgeResult.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdgeResult.Builder
- clearVertexInId() {
- vertexInId = null;
- fieldSetFlags()[2] = false;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Gets the value of the 'vertexOutId' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getVertexOutId() {
- return vertexOutId;
- }
-
- /**
- * Sets the value of the 'vertexOutId' field.
- * @param value CharSequence
- * @return GEdgeResult.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdgeResult.Builder
- setVertexOutId(java.lang.CharSequence value) {
- validate(fields()[3], value);
- this.vertexOutId = value;
- fieldSetFlags()[3] = true;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Checks whether the 'vertexOutId' field has been set.
- * @return boolean
- */
- public boolean hasVertexOutId() {
- return fieldSetFlags()[3];
- }
-
- /**
- * Clears the value of the 'vertexOutId' field.
- * @return GEdgeResult.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdgeResult.Builder
- clearVertexOutId() {
- vertexOutId = null;
- fieldSetFlags()[3] = false;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Gets the value of the 'label' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getLabel() {
- return label;
- }
-
- /**
- * Sets the value of the 'label' field.
- * @param value CharSequence
- * @return GEdgeResult.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdgeResult.Builder setLabel(
- java.lang.CharSequence value) {
- validate(fields()[4], value);
- this.label = value;
- fieldSetFlags()[4] = true;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Checks whether the 'label' field has been set.
- * @return boolean
- */
- public boolean hasLabel() {
- return fieldSetFlags()[4];
- }
-
- /**
- * Clears the value of the 'label' field.
- * @return GEdgeResult.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GEdgeResult.Builder
- clearLabel() {
- label = null;
- fieldSetFlags()[4] = false;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- @Override
- /**
- * Builds a GEdgeResult.
- * @return GEdgeResult
- */
- // CHECKSTYLE: stop IllegalCatch
- public GEdgeResult build() {
- try {
- GEdgeResult record = new GEdgeResult();
- record.edgeId = fieldSetFlags()[0] ? this.edgeId :
- (java.lang.CharSequence) defaultValue(fields()[0]);
- record.edgeWeight = fieldSetFlags()[1] ? this.edgeWeight :
- (java.lang.Float) defaultValue(fields()[1]);
- record.vertexInId = fieldSetFlags()[2] ? this.vertexInId :
- (java.lang.CharSequence) defaultValue(fields()[2]);
- record.vertexOutId = fieldSetFlags()[3] ? this.vertexOutId :
- (java.lang.CharSequence) defaultValue(fields()[3]);
- record.label = fieldSetFlags()[4] ? this.label :
- (java.lang.CharSequence) defaultValue(fields()[4]);
- return record;
- } catch (Exception e) {
- throw new org.apache.avro.AvroRuntimeException(e);
- }
- }
- // CHECKSTYLE: resume IllegalCatch
- }
-
- /**
- * Gets tombstone
- * @return GEdgeResult.Tombstone
- */
- public GEdgeResult.Tombstone getTombstone() {
- return TOMBSTONE;
- }
-
- /**
- * Gets a new instance
- * @return GEdgeResult.
- */
- public GEdgeResult newInstance() {
- return newBuilder().build();
- }
-
- /**
- * Tombstone class.
- */
- public static final class Tombstone extends GEdgeResult implements
- org.apache.gora.persistency.Tombstone {
-
- /**
- * Default constructor.
- */
- private Tombstone() {
- }
-
- /**
- * Gets the value of the 'edgeId' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getEdgeId() {
- throw new java.lang.UnsupportedOperationException(
- "Get is not supported on tombstones");
- }
-
- /**
- * Sets the value of the 'edgeId' field.
- * @param value the value to set.
- */
- public void setEdgeId(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "Set is not supported on tombstones");
- }
-
- /**
- * Checks the dirty status of the 'edgeId' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isEdgeIdDirty(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "IsDirty is not supported on tombstones");
- }
-
- /**
- * Gets the value of the 'edgeWeight' field.
- * @return Float
- */
- public java.lang.Float getEdgeWeight() {
- throw new java.lang.UnsupportedOperationException(
- "Get is not supported on tombstones");
- }
-
- /**
- * Sets the value of the 'edgeWeight' field.
- * @param value the value to set.
- */
- public void setEdgeWeight(java.lang.Float value) {
- throw new java.lang.UnsupportedOperationException(
- "Set is not supported on tombstones");
- }
-
- /**
- * Checks the dirty status of the 'edgeWeight' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isEdgeWeightDirty(java.lang.Float value) {
- throw new java.lang.UnsupportedOperationException(
- "IsDirty is not supported on tombstones");
- }
-
- /**
- * Gets the value of the 'vertexInId' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getVertexInId() {
- throw new java.lang.UnsupportedOperationException(
- "Get is not supported on tombstones");
- }
-
- /**
- * Sets the value of the 'vertexInId' field.
- * @param value the value to set.
- */
- public void setVertexInId(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "Set is not supported on tombstones");
- }
-
- /**
- * Checks the dirty status of the 'vertexInId' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isVertexInIdDirty(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "IsDirty is not supported on tombstones");
- }
-
- /**
- * Gets the value of the 'vertexOutId' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getVertexOutId() {
- throw new java.lang.UnsupportedOperationException(
- "Get is not supported on tombstones");
- }
-
- /**
- * Sets the value of the 'vertexOutId' field.
- * @param value the value to set.
- */
- public void setVertexOutId(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "Set is not supported on tombstones");
- }
-
- /**
- * Checks the dirty status of the 'vertexOutId' field. A field is dirty if
- * it represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isVertexOutIdDirty(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "IsDirty is not supported on tombstones");
- }
-
- /**
- * Gets the value of the 'label' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getLabel() {
- throw new java.lang.UnsupportedOperationException(
- "Get is not supported on tombstones");
- }
-
- /**
- * Sets the value of the 'label' field.
- * @param value the value to set.
- */
- public void setLabel(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "Set is not supported on tombstones");
- }
-
- /**
- * Checks the dirty status of the 'label' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isLabelDirty(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "IsDirty is not supported on tombstones");
- }
- }
-}
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/generated/GVertex.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/generated/GVertex.java
deleted file mode 100644
index 81b7c9a..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/generated/GVertex.java
+++ /dev/null
@@ -1,665 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora.generated;
-
-/**
- * Example class for defining a Giraph-vertex.
- */
-@SuppressWarnings("all")
-public class GVertex extends org.apache.gora.persistency.impl.PersistentBase
- implements org.apache.avro.specific.SpecificRecord,
- org.apache.gora.persistency.Persistent {
-
- /**
- * Schema used for the class.
- */
- public static final org.apache.avro.Schema SCHEMAS =
- new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\"," +
- "\"name\":\"GVertex\"," +
- "\"namespace\":\"org.apache.giraph.io.gora.generated\"," +
- "\"fields\":[{\"name\":\"vertexId\",\"type\":\"string\"}," +
- "{\"name\":\"vertexValue\",\"type\":\"float\"}," +
- "{\"name\":\"edges\",\"type\":" +
- "{\"type\":\"map\",\"values\":\"string\"}}]}");
-
- /** Enum containing all data bean's fields. */
- public static enum Field {
- /**
- * Vertex id.
- */
- VERTEX_ID(0, "vertexId"),
-
- /**
- * Vertex value.
- */
- VERTEX_VALUE(1, "vertexValue"),
-
- /**
- * Vertex edges.
- */
- EDGES(2, "edges");
-
- /**
- * Field's index.
- */
- private int index;
-
- /**
- * Field's name.
- */
- private String name;
-
- /**
- * Field's constructor
- * @param index field's index.
- * @param name field's name.
- */
- Field(int index, String name) {
- this.index = index;
- this.name = name;
- }
-
- /**
- * Gets field's index.
- * @return int field's index.
- */
- public int getIndex() {
- return index;
- }
-
- /**
- * Gets field's name.
- * @return String field's name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Gets field's attributes to string.
- * @return String field's attributes to string.
- */
- public String toString() {
- return name;
- }
- };
-
- /**
- * Array containing all fields/
- */
- private static final String[] ALL_FIELDS = {
- "vertexId", "vertexValue", "edges", };
-
- /**
- * Tombstone.
- */
- private static final Tombstone TOMBSTONE = new Tombstone();
-
- /**
- * vertexId.
- */
- private java.lang.CharSequence vertexId;
-
- /**
- * vertexValue.
- */
- private float vertexValue;
-
- /**
- * edges.
- */
- private java.util.Map<java.lang.CharSequence, java.lang.CharSequence> edges;
-
- /**
- * Gets the total field count.
- * @return int field count
- */
- public int getFieldsCount() {
- return GVertex.ALL_FIELDS.length;
- }
-
- /**
- * Gets the schema
- * @return Schema
- */
- public org.apache.avro.Schema getSchema() {
- return SCHEMAS;
- }
-
- /**
- * Gets field
- * @param field index field.
- * @return Object from an index.
- */
- public java.lang.Object get(int field) {
- switch (field) {
- case 0:
- return vertexId;
- case 1:
- return vertexValue;
- case 2:
- return edges;
- default:
- throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
-
- /**
- * Puts a value into a field.
- * @param field index of field used.
- * @param value value of field used.
- */
- @SuppressWarnings(value = "unchecked")
- public void put(int field, java.lang.Object value) {
- switch (field) {
- case 0:
- vertexId = (java.lang.CharSequence) value;
- break;
- case 1:
- vertexValue = (java.lang.Float) value;
- break;
- case 2:
- edges = (java.util.Map<java.lang.CharSequence, java.lang.CharSequence>)
- ((value instanceof org.apache.gora.persistency.Dirtyable) ? value :
- new org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)
- value));
- break;
- default:
- throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
-
- /**
- * Gets the value of the 'vertexId' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getVertexId() {
- return vertexId;
- }
-
- /**
- * Sets the value of the 'vertexId' field.
- * @param value the value to set.
- */
- public void setVertexId(java.lang.CharSequence value) {
- this.vertexId = value;
- setDirty(0);
- }
-
- /**
- * Checks the dirty status of the 'vertexId' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isVertexIdDirty(java.lang.CharSequence value) {
- return isDirty(0);
- }
-
- /**
- * Gets the value of the 'vertexValue' field.
- * @return Float
- */
- public java.lang.Float getVertexValue() {
- return vertexValue;
- }
-
- /**
- * Sets the value of the 'vertexValue' field.
- * @param value the value to set.
- */
- public void setVertexValue(java.lang.Float value) {
- this.vertexValue = value;
- setDirty(1);
- }
-
- /**
- * Checks the dirty status of the 'vertexValue' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isVertexValueDirty(java.lang.Float value) {
- return isDirty(1);
- }
-
- /**
- * Gets the value of the 'edges' field.
- * @return java.util.Map
- */
- public java.util.Map<java.lang.CharSequence, java.lang.CharSequence>
- getEdges() {
- return edges;
- }
-
- /**
- * Sets the value of the 'edges' field.
- * @param value the value to set.
- */
- public void setEdges(
- java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) {
- this.edges =
- (value instanceof org.apache.gora.persistency.Dirtyable) ? value :
- new org.apache.gora.persistency.impl.DirtyMapWrapper(value);
- setDirty(2);
- }
-
- /**
- * Checks the dirty status of the 'edges' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isEdgesDirty(
- java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) {
- return isDirty(2);
- }
-
- /**
- * Creates a new GVertex RecordBuilder.
- * @return GVertex.Builder
- */
- public static org.apache.giraph.io.gora.generated.GVertex.Builder
- newBuilder() {
- return new org.apache.giraph.io.gora.generated.GVertex.Builder();
- }
-
- /**
- * Creates a new GVertex RecordBuilder by copying an existing Builder.
- * @param other GVertex.Builder
- * @return GVertex.Builder
- */
- public static org.apache.giraph.io.gora.generated.GVertex.Builder newBuilder(
- org.apache.giraph.io.gora.generated.GVertex.Builder other) {
- return new org.apache.giraph.io.gora.generated.GVertex.Builder(other);
- }
-
- /**
- * Creates a new GVertex RecordBuilder by copying
- * an existing GVertex instance
- * @param other GVertex
- * @return GVertex.Builder
- */
- public static org.apache.giraph.io.gora.generated.GVertex.Builder newBuilder(
- org.apache.giraph.io.gora.generated.GVertex other) {
- return new org.apache.giraph.io.gora.generated.GVertex.Builder(other);
- }
-
- /**
- * Makes a deep copy from a bytebuffer.
- * @param input ByteBuffer
- * @return ByteBuffer
- */
- private static java.nio.ByteBuffer deepCopyToReadOnlyBuffer(
- java.nio.ByteBuffer input) {
- java.nio.ByteBuffer copy = java.nio.ByteBuffer.allocate(input.capacity());
- int position = input.position();
- input.reset();
- int mark = input.position();
- int limit = input.limit();
- input.rewind();
- input.limit(input.capacity());
- copy.put(input);
- input.rewind();
- copy.rewind();
- input.position(mark);
- input.mark();
- copy.position(mark);
- copy.mark();
- input.position(position);
- copy.position(position);
- input.limit(limit);
- copy.limit(limit);
- return copy.asReadOnlyBuffer();
- }
-
- /**
- * RecordBuilder for GVertex instances.
- */
- public static class Builder extends
- org.apache.avro.specific.SpecificRecordBuilderBase<GVertex> implements
- org.apache.avro.data.RecordBuilder<GVertex> {
-
- /**
- * vertexId
- */
- private java.lang.CharSequence vertexId;
-
- /**
- * vertexValue
- */
- private float vertexValue;
-
- /**
- * edges
- */
- private java.util.Map<java.lang.CharSequence, java.lang.CharSequence> edges;
-
- /** Creates a new Builder */
- private Builder() {
- super(org.apache.giraph.io.gora.generated.GVertex.SCHEMAS);
- }
-
- /**
- * Creates a Builder by copying an existing Builder.
- * @param other GVertex
- */
- private Builder(org.apache.giraph.io.gora.generated.GVertex.Builder other) {
- super(other);
- }
-
- /**
- * Creates a Builder by copying an existing GVertex instance.
- * @param other GVertex
- */
- // CHECKSTYLE: stop Indentation
- private Builder(org.apache.giraph.io.gora.generated.GVertex other) {
- super(org.apache.giraph.io.gora.generated.GVertex.SCHEMAS);
- if (isValidValue(fields()[0], other.vertexId)) {
- this.vertexId = (java.lang.CharSequence) data().deepCopy(
- fields()[0].schema(), other.vertexId);
- fieldSetFlags()[0] = true;
- }
- if (isValidValue(fields()[1], other.vertexValue)) {
- this.vertexValue = (java.lang.Float) data().deepCopy(
- fields()[1].schema(), other.vertexValue);
- fieldSetFlags()[1] = true;
- }
- if (isValidValue(fields()[2], other.edges)) {
- this.edges =
- (java.util.Map<java.lang.CharSequence, java.lang.CharSequence>)
- data().deepCopy(fields()[2].schema(), other.edges);
- fieldSetFlags()[2] = true;
- }
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Gets the value of the 'vertexId' field.
- * @return CharSsequence
- */
- public java.lang.CharSequence getVertexId() {
- return vertexId;
- }
-
- /**
- * Sets the value of the 'vertexId' field.
- * @param value CharSequence
- * @return GVertex.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GVertex.Builder setVertexId(
- java.lang.CharSequence value) {
- validate(fields()[0], value);
- this.vertexId = value;
- fieldSetFlags()[0] = true;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Checks whether the 'vertexId' field has been set.
- * @return boolean
- */
- public boolean hasVertexId() {
- return fieldSetFlags()[0];
- }
-
- /**
- * Clears the value of the 'vertexId' field
- * @return GVertex.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GVertex.Builder clearVertexId() {
- vertexId = null;
- fieldSetFlags()[0] = false;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Gets the value of the 'vertexValue' field
- * @return Float
- */
- public java.lang.Float getVertexValue() {
- return vertexValue;
- }
-
- /**
- * Sets the value of the 'vertexValue' field.
- * @param value float
- * @return GVertex.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GVertex.Builder setVertexValue(
- float value) {
- validate(fields()[1], value);
- this.vertexValue = value;
- fieldSetFlags()[1] = true;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Checks whether the 'vertexValue' field has been set.
- * @return boolean
- */
- public boolean hasVertexValue() {
- return fieldSetFlags()[1];
- }
-
- /**
- * Clears the value of the 'vertexValue' field.
- * @return GVertex.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GVertex.Builder
- clearVertexValue() {
- fieldSetFlags()[1] = false;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Gets the value of the 'edges' field.
- * @return java.util.Map
- */
- public java.util.Map<java.lang.CharSequence, java.lang.CharSequence>
- getEdges() {
- return edges;
- }
-
- /**
- * Sets the value of the 'edges' field.
- * @param value java.util.Map
- * @return GVertex.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GVertex.Builder setEdges(
- java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) {
- validate(fields()[2], value);
- this.edges = value;
- fieldSetFlags()[2] = true;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Checks whether the 'edges' field has been set.
- * @return boolean
- */
- public boolean hasEdges() {
- return fieldSetFlags()[2];
- }
-
- /**
- * Clears the value of the 'edges' field.
- * @return org.apache.giraph.io.gora.generated.GVertex.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GVertex.Builder clearEdges() {
- edges = null;
- fieldSetFlags()[2] = false;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- @Override
- /**
- * Builds a GVertex.
- * @return GVertex
- */
- // CHECKSTYLE: stop IllegalCatch
- public GVertex build() {
- try {
- GVertex record = new GVertex();
- record.vertexId = fieldSetFlags()[0] ? this.vertexId :
- (java.lang.CharSequence) defaultValue(fields()[0]);
- record.vertexValue = fieldSetFlags()[1] ? this.vertexValue :
- (java.lang.Float) defaultValue(fields()[1]);
- record.edges = fieldSetFlags()[2] ? this.edges :
- (java.util.Map<java.lang.CharSequence, java.lang.CharSequence>)
- new org.apache.gora.persistency.impl.DirtyMapWrapper(
- (java.util.Map) defaultValue(fields()[2]));
- return record;
- } catch (Exception e) {
- throw new org.apache.avro.AvroRuntimeException(e);
- }
- }
- // CHECKSTYLE: resume IllegalCatch
- }
-
- /**
- * Gets tombstone
- * @return GVertex.Tombstone
- */
- public GVertex.Tombstone getTombstone() {
- return TOMBSTONE;
- }
-
- /**
- * Gets a new instance
- * @return GVertex.
- */
- public GVertex newInstance() {
- return newBuilder().build();
- }
-
- /**
- * Tombstone class.
- */
- public static final class Tombstone extends GVertex implements
- org.apache.gora.persistency.Tombstone {
-
- /**
- * Default constructor.
- */
- private Tombstone() {
- }
-
- /**
- * Gets the value of the 'vertexId' field.
- * @return java.lang.CharSequence
- */
- public java.lang.CharSequence getVertexId() {
- throw new java.lang.UnsupportedOperationException(
- "Get is not supported on tombstones");
- }
-
- /**
- * Sets the value of the 'vertexId' field.
- * @param value the value to set.
- */
- public void setVertexId(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "Set is not supported on tombstones");
- }
-
- /**
- * Checks the dirty status of the 'vertexId' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isVertexIdDirty(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "IsDirty is not supported on tombstones");
- }
-
- /**
- * Gets the value of the 'vertexValue' field.
- * @return Float
- */
- public java.lang.Float getVertexValue() {
- throw new java.lang.UnsupportedOperationException(
- "Get is not supported on tombstones");
- }
-
- /**
- * Sets the value of the 'vertexValue' field.
- * @param value the value to set.
- */
- public void setVertexValue(java.lang.Float value) {
- throw new java.lang.UnsupportedOperationException(
- "Set is not supported on tombstones");
- }
-
- /**
- * Checks the dirty status of the 'vertexValue' field. A field is dirty if
- * it represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isVertexValueDirty(java.lang.Float value) {
- throw new java.lang.UnsupportedOperationException(
- "IsDirty is not supported on tombstones");
- }
-
- /**
- * Gets the value of the 'edges' field.
- * @return java.util.Map
- */
- public java.util.Map<java.lang.CharSequence, java.lang.CharSequence>
- getEdges() {
- throw new java.lang.UnsupportedOperationException(
- "Get is not supported on tombstones");
- }
-
- /**
- * Sets the value of the 'edges' field.
- * @param value the value to set.
- */
- public void setEdges(
- java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) {
- throw new java.lang.UnsupportedOperationException(
- "Set is not supported on tombstones");
- }
-
- /**
- * Checks the dirty status of the 'edges' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isEdgesDirty(
- java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) {
- throw new java.lang.UnsupportedOperationException(
- "IsDirty is not supported on tombstones");
- }
- }
-}
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/generated/GVertexResult.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/generated/GVertexResult.java
deleted file mode 100644
index 394fb8b..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/generated/GVertexResult.java
+++ /dev/null
@@ -1,668 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora.generated;
-
-/**
- * Example class for defining a Giraph-vertex result.
- */
-@SuppressWarnings("all")
-public class GVertexResult extends
- org.apache.gora.persistency.impl.PersistentBase implements
- org.apache.avro.specific.SpecificRecord,
- org.apache.gora.persistency.Persistent {
-
- /**
- * Schema used for the class.
- */
- public static final org.apache.avro.Schema SCHEMAS =
- new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\"," +
- "\"name\":\"GVertexResult\"," +
- "\"namespace\":\"org.apache.giraph.io.gora.generated\"," +
- "\"fields\":[{\"name\":\"vertexId\",\"type\":\"string\"}," +
- "{\"name\":\"vertexValue\",\"type\":\"float\"}," +
- "{\"name\":\"edges\",\"type\":" +
- "{\"type\":\"map\",\"values\":\"string\"}}]}");
-
- /** Enum containing all data bean's fields. */
- public static enum Field {
- /**
- * Vertex id.
- */
- VERTEX_ID(0, "vertexId"),
-
- /**
- * Vertex value.
- */
- VERTEX_VALUE(1, "vertexValue"),
-
- /**
- * Vertex edges.
- */
- EDGES(2, "edges");
-
- /**
- * Field's index.
- */
- private int index;
-
- /**
- * Field's name.
- */
- private String name;
-
- /**
- * Field's constructor
- * @param index field's index.
- * @param name field's name.
- */
- Field(int index, String name) {
- this.index = index;
- this.name = name;
- }
-
- /**
- * Gets field's index.
- * @return int field's index.
- */
- public int getIndex() {
- return index;
- }
-
- /**
- * Gets field's name.
- * @return String field's name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Gets field's attributes to string.
- * @return String field's attributes to string.
- */
- public String toString() {
- return name;
- }
- };
-
- /**
- * Array containing all fields/
- */
- private static final String[] ALL_FIELDS = {
- "vertexId", "vertexValue", "edges", };
-
- /**
- * Tombstone.
- */
- private static final Tombstone TOMBSTONE = new Tombstone();
-
- /**
- * vertexId.
- */
- private java.lang.CharSequence vertexId;
-
- /**
- * vertexValue.
- */
- private float vertexValue;
-
- /**
- * edges.
- */
- private java.util.Map<java.lang.CharSequence, java.lang.CharSequence> edges;
-
- /**
- * Gets the total field count.
- * @return int field count
- */
- public int getFieldsCount() {
- return GVertexResult.ALL_FIELDS.length;
- }
-
- /**
- * Gets the schema
- * @return Schema
- */
- public org.apache.avro.Schema getSchema() {
- return SCHEMAS;
- }
-
- /**
- * Gets field
- * @param field index field.
- * @return Object from an index.
- */
- public java.lang.Object get(int field) {
- switch (field) {
- case 0:
- return vertexId;
- case 1:
- return vertexValue;
- case 2:
- return edges;
- default:
- throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
-
- /**
- * Puts a value into a field.
- * @param field index of field used.
- * @param value value of field used.
- */
- @SuppressWarnings(value = "unchecked")
- public void put(int field, java.lang.Object value) {
- switch (field) {
- case 0:
- vertexId = (java.lang.CharSequence) value;
- break;
- case 1:
- vertexValue = (java.lang.Float) value;
- break;
- case 2:
- edges = (java.util.Map<java.lang.CharSequence, java.lang.CharSequence>)
- ((value instanceof org.apache.gora.persistency.Dirtyable) ? value :
- new org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)
- value));
- break;
- default:
- throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
-
- /**
- * Gets the value of the 'vertexId' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getVertexId() {
- return vertexId;
- }
-
- /**
- * Sets the value of the 'vertexId' field.
- * @param value the value to set.
- */
- public void setVertexId(java.lang.CharSequence value) {
- this.vertexId = value;
- setDirty(0);
- }
-
- /**
- * Checks the dirty status of the 'vertexId' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isVertexIdDirty(java.lang.CharSequence value) {
- return isDirty(0);
- }
-
- /**
- * Gets the value of the 'vertexValue' field.
- * @return Float
- */
- public java.lang.Float getVertexValue() {
- return vertexValue;
- }
-
- /**
- * Sets the value of the 'vertexValue' field.
- * @param value the value to set.
- */
- public void setVertexValue(java.lang.Float value) {
- this.vertexValue = value;
- setDirty(1);
- }
-
- /**
- * Checks the dirty status of the 'vertexValue' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isVertexValueDirty(java.lang.Float value) {
- return isDirty(1);
- }
-
- /**
- * Gets the value of the 'edges' field.
- * @return Edges
- */
- public java.util.Map<java.lang.CharSequence, java.lang.CharSequence>
- getEdges() {
- return edges;
- }
-
- /**
- * Sets the value of the 'edges' field.
- * @param value the value to set.
- */
- public void setEdges(
- java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) {
- this.edges = (value instanceof org.apache.gora.persistency.Dirtyable) ?
- value : new org.apache.gora.persistency.impl.DirtyMapWrapper(value);
- setDirty(2);
- }
-
- /**
- * Checks the dirty status of the 'edges' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isEdgesDirty(
- java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) {
- return isDirty(2);
- }
-
- /**
- * Creates a new GVertexResult RecordBuilder
- * @return GVertexResult.Builder
- */
- public static org.apache.giraph.io.gora.generated.GVertexResult.Builder
- newBuilder() {
- return new org.apache.giraph.io.gora.generated.GVertexResult.Builder();
- }
-
- /**
- * Creates a new GVertexResult RecordBuilder by copying an existing Builder.
- * @param other GVertexResult.Builder
- * @return GVertexResult.Builder
- */
- public static org.apache.giraph.io.gora.generated.GVertexResult.Builder
- newBuilder(org.apache.giraph.io.gora.generated.GVertexResult.Builder other) {
- return new org.apache.giraph.io.gora.generated.GVertexResult.Builder(other);
- }
-
- /**
- * Creates a new GVertexResult RecordBuilder by copying an existing
- * GVertexResult instance
- * @param other GVertexResult
- * @return GVertexResult.Builder
- */
- public static org.apache.giraph.io.gora.generated.GVertexResult.Builder
- newBuilder(org.apache.giraph.io.gora.generated.GVertexResult other) {
- return new org.apache.giraph.io.gora.generated.GVertexResult.Builder(other);
- }
-
- /**
- * Makes a deep copy from a bytebuffer.
- * @param input ByteBuffer
- * @return ByteBuffer
- */
- private static java.nio.ByteBuffer deepCopyToReadOnlyBuffer(
- java.nio.ByteBuffer input) {
- java.nio.ByteBuffer copy = java.nio.ByteBuffer.allocate(input.capacity());
- int position = input.position();
- input.reset();
- int mark = input.position();
- int limit = input.limit();
- input.rewind();
- input.limit(input.capacity());
- copy.put(input);
- input.rewind();
- copy.rewind();
- input.position(mark);
- input.mark();
- copy.position(mark);
- copy.mark();
- input.position(position);
- copy.position(position);
- input.limit(limit);
- copy.limit(limit);
- return copy.asReadOnlyBuffer();
- }
-
- /**
- * RecordBuilder for GVertexResult instances.
- */
- public static class Builder extends
- org.apache.avro.specific.SpecificRecordBuilderBase<GVertexResult>
- implements org.apache.avro.data.RecordBuilder<GVertexResult> {
-
- /**
- * vertexId
- */
- private java.lang.CharSequence vertexId;
-
- /**
- * vertexValue
- */
- private float vertexValue;
-
- /**
- * edges
- */
- private java.util.Map<java.lang.CharSequence, java.lang.CharSequence> edges;
-
- /** Creates a new Builder */
- private Builder() {
- super(org.apache.giraph.io.gora.generated.GVertexResult.SCHEMAS);
- }
-
- /**
- * Creates a Builder by copying an existing Builder.
- * @param other GVertexResult.Builder
- */
- private Builder(
- org.apache.giraph.io.gora.generated.GVertexResult.Builder other) {
- super(other);
- }
-
- /**
- * Creates a Builder by copying an existing GVertexResult instance.
- * @param other GVertexResult
- */
- // CHECKSTYLE: stop Indentation
- private Builder(org.apache.giraph.io.gora.generated.GVertexResult other) {
- super(org.apache.giraph.io.gora.generated.GVertexResult.SCHEMAS);
- if (isValidValue(fields()[0], other.vertexId)) {
- this.vertexId = (java.lang.CharSequence) data().deepCopy(
- fields()[0].schema(), other.vertexId);
- fieldSetFlags()[0] = true;
- }
- if (isValidValue(fields()[1], other.vertexValue)) {
- this.vertexValue = (java.lang.Float) data().deepCopy(
- fields()[1].schema(), other.vertexValue);
- fieldSetFlags()[1] = true;
- }
- if (isValidValue(fields()[2], other.edges)) {
- this.edges =
- (java.util.Map<java.lang.CharSequence, java.lang.CharSequence>)
- data().deepCopy(fields()[2].schema(), other.edges);
- fieldSetFlags()[2] = true;
- }
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Gets the value of the 'vertexId' field.
- * @return CharSequence
- */
- public java.lang.CharSequence getVertexId() {
- return vertexId;
- }
-
- /**
- * Sets the value of the 'vertexId' field.
- * @param value CharSequence
- * @return GVertexResult.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GVertexResult.Builder
- setVertexId(java.lang.CharSequence value) {
- validate(fields()[0], value);
- this.vertexId = value;
- fieldSetFlags()[0] = true;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Checks whether the 'vertexId' field has been set.
- * @return boolean
- */
- public boolean hasVertexId() {
- return fieldSetFlags()[0];
- }
-
- /**
- * Clears the value of the 'vertexId' field
- * @return GVertexResult.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GVertexResult.Builder
- clearVertexId() {
- vertexId = null;
- fieldSetFlags()[0] = false;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Gets the value of the 'vertexValue' field.
- * @return Float
- */
- public java.lang.Float getVertexValue() {
- return vertexValue;
- }
-
- /**
- * Sets the value of the 'vertexValue' field.
- * @param value float
- * @return GVertexResult.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GVertexResult.Builder
- setVertexValue(float value) {
- validate(fields()[1], value);
- this.vertexValue = value;
- fieldSetFlags()[1] = true;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Checks whether the 'vertexValue' field has been set.
- * @return boolean
- */
- public boolean hasVertexValue() {
- return fieldSetFlags()[1];
- }
-
- /**
- * Clears the value of the 'vertexValue' field.
- * @return GVertexResult.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GVertexResult.Builder
- clearVertexValue() {
- fieldSetFlags()[1] = false;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Gets the value of the 'edges' field.
- * @return java.util.Map
- */
- public java.util.Map<java.lang.CharSequence, java.lang.CharSequence>
- getEdges() {
- return edges;
- }
-
- /**
- * Sets the value of the 'edges' field
- * @param value java.util.Map
- * @return GVertexResult.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GVertexResult.Builder setEdges(
- java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) {
- validate(fields()[2], value);
- this.edges = value;
- fieldSetFlags()[2] = true;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- /**
- * Checks whether the 'edges' field has been set.
- * @return boolean
- */
- public boolean hasEdges() {
- return fieldSetFlags()[2];
- }
-
- /**
- * Clears the value of the 'edges' field.
- * @return org.apache.giraph.io.gora.generated.GVertexResult.Builder
- */
- // CHECKSTYLE: stop Indentation
- public org.apache.giraph.io.gora.generated.GVertexResult.Builder
- clearEdges() {
- edges = null;
- fieldSetFlags()[2] = false;
- return this;
- }
- // CHECKSTYLE: resume Indentation
-
- @Override
- /**
- * Builds a GVertexResult.
- * @return GVertexResult
- */
- // CHECKSTYLE: stop IllegalCatch
- public GVertexResult build() {
- try {
- GVertexResult record = new GVertexResult();
- record.vertexId = fieldSetFlags()[0] ? this.vertexId :
- (java.lang.CharSequence) defaultValue(fields()[0]);
- record.vertexValue = fieldSetFlags()[1] ? this.vertexValue :
- (java.lang.Float) defaultValue(fields()[1]);
- record.edges = fieldSetFlags()[2] ? this.edges :
- (java.util.Map<java.lang.CharSequence, java.lang.CharSequence>)
- new org.apache.gora.persistency.impl.DirtyMapWrapper(
- (java.util.Map) defaultValue(fields()[2]));
- return record;
- } catch (Exception e) {
- throw new org.apache.avro.AvroRuntimeException(e);
- }
- }
- // CHECKSTYLE: resume IllegalCatch
- }
-
- /**
- * Gets tombstone
- * @return GVertex.Tombstone
- */
- public GVertexResult.Tombstone getTombstone() {
- return TOMBSTONE;
- }
-
- /**
- * Gets a new instance
- * @return GVertexResult.
- */
- public GVertexResult newInstance() {
- return newBuilder().build();
- }
-
- /**
- * Tombstone class.
- */
- public static final class Tombstone extends GVertexResult implements
- org.apache.gora.persistency.Tombstone {
-
- /**
- * Default constructor.
- */
- private Tombstone() {
- }
-
- /**
- * Gets the value of the 'vertexId' field.
- * @return java.lang.CharSequence
- */
- public java.lang.CharSequence getVertexId() {
- throw new java.lang.UnsupportedOperationException(
- "Get is not supported on tombstones");
- }
-
- /**
- * Sets the value of the 'vertexId' field.
- * @param value the value to set.
- */
- public void setVertexId(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "Set is not supported on tombstones");
- }
-
- /**
- * Checks the dirty status of the 'vertexId' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isVertexIdDirty(java.lang.CharSequence value) {
- throw new java.lang.UnsupportedOperationException(
- "IsDirty is not supported on tombstones");
- }
-
- /**
- * Gets the value of the 'vertexValue' field.
- * @return Float
- */
- public java.lang.Float getVertexValue() {
- throw new java.lang.UnsupportedOperationException(
- "Get is not supported on tombstones");
- }
-
- /**
- * Sets the value of the 'vertexValue' field.
- * @param value the value to set.
- */
- public void setVertexValue(java.lang.Float value) {
- throw new java.lang.UnsupportedOperationException(
- "Set is not supported on tombstones");
- }
-
- /**
- * Checks the dirty status of the 'vertexValue' field. A field is dirty if
- * it represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isVertexValueDirty(java.lang.Float value) {
- throw new java.lang.UnsupportedOperationException(
- "IsDirty is not supported on tombstones");
- }
-
- /**
- * Gets the value of the 'edges' field.
- * @return java.util.Map
- */
- public java.util.Map<java.lang.CharSequence, java.lang.CharSequence>
- getEdges() {
- throw new java.lang.UnsupportedOperationException(
- "Get is not supported on tombstones");
- }
-
- /**
- * Sets the value of the 'edges' field.
- * @param value the value to set.
- */
- public void setEdges(
- java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) {
- throw new java.lang.UnsupportedOperationException(
- "Set is not supported on tombstones");
- }
-
- /**
- * Checks the dirty status of the 'edges' field. A field is dirty if it
- * represents a change that has not yet been written to the database.
- * @param value the value to set.
- * @return boolean
- */
- public boolean isEdgesDirty(
- java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) {
- throw new java.lang.UnsupportedOperationException(
- "IsDirty is not supported on tombstones");
- }
- }
-}
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/generated/package-info.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/generated/package-info.java
deleted file mode 100644
index 6c218d1..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/generated/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.
- */
-/**
- * Gora Input/Output for Giraph
- */
-package org.apache.giraph.io.gora.generated;
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/package-info.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/package-info.java
deleted file mode 100644
index 3a9b488..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.
- */
-/**
- * Gora Input/Output for Giraph
- */
-package org.apache.giraph.io.gora;
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/utils/DefaultKeyFactory.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/utils/DefaultKeyFactory.java
deleted file mode 100644
index 8d814f5..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/utils/DefaultKeyFactory.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora.utils;
-
-/**
- * Example class for defining a way to construct Gora keys.
- * Uses strings as keys inside Gora.
- */
-public class DefaultKeyFactory extends KeyFactory {
-
- /**
- * Builds a key from a string parameter.
- * @param keyString the key object as a string.
- * @return the key object.
- */
- @Override
- public Object buildKey(String keyString) {
- Object key = null;
- if (getDataStore() == null) {
- throw new RuntimeException(
- "DataStore must be defined before using a key Builder.");
- } else {
- key = getDataStore().newKey();
- // Do specific transformation
- key = keyString;
- }
- return key;
- }
-
-}
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/utils/ExtraGoraInputFormat.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/utils/ExtraGoraInputFormat.java
deleted file mode 100644
index fed042d..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/utils/ExtraGoraInputFormat.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora.utils;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.gora.mapreduce.GoraInputSplit;
-import org.apache.gora.mapreduce.GoraMapReduceUtils;
-import org.apache.gora.mapreduce.GoraRecordReader;
-import org.apache.gora.persistency.Persistent;
-import org.apache.gora.persistency.impl.PersistentBase;
-import org.apache.gora.query.PartitionQuery;
-import org.apache.gora.query.Query;
-import org.apache.gora.query.impl.PartitionQueryImpl;
-import org.apache.gora.store.DataStore;
-import org.apache.gora.util.IOUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.mapreduce.InputFormat;
-import org.apache.hadoop.mapreduce.InputSplit;
-import org.apache.hadoop.mapreduce.Job;
-import org.apache.hadoop.mapreduce.JobContext;
-import org.apache.hadoop.mapreduce.RecordReader;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-
-/**
- * InputFormat to fetch the input from Gora data stores. The
- * query to fetch the items from the datastore should be prepared and
- * set via setQuery(Job, Query), before submitting the job.
- *
- * Hadoop jobs can be either configured through static
- *<code>setInput()</code> methods, or from GoraMapper.
- * @param <K> KeyClass.
- * @param <T> PersistentClass.
- */
-public class ExtraGoraInputFormat<K, T extends PersistentBase>
- extends InputFormat<K, T> {
-
- /**
- * String used to map partitioned queries into configuration object.
- */
- public static final String QUERY_KEY = "gora.inputformat.query";
-
- /**
- * Data store to be used.
- */
- private DataStore<K, T> dataStore;
-
- /**
- * Query to be performed.
- */
- private Query<K, T> query;
-
- /**
- * @param split InputSplit to be used.
- * @param context JobContext to be used.
- * @return RecordReader record reader used inside Hadoop job.
- */
- @Override
- @SuppressWarnings("unchecked")
- public RecordReader<K, T> createRecordReader(InputSplit split,
- TaskAttemptContext context) throws IOException, InterruptedException {
-
- PartitionQuery<K, T> partitionQuery = (PartitionQuery<K, T>)
- ((GoraInputSplit) split).getQuery();
-
- //setInputPath(partitionQuery, context);
- return new GoraRecordReader<K, T>(partitionQuery, context);
- }
-
- /**
- * Gets splits.
- * @param context for the job.
- * @return splits found
- */
- @Override
- public List<InputSplit> getSplits(JobContext context) throws IOException,
- InterruptedException {
- List<PartitionQuery<K, T>> queries =
- getDataStore().getPartitions(getQuery());
- List<InputSplit> splits = new ArrayList<InputSplit>(queries.size());
- for (PartitionQuery<K, T> partQuery : queries) {
- ((PartitionQueryImpl) partQuery).setConf(context.getConfiguration());
- splits.add(new GoraInputSplit(context.getConfiguration(), partQuery));
- }
- return splits;
- }
-
- /**
- * @return the dataStore
- */
- public DataStore<K, T> getDataStore() {
- return dataStore;
- }
-
- /**
- * @param datStore the dataStore to set
- */
- public void setDataStore(DataStore<K, T> datStore) {
- this.dataStore = datStore;
- }
-
- /**
- * @return the query
- */
- public Query<K, T> getQuery() {
- return query;
- }
-
- /**
- * @param query the query to set
- */
- public void setQuery(Query<K, T> query) {
- this.query = query;
- }
-
- /**
- * Sets the partitioned query inside the job object.
- * @param conf Configuration used.
- * @param query Query to be executed.
- * @param <K> Key class
- * @param <T> Persistent class
- * @throws IOException Exception that be might thrown.
- */
- public static <K, T extends Persistent> void setQuery(Configuration conf,
- Query<K, T> query) throws IOException {
- IOUtils.storeToConf(query, conf, QUERY_KEY);
- }
-
- /**
- * Gets the partitioned query from the conf object passed.
- * @param conf Configuration object.
- * @return passed inside the configuration object
- * @throws IOException Exception that might be thrown.
- */
- public Query<K, T> getQuery(Configuration conf) throws IOException {
- return IOUtils.loadFromConf(conf, QUERY_KEY);
- }
-
- /**
- * Sets the input parameters for the job
- * @param job the job to set the properties for
- * @param query the query to get the inputs from
- * @param dataStore the datastore as the input
- * @param reuseObjects whether to reuse objects in serialization
- * @param <K> Key class
- * @param <V> Persistent class
- * @throws IOException
- */
- public static <K, V extends Persistent> void setInput(Job job,
- Query<K, V> query, DataStore<K, V> dataStore, boolean reuseObjects)
- throws IOException {
-
- Configuration conf = job.getConfiguration();
-
- GoraMapReduceUtils.setIOSerializations(conf, reuseObjects);
-
- job.setInputFormatClass(ExtraGoraInputFormat.class);
- ExtraGoraInputFormat.setQuery(job.getConfiguration(), query);
- }
-}
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/utils/GoraUtils.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/utils/GoraUtils.java
deleted file mode 100644
index 932e2f3..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/utils/GoraUtils.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora.utils;
-
-import org.apache.gora.persistency.Persistent;
-import org.apache.gora.query.Query;
-import org.apache.gora.query.Result;
-import org.apache.gora.query.impl.QueryBase;
-import org.apache.gora.store.DataStore;
-import org.apache.gora.store.DataStoreFactory;
-import org.apache.gora.util.GoraException;
-import org.apache.hadoop.conf.Configuration;
-
-/**
- * Class used to handle the creation and querying of data stores through Gora.
- */
-public class GoraUtils {
-
- /**
- * Attribute handling the specific class to be created.
- */
- private static Class<? extends DataStore> DATASTORECLASS;
-
- /**
- * The default constructor is set to be private by default so that the
- * class is not instantiated.
- */
- private GoraUtils() { /* private constructor */ }
-
- /**
- * Creates a generic data store using the data store class.
- * set using the class property
- * @param conf Configuration
- * @param <K> key class
- * @param <T> value class
- * @param keyClass key class used
- * @param persistentClass persistent class used
- * @return created data store
- * @throws GoraException exception threw
- */
- @SuppressWarnings("unchecked")
- public static <K, T extends Persistent> DataStore<K, T>
- createDataStore(Configuration conf,
- Class<K> keyClass, Class<T> persistentClass)
- throws GoraException {
- DataStoreFactory.createProps();
- DataStore<K, T> dataStore =
- DataStoreFactory.createDataStore((Class<? extends DataStore<K, T>>)
- DATASTORECLASS,
- keyClass, persistentClass,
- conf);
-
- return dataStore;
- }
-
- /**
- * Creates a specific data store specified by.
- * @param conf Configuration
- * @param <K> key class
- * @param <T> value class
- * @param dataStoreClass Defines the type of data store used.
- * @param keyClass Handles the key class to be used.
- * @param persistentClass Handles the persistent class to be used.
- * @return DataStore created using parameters passed.
- * @throws GoraException if an error occurs.
- */
- public static <K, T extends Persistent> DataStore<K, T>
- createSpecificDataStore(Configuration conf,
- Class<? extends DataStore> dataStoreClass,
- Class<K> keyClass, Class<T> persistentClass) throws GoraException {
- DATASTORECLASS = dataStoreClass;
- return createDataStore(conf, keyClass, persistentClass);
- }
-
- /**
- * Performs a range query to Gora datastores
- * @param <K> key class
- * @param <T> value class
- * @param pDataStore data store being used.
- * @param pStartKey start key for the range query.
- * @param pEndKey end key for the range query.
- * @return Result containing all results for the query.
- */
- public static <K, T extends Persistent> Result<K, T>
- getRequest(DataStore<K, T> pDataStore, K pStartKey, K pEndKey) {
- QueryBase query = getQuery(pDataStore, pStartKey, pEndKey);
- return getRequest(pDataStore, query);
- }
-
- /**
- * Performs a query to Gora datastores
- * @param pDataStore data store being used.
- * @param query query executed over data stores.
- * @param <K> key class
- * @param <T> value class
- * @return Result containing all results for the query.
- */
- public static <K, T extends Persistent> Result<K, T>
- getRequest(DataStore<K, T> pDataStore, Query<K, T> query) {
- return pDataStore.execute(query);
- }
-
- /**
- * Performs a range query to Gora datastores
- * @param <K> key class
- * @param <T> value class
- * @param pDataStore data store being used.
- * @param pStartKey start key for the range query.
- * @return Result containing all results for the query.
- */
- public static <K, T extends Persistent> Result<K, T>
- getRequest(DataStore<K, T> pDataStore, K pStartKey) {
- return getRequest(pDataStore, pStartKey, null);
- }
-
- /**
- * Gets a query object to be used as a range query.
- * @param pDataStore data store used.
- * @param pStartKey range start key.
- * @param pEndKey range end key.
- * @param <K> key class
- * @param <T> value class
- * @return range query object.
- */
- public static <K, T extends Persistent> QueryBase
- getQuery(DataStore pDataStore, K pStartKey, K pEndKey) {
- QueryBase query = (QueryBase) pDataStore.newQuery();
- query.setStartKey(pStartKey);
- query.setEndKey(pEndKey);
- return query;
- }
-
- /**
- * Gets a query object to be used as a simple get.
- * @param pDataStore data store used.
- * @param pStartKey range start key.
- * @param <K> key class
- * @param <T> value class
- * @return query object.
- */
- public static <K, T extends Persistent> Query<K, T>
- getQuery(DataStore<K, T> pDataStore, K pStartKey) {
- Query<K, T> query = pDataStore.newQuery();
- query.setStartKey(pStartKey);
- query.setEndKey(null);
- return query;
- }
-
- /**
- * Gets a query object to be used as a simple get.
- * @param pDataStore data store used.
- * @param <K> key class
- * @param <T> value class
- * @return query object.
- */
- public static <K, T extends Persistent> Query<K, T>
- getQuery(DataStore<K, T> pDataStore) {
- Query<K, T> query = pDataStore.newQuery();
- query.setStartKey(null);
- query.setEndKey(null);
- return query;
- }
-}
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/utils/KeyFactory.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/utils/KeyFactory.java
deleted file mode 100644
index c8dd4a7..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/utils/KeyFactory.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora.utils;
-
-import org.apache.gora.store.DataStore;
-
-/**
- * Class used to convert strings into more complex keys.
- */
-public abstract class KeyFactory {
-
- /**
- * Data store used for creating a new key.
- */
- private DataStore dataStore;
-
- /**
- * Builds a key from a string parameter.
- * @param keyString the key object as a string.
- * @return the key object.
- */
- public abstract Object buildKey(String keyString);
-
- /**
- * Gets the data store used in this factory.
- * @return the dataStore
- */
- public DataStore getDataStore() {
- return dataStore;
- }
-
- /**
- * Sets the data store used in this factory.
- * @param dataStore the dataStore to set
- */
- public void setDataStore(DataStore dataStore) {
- this.dataStore = dataStore;
- }
-}
diff --git a/giraph-gora/src/main/java/org/apache/giraph/io/gora/utils/package-info.java b/giraph-gora/src/main/java/org/apache/giraph/io/gora/utils/package-info.java
deleted file mode 100644
index 02dd59f..0000000
--- a/giraph-gora/src/main/java/org/apache/giraph/io/gora/utils/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.
- */
-/**
- * Gora Utils for Giraph
- */
-package org.apache.giraph.io.gora.utils;
diff --git a/giraph-gora/src/test/java/org/apache/giraph/io/gora/GoraTestEdgeInputFormat.java b/giraph-gora/src/test/java/org/apache/giraph/io/gora/GoraTestEdgeInputFormat.java
deleted file mode 100644
index c339eb0..0000000
--- a/giraph-gora/src/test/java/org/apache/giraph/io/gora/GoraTestEdgeInputFormat.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora;
-
-import java.io.IOException;
-
-import org.apache.giraph.edge.Edge;
-import org.apache.giraph.edge.EdgeFactory;
-import org.apache.giraph.io.gora.generated.GEdge;
-import org.apache.hadoop.io.FloatWritable;
-import org.apache.hadoop.io.LongWritable;
-import org.apache.hadoop.mapreduce.InputSplit;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-
-/**
- * Implementation of a specific reader for a generated data bean.
- */
-public class GoraTestEdgeInputFormat
- extends GoraEdgeInputFormat<LongWritable, FloatWritable> {
-
- /**
- * Default constructor
- */
- public GoraTestEdgeInputFormat() {
- }
-
- /**
- * Creates specific vertex reader to be used inside Hadoop.
- * @param split split to be read.
- * @param context JobContext to be used.
- * @return GoraEdgeReader Edge reader to be used by Hadoop.
- */
- @Override
- public GoraEdgeReader createEdgeReader(
- InputSplit split, TaskAttemptContext context) throws IOException {
- putArtificialData();
- return new GoraGEdgeEdgeReader();
- }
-
- /**
- * Writes data into the data store in order to test it out.
- */
- @SuppressWarnings("unchecked")
- private static void putArtificialData() {
- getDataStore().put("11-22",
- createEdge("11-22", "11", "22", "11-22", (float)(11+22)));
- getDataStore().put("22-11",
- createEdge("22-11", "22", "11", "22-11", (float)(22+11)));
- getDataStore().put("11-33",
- createEdge("11-33", "11", "33", "11-33", (float)(11+33)));
- getDataStore().put("33-11",
- createEdge("33-11", "33", "11", "33-11", (float)(33+11)));
- getDataStore().flush();
- }
-
- /**
- * Creates an edge using an id and a set of edges.
- * @param id Vertex id.
- * @param vertexInId Vertex source Id.
- * @param vertexOutId Vertex destination Id.
- * @param edgeLabel Edge label.
- * @param edgeWeight Edge wight.
- * @return GEdge created.
- */
- private static GEdge createEdge(String id, String vertexInId,
- String vertexOutId, String edgeLabel, float edgeWeight) {
- GEdge newEdge = new GEdge();
- newEdge.setEdgeId(id);
- newEdge.setVertexInId(vertexInId);
- newEdge.setVertexOutId(vertexOutId);
- newEdge.setLabel(edgeLabel);
- newEdge.setEdgeWeight(edgeWeight);
- return newEdge;
- }
-
- /**
- * Gora edge reader
- */
- protected class GoraGEdgeEdgeReader extends GoraEdgeReader {
-
- /** source vertex of the edge */
- private LongWritable sourceId;
-
- /**
- * Transforms a GoraObject into an Edge object.
- * @param goraObject Object from Gora to be translated.
- * @return Edge Result from transforming the gora object.
- */
- @Override
- protected Edge<LongWritable, FloatWritable> transformEdge
- (Object goraObject) {
- Edge<LongWritable, FloatWritable> edge = null;
- GEdge goraEdge = (GEdge) goraObject;
- Long dest;
- Float value;
- dest = Long.valueOf(goraEdge.getVertexOutId().toString());
- this.sourceId = new LongWritable();
- this.sourceId.set(Long.valueOf(goraEdge.getVertexInId().toString()));
- value = (float) goraEdge.getEdgeWeight();
- edge = EdgeFactory.create(new LongWritable(dest),
- new FloatWritable(value));
- return edge;
- }
-
- /**
- * Gets the currentSourceId for the edge.
- * @return LongWritable currentSourceId for the edge.
- */
- @Override
- public LongWritable getCurrentSourceId() throws IOException,
- InterruptedException {
- return this.sourceId;
- }
- }
-}
diff --git a/giraph-gora/src/test/java/org/apache/giraph/io/gora/GoraTestEdgeOutputFormat.java b/giraph-gora/src/test/java/org/apache/giraph/io/gora/GoraTestEdgeOutputFormat.java
deleted file mode 100644
index f2e88c6..0000000
--- a/giraph-gora/src/test/java/org/apache/giraph/io/gora/GoraTestEdgeOutputFormat.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora;
-
-import java.io.IOException;
-
-import org.apache.avro.util.Utf8;
-import org.apache.giraph.edge.Edge;
-import org.apache.giraph.io.gora.generated.GEdge;
-import org.apache.giraph.io.gora.generated.GEdgeResult;
-import org.apache.gora.persistency.Persistent;
-import org.apache.hadoop.io.DoubleWritable;
-import org.apache.hadoop.io.FloatWritable;
-import org.apache.hadoop.io.LongWritable;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-import org.junit.Assert;
-
-/**
- * Implementation of a specific writer for a generated data bean.
- */
-public class GoraTestEdgeOutputFormat
- extends GoraEdgeOutputFormat<LongWritable, DoubleWritable,
- FloatWritable> {
-
- /**
- * Default constructor
- */
- public GoraTestEdgeOutputFormat() {
- }
-
- @Override
- public GoraEdgeWriter createEdgeWriter(
- TaskAttemptContext context) throws IOException, InterruptedException {
- return new GoraGEdgeEdgeWriter();
- }
-
- /**
- * Gora edge writer.
- */
- protected class GoraGEdgeEdgeWriter
- extends GoraEdgeWriter {
-
- @Override
- protected Persistent getGoraEdge(LongWritable srcId,
- DoubleWritable srcValue, Edge<LongWritable, FloatWritable> edge) {
- GEdgeResult tmpGEdge = new GEdgeResult();
- Utf8 keyLabel = new Utf8(srcId.toString() + "-" +
- edge.getTargetVertexId().toString());
- tmpGEdge.setEdgeId(keyLabel.toString());
- tmpGEdge.setEdgeWeight(edge.getValue().get());
- tmpGEdge.setVertexInId(srcId.toString());
- tmpGEdge.setVertexOutId(edge.getTargetVertexId().toString());
- tmpGEdge.setLabel(keyLabel.toString());
- getLogger().debug("GoraObject created: " + tmpGEdge.toString());
- return tmpGEdge;
- }
-
- @Override
- protected Object getGoraKey(LongWritable srcId,
- DoubleWritable srcValue, Edge<LongWritable, FloatWritable> edge) {
- String goraKey = String.valueOf(
- edge.getTargetVertexId().get() + edge.getValue().get());
- return goraKey;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void writeEdge(LongWritable srcId, DoubleWritable srcValue,
- Edge<LongWritable, FloatWritable> edge)
- throws IOException, InterruptedException {
- super.writeEdge(srcId, srcValue, edge);
- Object goraKey = getGoraKey(srcId, srcValue, edge);
- String keyLabel = String.valueOf(srcId) + "-" +
- String.valueOf(edge.getTargetVertexId());
- float weight = Float.valueOf(srcId.toString()) +
- Float.valueOf(edge.getTargetVertexId().toString());
- // Asserting
- Assert.assertEquals(createEdge(keyLabel, String.valueOf(srcId),
- String.valueOf(edge.getTargetVertexId()),keyLabel, weight),
- getDataStore().get(goraKey));
- }
-
- /**
- * Creates an edge using an id and a set of edges.
- * @param id Vertex id.
- * @param vertexInId Vertex source Id.
- * @param vertexOutId Vertex destination Id.
- * @param edgeLabel Edge label.
- * @param edgeWeight Edge wight.
- * @return GEdge created.
- */
- private GEdgeResult createEdge(String id, String vertexInId,
- String vertexOutId, String edgeLabel, float edgeWeight) {
- GEdgeResult newEdge = new GEdgeResult();
- newEdge.setEdgeId(id);
- newEdge.setVertexInId(vertexInId);
- newEdge.setVertexOutId(vertexOutId);
- newEdge.setLabel(edgeLabel);
- newEdge.setEdgeWeight(edgeWeight);
- return newEdge;
- }
- }
-}
diff --git a/giraph-gora/src/test/java/org/apache/giraph/io/gora/GoraTestVertexInputFormat.java b/giraph-gora/src/test/java/org/apache/giraph/io/gora/GoraTestVertexInputFormat.java
deleted file mode 100644
index d79a8fa..0000000
--- a/giraph-gora/src/test/java/org/apache/giraph/io/gora/GoraTestVertexInputFormat.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.giraph.edge.Edge;
-import org.apache.giraph.edge.EdgeFactory;
-import org.apache.giraph.graph.Vertex;
-import org.apache.giraph.io.gora.generated.GVertex;
-import org.apache.hadoop.io.DoubleWritable;
-import org.apache.hadoop.io.FloatWritable;
-import org.apache.hadoop.io.LongWritable;
-import org.apache.hadoop.mapreduce.InputSplit;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-
-/**
- * Implementation of a specific reader for a generated data bean.
- */
-public class GoraTestVertexInputFormat
- extends GoraVertexInputFormat<LongWritable, DoubleWritable,
- FloatWritable> {
-
- /**
- * DEfault constructor
- */
- public GoraTestVertexInputFormat() {
- }
-
- /**
- * Creates specific vertex reader to be used inside Hadoop.
- * @param split split to be read.
- * @param context JobContext to be used.
- * @return GoraVertexReader Vertex reader to be used by Hadoop.
- */
- @Override
- public GoraVertexReader createVertexReader(
- InputSplit split, TaskAttemptContext context) throws IOException {
- putArtificialData();
- return new GoraGVertexVertexReader();
- }
-
- /**
- * Writes data into the data store in order to test it out.
- */
- @SuppressWarnings("unchecked")
- private static void putArtificialData() {
- getDataStore().put("1", createVertex("1", null));
- getDataStore().put("10", createVertex("10", null));
- getDataStore().put("100", createVertex("100", null));
- getDataStore().flush();
- }
-
- /**
- * Creates a vertex using an id and a set of edges.
- * @param id Vertex id.
- * @param edges Set of edges.
- * @return GVertex created.
- */
- public static GVertex createVertex(String id, Map<String, String> edges) {
- GVertex newVrtx = new GVertex();
- newVrtx.setVertexId(id);
- if (edges != null) {
- for (String edgeId : edges.keySet())
- newVrtx.getEdges().put(edgeId, edges.get(edgeId));
- }
- return newVrtx;
- }
-
- /**
- * Gora vertex reader
- */
- protected class GoraGVertexVertexReader extends GoraVertexReader {
-
- /**
- * Transforms a GoraObject into a Vertex object.
- * @param goraObject Object from Gora to be translated.
- * @return Vertex Result from transforming the gora object.
- */
- @Override
- protected Vertex<LongWritable, DoubleWritable, FloatWritable>
- transformVertex(Object goraObject) {
- Vertex<LongWritable, DoubleWritable, FloatWritable> vertex;
- /* create the actual vertex */
- vertex = getConf().createVertex();
- GVertex tmpGVertex = (GVertex) goraObject;
-
- LongWritable vrtxId = new LongWritable(
- Long.parseLong(tmpGVertex.getVertexId().toString()));
- DoubleWritable vrtxValue = new DoubleWritable(tmpGVertex.getVertexValue());
- vertex.initialize(vrtxId, vrtxValue);
- if (tmpGVertex.getEdges() != null && !tmpGVertex.getEdges().isEmpty()) {
- Set<CharSequence> keyIt = tmpGVertex.getEdges().keySet();
- for (CharSequence key : keyIt) {
- String keyVal = key.toString();
- String valVal = tmpGVertex.getEdges().get(key).toString();
- Edge<LongWritable, FloatWritable> edge;
- if (!keyVal.contains("vertexId")) {
- edge = EdgeFactory.create(
- new LongWritable(Long.parseLong(keyVal)),
- new FloatWritable(Float.parseFloat(valVal)));
- vertex.addEdge(edge);
- }
- }
- }
- return vertex;
- }
- }
-}
diff --git a/giraph-gora/src/test/java/org/apache/giraph/io/gora/GoraTestVertexOutputFormat.java b/giraph-gora/src/test/java/org/apache/giraph/io/gora/GoraTestVertexOutputFormat.java
deleted file mode 100644
index 1cb1f14..0000000
--- a/giraph-gora/src/test/java/org/apache/giraph/io/gora/GoraTestVertexOutputFormat.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.giraph.edge.Edge;
-import org.apache.giraph.graph.Vertex;
-import org.apache.giraph.io.VertexWriter;
-import org.apache.giraph.io.gora.generated.GVertex;
-import org.apache.giraph.io.gora.generated.GVertexResult;
-import org.apache.gora.persistency.Persistent;
-import org.apache.hadoop.io.DoubleWritable;
-import org.apache.hadoop.io.FloatWritable;
-import org.apache.hadoop.io.LongWritable;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-import org.junit.Assert;
-
-/**
- * Implementation of a specific reader for a generated data bean.
- */
-public class GoraTestVertexOutputFormat
- extends GoraVertexOutputFormat<LongWritable, DoubleWritable,
- FloatWritable> {
-
- /**
- * DEfault constructor
- */
- public GoraTestVertexOutputFormat() {
- }
-
- @Override
- public VertexWriter<LongWritable, DoubleWritable, FloatWritable>
- createVertexWriter(TaskAttemptContext context)
- throws IOException, InterruptedException {
- return new GoraGVertexVertexWriter();
- }
-
- /**
- * Gora vertex writer.
- */
- protected class GoraGVertexVertexWriter extends GoraVertexWriter {
-
- @Override
- protected Persistent getGoraVertex(
- Vertex<LongWritable, DoubleWritable, FloatWritable> vertex) {
- GVertexResult tmpGVertex = new GVertexResult();
- tmpGVertex.setVertexId(vertex.getId().toString());
- tmpGVertex.setVertexValue(Float.parseFloat(vertex.getValue().toString()));
- Iterator<Edge<LongWritable, FloatWritable>> it =
- vertex.getEdges().iterator();
- while (it.hasNext()) {
- Edge<LongWritable, FloatWritable> edge = it.next();
- tmpGVertex.getEdges().put(
- edge.getTargetVertexId().toString(),
- edge.getValue().toString());
- }
- getLogger().debug("GoraObject created: " + tmpGVertex.toString());
- return tmpGVertex;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void writeVertex(
- Vertex<LongWritable, DoubleWritable, FloatWritable> vertex)
- throws IOException, InterruptedException {
- super.writeVertex(vertex);
- // Asserting
- Assert.assertEquals(createVertex(vertex.getId().toString(), null),
- getDataStore().get(vertex.getId().toString()));
- }
-
- /**
- * Creates a vertex using an id and a set of edges.
- * @param id Vertex id.
- * @param edges Set of edges.
- * @return GVertex created.
- */
- public GVertexResult createVertex(String id, Map<String, String> edges) {
- GVertexResult newVrtx = new GVertexResult();
- newVrtx.setVertexId(id);
- if (edges != null) {
- for (String edgeId : edges.keySet())
- newVrtx.getEdges().put(edgeId, edges.get(edgeId));
- }
- return newVrtx;
- }
-
- @Override
- protected Object getGoraKey(
- Vertex<LongWritable, DoubleWritable, FloatWritable> vertex) {
- String goraKey = String.valueOf(vertex.getId());
- return goraKey;
- }
- }
-}
diff --git a/giraph-gora/src/test/java/org/apache/giraph/io/gora/TestGoraEdgeInputFormat.java b/giraph-gora/src/test/java/org/apache/giraph/io/gora/TestGoraEdgeInputFormat.java
deleted file mode 100644
index cf2df34..0000000
--- a/giraph-gora/src/test/java/org/apache/giraph/io/gora/TestGoraEdgeInputFormat.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora;
-
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_DATASTORE_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_END_KEY;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_KEYS_FACTORY_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_KEY_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_PERSISTENT_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_START_KEY;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.apache.giraph.conf.GiraphConfiguration;
-import org.apache.giraph.graph.BasicComputation;
-import org.apache.giraph.graph.Vertex;
-import org.apache.giraph.io.formats.IdWithValueTextOutputFormat;
-import org.apache.giraph.utils.InternalVertexRunner;
-import org.apache.hadoop.io.DoubleWritable;
-import org.apache.hadoop.io.FloatWritable;
-import org.apache.hadoop.io.LongWritable;
-import org.junit.Test;
-import org.junit.Assert;
-
-/**
- * Test class for Gora vertex input/output formats.
- */
-public class TestGoraEdgeInputFormat {
-
- @Test
- public void getEmptyDb() throws Exception {
- Iterable<String> results;
- Iterator<String> result;
- GiraphConfiguration conf = new GiraphConfiguration();
- GIRAPH_GORA_DATASTORE_CLASS.
- set(conf, "org.apache.gora.memory.store.MemStore");
- GIRAPH_GORA_KEYS_FACTORY_CLASS.
- set(conf,"org.apache.giraph.io.gora.utils.DefaultKeyFactory");
- GIRAPH_GORA_KEY_CLASS.set(conf,"java.lang.String");
- GIRAPH_GORA_PERSISTENT_CLASS.
- set(conf,"org.apache.giraph.io.gora.generated.GEdge");
- GIRAPH_GORA_START_KEY.set(conf,"1");
- GIRAPH_GORA_END_KEY.set(conf,"3");
- conf.set("io.serializations",
- "org.apache.hadoop.io.serializer.JavaSerialization," +
- "org.apache.hadoop.io.serializer.WritableSerialization");
- conf.setComputationClass(EmptyComputation.class);
- conf.setEdgeInputFormatClass(GoraGEdgeEdgeInputFormat.class);
- results = InternalVertexRunner.run(conf, new String[0], new String[0]);
- Assert.assertNotNull(results);
- result = results.iterator();
- Assert.assertFalse(result.hasNext());
- }
-
- @Test
- public void getTestDb() throws Exception {
- Iterable<String> results;
- GiraphConfiguration conf = new GiraphConfiguration();
- GIRAPH_GORA_DATASTORE_CLASS.
- set(conf, "org.apache.gora.memory.store.MemStore");
- GIRAPH_GORA_KEYS_FACTORY_CLASS.
- set(conf,"org.apache.giraph.io.gora.utils.DefaultKeyFactory");
- GIRAPH_GORA_KEY_CLASS.set(conf,"java.lang.String");
- GIRAPH_GORA_PERSISTENT_CLASS.
- set(conf,"org.apache.giraph.io.gora.generated.GEdge");
- GIRAPH_GORA_START_KEY.set(conf,"1");
- GIRAPH_GORA_END_KEY.set(conf,"4");
- conf.set("io.serializations",
- "org.apache.hadoop.io.serializer.WritableSerialization," +
- "org.apache.hadoop.io.serializer.JavaSerialization");
- conf.setComputationClass(EmptyComputation.class);
- conf.setEdgeInputFormatClass(GoraTestEdgeInputFormat.class);
- conf.setVertexOutputFormatClass(IdWithValueTextOutputFormat.class);
- results = InternalVertexRunner.run(conf, new String[0], new String[0]);
- Assert.assertNotNull(results);
- Assert.assertEquals(3, ((ArrayList<?>)results).size());
- if (results instanceof Collection<?>
- & (((Collection<?>)results).size() == 2)) {
- Assert.assertEquals("33\t0.0",
- ((ArrayList<?>)results).get(0).toString());
- Assert.assertEquals("22\t0.0",
- ((ArrayList<?>)results).get(1).toString());
- Assert.assertEquals("11\t0.0",
- ((ArrayList<?>)results).get(2).toString());
- }
- }
-
- /*
- Test compute method that sends each edge a notification of its parents.
- The test set only has a 1-1 parent-to-child ratio for this unit test.
- */
- public static class EmptyComputation
- extends BasicComputation<LongWritable, DoubleWritable,
- FloatWritable, LongWritable> {
-
- @Override
- public void compute(
- Vertex<LongWritable, DoubleWritable, FloatWritable> vertex,
- Iterable<LongWritable> messages) throws IOException {
- Assert.assertNotNull(vertex);
- vertex.voteToHalt();
- }
- }
-}
diff --git a/giraph-gora/src/test/java/org/apache/giraph/io/gora/TestGoraEdgeOutputFormat.java b/giraph-gora/src/test/java/org/apache/giraph/io/gora/TestGoraEdgeOutputFormat.java
deleted file mode 100644
index 7de6d01..0000000
--- a/giraph-gora/src/test/java/org/apache/giraph/io/gora/TestGoraEdgeOutputFormat.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora;
-
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_DATASTORE_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_END_KEY;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_KEYS_FACTORY_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_KEY_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_PERSISTENT_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_START_KEY;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_OUTPUT_DATASTORE_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_OUTPUT_KEY_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_OUTPUT_PERSISTENT_CLASS;
-
-import java.io.IOException;
-
-import org.apache.giraph.conf.GiraphConfiguration;
-import org.apache.giraph.graph.BasicComputation;
-import org.apache.giraph.graph.Vertex;
-import org.apache.giraph.utils.InternalVertexRunner;
-import org.apache.hadoop.io.DoubleWritable;
-import org.apache.hadoop.io.FloatWritable;
-import org.apache.hadoop.io.LongWritable;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Test class for Gora edge output formats.
- */
-public class TestGoraEdgeOutputFormat {
-
- @Test
- public void getWritingDb() throws Exception {
- Iterable<String> results;
- GiraphConfiguration conf = new GiraphConfiguration();
- // Parameters for input
- GIRAPH_GORA_DATASTORE_CLASS.
- set(conf, "org.apache.gora.memory.store.MemStore");
- GIRAPH_GORA_KEYS_FACTORY_CLASS.
- set(conf,"org.apache.giraph.io.gora.utils.DefaultKeyFactory");
- GIRAPH_GORA_KEY_CLASS.set(conf,"java.lang.String");
- GIRAPH_GORA_PERSISTENT_CLASS.
- set(conf,"org.apache.giraph.io.gora.generated.GEdge");
- GIRAPH_GORA_START_KEY.set(conf,"1");
- GIRAPH_GORA_END_KEY.set(conf,"4");
- conf.set("io.serializations",
- "org.apache.hadoop.io.serializer.WritableSerialization," +
- "org.apache.hadoop.io.serializer.JavaSerialization");
- conf.setComputationClass(EmptyComputation.class);
- conf.setEdgeInputFormatClass(GoraTestEdgeInputFormat.class);
- // Parameters for output
- GIRAPH_GORA_OUTPUT_DATASTORE_CLASS.
- set(conf, "org.apache.gora.memory.store.MemStore");
- GIRAPH_GORA_OUTPUT_KEY_CLASS.set(conf, "java.lang.String");
- GIRAPH_GORA_OUTPUT_PERSISTENT_CLASS.
- set(conf,"org.apache.giraph.io.gora.generated.GEdgeResult");
- conf.setEdgeOutputFormatClass(GoraTestEdgeOutputFormat.class);
- results = InternalVertexRunner.run(conf, new String[0], new String[0]);
- Assert.assertNotNull(results);
- }
-
- /*
- Test compute method that sends each edge a notification of its parents.
- The test set only has a 1-1 parent-to-child ratio for this unit test.
- */
- public static class EmptyComputation
- extends BasicComputation<LongWritable, DoubleWritable,
- FloatWritable, LongWritable> {
-
- @Override
- public void compute(
- Vertex<LongWritable, DoubleWritable, FloatWritable> vertex,
- Iterable<LongWritable> messages) throws IOException {
- Assert.assertNotNull(vertex);
- vertex.voteToHalt();
- }
- }
-}
diff --git a/giraph-gora/src/test/java/org/apache/giraph/io/gora/TestGoraVertexInputFormat.java b/giraph-gora/src/test/java/org/apache/giraph/io/gora/TestGoraVertexInputFormat.java
deleted file mode 100644
index 25440e1..0000000
--- a/giraph-gora/src/test/java/org/apache/giraph/io/gora/TestGoraVertexInputFormat.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora;
-
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_DATASTORE_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_END_KEY;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_KEYS_FACTORY_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_KEY_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_PERSISTENT_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_START_KEY;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-
-import org.apache.giraph.conf.GiraphConfiguration;
-import org.apache.giraph.graph.BasicComputation;
-import org.apache.giraph.graph.Vertex;
-import org.apache.giraph.io.formats.IdWithValueTextOutputFormat;
-import org.apache.giraph.utils.InternalVertexRunner;
-import org.apache.hadoop.io.DoubleWritable;
-import org.apache.hadoop.io.FloatWritable;
-import org.apache.hadoop.io.LongWritable;
-import org.junit.Test;
-import org.junit.Assert;
-
-/**
- * Test class for Gora vertex input/output formats.
- */
-public class TestGoraVertexInputFormat {
-
- @Test
- public void getEmptyDb() throws Exception {
- Iterable<String> results;
- Iterator<String> result;
- GiraphConfiguration conf = new GiraphConfiguration();
- GIRAPH_GORA_DATASTORE_CLASS.
- set(conf, "org.apache.gora.memory.store.MemStore");
- GIRAPH_GORA_KEYS_FACTORY_CLASS.
- set(conf,"org.apache.giraph.io.gora.utils.DefaultKeyFactory");
- GIRAPH_GORA_KEY_CLASS.set(conf,"java.lang.String");
- GIRAPH_GORA_PERSISTENT_CLASS.
- set(conf,"org.apache.giraph.io.gora.generated.GVertex");
- GIRAPH_GORA_START_KEY.set(conf,"1");
- GIRAPH_GORA_END_KEY.set(conf,"10");
- conf.set("io.serializations",
- "org.apache.hadoop.io.serializer.WritableSerialization," +
- "org.apache.hadoop.io.serializer.JavaSerialization");
- conf.setComputationClass(EmptyComputation.class);
- conf.setVertexInputFormatClass(GoraTestVertexInputFormat.class);
- results = InternalVertexRunner.run(conf, new String[0], new String[0]);
- Assert.assertNotNull(results);
- result = results.iterator();
- Assert.assertFalse(result.hasNext());
- }
-
- @Test
- public void getTestDb() throws Exception {
- Iterable<String> results;
- GiraphConfiguration conf = new GiraphConfiguration();
- GIRAPH_GORA_DATASTORE_CLASS.
- set(conf, "org.apache.gora.memory.store.MemStore");
- GIRAPH_GORA_KEYS_FACTORY_CLASS.
- set(conf,"org.apache.giraph.io.gora.utils.DefaultKeyFactory");
- GIRAPH_GORA_KEY_CLASS.set(conf,"java.lang.String");
- GIRAPH_GORA_PERSISTENT_CLASS.
- set(conf,"org.apache.giraph.io.gora.generated.GVertex");
- GIRAPH_GORA_START_KEY.set(conf,"1");
- GIRAPH_GORA_END_KEY.set(conf,"100");
- conf.set("io.serializations",
- "org.apache.hadoop.io.serializer.WritableSerialization," +
- "org.apache.hadoop.io.serializer.JavaSerialization");
- conf.setComputationClass(EmptyComputation.class);
- conf.setVertexInputFormatClass(GoraTestVertexInputFormat.class);
- conf.setVertexOutputFormatClass(IdWithValueTextOutputFormat.class);
- results = InternalVertexRunner.run(conf, new String[0], new String[0]);
- Assert.assertNotNull(results);
- Assert.assertEquals(3, ((ArrayList<?>)results).size());
- Collections.sort((ArrayList)results);
- String[] correct = new String[] {"1\t0.0", "10\t0.0", "100\t0.0"};
- Arrays.sort(correct);
- for (int i = 0; i < correct.length; i++) {
- Assert.assertEquals(correct[i],
- ((ArrayList<?>) results).get(i).toString());
- }
- }
-
- /*
- Test compute method that sends each edge a notification of its parents.
- The test set only has a 1-1 parent-to-child ratio for this unit test.
- */
- public static class EmptyComputation
- extends BasicComputation<LongWritable, DoubleWritable,
- FloatWritable, LongWritable> {
-
- @Override
- public void compute(
- Vertex<LongWritable, DoubleWritable, FloatWritable> vertex,
- Iterable<LongWritable> messages) throws IOException {
- vertex.voteToHalt();
- }
- }
-}
diff --git a/giraph-gora/src/test/java/org/apache/giraph/io/gora/TestGoraVertexOutputFormat.java b/giraph-gora/src/test/java/org/apache/giraph/io/gora/TestGoraVertexOutputFormat.java
deleted file mode 100644
index 2c2cb5e..0000000
--- a/giraph-gora/src/test/java/org/apache/giraph/io/gora/TestGoraVertexOutputFormat.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.
- */
-package org.apache.giraph.io.gora;
-
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_DATASTORE_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_END_KEY;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_KEYS_FACTORY_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_KEY_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_PERSISTENT_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_START_KEY;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_OUTPUT_DATASTORE_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_OUTPUT_KEY_CLASS;
-import static org.apache.giraph.io.gora.constants.GiraphGoraConstants.GIRAPH_GORA_OUTPUT_PERSISTENT_CLASS;
-
-import org.apache.giraph.conf.GiraphConfiguration;
-import org.apache.giraph.io.gora.TestGoraVertexInputFormat.EmptyComputation;
-import org.apache.giraph.utils.InternalVertexRunner;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Test class for Gora vertex output formats.
- */
-public class TestGoraVertexOutputFormat {
-
- @Test
- public void getWritingDb() throws Exception {
- Iterable<String> results;
- GiraphConfiguration conf = new GiraphConfiguration();
- GIRAPH_GORA_DATASTORE_CLASS.
- set(conf, "org.apache.gora.memory.store.MemStore");
- GIRAPH_GORA_KEYS_FACTORY_CLASS.
- set(conf,"org.apache.giraph.io.gora.utils.DefaultKeyFactory");
- GIRAPH_GORA_KEY_CLASS.set(conf,"java.lang.String");
- GIRAPH_GORA_PERSISTENT_CLASS.
- set(conf,"org.apache.giraph.io.gora.generated.GVertex");
- GIRAPH_GORA_START_KEY.set(conf,"1");
- GIRAPH_GORA_END_KEY.set(conf,"10");
- GIRAPH_GORA_OUTPUT_DATASTORE_CLASS.
- set(conf, "org.apache.gora.memory.store.MemStore");
- GIRAPH_GORA_OUTPUT_KEY_CLASS.set(conf, "java.lang.String");
- GIRAPH_GORA_OUTPUT_PERSISTENT_CLASS.
- set(conf, "org.apache.giraph.io.gora.generated.GVertex");
- conf.set("io.serializations",
- "org.apache.hadoop.io.serializer.WritableSerialization," +
- "org.apache.hadoop.io.serializer.JavaSerialization");
- conf.setComputationClass(EmptyComputation.class);
- conf.setVertexInputFormatClass(GoraTestVertexInputFormat.class);
- // Parameters for output
- GIRAPH_GORA_OUTPUT_DATASTORE_CLASS.
- set(conf, "org.apache.gora.memory.store.MemStore");
- GIRAPH_GORA_OUTPUT_KEY_CLASS.set(conf, "java.lang.String");
- GIRAPH_GORA_OUTPUT_PERSISTENT_CLASS.
- set(conf,"org.apache.giraph.io.gora.generated.GVertex");
- conf.setVertexOutputFormatClass(GoraTestVertexOutputFormat.class);
- results = InternalVertexRunner.run(conf, new String[0], new String[0]);
- Assert.assertNotNull(results);
- }
-}
diff --git a/pom.xml b/pom.xml
index a14da54..f12a4f0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -314,7 +314,6 @@ under the License.
<dep.avro.version>1.7.6</dep.avro.version>
<dep.accumulo.version>1.4.0</dep.accumulo.version>
<dep.asm.version>3.2</dep.asm.version>
- <dep.gora.version>0.5</dep.gora.version>
<dep.airline.version>0.5</dep.airline.version>
<dep.base64.version>2.3.8</dep.base64.version>
<dep.cli-parser.version>1.1</dep.cli-parser.version>
@@ -773,7 +772,6 @@ under the License.
<!-- test resources (for Giraph on YARN profile) -->
<exclude>**/test/resources/**</exclude>
<!-- Gora configs -->
- <exclude>giraph-gora/conf/**</exclude>
<!-- Rexster resource -->
<exclude>giraph-rexster/giraph-kibble/src/main/resources/META-INF/services/com.tinkerpop.rexster.extension.RexsterExtension</exclude>
<!-- site images -->
@@ -982,7 +980,11 @@ under the License.
<id>hadoop_1</id>
<modules>
<module>giraph-accumulo</module>
+<<<<<<< HEAD
<module>giraph-gora</module>
+=======
+ <module>giraph-hcatalog</module>
+>>>>>>> 5b36c5671da26f5fba3890e868048ef59a3e4903
<module>giraph-dist</module>
</modules>
<activation>
@@ -1133,7 +1135,11 @@ under the License.
<modules>
<module>giraph-accumulo</module>
<module>giraph-hbase</module>
+<<<<<<< HEAD
<module>giraph-gora</module>
+=======
+ <module>giraph-hcatalog</module>
+>>>>>>> 5b36c5671da26f5fba3890e868048ef59a3e4903
<module>giraph-dist</module>
</modules>
<properties>
@@ -1591,6 +1597,7 @@ under the License.
<version>${project.version}</version>
</dependency>
<dependency>
+<<<<<<< HEAD
<groupId>org.apache.giraph</groupId>
<artifactId>giraph-gora</artifactId>
<version>${project.version}</version>
@@ -1601,12 +1608,48 @@ under the License.
<version>${dep.gora.version}</version>
<exclusions>
<exclusion>
+=======
+ <groupId>org.apache.hcatalog</groupId>
+ <artifactId>hcatalog-core</artifactId>
+ <version>${dep.hcatalog.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.pig</groupId>
+ <artifactId>pig</artifactId>
+ </exclusion>
+ <exclusion>
+>>>>>>> 5b36c5671da26f5fba3890e868048ef59a3e4903
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
+<<<<<<< HEAD
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
+=======
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-common</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-shims</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper</artifactId>
+>>>>>>> 5b36c5671da26f5fba3890e868048ef59a3e4903
</exclusion>
</exclusions>
</dependency>