1 | package geniusweb.profilesserver;
|
---|
2 |
|
---|
3 | import java.io.IOException;
|
---|
4 | import java.util.List;
|
---|
5 |
|
---|
6 | import geniusweb.issuevalue.Domain;
|
---|
7 | import geniusweb.profile.Profile;
|
---|
8 | import geniusweb.profilesserver.events.ChangeEvent;
|
---|
9 | import tudelft.utilities.listener.Listenable;
|
---|
10 |
|
---|
11 | /**
|
---|
12 | * Profiles repository interface defining the access methods to the server.
|
---|
13 | */
|
---|
14 | public interface ProfilesRepository extends Listenable<ChangeEvent> {
|
---|
15 | /**
|
---|
16 | *
|
---|
17 | * @param domainname a simple name (no extensions or so) as specified in the
|
---|
18 | * domain (so no full path or special characters).
|
---|
19 | * @return domain with the given name or null if no such domain exists.
|
---|
20 | */
|
---|
21 | Domain getDomain(String domainname);
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * @param profilename simple profile name of the form "domainname/profileX"
|
---|
25 | * (no extendsions).
|
---|
26 | * @return {@link Profile} with the given name and the given domain, or null
|
---|
27 | * if no such domain or profile exists.
|
---|
28 | *
|
---|
29 | */
|
---|
30 | Profile getProfile(String profilename);
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * @return a list of all domain names
|
---|
34 | */
|
---|
35 | List<String> getDomains();
|
---|
36 |
|
---|
37 | /**
|
---|
38 | * @param domainname simple name of the domain.
|
---|
39 | * @return all profiles currently known for given domain
|
---|
40 | */
|
---|
41 | List<Profile> getProfiles(String domainname);
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * Permanently (over)write a profile to the repository (not just in memory).
|
---|
45 | *
|
---|
46 | * @param profile the profile to be written. The domain file must exist and
|
---|
47 | * match.
|
---|
48 | * @throws IOException if the profile does not meet the requirements.
|
---|
49 | */
|
---|
50 | void putProfile(Profile profile) throws IOException;
|
---|
51 |
|
---|
52 | }
|
---|