...
- Id.*
- toString() is inconsistent
- JSON serialization is inconsistent (since sometimes we use NamespacedIdCodec and sometimes we don't)
- Doesn't look pretty in JSON form due to heavy nesting
- Needs lots of extra code to implement JSON codec (NamespacedIdCodec)
- Id.Program vs Id.Flow: two classes that do the same thing
- Constructing an Id.* is requires repetition
- ProgramType
- Inconsistent in JSON form compared to other CDAP entities (using "Flow", "Mapreduce", etc. form instead of "flow", "mapreduce", etc. form to maintain backwards-compatibility)
- SchedulableProgramType duplicates ProgramType
- ElementType
- Only in cdap-cli
- Doesn't cover every type of entity
Proposal
Proposed changes
- EntityType: enum that describes every type of entity in CDAP (namespace, application, program, program run, flowlet, flowlet queue, schedule, notification feed, artifact, system service, etc.)
- EntityId: base class for entities in CDAP
- No nesting
- Consistent "static EntityId fromString(String)" and "String toString()"
- Consistent JSON serialization and deserialization (still need custom deserializer, but it should have much less code than NamespacedIdCodec, and should support all EntityIds)
- Easier way to construct child Ids (e.g. given a namespace id, construct app id)
...