public final class Api
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Api.ApiListener
Listener that can be registered with an
Api to receive lifecycle,
per request and per error callback notifications. |
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<Action> |
actions
Actions that may be selected to run regardless of the matched Endpoint.
|
protected java.util.List<Collection> |
collections
The data objects being served by this API.
|
protected java.util.List<Db> |
dbs
The underlying data sources for the Api.
|
protected boolean |
debug |
protected java.util.List<Endpoint> |
endpoints
The Request HTTP method/path combinations that map to a distinct set of Actions.
|
protected java.lang.String |
hash |
protected Linker |
linker |
protected java.util.List<Api.ApiListener> |
listeners
Listeners that receive callbacks on startup/shutdown/request/error.
|
protected org.slf4j.Logger |
log |
protected java.lang.String |
name |
protected java.util.List<Op> |
ops |
protected java.util.List<Server> |
servers
Host and root path config
|
protected java.lang.String |
url |
protected java.lang.String |
version |
| Modifier and Type | Method and Description |
|---|---|
Action |
getAction(java.lang.String name) |
java.util.List<Action> |
getActions() |
java.util.List<Api.ApiListener> |
getApiListeners() |
Collection |
getCollection(java.lang.String name) |
java.util.List<Collection> |
getCollections() |
Db |
getDb(java.lang.String name) |
java.util.List<Db> |
getDbs() |
Endpoint |
getEndpoint(java.lang.String name) |
java.util.List<Endpoint> |
getEndpoints() |
Engine |
getEngine() |
java.lang.String |
getHash() |
Linker |
getLinker() |
long |
getLoadTime() |
java.lang.String |
getName() |
Op |
getOp(java.lang.String name) |
java.util.List<Op> |
getOps() |
java.util.List<Server> |
getServers() |
java.lang.String |
getUrl() |
java.lang.String |
getVersion() |
boolean |
isDebug() |
boolean |
isStarted() |
Db |
matchDb(java.lang.String method,
io.inversion.utils.Path requestPath) |
Api |
removeEndpoint(Endpoint ep) |
void |
removeExcludes() |
void |
setDebug(boolean debug) |
void |
setLoadTime(long loadTime) |
Api |
withAction(Action action) |
Api |
withActions(Action... actions)
Add Action(s) may be selected to run across multiple Endpoints.
|
Api |
withApiListener(Api.ApiListener listener) |
Api |
withCollection(Collection coll) |
<T extends Db> |
withDb(Db<T> db) |
Api |
withDbs(Db... dbs) |
Api |
withDbs(java.util.List<Db> dbs) |
Api |
withDebug(boolean debug) |
void |
withDelayedConfig(java.lang.Runnable r) |
Api |
withEndpoint(Action action1,
Action... actions) |
Api |
withEndpoint(Endpoint... endpoints) |
Api |
withEndpoint(java.lang.String ruleMatcherSpec,
Action... actions) |
Api |
withHash(java.lang.String hash) |
Api |
withLinker(Linker linker) |
Api |
withName(java.lang.String name) |
Api |
withRelationship(java.lang.String parentCollectionName,
java.lang.String parentPropertyName,
java.lang.String childCollectionName,
java.lang.String childPropertyName,
java.lang.String... childFkProps)
Creates a ONE_TO_MANY Relationship from the parent to child collection and the inverse MANY_TO_ONE from the child to the parent.
|
Api |
withServer(Server server) |
Api |
withServers(java.lang.String... urls) |
Api |
withUrl(java.lang.String url) |
Api |
withVersion(java.lang.String version) |
protected final transient org.slf4j.Logger log
protected final java.util.List<Server> servers
protected final java.util.List<Db> dbs
protected final java.util.List<Endpoint> endpoints
A single Endpoint will be selected to run to service a Request. Any additional Path matching rules that exist on these Endpoint's Actions will be interpreted as relative to the end of the selected Endpoint's Path match.
protected final java.util.List<Action> actions
The Action's Path match statements will be considered relative to the Api's base URL NOT relative to the selected Endpoint.
protected final java.util.List<Collection> collections
protected final transient java.util.List<Api.ApiListener> listeners
protected transient Linker linker
protected transient java.util.List<Op> ops
protected java.lang.String name
protected transient java.lang.String hash
protected boolean debug
protected java.lang.String url
protected java.lang.String version
public boolean isStarted()
public void withDelayedConfig(java.lang.Runnable r)
public void removeExcludes()
public java.lang.String getHash()
public Api withHash(java.lang.String hash)
public java.util.List<Server> getServers()
public Api withServers(java.lang.String... urls)
public Api withCollection(Collection coll)
public java.util.List<Collection> getCollections()
public Collection getCollection(java.lang.String name)
public Db getDb(java.lang.String name)
public java.util.List<Db> getDbs()
public java.lang.String getName()
public Api withName(java.lang.String name)
public Api withVersion(java.lang.String version)
public java.lang.String getVersion()
public long getLoadTime()
public void setLoadTime(long loadTime)
public Endpoint getEndpoint(java.lang.String name)
public java.util.List<Endpoint> getEndpoints()
public Api withRelationship(java.lang.String parentCollectionName, java.lang.String parentPropertyName, java.lang.String childCollectionName, java.lang.String childPropertyName, java.lang.String... childFkProps)
If parentPropertyName is null, the ONE_TO_MANY relationship will not be crated.
If childPropertyName is null, the MANY_TO_ONE relationship will not be created.
If both parentPropertyName and childPropertyName are null, nothing will be performed, this will be a noop.
This configuration does not occur until after the Api has been started so that underlying Collections/Properties don't have to exist.
parentCollectionName - the name of the parent collectionparentPropertyName - the name of the json property for the parent that references the children (optional)childCollectionName - the target child collection namechildPropertyName - the name of hte json property for the child that references the parent (optional)childFkProps - names of the existing Properties that make up the foreign keyCollection.withOneToManyRelationship(String, Collection, String...),
Collection.withManyToOneRelationship(String, Collection, String...)public Action getAction(java.lang.String name)
public java.util.List<Action> getActions()
public Api withActions(Action... actions)
actions - actions to match and conditionally run across all Requestspublic Engine getEngine()
public boolean isDebug()
public Api withDebug(boolean debug)
public void setDebug(boolean debug)
public java.lang.String getUrl()
public Api withUrl(java.lang.String url)
public Linker getLinker()
public Api withApiListener(Api.ApiListener listener)
public java.util.List<Api.ApiListener> getApiListeners()
public Db matchDb(java.lang.String method, io.inversion.utils.Path requestPath)
public java.util.List<Op> getOps()
public Op getOp(java.lang.String name)
Copyright © 2023 Rocket Partners, LLC. All rights reserved.