use of uk.gov.gchq.gaffer.serialisation.implementation.JavaSerialiser in project Gaffer by gchq.
the class BloomFilter18IT method setup.
@Before
public void setup() {
Schema schema = new Schema.Builder().type(TestTypes.PROP_INTEGER, Integer.class).vertexSerialiser(new JavaSerialiser()).edge(TestGroups.EDGE, new SchemaEdgeDefinition.Builder().property(AccumuloPropertyNames.INT, TestTypes.PROP_INTEGER).build()).entity(TestGroups.ENTITY, new SchemaEntityDefinition.Builder().property(AccumuloPropertyNames.INT, TestTypes.PROP_INTEGER).build()).build();
byteEntityRangeFactory = new ByteEntityRangeFactory(schema);
byteEntityElementConverter = new ByteEntityAccumuloElementConverter(schema);
Gaffer1RangeFactory = new ClassicRangeFactory(schema);
gafferV1ElementConverter = new ClassicAccumuloElementConverter(schema);
}
use of uk.gov.gchq.gaffer.serialisation.implementation.JavaSerialiser in project Gaffer by gchq.
the class SchemaOptimiser method getDefaultVertexSerialiser.
private Serialisation getDefaultVertexSerialiser(final Schema schema, final boolean isStoreOrdered) {
if (null != schema.getVertexSerialiser()) {
return schema.getVertexSerialiser();
}
final Set<Class<?>> vertexClasses = new HashSet<>();
for (final SchemaEntityDefinition definition : schema.getEntities().values()) {
vertexClasses.add(definition.getIdentifierClass(IdentifierType.VERTEX));
}
for (final SchemaEdgeDefinition definition : schema.getEdges().values()) {
vertexClasses.add(definition.getIdentifierClass(IdentifierType.SOURCE));
vertexClasses.add(definition.getIdentifierClass(IdentifierType.DESTINATION));
}
vertexClasses.remove(null);
if (!vertexClasses.isEmpty()) {
Serialisation serialiser = null;
if (vertexClasses.size() == 1) {
serialiser = serialisationFactory.getSerialiser(vertexClasses.iterator().next(), isStoreOrdered);
} else {
for (final Class<?> clazz : vertexClasses) {
serialiser = serialisationFactory.getSerialiser(clazz, isStoreOrdered);
boolean canHandlerAll = true;
for (final Class<?> clazz2 : vertexClasses) {
if (!serialiser.canHandle(clazz2)) {
canHandlerAll = false;
serialiser = null;
break;
}
}
if (canHandlerAll) {
break;
}
}
}
if (null == serialiser) {
throw new IllegalArgumentException("No default serialiser could be found that would support all vertex class types " + vertexClasses.toString() + ", please implement your own or change your vertex class types.");
}
if (serialiser instanceof JavaSerialiser) {
LOGGER.warn("Java serialisation is not recommended for vertex serialisation - it may cause aggregation to fail. Please implement your own or change your vertex class types.");
}
return serialiser;
}
return null;
}
Aggregations