Class Api
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceListener that can be registered with anApito receive lifecycle, per request and per error callback notifications. -
Field Summary
FieldsModifier and TypeFieldDescriptionActions that may be selected to run regardless of the matched Endpoint.protected final List<Collection>The data objects being served by this API.The underlying data sources for the Api.protected booleanThe Request HTTP method/path combinations that map to a distinct set of Actions.protected Stringprotected Linkerprotected final List<Api.ApiListener>Listeners that receive callbacks on startup/shutdown/request/error.protected final org.slf4j.Loggerprotected StringHost and root path configprotected Stringprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCollection(String name) getDbs()getEndpoint(String name) getHash()longgetName()getOps()getUrl()booleanisDebug()booleanvoidvoidsetDebug(boolean debug) voidsetLoadTime(long loadTime) toString()withAction(Action action) withActions(Action... actions) Add Action(s) may be selected to run across multiple Endpoints.withApiListener(Api.ApiListener listener) withCollection(Collection coll) withDebug(boolean debug) voidwithEndpoint(Action action1, Action... actions) withEndpoint(Endpoint... endpoints) withEndpoint(String ruleMatcherSpec, Action... actions) withLinker(Linker linker) withRelationship(String parentCollectionName, String parentPropertyName, String childCollectionName, String childPropertyName, 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.withServer(Server server) withServers(String... urls) withVersion(String version)
-
Field Details
-
log
protected final transient org.slf4j.Logger log -
servers
Host and root path config -
dbs
The underlying data sources for the Api. -
endpoints
The Request HTTP method/path combinations that map to a distinct set of Actions.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.
-
actions
Actions that may be selected to run regardless of the matched Endpoint.The Action's Path match statements will be considered relative to the Api's base URL NOT relative to the selected Endpoint.
-
collections
The data objects being served by this API. In a simple API these may map one-to-one to, for example, database tables from a JdbcDb connecting to a RDBMS such as MySql or SqlServer. -
listeners
Listeners that receive callbacks on startup/shutdown/request/error. -
linker
-
ops
-
name
-
hash
-
debug
protected boolean debug -
url
-
version
-
-
Constructor Details
-
Api
public Api() -
Api
-
-
Method Details
-
isStarted
public boolean isStarted() -
withDelayedConfig
-
removeExcludes
public void removeExcludes() -
getHash
-
toString
-
withHash
-
getServers
-
withServers
-
withServer
-
withCollection
-
getCollections
-
getCollection
-
getDb
-
getDbs
- Returns:
- the dbs
-
withDbs
- Parameters:
dbs- the dbs to set- Returns:
- this
-
withDbs
-
withDb
-
getName
-
withName
-
withVersion
-
getVersion
-
getLoadTime
public long getLoadTime() -
setLoadTime
public void setLoadTime(long loadTime) -
getEndpoint
-
getEndpoints
-
removeEndpoint
-
withEndpoint
-
withEndpoint
-
withEndpoint
-
withRelationship
public Api withRelationship(String parentCollectionName, String parentPropertyName, String childCollectionName, String childPropertyName, 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. The Relationship object along with the required Index objects are created.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.
- Parameters:
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 key- Returns:
- this
- See Also:
-
getAction
-
getActions
-
withActions
Add Action(s) may be selected to run across multiple Endpoints.- Parameters:
actions- actions to match and conditionally run across all Requests- Returns:
- this
-
withAction
-
getEngine
-
isDebug
public boolean isDebug() -
withDebug
-
setDebug
public void setDebug(boolean debug) -
getUrl
-
withUrl
-
getLinker
-
withLinker
-
withApiListener
-
getApiListeners
-
matchDb
-
getOps
-
getOp
-