Search in sources :

Example 1 with Service

use of de.fraunhofer.iosb.ilt.faaast.service.Service in project FAAAST-Service by FraunhoferIOSB.

the class Application method run.

@Override
public void run() {
    try {
        ConfigFactory configFactory = new ConfigFactory();
        AASEnvironmentFactory environmentFactory = new AASEnvironmentFactory();
        readConfigurationParametersOverEnvironmentVariables();
        readFilePathsOverEnvironmentVariables();
        List<Config> customConfigComponents = getCustomConfigComponents();
        ServiceConfig config = configFactory.toServiceConfig(configFilePath, autoCompleteConfiguration, properties, customConfigComponents);
        AssetAdministrationShellEnvironment environment = null;
        if (useEmptyAASEnvironment) {
            LOGGER.info("Using empty Asset Administration Shell Environment");
            environment = environmentFactory.getEmptyAASEnvironment();
        } else {
            environment = environmentFactory.getAASEnvironment(aasEnvironmentFilePath);
            LOGGER.info("Successfully parsed Asset Administration Shell Environment");
        }
        if (validateAASEnv) {
            validate(environment);
        }
        service = new Service(config);
        service.setAASEnvironment(environment);
        service.start();
        LOGGER.info("FAAAST Service is running!");
    } catch (Exception ex) {
        if (service != null) {
            service.stop();
        }
        LOGGER.error(ex.getMessage());
        LOGGER.error("Abort starting FAAAST Service");
    }
}
Also used : ServiceConfig(de.fraunhofer.iosb.ilt.faaast.service.config.ServiceConfig) EndpointConfig(de.fraunhofer.iosb.ilt.faaast.service.endpoint.EndpointConfig) HttpEndpointConfig(de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.HttpEndpointConfig) ServiceConfig(de.fraunhofer.iosb.ilt.faaast.service.config.ServiceConfig) Config(de.fraunhofer.iosb.ilt.faaast.service.config.Config) Service(de.fraunhofer.iosb.ilt.faaast.service.Service) AssetAdministrationShellEnvironment(io.adminshell.aas.v3.model.AssetAdministrationShellEnvironment)

Example 2 with Service

use of de.fraunhofer.iosb.ilt.faaast.service.Service in project FAAAST-Service by FraunhoferIOSB.

the class IntegrationTestHttpEndpoint method init.

@Before
public void init() throws Exception {
    environment = AASFull.createEnvironment();
    ServiceConfig serviceConfig = new ServiceConfig.Builder().core(new CoreConfig.Builder().requestHandlerThreadPoolSize(2).build()).persistence(new PersistenceInMemoryConfig()).endpoints(List.of(new HttpEndpointConfig())).messageBus(new MessageBusInternalConfig()).build();
    service = new Service(serviceConfig);
    messageBus = service.getMessageBus();
    service.setAASEnvironment(environment);
    service.start();
}
Also used : ServiceConfig(de.fraunhofer.iosb.ilt.faaast.service.config.ServiceConfig) CoreConfig(de.fraunhofer.iosb.ilt.faaast.service.config.CoreConfig) MessageBusInternalConfig(de.fraunhofer.iosb.ilt.faaast.service.messagebus.internal.MessageBusInternalConfig) Service(de.fraunhofer.iosb.ilt.faaast.service.Service) PersistenceInMemoryConfig(de.fraunhofer.iosb.ilt.faaast.service.persistence.memory.PersistenceInMemoryConfig) HttpEndpointConfig(de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.HttpEndpointConfig) Before(org.junit.Before)

Aggregations

Service (de.fraunhofer.iosb.ilt.faaast.service.Service)2 ServiceConfig (de.fraunhofer.iosb.ilt.faaast.service.config.ServiceConfig)2 HttpEndpointConfig (de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.HttpEndpointConfig)2 Config (de.fraunhofer.iosb.ilt.faaast.service.config.Config)1 CoreConfig (de.fraunhofer.iosb.ilt.faaast.service.config.CoreConfig)1 EndpointConfig (de.fraunhofer.iosb.ilt.faaast.service.endpoint.EndpointConfig)1 MessageBusInternalConfig (de.fraunhofer.iosb.ilt.faaast.service.messagebus.internal.MessageBusInternalConfig)1 PersistenceInMemoryConfig (de.fraunhofer.iosb.ilt.faaast.service.persistence.memory.PersistenceInMemoryConfig)1 AssetAdministrationShellEnvironment (io.adminshell.aas.v3.model.AssetAdministrationShellEnvironment)1 Before (org.junit.Before)1