diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-02-06 21:00:19 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-02-06 21:00:19 +0100 |
commit | 1e8fd072ee765e70770a89970d164809e9d31a26 (patch) | |
tree | b89d1f22ec9f9511f225c22b44c705a39af10fa2 | |
parent | 8d19516ef4a2983f343883c29a48eacd942040ec (diff) |
Refactor: Rename classes.
Rename Client and Master classes, because the classes contain more than
just the service interfaces.
– ClientServiceImpl => Client.
– MasterServiceImpl => Master.
-rw-r--r-- | same-android/src/main/java/com/orbekk/GameView.java | 2 | ||||
-rw-r--r-- | same/src/main/java/com/orbekk/same/Client.java (renamed from same/src/main/java/com/orbekk/same/ClientServiceImpl.java) | 4 | ||||
-rw-r--r-- | same/src/main/java/com/orbekk/same/Master.java (renamed from same/src/main/java/com/orbekk/same/MasterServiceImpl.java) | 8 | ||||
-rw-r--r-- | same/src/main/java/com/orbekk/same/Same.java | 6 | ||||
-rw-r--r-- | same/src/main/java/com/orbekk/same/SameController.java | 16 | ||||
-rw-r--r-- | same/src/test/java/com/orbekk/same/ClientServiceImplTest.java | 2 | ||||
-rw-r--r-- | same/src/test/java/com/orbekk/same/MasterServiceImplTest.java | 12 |
7 files changed, 25 insertions, 25 deletions
diff --git a/same-android/src/main/java/com/orbekk/GameView.java b/same-android/src/main/java/com/orbekk/GameView.java index 620194e..4c4c8a8 100644 --- a/same-android/src/main/java/com/orbekk/GameView.java +++ b/same-android/src/main/java/com/orbekk/GameView.java @@ -5,7 +5,7 @@ import org.slf4j.LoggerFactory; import com.orbekk.same.State.Component; import com.orbekk.same.ClientService; -import com.orbekk.same.ClientServiceImpl; +import com.orbekk.same.Client; import com.orbekk.same.SameInterface; import com.orbekk.same.UpdateConflict; diff --git a/same/src/main/java/com/orbekk/same/ClientServiceImpl.java b/same/src/main/java/com/orbekk/same/Client.java index c503919..ce3947c 100644 --- a/same/src/main/java/com/orbekk/same/ClientServiceImpl.java +++ b/same/src/main/java/com/orbekk/same/Client.java @@ -11,7 +11,7 @@ import org.slf4j.LoggerFactory; import com.orbekk.util.WorkQueue; -public class ClientServiceImpl implements DiscoveryListener { +public class Client implements DiscoveryListener { private Logger logger = LoggerFactory.getLogger(getClass()); private ConnectionManager connections; private State state; @@ -57,7 +57,7 @@ public class ClientServiceImpl implements DiscoveryListener { } }; - public ClientServiceImpl(State state, ConnectionManager connections, + public Client(State state, ConnectionManager connections, String myUrl) { this.state = state; this.connections = connections; diff --git a/same/src/main/java/com/orbekk/same/MasterServiceImpl.java b/same/src/main/java/com/orbekk/same/Master.java index 7e25fc1..eaf0a8f 100644 --- a/same/src/main/java/com/orbekk/same/MasterServiceImpl.java +++ b/same/src/main/java/com/orbekk/same/Master.java @@ -8,7 +8,7 @@ import org.slf4j.LoggerFactory; import com.orbekk.same.State.Component; -public class MasterServiceImpl implements MasterService, Runnable { +public class Master implements MasterService, Runnable { private Logger logger = LoggerFactory.getLogger(getClass()); private final ConnectionManager connections; private State state; @@ -17,16 +17,16 @@ public class MasterServiceImpl implements MasterService, Runnable { private List<String> _fullStateReceivers = new ArrayList<String>(); private Thread workerThread = null; - public static MasterServiceImpl create(ConnectionManager connections, + public static Master create(ConnectionManager connections, Broadcaster broadcaster, String myUrl) { State state = new State("DefaultMaster"); state.update(".masterUrl", myUrl, 1); - return new MasterServiceImpl(state, connections, broadcaster); + return new Master(state, connections, broadcaster); } /** Constructor for internal use. */ - MasterServiceImpl(State initialState, ConnectionManager connections, + Master(State initialState, ConnectionManager connections, Broadcaster broadcaster) { this.state = initialState; this.connections = connections; diff --git a/same/src/main/java/com/orbekk/same/Same.java b/same/src/main/java/com/orbekk/same/Same.java index 69e1a0f..b152be4 100644 --- a/same/src/main/java/com/orbekk/same/Same.java +++ b/same/src/main/java/com/orbekk/same/Same.java @@ -10,7 +10,7 @@ import org.slf4j.LoggerFactory; @Deprecated public class Same implements SameInterface { private Logger logger = LoggerFactory.getLogger(getClass()); - private ClientServiceImpl client; + private Client client; private StateChangedProxy stateChangedProxy = new StateChangedProxy(); private class StateChangedProxy implements StateChangedListener { @@ -25,13 +25,13 @@ public class Same implements SameInterface { } } - public static Same createSame(ClientServiceImpl client) { + public static Same createSame(Client client) { Same same = new Same(client); client.setStateChangedListener(same.stateChangedProxy); return same; } - Same(ClientServiceImpl client) { + Same(Client client) { this.client = client; } diff --git a/same/src/main/java/com/orbekk/same/SameController.java b/same/src/main/java/com/orbekk/same/SameController.java index 44e1721..abf97c1 100644 --- a/same/src/main/java/com/orbekk/same/SameController.java +++ b/same/src/main/java/com/orbekk/same/SameController.java @@ -15,8 +15,8 @@ public class SameController { private Logger logger = LoggerFactory.getLogger(getClass()); private int port; private ServerContainer server; - private MasterServiceImpl master; - private ClientServiceImpl client; + private Master master; + private Client client; private PaxosServiceImpl paxos; /** @@ -37,10 +37,10 @@ public class SameController { String masterUrl = baseUrl + "MasterService.json"; String clientUrl = baseUrl + "ClientService.json"; - MasterServiceImpl master = MasterServiceImpl.create( + Master master = Master.create( connections, broadcaster, masterUrl); - ClientServiceImpl client = new ClientServiceImpl(state, connections, + Client client = new Client(state, connections, clientUrl); PaxosServiceImpl paxos = new PaxosServiceImpl(""); @@ -59,8 +59,8 @@ public class SameController { public SameController( int port, ServerContainer server, - MasterServiceImpl master, - ClientServiceImpl client, + Master master, + Client client, PaxosServiceImpl paxos) { this.port = port; this.server = server; @@ -103,11 +103,11 @@ public class SameController { client.joinNetwork(url); } - public ClientServiceImpl getClient() { + public Client getClient() { return client; } - public MasterServiceImpl getMaster() { + public Master getMaster() { return master; } } diff --git a/same/src/test/java/com/orbekk/same/ClientServiceImplTest.java b/same/src/test/java/com/orbekk/same/ClientServiceImplTest.java index 2c5604a..4dfc54a 100644 --- a/same/src/test/java/com/orbekk/same/ClientServiceImplTest.java +++ b/same/src/test/java/com/orbekk/same/ClientServiceImplTest.java @@ -8,7 +8,7 @@ import static org.mockito.Mockito.*; public class ClientServiceImplTest { private State state = new State("ClientNetwork"); private TestConnectionManager connections = new TestConnectionManager(); - private ClientServiceImpl client = new ClientServiceImpl(state, connections, + private Client client = new Client(state, connections, "http://client/ClientService.json"); private ClientService clientS = client.getService(); diff --git a/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java b/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java index cc89054..0e7c81d 100644 --- a/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java +++ b/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java @@ -12,7 +12,7 @@ public class MasterServiceImplTest { private State state = new State("TestNetwork"); private TestConnectionManager connections = new TestConnectionManager(); private TestBroadcaster broadcaster = new TestBroadcaster(); - private MasterServiceImpl master; + private Master master; public static class UnreachableClient implements ClientService { @Override @@ -36,7 +36,7 @@ public class MasterServiceImplTest { @Before public void setUp() { state.update(".masterUrl", "http://master/MasterService.json", 1); - master = new MasterServiceImpl(state, connections, broadcaster); + master = new Master(state, connections, broadcaster); connections.masterMap.put("http://master/MasterService.json", master); } @@ -66,7 +66,7 @@ public class MasterServiceImplTest { @Test public void clientJoin() { - ClientServiceImpl client = new ClientServiceImpl( + Client client = new Client( new State("ClientNetwork"), connections, "http://client/ClientService.json"); ClientService clientS = client.getService(); @@ -79,12 +79,12 @@ public class MasterServiceImplTest { @Test public void validStateRequest() { - ClientServiceImpl client1 = new ClientServiceImpl( + Client client1 = new Client( new State("ClientNetwork"), connections, "http://client/ClientService.json"); ClientService client1S = client1.getService(); connections.clientMap.put("http://client/ClientService.json", client1S); - ClientServiceImpl client2 = new ClientServiceImpl( + Client client2 = new Client( new State("ClientNetwork"), connections, "http://client2/ClientService.json"); ClientService client2S = client2.getService(); @@ -114,7 +114,7 @@ public class MasterServiceImplTest { @Test public void masterRemovesParticipant() { - ClientServiceImpl client = new ClientServiceImpl( + Client client = new Client( new State("ClientNetwork"), connections, "http://client/ClientService.json"); ClientService clientS = client.getService(); |