Search in sources :

Example 1 with IInvocationServiceClient

use of org.jowidgets.invocation.service.client.api.IInvocationServiceClient in project jo-client-platform by jo-source.

the class RemotingServiceProviderFactory method create.

/**
 * Creates the service provider for the remote services defined by the broker id
 *
 * @param brokerId The broker id to get the remote services for
 * @param timeout The timeout after giving up, e.g. if server is not available
 * @param cancelCallback A cancel callback that can be used to cancel the creation
 *
 * @return The ServiceProvider
 *
 * @throws RemotingTimeoutException if the timeout elapsed before initialization
 */
public static IServiceProvider create(final Object brokerId, final long timeout, final ICancelCallback cancelCallback) {
    final ServiceProviderBuilder builder = new ServiceProviderBuilder();
    final IInvocationServiceClient invocationServiceClient = InvocationServiceClientToolkit.getClient(brokerId);
    final IMethodInvocationService<Set<? extends IServiceId<?>>, Void, Void, Void, Void> methodService;
    methodService = invocationServiceClient.getMethodService(CapInvocationMethodNames.SERVICE_LOCATOR_METHOD_NAME);
    final SyncInvocationCallback<Set<? extends IServiceId<?>>> invocationCallback;
    invocationCallback = new SyncInvocationCallback<Set<? extends IServiceId<?>>>(getExecutionCallback(cancelCallback), timeout);
    methodService.invoke(invocationCallback, null, null, null);
    addServices(builder, brokerId, invocationCallback.getResultSynchronious());
    return builder.build();
}
Also used : IInvocationServiceClient(org.jowidgets.invocation.service.client.api.IInvocationServiceClient) Set(java.util.Set) IObserverSet(org.jowidgets.util.collection.IObserverSet) IServiceId(org.jowidgets.service.api.IServiceId) ServiceProviderBuilder(org.jowidgets.service.tools.ServiceProviderBuilder)

Aggregations

Set (java.util.Set)1 IInvocationServiceClient (org.jowidgets.invocation.service.client.api.IInvocationServiceClient)1 IServiceId (org.jowidgets.service.api.IServiceId)1 ServiceProviderBuilder (org.jowidgets.service.tools.ServiceProviderBuilder)1 IObserverSet (org.jowidgets.util.collection.IObserverSet)1