sPFLib/src/main/java/it/polimi/spf/lib/Component.java
protected static <C extends Component<C, I>, I extends IInterface> void load(final Context context, final Descriptor<C, I> descriptor, final ConnectionCallback<C> callback) {

		Utils.notNull(context, "context must not be null");
		Utils.notNull(descriptor, "context must not be null");

		if (AccessTokenManager.get(context).hasToken()) {
			bindToService(context, descriptor, callback);
		} else {
			AccessTokenManager.get(context).requireAccessToken(context, new AccessTokenManager.RegistrationCallback() {

				@Override
				public void onRegistrationSuccessful() {
					Log.d("Component" , "Access Toekn: " + descriptor);
					bindToService(context, descriptor, callback);
				}

				@Override
				public void onRegistrationError(SPFError errorMsg) {
					callback.onError(errorMsg);
				}
			});
		}

	}
protected static <C extends Component<C, I>, I extends IInterface> void load(final Context context, final Descriptor<C, I> descriptor, final ConnectionCallback<C> callback) {

		Utils.notNull(context, "context must not be null");
		Utils.notNull(descriptor, "context must not be null");

		if (AccessTokenManager.get(context).hasToken()) {
			bindToService(context, descriptor, callback);
		} else {
			AccessTokenManager.get(context).requireAccessToken(context, new AccessTokenManager.RegistrationCallback() {

				@Override
				public void onRegistrationSuccessful() {
					Log.d("Component" , "Access Toekn: " + descriptor);
					bindToService(context, descriptor, callback);
				}

				@Override
				public void onRegistrationError(SPFError errorMsg) {
					callback.onError(errorMsg);
				}
			});
		}

	}
protected static < C extends Component < C , I > , I extends IInterface > void load ( final Context context , final Descriptor < C , I > descriptor , final ConnectionCallback < C > callback ) { Utils . notNull ( context , "context must not be null" ) ; Utils . notNull ( descriptor , "context must not be null" ) ; if ( AccessTokenManager . get ( context ) . hasToken ( ) ) { bindToService ( context , descriptor , callback ) ; } else { AccessTokenManager . get ( context ) . requireAccessToken ( context , new AccessTokenManager . RegistrationCallback ( ) { @ Override public void onRegistrationSuccessful ( ) { Log . d ( "Component" , "Access Toekn: " + descriptor ) ; bindToService ( context , descriptor , callback ) ; } @ Override public void onRegistrationError ( SPFError errorMsg ) { callback . onError ( errorMsg ) ; } } ) ; } }
Loads a local component asynchronously.

@param context
- the context to use to bind to the service
@param descriptor
- a {@link Descriptor} to handle the creation of the
component;
@param callback
- the callback to be notified when the service is available
@param <C>
the type of the Component concrete implementation
@param <I>
the type of the AIDL interface that is wrapped by the
component
Loads a local component asynchronously .