Updated Branches:
  refs/heads/trunk 0c8700daf -> 4b01c88e4

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/main/java/org/apache/giraph/factories/TestMessageValueFactory.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/factories/TestMessageValueFactory.java
 
b/giraph-core/src/main/java/org/apache/giraph/factories/TestMessageValueFactory.java
new file mode 100644
index 0000000..3d376de
--- /dev/null
+++ 
b/giraph-core/src/main/java/org/apache/giraph/factories/TestMessageValueFactory.java
@@ -0,0 +1,53 @@
+/*
+ * 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.factories;
+
+import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
+import org.apache.giraph.utils.ReflectionUtils;
+import org.apache.hadoop.io.Writable;
+
+/**
+ * Message Factory class that allows setting the message value class
+ *
+ * @param <M> Message Value class
+ */
+public class TestMessageValueFactory<M extends Writable>
+    implements MessageValueFactory<M> {
+  /** The Message Value class */
+  private final Class<M> klass;
+
+  /**
+   * Constructor
+   *
+   * @param klass Message value class
+   */
+  public TestMessageValueFactory(Class<M> klass) {
+    this.klass = klass;
+  }
+
+  @Override public Class<M> getMessageValueClass() {
+    return klass;
+  }
+
+  @Override public void initialize(
+      ImmutableClassesGiraphConfiguration conf) { }
+
+  @Override public M createMessageValue() {
+    return ReflectionUtils.newInstance(klass);
+  }
+}

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/main/java/org/apache/giraph/factories/ValueFactories.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/factories/ValueFactories.java 
b/giraph-core/src/main/java/org/apache/giraph/factories/ValueFactories.java
new file mode 100644
index 0000000..98e59b3
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/factories/ValueFactories.java
@@ -0,0 +1,100 @@
+/*
+ * 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.factories;
+
+import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.io.Writable;
+import org.apache.hadoop.io.WritableComparable;
+
+import static org.apache.giraph.conf.GiraphConstants.EDGE_VALUE_FACTORY_CLASS;
+import static org.apache.giraph.conf.GiraphConstants.VERTEX_ID_FACTORY_CLASS;
+import static 
org.apache.giraph.conf.GiraphConstants.VERTEX_VALUE_FACTORY_CLASS;
+
+/**
+ * Holder for factories to create user types.
+ *
+ * Note that we don't store the {@link MessageValueFactory} here because they
+ * reference types which may change at a given superstep. Instead we create 
them
+ * as necessary so that they get the latest information.
+ *
+ * @param <I> Vertex id
+ * @param <V> Vertex data
+ * @param <E> Edge data
+ */
+public class ValueFactories<I extends WritableComparable,
+    V extends Writable, E extends Writable> {
+  /** Vertex ID factory. */
+  private final VertexIdFactory<I> vertexIdFactory;
+  /** Vertex value factory. */
+  private final VertexValueFactory<V> vertexValueFactory;
+  /** Edge value factory. */
+  private final EdgeValueFactory<E> edgeValueFactory;
+
+  /**
+   * Constructor with types
+   *
+   * @param vertexIdFactory vertex id factory
+   * @param vertexValueFactory vertex value factory
+   * @param edgeValueFactory edge value factory
+   */
+  public ValueFactories(
+      VertexIdFactory<I> vertexIdFactory,
+      VertexValueFactory<V> vertexValueFactory,
+      EdgeValueFactory<E> edgeValueFactory) {
+    this.edgeValueFactory = edgeValueFactory;
+    this.vertexIdFactory = vertexIdFactory;
+    this.vertexValueFactory = vertexValueFactory;
+  }
+
+  /**
+   * Constructor reading from Configuration
+   *
+   * @param conf Configuration to read from
+   */
+  public ValueFactories(Configuration conf) {
+    vertexIdFactory = VERTEX_ID_FACTORY_CLASS.newInstance(conf);
+    vertexValueFactory = VERTEX_VALUE_FACTORY_CLASS.newInstance(conf);
+    edgeValueFactory = EDGE_VALUE_FACTORY_CLASS.newInstance(conf);
+  }
+
+  /**
+   * Initialize all of the factories.
+   *
+   * @param conf ImmutableClassesGiraphConfiguration
+   */
+  public void initializeAll(
+      ImmutableClassesGiraphConfiguration<I, V, E> conf) {
+    vertexIdFactory.initialize(conf);
+    vertexValueFactory.initialize(conf);
+    edgeValueFactory.initialize(conf);
+  }
+
+  public EdgeValueFactory<E> getEdgeValueFactory() {
+    return edgeValueFactory;
+  }
+
+
+  public VertexIdFactory<I> getVertexIdFactory() {
+    return vertexIdFactory;
+  }
+
+  public VertexValueFactory<V> getVertexValueFactory() {
+    return vertexValueFactory;
+  }
+}

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/main/java/org/apache/giraph/factories/ValueFactoryBase.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/factories/ValueFactoryBase.java 
b/giraph-core/src/main/java/org/apache/giraph/factories/ValueFactoryBase.java
new file mode 100644
index 0000000..f92fb74
--- /dev/null
+++ 
b/giraph-core/src/main/java/org/apache/giraph/factories/ValueFactoryBase.java
@@ -0,0 +1,40 @@
+/*
+ * 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.factories;
+
+import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
+import org.apache.hadoop.io.Writable;
+
+/**
+ * Base interface for factories creating user graph value types (IVEMM)
+ *
+ * @param <W> Writable type
+ */
+public interface ValueFactoryBase<W extends Writable> {
+  /**
+   * Initialize factory settings from the conf.
+   * This gets called on startup and also if there are changes to the message
+   * classes used. For example if the user's
+   * {@link org.apache.giraph.master.MasterCompute} changes the
+   * {@link org.apache.giraph.graph.Computation} and the next superstep has a
+   * different message value type.
+   *
+   * @param conf Configuration
+   */
+  void initialize(ImmutableClassesGiraphConfiguration conf);
+}

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/main/java/org/apache/giraph/factories/VertexIdFactory.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/factories/VertexIdFactory.java 
b/giraph-core/src/main/java/org/apache/giraph/factories/VertexIdFactory.java
new file mode 100644
index 0000000..328bda8
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/factories/VertexIdFactory.java
@@ -0,0 +1,38 @@
+/*
+ * 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.factories;
+
+import org.apache.hadoop.io.WritableComparable;
+
+/**
+ * Factory class to create default vertex IDs.
+ * A user can extend this class in order to customize the creation of new
+ * vertex IDs when an vertex is created by the infrastructure.
+ *
+ * @param <I> Vertex ID
+ */
+public interface VertexIdFactory<I extends WritableComparable>
+    extends ValueFactoryBase<I> {
+  /**
+   * Create a new edge value.
+   *
+   * @return new edge value.
+   */
+  I createVertexId();
+}
+

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/main/java/org/apache/giraph/factories/VertexValueFactory.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/factories/VertexValueFactory.java 
b/giraph-core/src/main/java/org/apache/giraph/factories/VertexValueFactory.java
new file mode 100644
index 0000000..d2f62ab
--- /dev/null
+++ 
b/giraph-core/src/main/java/org/apache/giraph/factories/VertexValueFactory.java
@@ -0,0 +1,41 @@
+/*
+ * 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.factories;
+
+import org.apache.hadoop.io.Writable;
+
+/**
+ * Factory class to create default vertex values.
+ * A user can extend this class in order to customize the creation of new
+ * vertex values when a vertex is created by the infrastructure
+ * (e.g., if edges for a vertex are read).
+ *
+ * @param <V> Vertex value
+ */
+public interface VertexValueFactory<V extends Writable>
+    extends ValueFactoryBase<V> {
+  /**
+   * Create a new vertex value.
+   *
+   * @return new vertex value.
+   */
+  V createVertexValue();
+}
+
+

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/main/java/org/apache/giraph/factories/package-info.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/factories/package-info.java 
b/giraph-core/src/main/java/org/apache/giraph/factories/package-info.java
new file mode 100644
index 0000000..59ccee2
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/factories/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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 of factories for creating types, for example the user's graph types.
+ */
+package org.apache.giraph.factories;

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/main/java/org/apache/giraph/graph/ComputationFactory.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/graph/ComputationFactory.java 
b/giraph-core/src/main/java/org/apache/giraph/graph/ComputationFactory.java
deleted file mode 100644
index d23db05..0000000
--- a/giraph-core/src/main/java/org/apache/giraph/graph/ComputationFactory.java
+++ /dev/null
@@ -1,69 +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.graph;
-
-import org.apache.giraph.conf.GiraphConfiguration;
-import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.io.WritableComparable;
-
-/**
- * Factory for creating Computations
- *
- * @param <I> Vertex ID
- * @param <V> Vertex Value
- * @param <E> Edge Value
- * @param <M1> Incoming Message Value
- * @param <M2> Outgoing Message Value
- */
-public interface ComputationFactory<I extends WritableComparable,
-    V extends Writable, E extends Writable, M1 extends Writable,
-    M2 extends Writable> {
-  /**
-   * One time initialization before compute calls.
-   * Guaranteed to be called from only one thread before computation begins.
-   *
-   * @param conf Configuration
-   */
-  void initComputation(ImmutableClassesGiraphConfiguration<I, V, E> conf);
-
-  /**
-   * Get Computation object
-   *
-   * @param conf Configuration
-   * @return Computation
-   */
-  Computation<I, V, E, M1, M2> getComputation(
-      ImmutableClassesGiraphConfiguration<I, V, E> conf);
-
-  /**
-   * Check that the Configuration passed in is setup correctly to run a job.
-   *
-   * @param conf Configuration to check.
-   */
-  void checkConfiguration(
-      ImmutableClassesGiraphConfiguration<I, V, E> conf);
-
-  /**
-   * Get name of this particular computation
-   *
-   * @param conf Configuration
-   * @return String name of computation
-   */
-  String computationName(GiraphConfiguration conf);
-}

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/main/java/org/apache/giraph/graph/DefaultComputationFactory.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/graph/DefaultComputationFactory.java
 
b/giraph-core/src/main/java/org/apache/giraph/graph/DefaultComputationFactory.java
deleted file mode 100644
index 405b272..0000000
--- 
a/giraph-core/src/main/java/org/apache/giraph/graph/DefaultComputationFactory.java
+++ /dev/null
@@ -1,63 +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.graph;
-
-import org.apache.giraph.conf.GiraphConfiguration;
-import org.apache.giraph.conf.GiraphConstants;
-import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
-import org.apache.giraph.utils.ReflectionUtils;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.io.WritableComparable;
-
-/**
- * Default computation factory that simply creates java computation object
- *
- * @param <I> Vertex ID
- * @param <V> Vertex Value
- * @param <E> Edge Value
- */
-public class DefaultComputationFactory<I extends WritableComparable,
-    V extends Writable, E extends Writable>
-    implements ComputationFactory<I, V, E, Writable, Writable> {
-  @Override
-  public void initComputation(
-      ImmutableClassesGiraphConfiguration<I, V, E> conf) {
-    // Nothing to do here
-  }
-
-  @Override
-  public Computation<I, V, E, Writable, Writable> getComputation(
-      ImmutableClassesGiraphConfiguration<I, V, E> conf) {
-    Class<? extends Computation> klass = conf.getComputationClass();
-    return ReflectionUtils.newInstance(klass, conf);
-  }
-
-  @Override
-  public void checkConfiguration(
-      ImmutableClassesGiraphConfiguration<I, V, E> conf) {
-    if (conf.getComputationClass() == null) {
-      throw new IllegalArgumentException("checkConfiguration: Null " +
-          GiraphConstants.COMPUTATION_CLASS.getKey());
-    }
-  }
-
-  @Override
-  public String computationName(GiraphConfiguration conf) {
-    return conf.getComputationClass().getSimpleName();
-  }
-}

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/main/java/org/apache/giraph/graph/DefaultVertexValueFactory.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/graph/DefaultVertexValueFactory.java
 
b/giraph-core/src/main/java/org/apache/giraph/graph/DefaultVertexValueFactory.java
deleted file mode 100644
index adbe9d3..0000000
--- 
a/giraph-core/src/main/java/org/apache/giraph/graph/DefaultVertexValueFactory.java
+++ /dev/null
@@ -1,58 +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.graph;
-
-import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
-import org.apache.hadoop.io.NullWritable;
-import org.apache.hadoop.io.Writable;
-
-/**
- * Default {@link VertexValueFactory} that simply uses the default
- * constructor for the vertex value class.
- *
- * @param <V> Vertex value
- */
-public class DefaultVertexValueFactory<V extends Writable>
-    implements VertexValueFactory<V> {
-  /** Cached vertex value class. */
-  private Class<V> vertexValueClass;
-
-  @Override
-  public void initialize(
-      ImmutableClassesGiraphConfiguration<?, V, ?> configuration) {
-    vertexValueClass = configuration.getVertexValueClass();
-  }
-
-  @Override
-  public V createVertexValue() {
-    if (vertexValueClass == NullWritable.class) {
-      return (V) NullWritable.get();
-    } else {
-      try {
-        return vertexValueClass.newInstance();
-      } catch (InstantiationException e) {
-        throw new IllegalArgumentException(
-            "createVertexValue: Failed to instantiate", e);
-      } catch (IllegalAccessException e) {
-        throw new IllegalArgumentException(
-            "createVertexValue: Illegally accessed", e);
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/main/java/org/apache/giraph/graph/GraphTaskManager.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/graph/GraphTaskManager.java 
b/giraph-core/src/main/java/org/apache/giraph/graph/GraphTaskManager.java
index e7af825..e81c7c4 100644
--- a/giraph-core/src/main/java/org/apache/giraph/graph/GraphTaskManager.java
+++ b/giraph-core/src/main/java/org/apache/giraph/graph/GraphTaskManager.java
@@ -191,7 +191,7 @@ public class GraphTaskManager<I extends WritableComparable, 
V extends Writable,
     // init the metrics objects
     setupAndInitializeGiraphMetrics();
     // One time setup for computation factory
-    conf.createComputationFactory().initComputation(conf);
+    conf.createComputationFactory().initialize(conf);
     // Check input
     checkInput();
     // Do some task setup (possibly starting up a Zookeeper service)

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/main/java/org/apache/giraph/graph/VertexValueFactory.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/graph/VertexValueFactory.java 
b/giraph-core/src/main/java/org/apache/giraph/graph/VertexValueFactory.java
deleted file mode 100644
index eb9197c..0000000
--- a/giraph-core/src/main/java/org/apache/giraph/graph/VertexValueFactory.java
+++ /dev/null
@@ -1,47 +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.graph;
-
-import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
-import org.apache.hadoop.io.Writable;
-
-/**
- * Factory class to create default vertex values.
- * A user can extend this class in order to customize the creation of new
- * vertex values when a vertex is created by the infrastructure
- * (e.g., if edges for a vertex are read).
- *
- * @param <V> Vertex value
- */
-public interface VertexValueFactory<V extends Writable> {
-  /**
-   * Initialize the factory from the configuration.
-   *
-   * @param configuration Configuration
-   */
-  void initialize(
-      ImmutableClassesGiraphConfiguration<?, V, ?> configuration);
-
-  /**
-   * Create a new vertex value.
-   *
-   * @return New vertex value.
-   */
-  V createVertexValue();
-}

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/main/java/org/apache/giraph/job/GiraphConfigurationValidator.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/job/GiraphConfigurationValidator.java
 
b/giraph-core/src/main/java/org/apache/giraph/job/GiraphConfigurationValidator.java
index 486c6db..5b870c5 100644
--- 
a/giraph-core/src/main/java/org/apache/giraph/job/GiraphConfigurationValidator.java
+++ 
b/giraph-core/src/main/java/org/apache/giraph/job/GiraphConfigurationValidator.java
@@ -22,10 +22,10 @@ import org.apache.giraph.combiner.Combiner;
 import org.apache.giraph.conf.GiraphConstants;
 import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
 import org.apache.giraph.edge.OutEdges;
+import org.apache.giraph.factories.DefaultVertexValueFactory;
+import org.apache.giraph.factories.VertexValueFactory;
 import org.apache.giraph.graph.DefaultVertexResolver;
-import org.apache.giraph.graph.DefaultVertexValueFactory;
 import org.apache.giraph.graph.VertexResolver;
-import org.apache.giraph.graph.VertexValueFactory;
 import org.apache.giraph.io.EdgeInputFormat;
 import org.apache.giraph.io.VertexInputFormat;
 import org.apache.giraph.io.VertexOutputFormat;
@@ -233,8 +233,8 @@ public class GiraphConfigurationValidator<I extends 
WritableComparable,
     if (edgeInputFormatClass != null) {
       Class<?>[] classList =
           getTypeArguments(EdgeInputFormat.class, edgeInputFormatClass);
-      checkAssignable(classList, ID_PARAM_INDEX,
-          vertexIndexType(), EdgeInputFormat.class, "vertex index");
+      checkAssignable(classList, ID_PARAM_INDEX, vertexIndexType(),
+          EdgeInputFormat.class, "vertex index");
       checkAssignable(classList, EDGE_PARAM_EDGE_INPUT_FORMAT_INDEX,
           edgeValueType(), EdgeInputFormat.class, "edge value");
     }
@@ -247,8 +247,8 @@ public class GiraphConfigurationValidator<I extends 
WritableComparable,
     if (vertexCombinerClass != null) {
       Class<?>[] classList =
           getTypeArguments(Combiner.class, vertexCombinerClass);
-      checkEquals(classList, ID_PARAM_INDEX, vertexIndexType(),
-          Combiner.class, "vertex index");
+      checkEquals(classList, ID_PARAM_INDEX, vertexIndexType(), Combiner.class,
+          "vertex index");
       checkEquals(classList, MSG_COMBINER_PARAM_INDEX,
           outgoingMessageValueType(), Combiner.class, "message value");
     }
@@ -320,7 +320,7 @@ public class GiraphConfigurationValidator<I extends 
WritableComparable,
           "checkClassTypes: " + typeName + " types not equal, " +
               "computation - " + classFromComputation +
               ", " + klass.getSimpleName() + " - " +
-              classList[EDGE_PARAM_EDGE_INPUT_FORMAT_INDEX]);
+              classList[index]);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/main/java/org/apache/giraph/jython/JythonComputationFactory.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/jython/JythonComputationFactory.java
 
b/giraph-core/src/main/java/org/apache/giraph/jython/JythonComputationFactory.java
index f7331ac..b714e91 100644
--- 
a/giraph-core/src/main/java/org/apache/giraph/jython/JythonComputationFactory.java
+++ 
b/giraph-core/src/main/java/org/apache/giraph/jython/JythonComputationFactory.java
@@ -22,7 +22,7 @@ import org.apache.giraph.conf.GiraphConfiguration;
 import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
 import org.apache.giraph.conf.StrConfOption;
 import org.apache.giraph.graph.Computation;
-import org.apache.giraph.graph.ComputationFactory;
+import org.apache.giraph.factories.ComputationFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.log4j.Logger;
@@ -62,7 +62,7 @@ public class JythonComputationFactory implements 
ComputationFactory {
   private static final Logger LOG = Logger.getLogger(JythonUtils.class);
 
   @Override
-  public void initComputation(ImmutableClassesGiraphConfiguration conf) {
+  public void initialize(ImmutableClassesGiraphConfiguration conf) {
     String scriptPath = JYTHON_SCRIPT_PATH.get(conf);
     InputStream pythonStream = getPythonScriptStream(conf, scriptPath);
     try {
@@ -130,7 +130,8 @@ public class JythonComputationFactory implements 
ComputationFactory {
   }
 
   @Override
-  public Computation getComputation(ImmutableClassesGiraphConfiguration conf) {
+  public Computation createComputation(
+      ImmutableClassesGiraphConfiguration conf) {
     PyObject pyComputationModule = JythonUtils.getPythonComputationModule();
     Preconditions.checkNotNull(pyComputationModule);
 

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/main/java/org/apache/giraph/utils/ByteArrayVertexIdMessages.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/utils/ByteArrayVertexIdMessages.java
 
b/giraph-core/src/main/java/org/apache/giraph/utils/ByteArrayVertexIdMessages.java
index 6b4642c..3c8afd0 100644
--- 
a/giraph-core/src/main/java/org/apache/giraph/utils/ByteArrayVertexIdMessages.java
+++ 
b/giraph-core/src/main/java/org/apache/giraph/utils/ByteArrayVertexIdMessages.java
@@ -17,6 +17,7 @@
  */
 package org.apache.giraph.utils;
 
+import org.apache.giraph.factories.MessageValueFactory;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.io.WritableComparable;
 
@@ -34,18 +35,18 @@ import java.io.IOException;
 public class ByteArrayVertexIdMessages<I extends WritableComparable,
     M extends Writable> extends ByteArrayVertexIdData<I, M> {
   /** Message value class */
-  private Class<M> messageValueClass;
+  private MessageValueFactory<M> messageValueFactory;
   /** Add the message size to the stream? (Depends on the message store) */
   private boolean useMessageSizeEncoding = false;
 
   /**
    * Constructor
    *
-   * @param messageValueClass Class for messages
+   * @param messageValueFactory Class for messages
    */
   public ByteArrayVertexIdMessages(
-      Class<? extends Writable> messageValueClass) {
-    this.messageValueClass = (Class<M>) messageValueClass;
+      MessageValueFactory<M> messageValueFactory) {
+    this.messageValueFactory = messageValueFactory;
   }
 
   /**
@@ -63,7 +64,7 @@ public class ByteArrayVertexIdMessages<I extends 
WritableComparable,
 
   @Override
   public M createData() {
-    return ReflectionUtils.newInstance(messageValueClass);
+    return messageValueFactory.createMessageValue();
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/main/java/org/apache/giraph/utils/ConfigurationUtils.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/utils/ConfigurationUtils.java 
b/giraph-core/src/main/java/org/apache/giraph/utils/ConfigurationUtils.java
index aba5131..6b89403 100644
--- a/giraph-core/src/main/java/org/apache/giraph/utils/ConfigurationUtils.java
+++ b/giraph-core/src/main/java/org/apache/giraph/utils/ConfigurationUtils.java
@@ -32,7 +32,7 @@ import org.apache.giraph.conf.GiraphTypes;
 import org.apache.giraph.conf.TypesHolder;
 import org.apache.giraph.edge.OutEdges;
 import org.apache.giraph.graph.Computation;
-import org.apache.giraph.graph.VertexValueFactory;
+import org.apache.giraph.factories.VertexValueFactory;
 import org.apache.giraph.io.EdgeInputFormat;
 import org.apache.giraph.io.VertexInputFormat;
 import org.apache.giraph.io.VertexOutputFormat;

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/main/java/org/apache/giraph/utils/WritableUtils.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/utils/WritableUtils.java 
b/giraph-core/src/main/java/org/apache/giraph/utils/WritableUtils.java
index 695b08d..9163c08 100644
--- a/giraph-core/src/main/java/org/apache/giraph/utils/WritableUtils.java
+++ b/giraph-core/src/main/java/org/apache/giraph/utils/WritableUtils.java
@@ -25,9 +25,9 @@ import org.apache.giraph.graph.Vertex;
 import org.apache.giraph.zk.ZooKeeperExt;
 import org.apache.giraph.zk.ZooKeeperExt.PathStat;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.io.NullWritable;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.io.WritableComparable;
-import org.apache.hadoop.util.ReflectionUtils;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.ZooDefs.Ids;
@@ -43,6 +43,8 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
+import static org.apache.hadoop.util.ReflectionUtils.newInstance;
+
 /**
  * Helper static methods for working with Writable objects.
  */
@@ -53,6 +55,21 @@ public class WritableUtils {
   private WritableUtils() { }
 
   /**
+   * Instantiate a new Writable, checking for NullWritable along the way.
+   *
+   * @param klass Class
+   * @param <W> type
+   * @return new instance of class
+   */
+  public static <W extends Writable> W createWritable(Class<W> klass) {
+    if (NullWritable.class.equals(klass)) {
+      return (W) NullWritable.get();
+    } else {
+      return ReflectionUtils.newInstance(klass);
+    }
+  }
+
+  /**
    * Read fields from byteArray to a Writeable object.
    *
    * @param byteArray Byte array to find the fields in.
@@ -289,8 +306,7 @@ public class WritableUtils {
       int size = inputStream.readInt();
       List<T> writableList = new ArrayList<T>(size);
       for (int i = 0; i < size; ++i) {
-        T writable =
-            ReflectionUtils.newInstance(writableClass, conf);
+        T writable = newInstance(writableClass, conf);
         writable.readFields(inputStream);
         writableList.add(writable);
       }

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/test/java/org/apache/giraph/comm/RequestFailureTest.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/test/java/org/apache/giraph/comm/RequestFailureTest.java 
b/giraph-core/src/test/java/org/apache/giraph/comm/RequestFailureTest.java
index c2c8568..236bc88 100644
--- a/giraph-core/src/test/java/org/apache/giraph/comm/RequestFailureTest.java
+++ b/giraph-core/src/test/java/org/apache/giraph/comm/RequestFailureTest.java
@@ -26,6 +26,7 @@ import org.apache.giraph.comm.requests.WritableRequest;
 import org.apache.giraph.conf.GiraphConfiguration;
 import org.apache.giraph.conf.GiraphConstants;
 import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
+import org.apache.giraph.factories.TestMessageValueFactory;
 import org.apache.giraph.utils.ByteArrayVertexIdMessages;
 import org.apache.giraph.utils.IntNoOpComputation;
 import org.apache.giraph.utils.MockUtils;
@@ -82,7 +83,7 @@ public class RequestFailureTest {
     ByteArrayVertexIdMessages<IntWritable,
             IntWritable> vertexIdMessages =
         new ByteArrayVertexIdMessages<IntWritable, IntWritable>(
-            IntWritable.class);
+            new TestMessageValueFactory<IntWritable>(IntWritable.class));
     vertexIdMessages.setConf(conf);
     vertexIdMessages.initialize();
     dataToSend.add(partitionId, vertexIdMessages);

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/test/java/org/apache/giraph/comm/RequestTest.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/test/java/org/apache/giraph/comm/RequestTest.java 
b/giraph-core/src/test/java/org/apache/giraph/comm/RequestTest.java
index d7664ef..2e60c09 100644
--- a/giraph-core/src/test/java/org/apache/giraph/comm/RequestTest.java
+++ b/giraph-core/src/test/java/org/apache/giraph/comm/RequestTest.java
@@ -29,6 +29,7 @@ import org.apache.giraph.conf.GiraphConstants;
 import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
 import org.apache.giraph.edge.Edge;
 import org.apache.giraph.edge.EdgeFactory;
+import org.apache.giraph.factories.TestMessageValueFactory;
 import org.apache.giraph.graph.Vertex;
 import org.apache.giraph.graph.VertexMutations;
 import org.apache.giraph.metrics.GiraphMetrics;
@@ -146,7 +147,7 @@ public class RequestTest {
     ByteArrayVertexIdMessages<IntWritable,
             IntWritable> vertexIdMessages =
         new ByteArrayVertexIdMessages<IntWritable, IntWritable>(
-            IntWritable.class);
+            new TestMessageValueFactory<IntWritable>(IntWritable.class));
     vertexIdMessages.setConf(conf);
     vertexIdMessages.initialize();
     dataToSend.add(partitionId, vertexIdMessages);

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/test/java/org/apache/giraph/comm/TestMessageStores.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/test/java/org/apache/giraph/comm/TestMessageStores.java 
b/giraph-core/src/test/java/org/apache/giraph/comm/TestMessageStores.java
index e270816..eb2497b 100644
--- a/giraph-core/src/test/java/org/apache/giraph/comm/TestMessageStores.java
+++ b/giraph-core/src/test/java/org/apache/giraph/comm/TestMessageStores.java
@@ -33,6 +33,7 @@ import 
org.apache.giraph.comm.messages.out_of_core.SequentialFileMessageStore;
 import org.apache.giraph.conf.GiraphConfiguration;
 import org.apache.giraph.conf.GiraphConstants;
 import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
+import org.apache.giraph.factories.TestMessageValueFactory;
 import org.apache.giraph.utils.ByteArrayVertexIdMessages;
 import org.apache.giraph.utils.CollectionUtils;
 import org.apache.giraph.utils.IntNoOpComputation;
@@ -147,8 +148,8 @@ public class TestMessageStores {
           service.getVertexPartitionOwner(entry.getKey()).getPartitionId();
       ByteArrayVertexIdMessages<IntWritable, IntWritable>
           byteArrayVertexIdMessages =
-          new ByteArrayVertexIdMessages<IntWritable,
-              IntWritable>(IntWritable.class);
+          new ByteArrayVertexIdMessages<IntWritable, IntWritable>(
+              new TestMessageValueFactory(IntWritable.class));
       byteArrayVertexIdMessages.setConf(config);
       byteArrayVertexIdMessages.initialize();
       for (IntWritable message : entry.getValue()) {
@@ -219,7 +220,7 @@ public class TestMessageStores {
     }
     out.close();
 
-    messageStore = messageStoreFactory.newStore(IntWritable.class);
+    messageStore = messageStoreFactory.newStore(new 
TestMessageValueFactory<IntWritable>(IntWritable.class));
 
     DataInputStream in = new DataInputStream(new BufferedInputStream(
         (new FileInputStream(file))));
@@ -239,7 +240,7 @@ public class TestMessageStores {
       TestData testData) throws IOException {
     SortedMap<IntWritable, Collection<IntWritable>> messages =
         new TreeMap<IntWritable, Collection<IntWritable>>();
-    S messageStore = messageStoreFactory.newStore(IntWritable.class);
+    S messageStore = messageStoreFactory.newStore(new 
TestMessageValueFactory<IntWritable>(IntWritable.class));
     putNTimes(messageStore, messages, testData);
     assertTrue(equalMessages(messageStore, messages, testData));
     messageStore.clearAll();

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/test/java/org/apache/giraph/comm/messages/TestIntFloatPrimitiveMessageStores.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/test/java/org/apache/giraph/comm/messages/TestIntFloatPrimitiveMessageStores.java
 
b/giraph-core/src/test/java/org/apache/giraph/comm/messages/TestIntFloatPrimitiveMessageStores.java
index fd3a496..a8f6f70 100644
--- 
a/giraph-core/src/test/java/org/apache/giraph/comm/messages/TestIntFloatPrimitiveMessageStores.java
+++ 
b/giraph-core/src/test/java/org/apache/giraph/comm/messages/TestIntFloatPrimitiveMessageStores.java
@@ -24,6 +24,7 @@ import 
org.apache.giraph.comm.messages.primitives.IntByteArrayMessageStore;
 import org.apache.giraph.comm.messages.primitives.IntFloatMessageStore;
 import org.apache.giraph.conf.GiraphConfiguration;
 import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
+import org.apache.giraph.factories.TestMessageValueFactory;
 import org.apache.giraph.graph.BasicComputation;
 import org.apache.giraph.graph.Vertex;
 import org.apache.giraph.partition.Partition;
@@ -93,7 +94,7 @@ public class TestIntFloatPrimitiveMessageStores {
   createIntFloatMessages() {
     ByteArrayVertexIdMessages<IntWritable, FloatWritable> messages =
         new ByteArrayVertexIdMessages<IntWritable, FloatWritable>(
-            FloatWritable.class);
+            new TestMessageValueFactory<FloatWritable>(FloatWritable.class));
     messages.setConf(createIntFloatConf());
     messages.initialize();
     return messages;
@@ -143,7 +144,8 @@ public class TestIntFloatPrimitiveMessageStores {
   @Test
   public void testIntByteArrayMessageStore() throws IOException {
     IntByteArrayMessageStore<FloatWritable> messageStore =
-        new IntByteArrayMessageStore<FloatWritable>(FloatWritable.class,
+        new IntByteArrayMessageStore<FloatWritable>(new
+            TestMessageValueFactory<FloatWritable>(FloatWritable.class),
             service, createIntFloatConf());
     insertIntFloatMessages(messageStore);
 

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/test/java/org/apache/giraph/comm/messages/TestLongDoublePrimitiveMessageStores.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/test/java/org/apache/giraph/comm/messages/TestLongDoublePrimitiveMessageStores.java
 
b/giraph-core/src/test/java/org/apache/giraph/comm/messages/TestLongDoublePrimitiveMessageStores.java
index 5a69062..0659260 100644
--- 
a/giraph-core/src/test/java/org/apache/giraph/comm/messages/TestLongDoublePrimitiveMessageStores.java
+++ 
b/giraph-core/src/test/java/org/apache/giraph/comm/messages/TestLongDoublePrimitiveMessageStores.java
@@ -24,6 +24,7 @@ import 
org.apache.giraph.comm.messages.primitives.LongByteArrayMessageStore;
 import org.apache.giraph.comm.messages.primitives.LongDoubleMessageStore;
 import org.apache.giraph.conf.GiraphConfiguration;
 import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
+import org.apache.giraph.factories.TestMessageValueFactory;
 import org.apache.giraph.graph.BasicComputation;
 import org.apache.giraph.graph.Vertex;
 import org.apache.giraph.partition.Partition;
@@ -93,7 +94,7 @@ public class TestLongDoublePrimitiveMessageStores {
   createLongDoubleMessages() {
     ByteArrayVertexIdMessages<LongWritable, DoubleWritable> messages =
         new ByteArrayVertexIdMessages<LongWritable, DoubleWritable>(
-            DoubleWritable.class);
+            new TestMessageValueFactory<DoubleWritable>(DoubleWritable.class));
     messages.setConf(createLongDoubleConf());
     messages.initialize();
     return messages;
@@ -143,7 +144,8 @@ public class TestLongDoublePrimitiveMessageStores {
   @Test
   public void testLongByteArrayMessageStore() throws IOException {
     LongByteArrayMessageStore<DoubleWritable> messageStore =
-        new LongByteArrayMessageStore<DoubleWritable>(DoubleWritable.class,
+        new LongByteArrayMessageStore<DoubleWritable>(
+            new TestMessageValueFactory<DoubleWritable>(DoubleWritable.class),
             service, createLongDoubleConf());
     insertLongDoubleMessages(messageStore);
 

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/test/java/org/apache/giraph/io/TestEdgeInput.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/test/java/org/apache/giraph/io/TestEdgeInput.java 
b/giraph-core/src/test/java/org/apache/giraph/io/TestEdgeInput.java
index 327aaa3..425fcba 100644
--- a/giraph-core/src/test/java/org/apache/giraph/io/TestEdgeInput.java
+++ b/giraph-core/src/test/java/org/apache/giraph/io/TestEdgeInput.java
@@ -24,7 +24,7 @@ import 
org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
 import org.apache.giraph.edge.ByteArrayEdges;
 import org.apache.giraph.edge.Edge;
 import org.apache.giraph.graph.Vertex;
-import org.apache.giraph.graph.VertexValueFactory;
+import org.apache.giraph.factories.VertexValueFactory;
 import org.apache.giraph.io.formats.IdWithValueTextOutputFormat;
 import org.apache.giraph.io.formats.IntIntTextVertexValueInputFormat;
 import org.apache.giraph.io.formats.IntNullReverseTextEdgeInputFormat;
@@ -225,8 +225,7 @@ public class TestEdgeInput extends BspCase {
   public static class TestVertexValueFactory
       implements VertexValueFactory<IntWritable> {
     @Override
-    public void initialize(ImmutableClassesGiraphConfiguration<?, IntWritable,
-        ?> configuration) { }
+    public void initialize(ImmutableClassesGiraphConfiguration conf) { }
 
     @Override
     public IntWritable createVertexValue() {

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-core/src/test/java/org/apache/giraph/utils/TestReflectionUtils.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/test/java/org/apache/giraph/utils/TestReflectionUtils.java 
b/giraph-core/src/test/java/org/apache/giraph/utils/TestReflectionUtils.java
index c9b4ace..1c3eed3 100644
--- a/giraph-core/src/test/java/org/apache/giraph/utils/TestReflectionUtils.java
+++ b/giraph-core/src/test/java/org/apache/giraph/utils/TestReflectionUtils.java
@@ -20,13 +20,20 @@ package org.apache.giraph.utils;
 import org.apache.giraph.conf.TypesHolder;
 import org.apache.giraph.edge.ByteArrayEdges;
 import org.apache.giraph.edge.OutEdges;
+import org.apache.giraph.factories.DefaultEdgeValueFactory;
+import org.apache.giraph.factories.DefaultIncomingMessageValueFactory;
+import org.apache.giraph.factories.DefaultOutgoingMessageValueFactory;
+import org.apache.giraph.factories.DefaultVertexIdFactory;
+import org.apache.giraph.factories.DefaultVertexValueFactory;
+import org.apache.giraph.factories.EdgeValueFactory;
+import org.apache.giraph.factories.MessageValueFactory;
+import org.apache.giraph.factories.VertexIdFactory;
+import org.apache.giraph.factories.VertexValueFactory;
 import org.apache.giraph.graph.BasicComputation;
 import org.apache.giraph.graph.Computation;
 import org.apache.giraph.graph.DefaultVertexResolver;
-import org.apache.giraph.graph.DefaultVertexValueFactory;
 import org.apache.giraph.graph.Vertex;
 import org.apache.giraph.graph.VertexResolver;
-import org.apache.giraph.graph.VertexValueFactory;
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.io.WritableComparable;
@@ -75,10 +82,32 @@ public class TestReflectionUtils {
     assertEquals(WritableComparable.class, classes[0]);
     assertEquals(Writable.class, classes[1]);
     assertEquals(Writable.class, classes[2]);
+
+    classes = getTypeArguments(VertexIdFactory.class,
+        DefaultVertexIdFactory.class);
+    assertEquals(1, classes.length);
+    assertEquals(WritableComparable.class, classes[0]);
+
     classes = getTypeArguments(VertexValueFactory.class,
         DefaultVertexValueFactory.class);
     assertEquals(1, classes.length);
     assertEquals(Writable.class, classes[0]);
+
+    classes = getTypeArguments(EdgeValueFactory.class,
+        DefaultEdgeValueFactory.class);
+    assertEquals(1, classes.length);
+    assertEquals(Writable.class, classes[0]);
+
+    classes = getTypeArguments(MessageValueFactory.class,
+        DefaultIncomingMessageValueFactory.class);
+    assertEquals(1, classes.length);
+    assertEquals(Writable.class, classes[0]);
+
+    classes = getTypeArguments(MessageValueFactory.class,
+        DefaultOutgoingMessageValueFactory.class);
+    assertEquals(1, classes.length);
+    assertEquals(Writable.class, classes[0]);
+
     classes = getTypeArguments(OutEdges.class, ByteArrayEdges.class);
     assertEquals(2, classes.length);
     assertEquals(WritableComparable.class, classes[0]);

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-examples/src/test/java/org/apache/giraph/TestBspBasic.java
----------------------------------------------------------------------
diff --git a/giraph-examples/src/test/java/org/apache/giraph/TestBspBasic.java 
b/giraph-examples/src/test/java/org/apache/giraph/TestBspBasic.java
index 0e3503c..f9e77af 100644
--- a/giraph-examples/src/test/java/org/apache/giraph/TestBspBasic.java
+++ b/giraph-examples/src/test/java/org/apache/giraph/TestBspBasic.java
@@ -151,8 +151,9 @@ public class
         immutableClassesGiraphConfiguration.createVertexValue();
     NullWritable edgeValue =
         immutableClassesGiraphConfiguration.createEdgeValue();
-    NullWritable messageValue =
-        immutableClassesGiraphConfiguration.createOutgoingMessageValue();
+    Writable messageValue =
+        immutableClassesGiraphConfiguration.getOutgoingMessageValueFactory()
+            .createMessageValue();
     assertSame(vertexValue.getClass(), NullWritable.class);
     assertSame(vertexValue, edgeValue);
     assertSame(edgeValue, messageValue);

http://git-wip-us.apache.org/repos/asf/giraph/blob/4b01c88e/giraph-examples/src/test/java/org/apache/giraph/vertex/TestComputationTypes.java
----------------------------------------------------------------------
diff --git 
a/giraph-examples/src/test/java/org/apache/giraph/vertex/TestComputationTypes.java
 
b/giraph-examples/src/test/java/org/apache/giraph/vertex/TestComputationTypes.java
index 3c63ee0..fe354fa 100644
--- 
a/giraph-examples/src/test/java/org/apache/giraph/vertex/TestComputationTypes.java
+++ 
b/giraph-examples/src/test/java/org/apache/giraph/vertex/TestComputationTypes.java
@@ -23,7 +23,7 @@ import org.apache.giraph.conf.GiraphConstants;
 import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
 import org.apache.giraph.edge.ByteArrayEdges;
 import 
org.apache.giraph.examples.SimpleSuperstepComputation.SimpleSuperstepVertexInputFormat;
-import org.apache.giraph.graph.VertexValueFactory;
+import org.apache.giraph.factories.VertexValueFactory;
 import org.apache.giraph.io.formats.GeneratedVertexInputFormat;
 import org.apache.giraph.io.formats.JsonBase64VertexInputFormat;
 import org.apache.giraph.io.formats.JsonBase64VertexOutputFormat;
@@ -101,9 +101,7 @@ public class TestComputationTypes {
         VertexValueFactory<DoubleWritable> {
 
       @Override
-      public void initialize(
-          ImmutableClassesGiraphConfiguration<?, DoubleWritable, ?>
-              configuration) {}
+      public void initialize(ImmutableClassesGiraphConfiguration conf) { }
 
       @Override
       public DoubleWritable createVertexValue() {

Reply via email to