I have the following situation:
I'm collecting data on hosts. Each host has collections of properties and statuses. and the hosts are gathered in groups.
Each group has a unique ID and each host has a unique ID
and all the groups are gathered in a single "repository".
I'm currently using the following data structure:
public class Host {
private final Map<PropertyId, Property> properties;
private final Map<StatusId, Status> statuses;
}
public class Group {
private final Map<HostId, Host> hosts;
}
public class AllGroups {
private final Map<GroupId, Group> groups;
}
This is currently implemented as a regular in memory data structure but I need to save all this in a data base. I want to define a good abstraction that would allow me:
- To read each item
- to create update and delete properties and statuses
- to add and delete hosts
- to delete groups
I read some posts regarding the repository pattern and it seems appropriate, but I can't figure out how to define the interfaces correctly
Should I have 1 repository interface? Or should I have separate interfaces for HostRepository, PropertyRepository StatusReporitory...
Aucun commentaire:
Enregistrer un commentaire