| Chunk |
|---|
| Conflicting content |
|---|
import org.societies.android.api.comms.IMethodCallback; import org.societies.android.api.css.directory.IAndroidCssDirectory; import org.societies.android.api.css.manager.IServiceManager; <<<<<<< HEAD import org.societies.android.api.events.IAndroidSocietiesEvents; import org.societies.android.api.internal.context.IInternalCtxClient; ======= >>>>>>> b8ca5af46f857705b0fc9d84f23fd641e908a161 import org.societies.android.api.internal.cssmanager.IFriendsManager; import org.societies.android.api.internal.privacytrust.IPrivacyPolicyManager; import org.societies.android.api.internal.privacytrust.trust.IInternalTrustClient; |
| Solution content |
|---|
import org.societies.android.api.comms.IMethodCallback; import org.societies.android.api.css.directory.IAndroidCssDirectory; import org.societies.android.api.css.manager.IServiceManager; import org.societies.android.api.events.IAndroidSocietiesEvents; import org.societies.android.api.internal.context.IInternalCtxClient; import org.societies.android.api.internal.cssmanager.IFriendsManager; import org.societies.android.api.internal.privacytrust.IPrivacyPolicyManager; import org.societies.android.api.internal.privacytrust.trust.IInternalTrustClient; |
| File |
|---|
| SocietiesClientServicesController.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
*/
*
* Start all Societies Client app services
* for services that are considered essential and are dependencies of some or all services started in this class.
*/
public class SocietiesClientServicesController {
<<<<<<< HEAD
private final static String LOG_TAG = SocietiesClientServicesController.class.getName();
//timeout for bind, start and stop all services
private final static long TASK_TIMEOUT = 10000;
private final static int NUM_SERVICES = 14;
private final static int CIS_DIRECTORY_SERVICE = 0;
private final static int CIS_MANAGER_SERVICE = 1;
private final static int CIS_SUBSCRIBED_SERVICE = 2;
private final static int CSS_DIRECTORY_SERVICE = 3;
private final static int TRUST_SERVICE = 4;
private final static int SLM_SERVICE_CONTROL_SERVICE= 5;
private final static int PRIVACY_DATA_SERVICE = 6;
private final static int PRIVACY_POLICY_SERVICE = 7;
private final static int SNS_SOCIAL_DATA_SERVICE = 8;
private final static int PERSONALISATION_SERVICE = 9;
private final static int SLM_SERVICE_DISCO_SERVICE = 10;
private final static int FRIENDS_MANAGER_SERVICE = 11;
private final static int CONTEXT_SERVICE = 12;
private final static int INTERNAL_TRUST_SERVICE = 13;
private Context context;
private CountDownLatch servicesBinded;
private CountDownLatch servicesStarted;
private CountDownLatch servicesStopped;
private BroadcastReceiver startupReceiver;
private BroadcastReceiver shutdownReceiver;
private boolean connectedToServices[];
private ServiceConnection platformServiceConnections [];
private Messenger allMessengers [];
private IAndroidCssDirectory cssDirectoryService;
private IServiceDiscovery slmServiceDisco;
private IServiceControl slmServiceControl;
private ISocialData snsConnectorService;
private IFriendsManager friendMgrService;
private IPrivacyPolicyManager privacyPolicyService;
private IInternalTrustClient internalTrustService;
private long startTime;
public SocietiesClientServicesController(Context context) {
this.context = context;
this.connectedToServices = new boolean[NUM_SERVICES];
allMessengers = new Messenger[NUM_SERVICES];
this.platformServiceConnections = new ServiceConnection[NUM_SERVICES];
this.startupReceiver = null;
this.shutdownReceiver = null;
}
/**
* Bind to the app services. Assumes that login has already taken place
* @param IMethodCallback callback
*/
public void bindToServices(IMethodCallback callback) {
//set up broadcast receiver for start/bind actions
setupStartupBroadcastReceiver();
InvokeBindAllServices invoker = new InvokeBindAllServices(callback);
invoker.execute();
}
/**
* Unbind from app services
*
*/
public void unbindFromServices() {
Log.d(LOG_TAG, "Unbind from Societies Platform Services");
for (int i = 0; i < this.connectedToServices.length; i++) {
if (this.connectedToServices[i]) {
this.context.unbindService(this.platformServiceConnections[i]);
}
}
//tear down broadcast receiver after stop/unbind actions
this.teardownBroadcastReceiver(this.shutdownReceiver);
}
/**
* Start all Societies Client app services
* @param callback
*/
public void startAllServices(IMethodCallback callback) {
InvokeStartAllServices invoker = new InvokeStartAllServices(callback);
invoker.execute();
}
/**
* Stop all Societies Client app services
* @param callback
*/
public void stopAllServices(IMethodCallback callback) {
//set up broadcast receiver for stop/unbind actions
setupShutdownBroadcastReceiver();
InvokeStopAllServices invoker = new InvokeStopAllServices(callback);
invoker.execute();
}
/**
* Service Connection objects
*/
=======
private final static String LOG_TAG = SocietiesClientServicesController.class.getCanonicalName();
//timeout for bind, start and stop all services
private final static long TASK_TIMEOUT = 10000;
private final static int NUM_SERVICES = 12;
private final static int CIS_DIRECTORY_SERVICE = 0;
private final static int CIS_MANAGER_SERVICE = 1;
private final static int CIS_SUBSCRIBED_SERVICE = 2;
private final static int CSS_DIRECTORY_SERVICE = 3;
private final static int TRUST_SERVICE = 4;
private final static int SLM_SERVICE_CONTROL_SERVICE= 5;
private final static int PRIVACY_DATA_SERVICE = 6;
private final static int PRIVACY_POLICY_SERVICE = 7;
private final static int SNS_SOCIAL_DATA_SERVICE = 8;
private final static int PERSONALISATION_SERVICE = 9;
private final static int SLM_SERVICE_DISCO_SERVICE = 10;
private final static int FRIENDS_MANAGER_SERVICE = 11;
private Context context;
private CountDownLatch servicesBinded;
private CountDownLatch servicesStarted;
private CountDownLatch servicesStopped;
private BroadcastReceiver startupReceiver;
private BroadcastReceiver shutdownReceiver;
private boolean connectedToServices[];
private ServiceConnection platformServiceConnections[];
private Messenger allMessengers[];
private IAndroidCssDirectory cssDirectoryService;
private IServiceDiscovery slmServiceDisco;
private IServiceControl slmServiceControl;
private ISocialData snsConnectorService;
private IFriendsManager friendMgrService;
private IPrivacyPolicyManager privacyPolicyService;
private long startTime;
public SocietiesClientServicesController(Context context) {
this.context = context;
this.connectedToServices = new boolean[NUM_SERVICES];
allMessengers = new Messenger[NUM_SERVICES];
this.platformServiceConnections = new ServiceConnection[NUM_SERVICES];
this.startupReceiver = null;
this.shutdownReceiver = null;
}
/**
* Bind to the app services. Assumes that login has already taken place
*/
public void bindToServices(IMethodCallback callback) {
//set up broadcast receiver for start/bind actions
setupStartupBroadcastReceiver();
InvokeBindAllServices invoker = new InvokeBindAllServices(callback);
invoker.execute();
}
/**
* Unbind from app services
*/
public void unbindFromServices() {
Log.d(LOG_TAG, "Unbind from Societies Platform Services");
for (int i = 0; i < this.connectedToServices.length; i++) {
if (this.connectedToServices[i]) {
this.context.unbindService(this.platformServiceConnections[i]);
}
}
//tear down broadcast receiver after stop/unbind actions
this.teardownBroadcastReceiver(this.shutdownReceiver);
}
/**
public void startAllServices(IMethodCallback callback) {
InvokeStartAllServices invoker = new InvokeStartAllServices(callback);
invoker.execute();
}
/**
* Stop all Societies Client app services
*/
public void stopAllServices(IMethodCallback callback) {
//set up broadcast receiver for stop/unbind actions
setupShutdownBroadcastReceiver();
InvokeStopAllServices invoker = new InvokeStopAllServices(callback);
invoker.execute();
}
/**
* Service Connection objects
*/
>>>>>>> b8ca5af46f857705b0fc9d84f23fd641e908a161
private ServiceConnection cisDirectoryConnection = new ServiceConnection() {
|
| Solution content |
|---|
* for services that are considered essential and are dependencies of some or all services started in this class.
*
*/
public class SocietiesClientServicesController {
private final static String LOG_TAG = SocietiesClientServicesController.class.getName();
//timeout for bind, start and stop all services
private final static long TASK_TIMEOUT = 10000;
private final static int NUM_SERVICES = 14;
private final static int CIS_DIRECTORY_SERVICE = 0;
private final static int CIS_MANAGER_SERVICE = 1;
private final static int CIS_SUBSCRIBED_SERVICE = 2;
private final static int CSS_DIRECTORY_SERVICE = 3;
private final static int TRUST_SERVICE = 4;
private final static int SLM_SERVICE_CONTROL_SERVICE= 5;
private final static int PRIVACY_DATA_SERVICE = 6;
private final static int PRIVACY_POLICY_SERVICE = 7;
private final static int SNS_SOCIAL_DATA_SERVICE = 8;
private final static int PERSONALISATION_SERVICE = 9;
private final static int SLM_SERVICE_DISCO_SERVICE = 10;
private final static int FRIENDS_MANAGER_SERVICE = 11;
private final static int CONTEXT_SERVICE = 12;
private final static int INTERNAL_TRUST_SERVICE = 13;
private Context context;
private CountDownLatch servicesBinded;
private CountDownLatch servicesStarted;
private CountDownLatch servicesStopped;
private BroadcastReceiver startupReceiver;
private BroadcastReceiver shutdownReceiver;
private boolean connectedToServices[];
private ServiceConnection platformServiceConnections [];
private Messenger allMessengers [];
private IAndroidCssDirectory cssDirectoryService;
private IServiceDiscovery slmServiceDisco;
private IServiceControl slmServiceControl;
private ISocialData snsConnectorService;
private IFriendsManager friendMgrService;
private IPrivacyPolicyManager privacyPolicyService;
private IInternalTrustClient internalTrustService;
private long startTime;
public SocietiesClientServicesController(Context context) {
this.context = context;
this.connectedToServices = new boolean[NUM_SERVICES];
allMessengers = new Messenger[NUM_SERVICES];
this.platformServiceConnections = new ServiceConnection[NUM_SERVICES];
this.startupReceiver = null;
this.shutdownReceiver = null;
}
/**
* Bind to the app services. Assumes that login has already taken place
*
* @param IMethodCallback callback
*/
public void bindToServices(IMethodCallback callback) {
//set up broadcast receiver for start/bind actions
setupStartupBroadcastReceiver();
InvokeBindAllServices invoker = new InvokeBindAllServices(callback);
invoker.execute();
}
/**
* Unbind from app services
*
*/
public void unbindFromServices() {
Log.d(LOG_TAG, "Unbind from Societies Platform Services");
for (int i = 0; i < this.connectedToServices.length; i++) {
if (this.connectedToServices[i]) {
this.context.unbindService(this.platformServiceConnections[i]);
}
}
//tear down broadcast receiver after stop/unbind actions
this.teardownBroadcastReceiver(this.shutdownReceiver);
}
/**
* Start all Societies Client app services
* @param callback
*/
public void startAllServices(IMethodCallback callback) {
InvokeStartAllServices invoker = new InvokeStartAllServices(callback);
invoker.execute();
}
/**
* Stop all Societies Client app services
* @param callback
*/
public void stopAllServices(IMethodCallback callback) {
//set up broadcast receiver for stop/unbind actions
setupShutdownBroadcastReceiver();
InvokeStopAllServices invoker = new InvokeStopAllServices(callback);
invoker.execute();
}
/**
* Service Connection objects
*/
private ServiceConnection cisDirectoryConnection = new ServiceConnection() {
|
| File |
|---|
| SocietiesClientServicesController.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| Method declaration |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
SocietiesClientServicesController.this.servicesBinded.countDown();
}
};
<<<<<<< HEAD
private ServiceConnection personalisationMgrConnection = new ServiceConnection() {
final static String SERVICE_NAME = "Platform Personalisation Manager";
public void onServiceDisconnected(ComponentName name) {
Log.d(LOG_TAG, "Disconnecting from " + SERVICE_NAME + " service");
SocietiesClientServicesController.this.connectedToServices[PERSONALISATION_SERVICE] = false;
}
public void onServiceConnected(ComponentName name, IBinder service) {
Log.d(LOG_TAG, "Connecting to " + SERVICE_NAME + " service");
SocietiesClientServicesController.this.connectedToServices[PERSONALISATION_SERVICE] = true;
//get a remote binder
SocietiesClientServicesController.this.allMessengers[PERSONALISATION_SERVICE] = new Messenger(service);
SocietiesClientServicesController.this.platformServiceConnections[PERSONALISATION_SERVICE] = this;
SocietiesClientServicesController.this.servicesBinded.countDown();
Log.d(LOG_TAG, "Time to bind to " + SERVICE_NAME + " service: " + Long.toString(System.currentTimeMillis() - SocietiesClientServicesController.this.startTime));
}
};
private ServiceConnection friendsMgrConnection = new ServiceConnection() {
public void onServiceDisconnected(ComponentName name) {
Log.d(LOG_TAG, "Disconnecting from Platform Friends Manager service");
SocietiesClientServicesController.this.connectedToServices[FRIENDS_MANAGER_SERVICE] = false;
}
public void onServiceConnected(ComponentName name, IBinder service) {
Log.d(LOG_TAG, "Connecting to Platform Friends Manager service");
SocietiesClientServicesController.this.connectedToServices[FRIENDS_MANAGER_SERVICE] = true;
//Get a local binder
LocalFriendsManagerBinder binder = (LocalFriendsManagerBinder) service;
//Retrieve the local service API
SocietiesClientServicesController.this.friendMgrService = (IFriendsManager) binder.getService();
SocietiesClientServicesController.this.platformServiceConnections[FRIENDS_MANAGER_SERVICE] = this;
SocietiesClientServicesController.this.servicesBinded.countDown();
}
};
private ServiceConnection contextConnection = new ServiceConnection() {
final static String SERVICE_NAME = "Platform Context";
public void onServiceDisconnected(ComponentName name) {
Log.d(LOG_TAG, "Disconnecting from " + SERVICE_NAME + " service");
SocietiesClientServicesController.this.connectedToServices[CONTEXT_SERVICE] = false;
}
public void onServiceConnected(ComponentName name, IBinder service) {
Log.d(LOG_TAG, "Connecting to " + SERVICE_NAME + " service");
SocietiesClientServicesController.this.connectedToServices[CONTEXT_SERVICE] = true;
//get a remote binder
SocietiesClientServicesController.this.allMessengers[CONTEXT_SERVICE] = new Messenger(service);
SocietiesClientServicesController.this.platformServiceConnections[CONTEXT_SERVICE] = this;
SocietiesClientServicesController.this.servicesBinded.countDown();
Log.d(LOG_TAG, "Time to bind to " + SERVICE_NAME + " service: " + Long.toString(System.currentTimeMillis() - SocietiesClientServicesController.this.startTime));
}
};
=======
>>>>>>> b8ca5af46f857705b0fc9d84f23fd641e908a161
// private ServiceConnection ???Connection = new ServiceConnection() {
// |
| Solution content |
|---|
}
};
private ServiceConnection personalisationMgrConnection = new ServiceConnection() {
final static String SERVICE_NAME = "Platform Personalisation Manager";
public void onServiceDisconnected(ComponentName name) {
Log.d(LOG_TAG, "Disconnecting from " + SERVICE_NAME + " service");
SocietiesClientServicesController.this.connectedToServices[PERSONALISATION_SERVICE] = false;
}
public void onServiceConnected(ComponentName name, IBinder service) {
Log.d(LOG_TAG, "Connecting to " + SERVICE_NAME + " service");
SocietiesClientServicesController.this.connectedToServices[PERSONALISATION_SERVICE] = true;
//get a remote binder
SocietiesClientServicesController.this.allMessengers[PERSONALISATION_SERVICE] = new Messenger(service);
SocietiesClientServicesController.this.platformServiceConnections[PERSONALISATION_SERVICE] = this;
SocietiesClientServicesController.this.servicesBinded.countDown();
Log.d(LOG_TAG, "Time to bind to " + SERVICE_NAME + " service: " + Long.toString(System.currentTimeMillis() - SocietiesClientServicesController.this.startTime));
}
};
private ServiceConnection friendsMgrConnection = new ServiceConnection() {
public void onServiceDisconnected(ComponentName name) {
Log.d(LOG_TAG, "Disconnecting from Platform Friends Manager service");
SocietiesClientServicesController.this.connectedToServices[FRIENDS_MANAGER_SERVICE] = false;
}
public void onServiceConnected(ComponentName name, IBinder service) {
Log.d(LOG_TAG, "Connecting to Platform Friends Manager service");
SocietiesClientServicesController.this.connectedToServices[FRIENDS_MANAGER_SERVICE] = true;
//Get a local binder
LocalFriendsManagerBinder binder = (LocalFriendsManagerBinder) service;
//Retrieve the local service API
SocietiesClientServicesController.this.friendMgrService = (IFriendsManager) binder.getService();
SocietiesClientServicesController.this.platformServiceConnections[FRIENDS_MANAGER_SERVICE] = this;
SocietiesClientServicesController.this.servicesBinded.countDown();
}
};
private ServiceConnection contextConnection = new ServiceConnection() {
final static String SERVICE_NAME = "Platform Context";
public void onServiceDisconnected(ComponentName name) {
Log.d(LOG_TAG, "Disconnecting from " + SERVICE_NAME + " service");
SocietiesClientServicesController.this.connectedToServices[CONTEXT_SERVICE] = false;
}
public void onServiceConnected(ComponentName name, IBinder service) {
Log.d(LOG_TAG, "Connecting to " + SERVICE_NAME + " service");
SocietiesClientServicesController.this.connectedToServices[CONTEXT_SERVICE] = true;
//get a remote binder
SocietiesClientServicesController.this.allMessengers[CONTEXT_SERVICE] = new Messenger(service);
SocietiesClientServicesController.this.platformServiceConnections[CONTEXT_SERVICE] = this;
SocietiesClientServicesController.this.servicesBinded.countDown();
Log.d(LOG_TAG, "Time to bind to " + SERVICE_NAME + " service: " + Long.toString(System.currentTimeMillis() - SocietiesClientServicesController.this.startTime));
}
};
// private ServiceConnection ???Connection = new ServiceConnection() {
// |
| File |
|---|
| SocietiesClientServicesController.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Attribute |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
}
*/
private class InvokeBindAllServices extends AsyncTask |
| Solution content |
|---|
*/
private class InvokeBindAllServices extends AsyncTask |
| File |
|---|
| SocietiesClientServicesController.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Annotation |
| Attribute |
| Comment |
| Method declaration |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
/**
*/
private class InvokeStartAllServices extends AsyncTask |
| Solution content |
|---|
*/
private class InvokeStartAllServices extends AsyncTask |
| File |
|---|
| SocietiesClientServicesController.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Attribute |
| Comment |
| For statement |
| Method declaration |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
*/
private class InvokeStopAllServices extends AsyncTask |
| Solution content |
|---|
*/
private class InvokeStopAllServices extends AsyncTask |
| File |
|---|
| SocietiesClientServicesController.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Attribute |
| Comment |
| For statement |
| Method declaration |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
* Create the correct message for remote method invocation
*/
private android.os.Message getRemoteMessage(String targetMethod, int index) {
<<<<<<< HEAD
android.os.Message retValue = null;
switch (index) {
case CIS_DIRECTORY_SERVICE:
retValue = android.os.Message.obtain(null, ServiceMethodTranslator.getMethodIndex(ICisDirectory.methodsArray, targetMethod), 0, 0);
break;
case CIS_MANAGER_SERVICE:
retValue = android.os.Message.obtain(null, ServiceMethodTranslator.getMethodIndex(ICisManager.methodsArray, targetMethod), 0, 0);
break;
case CIS_SUBSCRIBED_SERVICE:
retValue = android.os.Message.obtain(null, ServiceMethodTranslator.getMethodIndex(ICisSubscribed.methodsArray, targetMethod), 0, 0);
break;
case TRUST_SERVICE:
retValue = android.os.Message.obtain(null, ServiceMethodTranslator.getMethodIndex(IInternalTrustClient.methodsArray, targetMethod), 0, 0);
break;
case CONTEXT_SERVICE:
retValue = android.os.Message.obtain(null, ServiceMethodTranslator.getMethodIndex(IInternalCtxClient.methodsArray, targetMethod), 0, 0);
break;
=======
android.os.Message retValue = null;
switch (index) {
case CIS_DIRECTORY_SERVICE:
retValue = android.os.Message.obtain(null, ServiceMethodTranslator.getMethodIndex(ICisDirectory.methodsArray, targetMethod), 0, 0);
break;
case CIS_MANAGER_SERVICE:
retValue = android.os.Message.obtain(null, ServiceMethodTranslator.getMethodIndex(ICisManager.methodsArray, targetMethod), 0, 0);
break;
case CIS_SUBSCRIBED_SERVICE:
retValue = android.os.Message.obtain(null, ServiceMethodTranslator.getMethodIndex(ICisSubscribed.methodsArray, targetMethod), 0, 0);
break;
case TRUST_SERVICE:
retValue = android.os.Message.obtain(null, ServiceMethodTranslator.getMethodIndex(IInternalTrustClient.methodsArray, targetMethod), 0, 0);
break;
>>>>>>> b8ca5af46f857705b0fc9d84f23fd641e908a161
// case ???_SERVICE:
// retValue = android.os.Message.obtain(null, ServiceMethodTranslator.getMethodIndex(???.methodsArray, targetMethod), 0, 0);
// break; |
| Solution content |
|---|
* Create the correct message for remote method invocation
*
* @param targetMethod
* @param index
* @return android.os.Message
*/
private android.os.Message getRemoteMessage(String targetMethod, int index) {
android.os.Message retValue = null;
switch (index) {
case CIS_DIRECTORY_SERVICE:
retValue = android.os.Message.obtain(null, ServiceMethodTranslator.getMethodIndex(ICisDirectory.methodsArray, targetMethod), 0, 0);
break;
case CIS_MANAGER_SERVICE:
retValue = android.os.Message.obtain(null, ServiceMethodTranslator.getMethodIndex(ICisManager.methodsArray, targetMethod), 0, 0);
break;
case CIS_SUBSCRIBED_SERVICE:
retValue = android.os.Message.obtain(null, ServiceMethodTranslator.getMethodIndex(ICisSubscribed.methodsArray, targetMethod), 0, 0);
break;
case TRUST_SERVICE:
retValue = android.os.Message.obtain(null, ServiceMethodTranslator.getMethodIndex(IInternalTrustClient.methodsArray, targetMethod), 0, 0);
break;
case CONTEXT_SERVICE:
retValue = android.os.Message.obtain(null, ServiceMethodTranslator.getMethodIndex(IInternalCtxClient.methodsArray, targetMethod), 0, 0);
break;
// case ???_SERVICE:
// retValue = android.os.Message.obtain(null, ServiceMethodTranslator.getMethodIndex(???.methodsArray, targetMethod), 0, 0);
// break; |
| File |
|---|
| SocietiesClientServicesController.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Break statement |
| Case statement |
| Method invocation |
| Switch statement |
| Variable |