1 | package geniusweb.protocol.partyconnection;
|
---|
2 |
|
---|
3 | import java.io.IOException;
|
---|
4 | import java.util.List;
|
---|
5 |
|
---|
6 | import geniusweb.actions.Action;
|
---|
7 | import geniusweb.connection.ConnectionFactory;
|
---|
8 | import geniusweb.inform.Inform;
|
---|
9 | import geniusweb.references.Reference;
|
---|
10 | import tudelft.utilities.repository.NoResourcesNowException;
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * An extended {@link ConnectionFactory} that store PartyIDs with the
|
---|
14 | * connections, making it possible to find back the appropriate connection given
|
---|
15 | * a PartyID. Also, it allows the connection factory to actually assign the
|
---|
16 | * PartyIDs.
|
---|
17 | *
|
---|
18 | */
|
---|
19 | public interface ProtocolToPartyConnFactory
|
---|
20 | extends ConnectionFactory<Action, Inform> {
|
---|
21 | @Override
|
---|
22 | public ProtocolToPartyConn connect(Reference reference)
|
---|
23 | throws IOException, NoResourcesNowException;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * Connects a set of References in one go, following a modified Banker's
|
---|
27 | * algorithm. Only succeeds if all requested connections can be made.
|
---|
28 | *
|
---|
29 | * @param references the list of references to connect with
|
---|
30 | * @return a List of connections, one fore each Reference. The URI Scheme
|
---|
31 | * deteremines how the connection to the party is created.
|
---|
32 | * Typically,
|
---|
33 | * <ul>
|
---|
34 | * <li>"classpath" assumes the file refers to an existing class on
|
---|
35 | * the classpath, directly to be instantiated.
|
---|
36 | * <li>"pythonpath" idem, but now the party is a python party.
|
---|
37 | * <li>"http" assumes the party is to be started on a partiesserver,
|
---|
38 | * where the partiesserver will convert the provided address to a
|
---|
39 | * specific party.
|
---|
40 | * </ul>
|
---|
41 | * It depends on the run system which of these protocols are
|
---|
42 | * actually supported, eg "pythonpath" is typically only supported
|
---|
43 | * for the python-based simplerunner.
|
---|
44 | * @throws IOException if a connection is failing irrecoverably.
|
---|
45 | * @throws NoResourcesNowException is there are insufficient resources now.
|
---|
46 | * This exception includes a suggested
|
---|
47 | * moment to retry.
|
---|
48 | */
|
---|
49 | List<ProtocolToPartyConn> connect(List<Reference> references)
|
---|
50 | throws IOException, NoResourcesNowException;
|
---|
51 |
|
---|
52 | }
|
---|