-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added builder for the root route and removed routes visitor as the ro…
…ute can be created with customized sub-route directly. Signed-off-by: Johannes Schneider <johannes.schneider@bosch-si.com>
- Loading branch information
Johannes Schneider
committed
Jan 8, 2019
1 parent
7048845
commit b6f6e9c
Showing
9 changed files
with
717 additions
and
332 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
386 changes: 206 additions & 180 deletions
386
...ndpoints/src/main/java/org/eclipse/ditto/services/gateway/endpoints/routes/RootRoute.java
Large diffs are not rendered by default.
Oops, something went wrong.
197 changes: 197 additions & 0 deletions
197
...s/src/main/java/org/eclipse/ditto/services/gateway/endpoints/routes/RootRouteBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
/* | ||
* Copyright (c) 2017-2018 Bosch Software Innovations GmbH. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/org/documents/epl-2.0/index.php | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.eclipse.ditto.services.gateway.endpoints.routes; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.ditto.protocoladapter.HeaderTranslator; | ||
import org.eclipse.ditto.services.gateway.endpoints.directives.auth.GatewayAuthenticationDirective; | ||
import org.eclipse.ditto.services.gateway.endpoints.routes.devops.DevOpsRoute; | ||
import org.eclipse.ditto.services.gateway.endpoints.routes.health.CachingHealthRoute; | ||
import org.eclipse.ditto.services.gateway.endpoints.routes.policies.PoliciesRoute; | ||
import org.eclipse.ditto.services.gateway.endpoints.routes.sse.SseThingsRoute; | ||
import org.eclipse.ditto.services.gateway.endpoints.routes.stats.StatsRoute; | ||
import org.eclipse.ditto.services.gateway.endpoints.routes.status.OverallStatusRoute; | ||
import org.eclipse.ditto.services.gateway.endpoints.routes.things.ThingsRoute; | ||
import org.eclipse.ditto.services.gateway.endpoints.routes.thingsearch.ThingSearchRoute; | ||
import org.eclipse.ditto.services.gateway.endpoints.routes.websocket.WebsocketRoute; | ||
import org.eclipse.ditto.services.utils.health.routes.StatusRoute; | ||
import org.eclipse.ditto.services.utils.protocol.ProtocolAdapterProvider; | ||
|
||
import akka.http.javadsl.server.ExceptionHandler; | ||
import akka.http.javadsl.server.RejectionHandler; | ||
import akka.http.javadsl.server.Route; | ||
|
||
/** | ||
* A builder for the root {@code Route}. | ||
*/ | ||
public interface RootRouteBuilder { | ||
|
||
/** | ||
* Sets the status sub-route. | ||
* | ||
* @param route the route to set. | ||
* @return the Builder to allow method chaining. | ||
*/ | ||
RootRouteBuilder statusRoute(StatusRoute route); | ||
|
||
/** | ||
* Sets the overall status sub-route. | ||
* | ||
* @param route the route to set. | ||
* @return the Builder to allow method chaining. | ||
*/ | ||
RootRouteBuilder overallStatusRoute(OverallStatusRoute route); | ||
|
||
/** | ||
* Sets the caching health sub-route. | ||
* | ||
* @param route the route to set. | ||
* @return the Builder to allow method chaining. | ||
*/ | ||
RootRouteBuilder cachingHealthRoute(CachingHealthRoute route); | ||
|
||
/** | ||
* Sets the devops sub-route. | ||
* | ||
* @param route the route to set. | ||
* @return the Builder to allow method chaining. | ||
*/ | ||
RootRouteBuilder devopsRoute(DevOpsRoute route); | ||
|
||
/** | ||
* Sets the policies sub-route. | ||
* | ||
* @param route the route to set. | ||
* @return the Builder to allow method chaining. | ||
*/ | ||
RootRouteBuilder policiesRoute(PoliciesRoute route); | ||
|
||
/** | ||
* Sets the sse things sub-route. | ||
* | ||
* @param route the route to set. | ||
* @return the Builder to allow method chaining. | ||
*/ | ||
RootRouteBuilder sseThingsRoute(SseThingsRoute route); | ||
|
||
/** | ||
* Sets the things sub-route. | ||
* | ||
* @param route the route to set. | ||
* @return the Builder to allow method chaining. | ||
*/ | ||
RootRouteBuilder thingsRoute(ThingsRoute route); | ||
|
||
/** | ||
* Sets the thing search sub-route. | ||
* | ||
* @param route the route to set. | ||
* @return the Builder to allow method chaining. | ||
*/ | ||
RootRouteBuilder thingSearchRoute(ThingSearchRoute route); | ||
|
||
/** | ||
* Sets the websocket sub-route. | ||
* | ||
* @param route the route to set. | ||
* @return the Builder to allow method chaining. | ||
*/ | ||
RootRouteBuilder websocketRoute(WebsocketRoute route); | ||
|
||
/** | ||
* Sets the stats sub-route. | ||
* | ||
* @param route the route to set. | ||
* @return the Builder to allow method chaining. | ||
*/ | ||
RootRouteBuilder statsRoute(StatsRoute route); | ||
|
||
/** | ||
* Sets the http authentication directive. | ||
* | ||
* @param directive the directive to set. | ||
* @return the Builder to allow method chaining. | ||
*/ | ||
RootRouteBuilder httpAuthenticationDirective(GatewayAuthenticationDirective directive); | ||
|
||
/** | ||
* Sets the websocket authentication directive. | ||
* | ||
* @param directive the directive to set. | ||
* @return the Builder to allow method chaining. | ||
*/ | ||
RootRouteBuilder wsAuthenticationDirective(GatewayAuthenticationDirective directive); | ||
|
||
/** | ||
* Sets the supported api versions. | ||
* | ||
* @param versions the versions to set. | ||
* @return the Builder to allow method chaining. | ||
*/ | ||
RootRouteBuilder supportedSchemaVersions(List<Integer> versions); | ||
|
||
/** | ||
* Sets the protocol adapter provider. | ||
* | ||
* @param provider the provider to set. | ||
* @return the Builder to allow method chaining. | ||
*/ | ||
RootRouteBuilder protocolAdapterProvider(ProtocolAdapterProvider provider); | ||
|
||
/** | ||
* Sets the header translator. | ||
* | ||
* @param translator the translator to set. | ||
* @return the Builder to allow method chaining. | ||
*/ | ||
RootRouteBuilder headerTranslator(HeaderTranslator translator); | ||
|
||
/** | ||
* Sets the custom api routes provider. | ||
* | ||
* @param provider the provider to set. | ||
* @return the Builder to allow method chaining. | ||
*/ | ||
RootRouteBuilder customApiRoutesProvider(CustomApiRoutesProvider provider); | ||
|
||
/** | ||
* Sets the custom headers handler. | ||
* | ||
* @param handler the handler to set. | ||
* @return the Builder to allow method chaining. | ||
*/ | ||
RootRouteBuilder customHeadersHandler(CustomHeadersHandler handler); | ||
|
||
/** | ||
* Sets the exception handler. | ||
* | ||
* @param handler the handler to set. | ||
* @return the Builder to allow method chaining. | ||
*/ | ||
RootRouteBuilder exceptionHandler(ExceptionHandler handler); | ||
|
||
/** | ||
* Sets the rejection handler. | ||
* | ||
* @param handler the handler to set. | ||
* @return the Builder to allow method chaining. | ||
*/ | ||
RootRouteBuilder rejectionHandler(RejectionHandler handler); | ||
|
||
/** | ||
* Builds the root route. | ||
* | ||
* @return the route. | ||
*/ | ||
Route build(); | ||
|
||
} |
Oops, something went wrong.