@Override public ClientApp build() { initClientApp(); return new ClientApp(); }
public void configureModule(ModuleConfiguration configuration) { configuration.registerPresenters(this); configuration.registerRequests(this); configuration.registerViews(this); configuration.registerListeners(this); configuration.registerInitialTasks(this); configuration.registerRequestRestSenders(this); }
private void start() { fireEvent(MainDominoEvent.class, MAIN_EXTENSION_POINT_HOLDER.attribute); onApplicationStarted(); }
protected void runAsync(AsyncRunner.AsyncTask asyncTask) { ClientApp.make().getAsyncRunner().runAsync(asyncTask); }
public static boolean hasServiceRoot(String path){ final List<DynamicServiceRoot> serviceRoots = ClientApp.make().dominoOptions().getServiceRoots(); return serviceRoots.stream().anyMatch(r -> r.isMatchingPath(path)); } }
protected AppHistory history() { return ClientApp.make().getHistory(); } }
public void configureModule(ModuleConfiguration moduleConfiguration){ ClientApp.make().configureModule(moduleConfiguration); }
private void onApplicationStarted() { ApplicationStartHandler applicationStartHandler = dominoOptions().getApplicationStartHandler(); if (nonNull(applicationStartHandler)) { applicationStartHandler.onApplicationStarted(); } }
@Override public void startRouting() { state = sent; clientApp.getServerRouter().routeRequest(this); }
@Override public void startRouting() { state = sent; clientApp.getClientRouter().routeRequest(this); }
public void run() { run(canSetDominoOptions -> { }); }
public static HasPathMatcher pathMatcher(PathMatcher pathMatcher){ return new DynamicServiceRoot(pathMatcher); }
public boolean isMatchingPath(String path){ return pathMatcher.isMatch(path); }
public String onMatchingPath(){ return serviceRoot.onMatch(); }
public static HasClientRouter clientRouter(RequestRouter<PresenterCommand> clientRouter) { return new ClientAppBuilder(clientRouter); }
private void initClientApp() { ClientApp.CLIENT_ROUTER_HOLDER.hold(clientRouter); ClientApp.SERVER_ROUTER_HOLDER.hold(serverRouter); ClientApp.EVENTS_BUS_HOLDER.hold(eventsBus); ClientApp.COMMANDS_REPOSITORY_HOLDER.hold(requestRepository); ClientApp.PRESENTERS_REPOSITORY_HOLDER.hold(presentersRepository); ClientApp.VIEWS_REPOSITORY_HOLDER.hold(viewsRepository); ClientApp.LISTENERS_REPOSITORY_HOLDER.hold(dominoEventsListenersRepository); ClientApp.REQUEST_REST_SENDERS_REPOSITORY_HOLDER.hold(requestRestSendersRepository); ClientApp.MAIN_EXTENSION_POINT_HOLDER.hold(mainDominoEvent); ClientApp.HISTORY_HOLDER.hold(history); ClientApp.INITIAL_TASKS_HOLDER.hold(new LinkedList<>()); ClientApp.ASYNC_RUNNER_HOLDER.hold(asyncRunner); ClientApp.DOMINO_OPTIONS_HOLDER.hold(dominoOptions); } }
@Override public void routeRequest(final PresenterCommand presenterCommand) { ClientApp.make().getAsyncRunner().runAsync(new AsyncRunner.AsyncTask() { @Override public void onSuccess() { requestEventFactory.make(presenterCommand).fire(); } @Override public void onFailed(Throwable error) { LOGGER.error("Could not RunAsync request [" + presenterCommand + "]", error); } }); } }
public static String matchedServiceRoot(String path) { final List<DynamicServiceRoot> serviceRoots = ClientApp.make().dominoOptions().getServiceRoots(); return serviceRoots.stream().filter(r -> r.isMatchingPath(path)).findFirst().orElse(defaultRoot).onMatchingPath(); }
@SuppressWarnings("rawtypes") @Override public final void send(final ServerRequest request) { ClientApp.make().getAsyncRunner().runAsync(new RequestAsyncTask(request)); }