use of com.canoo.platform.client.ClientConfiguration in project dolphin-platform-examples by canoo.
the class Client method createClientContext.
private final ClientContext createClientContext(final URI endpoint) throws Exception {
final ClientConfiguration clientConfiguration = PlatformClient.getClientConfiguration();
final ClientContextFactory clientContextFactory = PlatformClient.getService(ClientContextFactory.class);
return clientContextFactory.create(clientConfiguration, endpoint);
}
use of com.canoo.platform.client.ClientConfiguration in project dolphin-platform-examples by canoo.
the class Client method showApp.
private void showApp(final Stage primaryStage) throws Exception {
final ClientConfiguration clientConfiguration = PlatformClient.getClientConfiguration();
final ClientContextFactory contextFactory = PlatformClient.getService(ClientContextFactory.class);
final URI endpoint = new URI("http://localhost:8080/dolphin");
final ClientContext clientContext = contextFactory.create(clientConfiguration, endpoint);
clientContext.connect().handle((v, e) -> {
final UserView view = new UserView(clientContext);
Platform.runLater(() -> {
primaryStage.setScene(new Scene(view.getParent()));
primaryStage.show();
});
return null;
});
}
use of com.canoo.platform.client.ClientConfiguration in project dolphin-platform by canoo.
the class LogListViewController method init.
@Override
protected void init() {
FXBinder.bind(listView.getItems()).to(getModel().getEntries(), b -> convertBean(b));
invoke(UPDATE_ACTION);
final ClientConfiguration clientConfiguration = PlatformClient.getClientConfiguration();
clientConfiguration.getBackgroundExecutor().execute(() -> {
while (true) {
try {
Thread.sleep(2_000);
} catch (InterruptedException e) {
e.printStackTrace();
}
clientConfiguration.getUiExecutor().execute(() -> invoke(UPDATE_ACTION));
}
});
}
use of com.canoo.platform.client.ClientConfiguration in project dolphin-platform by canoo.
the class ClientContextFactoryImpl method create.
/**
* Create a {@link ClientContext} based on the given configuration. This method doesn't block and returns a
* {@link CompletableFuture} to receive its result. If the {@link ClientContext} can't be created the
* {@link CompletableFuture#get()} will throw a {@link ClientInitializationException}.
*
* @param clientConfiguration the configuration
* @return the future
*/
public ClientContext create(final ClientConfiguration clientConfiguration, final URI endpoint) {
Assert.requireNonNull(clientConfiguration, "clientConfiguration");
final HttpClient httpClient = PlatformClient.getService(HttpClient.class);
final HttpURLConnectionHandler clientSessionCheckResponseHandler = new StrictClientSessionResponseHandler(endpoint);
httpClient.addResponseHandler(clientSessionCheckResponseHandler);
final Function<ClientModelStore, AbstractClientConnector> connectionProvider = s -> {
return new DolphinPlatformHttpClientConnector(endpoint, clientConfiguration, s, OptimizedJsonCodec.getInstance(), e -> {
}, httpClient);
};
return new ClientContextImpl(clientConfiguration, endpoint, connectionProvider, PlatformClient.getService(ClientSessionStore.class));
}
Aggregations