Deprecations
This page describes deprecated code which has been removed in Gaffer 2 and how to migrate to better equivalents. Each heading for a section below refers to a classname from uk.gov.gchq.gaffer
where there have been changes or where that class has been removed entirely. The section headings link to the code on GitHub for that class (as of the Gaffer 1.21.1 release).
Deprecations impacting the serialisers used in schemas are listed first, followed by changes to Seed Matching and changes to Traits. Other deprecations are then listed in alphabetical order.
Serialisers
Migrating away from deprecated Serialisers
Various deprecated serialisers have been removed completely (details below). If any of these are being used in an existing schema, a new graph and schema will need to be created (see below for replacement serialisers to use) and data from existing graphs migrated. Data will need to be migrated (export and reimport) from graphs using deprecated serialisers before upgrading to Gaffer v2.
It is essential to migrate data stored using deprecated serialisers. Simply replacing these serialisers is not enough because this will prevent existing data from being read and potentially put the backing store into a corrupted state.
Preservation of ordering
When using an ordered store (such as Accumulo), all serialisers used on vertices must preserve order. As such, compactRaw
serialisers (which do not preserve order) cannot be used on vertices in ordered stores.
However, when preserving order is not required, such as for properties, CompactRaw
serialisers are the most effective solution and should always be used. Using an ordered serialiser on a property would reduce performance without providing any benefit. See the schemas documentation for more detail.
Removed Serialisers
serialisation.implementation.raw.RawDateSerialiser
and serialisation.DateSerialiser
Use uk.gov.gchq.gaffer.serialisation.implementation.ordered.OrderedDateSerialiser
instead - note that this will preserve order. Neither of these replacement serialisers implement .deserialiseString(String)
, instead use new Date(Long.parseLong(String))
in place of this.
serialisation.implementation.raw.RawDoubleSerialiser
and serialisation.DoubleSerialiser
Use uk.gov.gchq.gaffer.serialisation.implementation.ordered.OrderedDoubleSerialiser
instead - note that this will preserve order. Neither of these replacement serialisers implement .deserialiseString(String)
, instead use Double.parseDouble(String)
in place of this.
serialisation.implementation.raw.RawFloatSerialiser
and serialisation.FloatSerialiser
Use uk.gov.gchq.gaffer.serialisation.implementation.ordered.OrderedFloatSerialiser
instead - note that this will preserve order.
serialisation.IntegerSerialiser
and serialisation.implementation.raw.RawIntegerSerialiser
Use uk.gov.gchq.gaffer.serialisation.implementation.ordered.OrderedIntegerSerialiser
instead if you need order preserved (e.g. vertex types). If object ordering definitely does not need to be preserved (e.g. only property types), uk.gov.gchq.gaffer.serialisation.implementation.raw.CompactRawIntegerSerialiser
should be used instead. Neither of these replacement serialisers implement .deserialiseString(String)
, instead use Integer.parseInt(String)
in place of this.
serialisation.LongSerialiser
and serialisation.implementation.raw.RawLongSerialiser
Use uk.gov.gchq.gaffer.serialisation.implementation.ordered.OrderedLongSerialiser
instead if you need order preserved (e.g. vertex types). If object ordering definitely does not need to be preserved (e.g. only property types), uk.gov.gchq.gaffer.serialisation.implementation.raw.CompactRawLongSerialiser
could also be used instead.
Changed Serialisers
serialisation.ToBytesSerialiser
and serialisation.ToBytesViaStringDeserialiser
In both serialisers, the method deserialise(byte[])
has been marked as deprecated. It cannot be deleted as it is needed to implement the Serialiser interface. It is recommended for speed/performance to use the other implementation with an offset and a length: deserialise(byte[], int, int)
.
Removal of Seed Matching
operation.SeedMatching
SeedMatching has been removed from Gaffer. This was previously used in get operations, like GetElements
, to select whether you wanted your results to contain only Elements that are the same type as the seed, or both Edges and Entities. For more info, see the Gaffer 1.X docs page on SeedMatching. As described in the Gaffer 1.X docs, SeedMatching
can be replaced with a View
. The default behaviour in Gaffer is the same as if you used seed_matching="RELATED"
, so if this is the case, there is no migration required. However, if you used seed_matching="EQUAL"
, you will need to migrate to a View
.
SeedMatching migration with EdgeSeeds
Where SeedMatching was used to only get back Edges from EdgeSeeds
You should instead specify that in a View
SeedMatching migration with EntitySeeds
Where SeedMatching was used to only get back Entities from EntitySeeds
You should instead specify that in a View
SeedMatching migration with EdgeSeeds and EntitySeeds
Where SeedMatching was used to only get back only Edges from the provided EdgeSeeds and only Entities from the provided EntitySeeds
You will instead need to perform multiple Operations and combine the results. To perform the above operation, you would have to combine both previous examples.
Changes to Store Traits
store.Store
- The method
getTraits()
has been removed. UseStore.execute(Operation, Context)
with theGetTraits
operation instead. - The method
hasTrait(StoreTrait)
has been removed. UseStore.execute(Operation, Context)
with theHasTrait
operation instead.
federatedstore.FederatedGraphStorage
- The method
getTraits(GetTraits, Context)
has been removed. UseStore.execute(Operation, Context)
with theGetTraits
operation instead.
federatedstore.FederatedStore
- The methods
getTraits()
andgetTraits(GetTraits, Context)
have been removed. UseStore.execute(Operation, Context)
with theGetTraits
operation instead.
Changes to Schemas
Deprecated methods in store.schema.TypeDefinition
and store.schema.Schema
have been removed (see below sections).
Elements Schema
Specifying a property name to use as a time stamp is now set under config
.
Previously set at the top level:
Now set in config
:
Types Schema
Specifying a serialiser class using deprecated serialiserClass
is no longer possible. Instead, use class
in serialiser
. Deprecated vertexSerialiserClass
has also been removed.
Old, deprecated, and now removed approach:
{
"types": {
"example.map": {
"description": "Map type description",
"class": "java.util.LinkedHashMap",
"serialiserClass": "uk.gov.gchq.gaffer.serialisation.implementation.MapSerialiser"
}
}
}
Now set in serialiser
:
{
"types": {
"example.map": {
"description": "Map type description",
"class": "java.util.LinkedHashMap",
"serialiser": {
"class": "uk.gov.gchq.gaffer.serialisation.implementation.MapSerialiser"
}
}
}
}
All other Deprecations
accumulostore.AccumuloProperties
- The
TABLE
setting/variable plus the methodsgetTable()
andsetTable(String)
have been removed. ForgetTable()
, uk.gov.gchq.gaffer.accumulostore.getTableName() could be used instead. - A
graphId
should be supplied instead of settingTABLE
directly.
accumulostore.MockAccumuloStore
- This class has been removed.
- For in memory graphs, use
uk.gov.gchq.gaffer.mapstore.MapStore
instead. - For Accumulo specific store tests, use
uk.gov.gchq.gaffer.accumulostore.MiniAccumuloStore
instead.
commonutil.TestTypes
- This class has been removed.
- Use the equivalent
TestTypes
class in the store moduleuk.gov.gchq.gaffer.store.TestTypes
instead.
commonutil.CommonConstants
- This class has been removed as it was redundant.
- For the
UTF-8
constant useStandardCharsets.UTF_8.name()
from built in Java libraries. - The above also applies to the
ISO_8859_1
constant from this class. - This also allows for more robust error handing, this commit is an example of a change implementing this.
data.elementdefinition.view.NamedViewDetail
- The method
hasWriteAccess(String userId, Set<String> opAuths, String adminAuth)
has been removed. - Use
hasWriteAccess(User user, String adminAuth)
instead.
data.elementdefinition.view.ViewElementDefinition
- The method
setAggregator(ElementAggregator aggregator)
has been removed. - A
ViewElementDefinition
should be constructed using the builderuk.gov.gchq.gaffer.data.elementdefinition.view.ViewElementDefinition.Builder
instead.
Example
Where setAggregator
was used previously
final ViewElementDefinition elementDef = new ViewElementDefinition();
elementDef.setAggregator(myElementAggregator);
You should now use the Builder
federatedstore.FederatedAccess
- The method
isAddingUser(User)
has been removed. - Use
hasReadAccess(User user, String adminAuth)
/hasWriteAccess(User user, String adminAuth)
instead.
federatedstore.FederatedGraphStorage
- The methods
getAllIdsAsAdmin()
,getAllGraphAndAccessAsAdmin(List<String>)
andchangeGraphAccessAsAdmin(String, FederatedAccess)
have all been removed. - The method
remove(String graphId)
has been removed. The following can be used instead:remove(String graphId, User user)
remove(String graphId, User user, String adminAuth)
remove(String graphId, Predicate<Entry<FederatedAccess, Set<Graph>>> entryPredicateForGraphRemoval)
federatedstore.FederatedStore
- The method
updateOperationForGraph(Operation, Graph)
has been removed. UseFederatedStoreUtil.updateOperationForGraph(Operation, Graph)
instead. - The method
addGraphs(Set<String> graphAuths, String addingUserId, GraphSerialisable... graphs)
has been removed. The following can be used instead:addGraphs(Set<String> graphAuths, String addingUserId, boolean isPublic, GraphSerialisable... graphs)
addGraphs(Set<String> graphAuths, String addingUserId, boolean isPublic, boolean disabledByDefault, GraphSerialisable... graphs)
addGraphs(Set<String> graphAuths, String addingUserId, boolean isPublic, boolean disabledByDefault, AccessPredicate readAccessPredicate, AccessPredicate writeAccessPredicate, GraphSerialisable... graphs)
addGraphs(FederatedAccess access, GraphSerialisable... graphs)
federatedstore.operation.RemoveGraph
- The method
Builder.setGraphId(String graphId)
has been removed. - Use
Builder.graphId(String graphId)
which has identical behaviour instead.
Example
Where Builder.setGraphId
was used previously
You should now use Builder.graphId
graph.Graph
- The methods
Builder.graphId
,Builder.library
,Builder.view
,Builder.addHook
,Builder.addHooks
have all been removed in all forms. - Instead of using these methods, use
.config()
to set thegraphConfig
.
Example
Where the graph config was added using the Graph.Builder
before
final Graph myGraph = new Graph.Builder()
.graphId("myGraph")
.library(myGraphLibrary)
.view(myView)
.addHook(customHook)
.addSchema(mySchema)
.storeProperties(storeProperties)
.build();
You should now use the GraphConfig.Builder
final Graph myGraph = new Graph.Builder()
.config(new GraphConfig.Builder()
.graphId("myGraph")
.library(myGraphLibrary)
.view(myView)
.addHook(customHook)
.build())
.addSchema(mySchema) // (1)!
.storeProperties(storeProperties) // (2)!
.build();
- Schemas are not part of the GraphConfig
- StoreProperties are not part of the GraphConfig
hdfs.operation.MapReduce
- The methods
getNumReduceTasks()
andsetNumReduceTasks(Integer)
have been removed. - Gaffer’s operations that inherit
MapReduce
did not make use ofnumReduceTasks
, either setting it to a constant number in theJobFactory
or using Accumulo to automatically set the number (recommended for performance) and using min/max to keep it within a range. Therefore,numReduceTasks
,getNumReduceTasks
andsetNumReduceTasks
have been removed from this interface.
hdfs.operation.AddElementsFromHdfs
- The methods
getNumReduceTasks()
andsetNumReduceTasks(Integer)
have been removed. - The number of reduce tasks should not be set. By default the number of reduce tasks should match the number of tablets. Use minimum and maximum reduce tasks to specify boundaries for the number of reduce tasks.
hdfs.operation.SampleDataForSplitPoints
- The methods
getNumReduceTasks()
andsetNumReduceTasks(Integer)
have been removed. - These methods were not required as
NumReduceTasks
was always set to 1 in any case.
jobtracker.JobDetail
- The constructors which took
userId
as aString
have been removed. - Instead, a
User
(uk.gov.gchq.gaffer.user.User
) should be used in its place. See the Builder for User. getUserId
andsetUserId
have also been removed. For getting theUserId
,getUser().getUserId()
can be used instead. See the Javadoc for User.
jsonserialisation.JSONSerialiser
- The method
update(String jsonSerialiserClass, String jsonSerialiserModules)
has been removed. - Use
update(String jsonSerialiserClass, String jsonSerialiserModules, Boolean strictJson)
instead. PassingstrictJson
asnull
will result in the same behaviour.
operation.Operation
- The method
asOperationChain(Operation operation)
has been removed. - Use
OperationChain.wrap
with theOperation
instead.
operation.impl.GetWalks
- The method
Builder.operation
has been removed. - Use the vararg method
Builder.addOperations
instead.
operation.impl.SplitStore
- This class has been removed.
- It is replaced by
SplitStoreFromFile
which is identical except in name.
operation.impl.join.methods.JoinFunction
- The method
join(Iterable keys, String keyName, String matchingValuesName, Match match, Boolean flatten)
which was not implemented has been removed.
rest.SystemProperty
GRAPH_ID
,GRAPH_HOOKS_PATH
,GRAPH_LIBRARY_PATH
andGRAPH_LIBRARY_CONFIG
have been removed.- These config options have been removed in favour of providing a
graphConfig
JSON and usingGRAPH_CONFIG_PATH
instead.
rest.service.v2.example.ExamplesFactory
- This class has been removed.
- It is replaced by
uk.gov.gchq.gaffer.rest.factory.ExamplesFactory
, which can be used instead.
store.StoreProperties
- StoreProperties ID (
gaffer.store.id
) and related methods (getId()
,setId(String)
) have been removed. - The ID of the store properties is instead directly set in the
GraphLibrary
when adding theStoreProperties
withGraphLibrary.add(String graphId, String schemaId, Schema schema, String propertiesId, StoreProperties properties)
. - See the Javadoc for GraphLibrary for more detail.
- If you aren't using a
GraphLibrary
, this change shouldn't affect you as store properties ID is only used inGraphLibrary
.
store.Context
- The private constructor
Context(User user, Map<String, Object> config, String jobId)
has been removed; along with thejobId(String)
method. - Use
Context(User user, Map<String, Object> config)
instead. This does not support supplying the Job ID, this will be set automatically. To get the Job ID use.getJobId()
.
store.schema.TypeDefinition
- The method
getSerialiserClass()
has been removed. Instead, usegetSerialiser()
with.getClass()
and related methods. - The method
setSerialiserClass(String)
has been removed. Instead, set the Serialiser directly usingsetSerialiser(Serialiser)
.
store.schema.Schema
- Schema ID (
gaffer.store.id
) and related methods have been removed. The ID is now defined inGraphLibrary
when adding the schema. timestampProperty
and related methods have been removed. Instead, this is specified by setting"config": {"timestampProperty": "timestamp"}
(where"timestamp"
is the property name to use as a time stamp) in the Schema. See this example schema for more info.- The method
getVertexSerialiserClass()
has been removed. It can be replaced by callingvertexSerialiser.getClass()
and converting the result as appropriate, e.g.getVertexSerialiserClass()
usedSimpleClassNameIdResolver.getSimpleClassName(vertexSerialiser.getClass())
.
store.library.GraphLibrary
- The method
addSchema(Schema schema)
has been removed. UseaddSchema(String id, Schema schema)
instead. - The method
addProperties(StoreProperties properties)
has been removed. UseaddProperties(String id, StoreProperties properties)
instead. - Both of these now require the ID to be supplied.
store.operation.OperationChainValidator
- The method
validateViews(Operation op, ValidationResult validationResult, Schema schemaNotUsed, Store store)
has been removed. UsevalidateViews(Operation op, User user, Store store, ValidationResult validationResult)
instead, passinguser
asnull
will result in the same behaviour. - The method
validateComparables(Operation op, ValidationResult validationResult, Schema schemaNotUsed, Store store)
has been removed. UsevalidateComparables(Operation op, User user, Store store, ValidationResult validationResult)
instead, passinguser
asnull
will result in the same behaviour.
store.operation.handler.named.cache.NamedViewCache
- The method
deleteNamedView(String name)
has been removed. UsedeleteNamedView(String name, User user)
instead, passinguser
asnull
will result in the same behaviour. - The method
getNamedView(String name)
has been removed. UsegetNamedView(String name, User user)
instead. - The method
getAllNamedViews()
has been removed. UsegetAllNamedViews(User user)
instead.
types.IntegerFreqMap
- This class has been removed.
- Use
uk.gov.gchq.gaffer.types.FreqMap
instead, this is identical except for using Long rather than Integer.
types.function.IntegerFreqMapAggregator
- This class has been removed.
- Use
uk.gov.gchq.gaffer.types.function.FreqMapAggregator
instead.
serialisation.IntegerFreqMapSerialiser
- This class has been removed.
- Use
uk.gov.gchq.gaffer.serialisation.FreqMapSerialiser
instead.