Mercurial > dive4elements > framework
diff artifact-database/src/main/java/org/dive4elements/artifactdatabase/ArtifactDatabaseImpl.java @ 562:05caf2e731d0
Allow to add additional restful services via configuration.
author | gernotbelger |
---|---|
date | Wed, 10 Oct 2018 20:07:58 +0200 |
parents | 68f01f10624e |
children |
line wrap: on
line diff
--- a/artifact-database/src/main/java/org/dive4elements/artifactdatabase/ArtifactDatabaseImpl.java Mon Sep 24 17:59:17 2018 +0200 +++ b/artifact-database/src/main/java/org/dive4elements/artifactdatabase/ArtifactDatabaseImpl.java Wed Oct 10 20:07:58 2018 +0200 @@ -407,6 +407,8 @@ */ protected HashMap name2service; + private Map<String, Class<?>> restServices; + /** * The factory that is used to create new artifact collections. */ @@ -464,6 +466,8 @@ protected List<LifetimeListener> lifetimeListeners; + private String serverAddress; + /** * Default constructor. */ @@ -493,10 +497,13 @@ backgroundIds = new HashSet<Integer>(); backgroundMsgs = new HashMap<String, LinkedList<Message>>(); + + this.serverAddress = bootstrap.getHTTPServer().getServerAddress(); setupArtifactCollectionFactory(bootstrap); setupArtifactFactories(bootstrap); setupServices(bootstrap); + setupRestServices(bootstrap); setupUserFactory(bootstrap); setupCallContextListener(bootstrap); setupHooks(bootstrap); @@ -638,6 +645,17 @@ } /** + * Used to extract the service factories from the bootstrap + * parameters, setting up the services and building the internal + * lookup tables. + * @param bootstrap The bootstrap parameters. + */ + private void setupRestServices(FactoryBootstrap bootstrap) { + + restServices = new HashMap<String,Class<?>>(bootstrap.getRestServiceNames()); + } + + /** * Wires a storage backend to this artifact database and * establishes a callback to be able to revive artifacts * via the serializers of this artifact factories. @@ -1984,5 +2002,15 @@ public String findArtifactUser(final String artifactIdentifier) { return backend.findUserName(artifactIdentifier); } + + @Override + public String getServerAddress() { + return this.serverAddress; + } + + @Override + public Map<String, Class<?>> getRestServices() { + return restServices; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :