Skip to content

Commit

Permalink
Adding first classes of SRE network module
Browse files Browse the repository at this point in the history
  • Loading branch information
ngaud committed Mar 12, 2020
1 parent c54dfab commit a30b85d
Show file tree
Hide file tree
Showing 14 changed files with 442 additions and 0 deletions.
21 changes: 21 additions & 0 deletions sre/io.janusproject/io.janusproject.network/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: io.janusproject.network;singleton:=true
Bundle-Version: 0.11.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: io.sarl.core;bundle-version="0.11.0",
io.sarl.util;bundle-version="0.11.0",
org.eclipse.osgi;bundle-version="3.15.100",
javax.inject;bundle-version="1.0.0",
io.bootique;bundle-version="1.0.0",
org.arakhne.afc.bootique.log4j;bundle-version="16.0.0",
org.arakhne.afc.bootique.variables;bundle-version="16.0.0",
com.google.inject;bundle-version="4.1.0",
com.hazelcast;bundle-version="4.0.0",
io.janusproject.plugin;bundle-version="0.11.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Automatic-Module-Name: io.janusproject.network
Bundle-ActivationPolicy: lazy
Export-Package: io.sarl.sre.network.boot,
io.sarl.sre.network.services
@@ -0,0 +1,3 @@
io.sarl.sre.network.totoprovider


@@ -0,0 +1,3 @@
#Properties file for io.janusproject.plugin
Bundle-Vendor = janusproject.io
Bundle-Name = Janus platform
10 changes: 10 additions & 0 deletions sre/io.janusproject/io.janusproject.network/build.properties
@@ -0,0 +1,10 @@
source.. = src/main/sarl,\
src/main/generated-sources/sarl
bin.includes = .,\
META-INF/,\
OSGI-INF/
jre.compilation.profile = JavaSE-1.8
#The line below is essential to enable Tycho to compile with Maven a project depending on a eclipse fragment
#You must list the corresponding fragment below
#In out case we have com.google.inject.multibindings fragments of com.google.inject
extra.. = platform:/fragment/com.google.inject.multibindings
111 changes: 111 additions & 0 deletions sre/io.janusproject/io.janusproject.network/pom.xml
@@ -0,0 +1,111 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.janusproject.sre</groupId>
<artifactId>io.janusproject</artifactId>
<version>0.11.0-SNAPSHOT</version>
</parent>

<groupId>io.janusproject</groupId>
<artifactId>io.janusproject.network</artifactId>
<packaging>eclipse-plugin</packaging>
<name>Janus Project Network extension</name>
<url>${janusUrl}</url>
<inceptionYear>2020</inceptionYear>

<properties>
<jkernel.version>2.${project.version}</jkernel.version>
<cliRunnerMainClass>io.sarl.sre.boot.Boot</cliRunnerMainClass>
<bootstrap>io.sarl.sre.boot.SreMain</bootstrap>
</properties>

<build>
<plugins>
<!-- CAUTION:
The following plugin is copying the service definitions from META-INF/services
into the target/classes/META-INF/services because the "eclipse-plugin"
reactor does not copy these files in this particular location.
But, it is mandatory in order to enable debugging into the Eclipse DSL tool.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-bootique-module-providers</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}/META-INF/services</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/META-INF/services</directory>
<filtering>false</filtering>
</resource>
</resources>
<overwrite>true</overwrite>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.sarl.maven</groupId>
<artifactId>sarl-maven-plugin</artifactId>
<!-- Maven extension mechanism seems not working because the plugin is
defined in the same project. The different goals must be explicitly provided. -->
<executions>
<execution>
<id>sarl-compiler-init</id>
<phase>initialize</phase>
<goals>
<goal>initialize</goal>
</goals>
</execution>
<execution>
<id>sarl-compiler-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>sarl-compiler-clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
<configuration>
<tycho>true</tycho>
<source>${sarl-dsl.min.jdk.version}</source>
<target>${sarl-dsl.min.jdk.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<runJavaCompiler>true</runJavaCompiler>
<generateInlines>true</generateInlines>
<generateStorageFiles>true</generateStorageFiles>
<generateTraceFiles>true</generateTraceFiles>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<sourceDirectories>
<sourceDirectory>src/main/sarl</sourceDirectory>
</sourceDirectories>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-source-plugin</artifactId>
</plugin>
</plugins>
</build>


</project>
@@ -0,0 +1 @@
HazelcastInfrastructureServiceModuleProvider_0=The configuration for the Hazelcast infrastructure module
@@ -0,0 +1,5 @@
package io.sarl.sre.network




@@ -0,0 +1 @@
package io.sarl.sre.network.boot
@@ -0,0 +1,50 @@
package io.sarl.sre.network.boot

import com.google.common.util.concurrent.Service
import com.google.inject.AbstractModule
import com.google.inject.Module
import io.bootique.BQModule
import io.bootique.BQModuleProvider
import io.sarl.sre.services.infrastructure.InfrastructureService
import javax.inject.Singleton

import static extension com.google.inject.multibindings.Multibinder.*
import io.sarl.sre.network.services.HazelcastInfrastructureService

/**
* Module for the Hazelcast infrastructure services.
*
* @author $Author: ngaud$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
class HazelcastInfrastructureServiceModule extends AbstractModule {

protected override configure {
typeof(InfrastructureService).bind.to(typeof(HazelcastInfrastructureService)).in(typeof(Singleton))

//binder.newSetBinder(typeof(Service), typeof(SreServices)).addBinding.to(typeof(InfrastructureService))
}

}

/** Provider of the module for the Hazelcast infrastructure services.
*
* @author $Author: ngaud$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
* @since 0.9
*/
class HazelcastInfrastructureServiceModuleProvider implements BQModuleProvider {

override module : Module {
return new HazelcastInfrastructureServiceModule
}

override moduleBuilder : BQModule.Builder {
return BQModule::builder(module).overrides(overrides).providerName(name).configs(configs).description(Messages::HazelcastInfrastructureServiceModuleProvider_0);
}

}
@@ -0,0 +1,20 @@
package io.sarl.sre.network.boot

import org.eclipse.osgi.util.NLS

final class Messages extends NLS {

static val BUNDLE_NAME = typeof(Messages).getPackage.name + ".messages"

static new {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, typeof(Messages))
}

public static var HazelcastInfrastructureServiceModuleProvider_0 : String


private new {
}

}
@@ -0,0 +1,18 @@
package io.sarl.sre.network.services

import com.hazelcast.map.IMap
import io.sarl.lang.core.SpaceID
import io.sarl.sre.services.context.MemoryBasedContextService
import java.util.UUID

class HazelcastContextService extends MemoryBasedContextService {

/**
* Map linking a context id to its associated default space id. This map must be
* distributed and synchronized all over the network
*/
var defaultSpaces: IMap<UUID, SpaceID>



}
@@ -0,0 +1,18 @@
package io.sarl.sre.network.services

import io.sarl.sre.spaces.EventTransportService

import javax.inject.Singleton
import io.sarl.lang.core.Event
import io.sarl.lang.core.EventSpace
import io.sarl.lang.core.Scope
import io.sarl.lang.core.Address

@Singleton
class HazelcastEventTransportService implements EventTransportService {

def routeEvent(^event : Event, ^space : EventSpace, scope : Scope<? super Address>) : boolean {
throw new UnsupportedOperationException("TODO: auto-generated method stub")
}

}
@@ -0,0 +1,12 @@
package io.sarl.sre.network.services

import io.sarl.sre.services.AbstractSreService
import io.sarl.sre.services.infrastructure.InfrastructureService
import javax.inject.Singleton

@Singleton
class HazelcastInfrastructureService extends AbstractSreService implements InfrastructureService {


//
}

0 comments on commit a30b85d

Please sign in to comment.