diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java index 7d0bc151d8..b8c5639b39 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java @@ -23,7 +23,9 @@ import com.google.gson.stream.JsonWriter; import io.cloudbeaver.DBWConnectionGrant; import io.cloudbeaver.DBWSecurityController; import io.cloudbeaver.WebServiceUtils; +import io.cloudbeaver.registry.WebServiceRegistry; import io.cloudbeaver.server.jetty.CBJettyServer; +import io.cloudbeaver.service.DBWServiceInitializer; import org.eclipse.core.runtime.Platform; import org.eclipse.equinox.app.IApplicationContext; import org.eclipse.osgi.service.datalocation.Location; @@ -242,6 +244,17 @@ public class CBApplication extends BaseApplicationImpl { log.debug("\t\t" + ia.getHostAddress() + " (" + ia.getCanonicalHostName() + ")"); } } + { + // Perform services initialization + for (DBWServiceInitializer wsi : WebServiceRegistry.getInstance().getWebServices(DBWServiceInitializer.class)) { + try { + wsi.initializeService(this); + } catch (Exception e) { + log.warn("Error initializing web service " + wsi.getClass().getName(), e); + } + } + + } { try { @@ -278,7 +291,7 @@ public class CBApplication extends BaseApplicationImpl { try { InetAddress dockerAddress = InetAddress.getByName(CBConstants.VAR_HOST_DOCKER_INTERNAL); localInetAddresses.add(dockerAddress); - log.debug("\tRun in Docker container (" + dockerAddress + ")"); + log.debug("\tRun in Docker container (" + dockerAddress + ")?"); } catch (UnknownHostException e) { // Ignore - not a docker env } diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/DBWServiceInitializer.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/DBWServiceInitializer.java new file mode 100644 index 0000000000..e239895f74 --- /dev/null +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/DBWServiceInitializer.java @@ -0,0 +1,29 @@ +/* + * DBeaver - Universal Database Manager + * Copyright (C) 2010-2020 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.cloudbeaver.service; + +import org.jkiss.dbeaver.DBException; +import org.jkiss.dbeaver.model.app.DBPApplication; + +/** + * Web service implementation + */ +public interface DBWServiceInitializer extends DBWServiceBinding { + + void initializeService(DBPApplication application) throws DBException; + +}