Skip to content
Snippets Groups Projects
Verified Commit f25fbc5b authored by akwizgran's avatar akwizgran
Browse files

Merge registration methods for clients and hooks.

parent 57a6c8cb
No related branches found
No related tags found
No related merge requests found
...@@ -22,17 +22,11 @@ public interface ClientVersioningManager { ...@@ -22,17 +22,11 @@ public interface ClientVersioningManager {
int MAJOR_VERSION = 0; int MAJOR_VERSION = 0;
/** /**
* Registers a client that will be advertised to contacts. This method * Registers a client that will be advertised to contacts. The hook will
* should be called before {@link LifecycleManager#startServices(String)}. * be called when the visibility of the client changes. This method should
* be called before {@link LifecycleManager#startServices(String)}.
*/ */
void registerClient(ClientId clientId, int majorVersion, int minorVersion); void registerClient(ClientId clientId, int majorVersion, int minorVersion,
/**
* Registers a hook that will be called when the visibility of the given
* client changes. This method should be called before
* {@link LifecycleManager#startServices(String)}.
*/
void registerClientVersioningHook(ClientId clientId, int majorVersion,
ClientVersioningHook hook); ClientVersioningHook hook);
/** /**
......
...@@ -53,9 +53,7 @@ public class PropertiesModule { ...@@ -53,9 +53,7 @@ public class PropertiesModule {
transportPropertyManager); transportPropertyManager);
contactManager.registerContactHook(transportPropertyManager); contactManager.registerContactHook(transportPropertyManager);
clientVersioningManager.registerClient(CLIENT_ID, MAJOR_VERSION, clientVersioningManager.registerClient(CLIENT_ID, MAJOR_VERSION,
MINOR_VERSION); MINOR_VERSION, transportPropertyManager);
clientVersioningManager.registerClientVersioningHook(CLIENT_ID,
MAJOR_VERSION, transportPropertyManager);
return transportPropertyManager; return transportPropertyManager;
} }
} }
...@@ -80,14 +80,9 @@ class ClientVersioningManagerImpl implements ClientVersioningManager, Client, ...@@ -80,14 +80,9 @@ class ClientVersioningManagerImpl implements ClientVersioningManager, Client,
@Override @Override
public void registerClient(ClientId clientId, int majorVersion, public void registerClient(ClientId clientId, int majorVersion,
int minorVersion) { int minorVersion, ClientVersioningHook hook) {
clients.add(new ClientMinorVersion(clientId, majorVersion, clients.add(new ClientMinorVersion(clientId, majorVersion,
minorVersion)); minorVersion));
}
@Override
public void registerClientVersioningHook(ClientId clientId,
int majorVersion, ClientVersioningHook hook) {
hooks.put(new ClientVersion(clientId, majorVersion), hook); hooks.put(new ClientVersion(clientId, majorVersion), hook);
} }
......
...@@ -57,9 +57,7 @@ public class IntroductionModule { ...@@ -57,9 +57,7 @@ public class IntroductionModule {
MAJOR_VERSION, introductionManager); MAJOR_VERSION, introductionManager);
conversationManager.registerConversationClient(introductionManager); conversationManager.registerConversationClient(introductionManager);
clientVersioningManager.registerClient(CLIENT_ID, MAJOR_VERSION, clientVersioningManager.registerClient(CLIENT_ID, MAJOR_VERSION,
MINOR_VERSION); MINOR_VERSION, introductionManager);
clientVersioningManager.registerClientVersioningHook(CLIENT_ID,
MAJOR_VERSION, introductionManager);
return introductionManager; return introductionManager;
} }
......
...@@ -64,9 +64,7 @@ public class MessagingModule { ...@@ -64,9 +64,7 @@ public class MessagingModule {
messagingManager); messagingManager);
conversationManager.registerConversationClient(messagingManager); conversationManager.registerConversationClient(messagingManager);
clientVersioningManager.registerClient(CLIENT_ID, MAJOR_VERSION, clientVersioningManager.registerClient(CLIENT_ID, MAJOR_VERSION,
MINOR_VERSION); MINOR_VERSION, messagingManager);
clientVersioningManager.registerClientVersioningHook(CLIENT_ID,
MAJOR_VERSION, messagingManager);
return messagingManager; return messagingManager;
} }
......
...@@ -49,17 +49,12 @@ public class GroupInvitationModule { ...@@ -49,17 +49,12 @@ public class GroupInvitationModule {
privateGroupManager.registerPrivateGroupHook(groupInvitationManager); privateGroupManager.registerPrivateGroupHook(groupInvitationManager);
conversationManager.registerConversationClient(groupInvitationManager); conversationManager.registerConversationClient(groupInvitationManager);
clientVersioningManager.registerClient(CLIENT_ID, MAJOR_VERSION, clientVersioningManager.registerClient(CLIENT_ID, MAJOR_VERSION,
MINOR_VERSION); MINOR_VERSION, groupInvitationManager);
clientVersioningManager.registerClientVersioningHook(CLIENT_ID,
MAJOR_VERSION, groupInvitationManager);
// The group invitation manager handles client visibility changes for // The group invitation manager handles client visibility changes for
// the private group manager // the private group manager
clientVersioningManager.registerClient(PrivateGroupManager.CLIENT_ID, clientVersioningManager.registerClient(PrivateGroupManager.CLIENT_ID,
PrivateGroupManager.MAJOR_VERSION, PrivateGroupManager.MAJOR_VERSION,
PrivateGroupManager.MINOR_VERSION); PrivateGroupManager.MINOR_VERSION,
clientVersioningManager.registerClientVersioningHook(
PrivateGroupManager.CLIENT_ID,
PrivateGroupManager.MAJOR_VERSION,
groupInvitationManager.getPrivateGroupClientVersioningHook()); groupInvitationManager.getPrivateGroupClientVersioningHook());
return groupInvitationManager; return groupInvitationManager;
} }
......
...@@ -85,16 +85,11 @@ public class SharingModule { ...@@ -85,16 +85,11 @@ public class SharingModule {
blogManager.registerRemoveBlogHook(blogSharingManager); blogManager.registerRemoveBlogHook(blogSharingManager);
clientVersioningManager.registerClient(BlogSharingManager.CLIENT_ID, clientVersioningManager.registerClient(BlogSharingManager.CLIENT_ID,
BlogSharingManager.MAJOR_VERSION, BlogSharingManager.MAJOR_VERSION,
BlogSharingManager.MINOR_VERSION); BlogSharingManager.MINOR_VERSION, blogSharingManager);
clientVersioningManager.registerClientVersioningHook(
BlogSharingManager.CLIENT_ID, BlogSharingManager.MAJOR_VERSION,
blogSharingManager);
// The blog sharing manager handles client visibility changes for the // The blog sharing manager handles client visibility changes for the
// blog manager // blog manager
clientVersioningManager.registerClient(BlogManager.CLIENT_ID, clientVersioningManager.registerClient(BlogManager.CLIENT_ID,
BlogManager.MAJOR_VERSION, BlogManager.MINOR_VERSION); BlogManager.MAJOR_VERSION, BlogManager.MINOR_VERSION,
clientVersioningManager.registerClientVersioningHook(
BlogManager.CLIENT_ID, BlogManager.MAJOR_VERSION,
blogSharingManager.getShareableClientVersioningHook()); blogSharingManager.getShareableClientVersioningHook());
return blogSharingManager; return blogSharingManager;
} }
...@@ -149,16 +144,11 @@ public class SharingModule { ...@@ -149,16 +144,11 @@ public class SharingModule {
forumManager.registerRemoveForumHook(forumSharingManager); forumManager.registerRemoveForumHook(forumSharingManager);
clientVersioningManager.registerClient(ForumSharingManager.CLIENT_ID, clientVersioningManager.registerClient(ForumSharingManager.CLIENT_ID,
ForumSharingManager.MAJOR_VERSION, ForumSharingManager.MAJOR_VERSION,
ForumSharingManager.MINOR_VERSION); ForumSharingManager.MINOR_VERSION, forumSharingManager);
clientVersioningManager.registerClientVersioningHook(
ForumSharingManager.CLIENT_ID,
ForumSharingManager.MAJOR_VERSION, forumSharingManager);
// The forum sharing manager handles client visibility changes for the // The forum sharing manager handles client visibility changes for the
// forum manager // forum manager
clientVersioningManager.registerClient(ForumManager.CLIENT_ID, clientVersioningManager.registerClient(ForumManager.CLIENT_ID,
ForumManager.MAJOR_VERSION, ForumManager.MINOR_VERSION); ForumManager.MAJOR_VERSION, ForumManager.MINOR_VERSION,
clientVersioningManager.registerClientVersioningHook(
ForumManager.CLIENT_ID, ForumManager.MAJOR_VERSION,
forumSharingManager.getShareableClientVersioningHook()); forumSharingManager.getShareableClientVersioningHook());
return forumSharingManager; return forumSharingManager;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment