Skip to content

Commit

Permalink
#15 Removed Extensionservice
Browse files Browse the repository at this point in the history
  • Loading branch information
wuetherich committed Jan 5, 2020
1 parent 4fbb57b commit 753aaba
Show file tree
Hide file tree
Showing 46 changed files with 145 additions and 1,877 deletions.
1 change: 0 additions & 1 deletion slizaa-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

<modules>
<module>slizaa-server-service-configuration</module>
<module>slizaa-server-service-extensions</module>
<module>slizaa-server-service-backend</module>
<module>slizaa-server-service-svg</module>
<module>slizaa-server-service-slizaa</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,11 @@
*/
package io.codekontor.slizaa.server.command;

import io.codekontor.slizaa.server.descr.ContentDefinition;
import io.codekontor.slizaa.server.descr.GraphDatabase;
import io.codekontor.slizaa.server.descr.HierarchicalGraph;
import io.codekontor.slizaa.server.service.backend.IBackendService;
import io.codekontor.slizaa.server.service.backend.IModifiableBackendService;
import io.codekontor.slizaa.server.service.extensions.IExtension;
import io.codekontor.slizaa.server.service.extensions.IExtensionService;
import io.codekontor.slizaa.server.service.backend.extensions.IExtension;
import io.codekontor.slizaa.server.service.slizaa.IGraphDatabase;
import io.codekontor.slizaa.server.service.slizaa.ISlizaaService;
import io.codekontor.slizaa.server.spec.HierarchicalGraphSpec;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.shell.table.*;
Expand All @@ -46,9 +41,6 @@ public abstract class AbstractGraphDatabaseCommandComponent {
@Autowired
private IBackendService _backendService;

@Autowired
private IExtensionService _extensionService;

protected ISlizaaService slizaaService() {
return _slizaaService;
}
Expand All @@ -65,10 +57,6 @@ protected IBackendService backendService() {
return _backendService;
}

protected IExtensionService extensionService() {
return _extensionService;
}

@NotNull
protected Object dumpGraphDatabases() {

Expand Down Expand Up @@ -130,14 +118,7 @@ protected String dumpContentDefinitionProviderFactories() {
*/
protected String checkBackendConfigured() {
if (!_slizaaService.getBackendService().hasInstalledExtensions()) {
StringBuilder message = new StringBuilder();
message
.append("The Slizaa Server has not been configured properly: There are not installed backend extensions.\n");
message.append(dumpAvailableExtensions());
if (_modifiableBackendService != null) {
message.append("You can install backend extensions using the command 'installExtensions'.");
}
return cannotExecuteCommand(message.toString());
return cannotExecuteCommand("The Slizaa Server has not been configured properly: There are no installed backend extensions.\n");
}
return null;
}
Expand Down Expand Up @@ -165,15 +146,6 @@ protected String cannotExecuteCommand(String msg) {
return stringBuffer.toString();
}

protected String dumpAvailableExtensions() {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("Available Backend Extensions:\n");
extensionService().getExtensions().forEach(extension -> {
stringBuffer.append(formatExtension(extension));
});
return stringBuffer.toString();
}

protected String formatExtension(IExtension extension) {
return String.format(" - %1$s_%2$s (Symbolic name: %1$s, version: %2$s)\n", extension.getSymbolicName(),
extension.getVersion());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package io.codekontor.slizaa.server.command;

import com.google.common.base.Preconditions;
import io.codekontor.slizaa.server.service.extensions.IExtensionIdentifier;
import io.codekontor.slizaa.server.service.extensions.Version;
import io.codekontor.slizaa.server.service.backend.extensions.IExtensionIdentifier;
import io.codekontor.slizaa.server.service.backend.extensions.Version;

public class ExtensionIdentifier implements IExtensionIdentifier {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
*/
package io.codekontor.slizaa.server.command;

import io.codekontor.slizaa.server.service.extensions.IExtension;
import io.codekontor.slizaa.server.service.extensions.IExtensionIdentifier;
import io.codekontor.slizaa.server.service.backend.extensions.IExtension;
import io.codekontor.slizaa.server.service.backend.extensions.IExtensionIdentifier;
import org.springframework.shell.Availability;
import org.springframework.shell.standard.*;

Expand All @@ -29,19 +29,6 @@
@ShellCommandGroup("Slizaa Backend Commands")
public class SlizaaBackendCommands extends AbstractGraphDatabaseCommandComponent{

@ShellMethod(value = "List all available backend extensions.", key="listAvailableExtensions")
@ShellMethodAvailability("availabilityCheck")
public String listAvailableExtensions() {

//
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("Available Backend Extensions:\n");
extensionService().getExtensions().forEach(extension -> {
stringBuffer.append(formatExtension(extension));
});
return stringBuffer.toString();
}

@ShellMethod(value = "List installed extensions.", key="listInstalledExtensions")
public String listInstalledExtensions() {

Expand All @@ -54,45 +41,4 @@ public String listInstalledExtensions() {

return stringBuffer.toString();
}

@ShellMethod(value = "Install backend extensions.", key="installExtensions")
@ShellMethodAvailability("availabilityCheck")
public String installExtensions(String[] extensions) {

// fail fast
if (!hasModifiableBackendService()) {
return cannotExecuteCommand("Backend is not modifiable.");
}

//
List<IExtensionIdentifier> extensionIdList = new ArrayList<>();

for (int i = 0; i < extensions.length; i++) {
String extension = extensions[i];
String[] split = extension.split("_");
if (split.length != 2) {
return cannotExecuteCommand(String.format("Invalid parameter value '%s'.", extension));
}
extensionIdList.add(new ExtensionIdentifier(split[0], split[1]));
}

//
List<IExtension> extensionsToInstall = extensionService().getExtensions(extensionIdList);
modifiableBackendService().installExtensions(extensionsToInstall);

StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("Installed Backend Extensions:\n");
modifiableBackendService().getInstalledExtensions().forEach(extension -> {
stringBuffer.append(formatExtension(extension));
});


return stringBuffer.toString();
}

public Availability availabilityCheck() {
return modifiableBackendService() != null
? Availability.available()
: Availability.unavailable("an offline backend is not modifiable.");
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,4 @@ public ServerConfiguration serverConfiguration() {
//
return new ServerConfiguration(installedServerExtensions);
}

public List<ServerExtension> availableServerExtensions() {
return slizaaService.getExtensionService().getExtensions().stream()
.map(ext -> new ServerExtension(ext.getSymbolicName(), ext.getVersion().toString()))
.collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,4 @@ extend type Query {

# Returns the server configuration
serverConfiguration: ServerConfiguration!

# Returns the available server extensions
availableServerExtensions: [ServerExtension]!
}

extend type Mutation {

# Installs the specified server extensions.
installServerExtensions(extensions: [ServerExtensionIdentifier]): [ServerExtension]!
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,7 @@
*/
package io.codekontor.slizaa.server;

import io.codekontor.slizaa.server.command.EnableSlizaaServerCommandModule;
import io.codekontor.slizaa.server.graphql.EnableGraphqlModule;
import io.codekontor.slizaa.server.service.backend.EnableBackendServiceModule;
import io.codekontor.slizaa.server.service.configuration.EnableConfigurationModule;
import io.codekontor.slizaa.server.service.extensions.EnableExtensionsModule;
import io.codekontor.slizaa.server.service.selection.EnableSelectionServiceModule;
import io.codekontor.slizaa.server.service.slizaa.EnableSlizaaServiceModule;
import io.codekontor.slizaa.server.service.svg.EnableSvgServiceModule;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import io.codekontor.slizaa.server.graphql.EnableGraphqlModule;
import io.codekontor.slizaa.server.service.backend.EnableBackendServiceModule;
import io.codekontor.slizaa.server.service.configuration.EnableConfigurationModule;
import io.codekontor.slizaa.server.service.extensions.EnableExtensionsModule;
import io.codekontor.slizaa.server.service.selection.EnableSelectionServiceModule;
import io.codekontor.slizaa.server.service.slizaa.EnableSlizaaServiceModule;
import io.codekontor.slizaa.server.service.svg.EnableSvgServiceModule;
Expand All @@ -33,7 +32,6 @@
* @author Gerd W&uuml;therich ([email protected])
*/
@SpringBootApplication
@EnableExtensionsModule
@EnableBackendServiceModule
@EnableSlizaaServiceModule
@EnableGraphqlModule
Expand Down
11 changes: 5 additions & 6 deletions slizaa-server/slizaa-server-service-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@
<artifactId>slizaa-server-service-backend</artifactId>

<dependencies>
<dependency>
<groupId>io.codekontor.slizaa</groupId>
<artifactId>slizaa-server-service-extensions</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.codekontor.slizaa</groupId>
<artifactId>slizaa-server-service-configuration</artifactId>
Expand Down Expand Up @@ -74,7 +69,11 @@
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
</dependency>

<dependency>
<groupId>io.codekontor.mvnresolver</groupId>
<artifactId>mvnresolver-uber</artifactId>
<version>${version-mvnresolver-uber}</version>
</dependency>

<!-- TEST -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import java.util.List;

import io.codekontor.slizaa.server.service.extensions.IExtension;
import io.codekontor.slizaa.server.service.backend.extensions.IExtension;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import java.util.List;

import io.codekontor.slizaa.server.service.extensions.IExtension;
import io.codekontor.slizaa.server.service.backend.extensions.IExtension;

public interface IBackendServiceCallback {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
package io.codekontor.slizaa.server.service.backend;

import io.codekontor.slizaa.server.service.extensions.IExtension;
import io.codekontor.slizaa.server.service.backend.extensions.IExtension;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* slizaa-server-service-extensions - Slizaa Static Software Analysis Tools
* slizaa-server-service-backend - Slizaa Static Software Analysis Tools
* Copyright © 2019 Code-Kontor GmbH and others ([email protected])
*
* This program is free software: you can redistribute it and/or modify
Expand All @@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package io.codekontor.slizaa.server.service.extensions;
package io.codekontor.slizaa.server.service.backend.extensions;

import static com.google.common.base.Preconditions.checkNotNull;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* slizaa-server-service-extensions - Slizaa Static Software Analysis Tools
* slizaa-server-service-backend - Slizaa Static Software Analysis Tools
* Copyright © 2019 Code-Kontor GmbH and others ([email protected])
*
* This program is free software: you can redistribute it and/or modify
Expand All @@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package io.codekontor.slizaa.server.service.extensions;
package io.codekontor.slizaa.server.service.backend.extensions;

import java.net.URL;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* slizaa-server-service-extensions - Slizaa Static Software Analysis Tools
* slizaa-server-service-backend - Slizaa Static Software Analysis Tools
* Copyright © 2019 Code-Kontor GmbH and others ([email protected])
*
* This program is free software: you can redistribute it and/or modify
Expand All @@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package io.codekontor.slizaa.server.service.extensions;
package io.codekontor.slizaa.server.service.backend.extensions;

/**
*
Expand Down
Loading

0 comments on commit 753aaba

Please sign in to comment.