Skip to content

Commit

Permalink
[api][sre] Move the naming API from Janus to the general SARL API.
Browse files Browse the repository at this point in the history
see #972

Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Aug 20, 2020
1 parent 13a50a2 commit 596873b
Show file tree
Hide file tree
Showing 140 changed files with 4,859 additions and 1,831 deletions.
14 changes: 14 additions & 0 deletions main/apiplugins/io.sarl.api.naming/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: io.sarl.api.naming;singleton:=true
Automatic-Module-Name: io.sarl.api.naming
Bundle-Version: 0.12.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-Name: %Bundle-Name
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: io.sarl.lang.core;bundle-version="0.12.0",
org.eclipse.xtend.lib;bundle-version="2.22.0"
Export-Package: io.sarl.api.naming.name,
io.sarl.api.naming.namespace,
io.sarl.api.naming.parser,
io.sarl.api.naming.scheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#Properties file for io.sarl.core
Bundle-Vendor = SARL.io
Bundle-Name = SARL Naming API
10 changes: 10 additions & 0 deletions main/apiplugins/io.sarl.api.naming/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
source.. = src/main/sarl,\
src/main/generated-sources/sarl
src.excludes = **/*.sarlbin
bin.includes = META-INF/,\
OSGI-INF/,\
.
bin.excludes = **/*.java._trace,\
**/*.sarlbin,\
**/*.sarl
jre.compilation.profile = JavaSE-1.8
160 changes: 160 additions & 0 deletions main/apiplugins/io.sarl.api.naming/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
<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.sarl</groupId>
<artifactId>io.sarl.plugins.api</artifactId>
<version>0.12.0-SNAPSHOT</version>
</parent>
<artifactId>io.sarl.api.naming</artifactId>
<packaging>eclipse-plugin</packaging>
<name>SARL Naming API</name>

<build>
<plugins>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<executions>
<execution>
<id>prepare-eclipse-buildproperties</id>
<phase>process-resources</phase>
<goals>
<goal>replace</goal>
</goals>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<file>${project.basedir}/build.properties</file>
<regexFlags><regexFlag>MULTILINE</regexFlag></regexFlags>
<replacements>
<replacement>
<token>^(jre\.compilation\.profile *= *)(.*)$</token>
<value>$1${sarl-dsl.min.jre.environment}</value>
</replacement>
</replacements>
</configuration>
</execution>
<execution>
<id>prepare-eclipse-manifestmf</id>
<phase>process-resources</phase>
<goals>
<goal>replace</goal>
</goals>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<file>${project.basedir}/META-INF/MANIFEST.MF</file>
<regexFlags><regexFlag>MULTILINE</regexFlag></regexFlags>
<replacements>
<replacement>
<token>^(Bundle-RequiredExecutionEnvironment: *)(.*)$</token>
<value>$1${user.min.jre.environment}</value>
</replacement>
</replacements>
</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>
</plugins>
</build>

<!-- ======================================= -->
<!-- ==== Release Management === -->
<!-- ======================================= -->
<profiles>
<profile>
<id>default-profile</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-source-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>maven-release-of-core-plugin</id>
<activation>
<property>
<name>publicSarlApiModuleSet</name>
<value>true</value>
</property>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.arakhne.afc.maven</groupId>
<artifactId>tag-replacer</artifactId>
<configuration>
<sources>
<source>${project.basedir}/src/main/sarl</source>
<source>${project.basedir}/src/main/generated-sources/sarl</source>
</sources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<sourcepath>${project.build.directory}/generated-sources/java</sourcepath>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>

</project>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/**
* $Id$
*
* SARL is an general-purpose agent programming language.
* More details on http://www.sarl.io
*
* Copyright (C) 2014-2020 the original authors or authors.
*
* 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.sarl.api.naming.name;

import io.sarl.api.naming.name.SarlName;
import io.sarl.lang.annotation.PrivateAPI;
import io.sarl.lang.annotation.SarlElementType;
import io.sarl.lang.annotation.SarlSpecification;
import io.sarl.lang.annotation.SyntheticMember;
import java.net.URI;
import java.util.Objects;
import java.util.UUID;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtext.xbase.lib.Pure;

/**
* This class represents a space name.
*
* @author $Author: sgalland$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
* @since 0.12
*/
@SarlSpecification("0.12")
@SarlElementType(10)
@SuppressWarnings("all")
public class AgentName extends SarlName {
@Accessors
private final UUID contextId;

@Accessors
private final UUID spaceId;

@Accessors
private final UUID agentId;

/**
* Constructor.
*
* @param uri the uri of the context.
* @param contextId the identifier of the context.
* @param spaceId the identifier of the space.
* @param agentId the identifier of the agent.
*/
@PrivateAPI
public AgentName(final URI uri, final UUID contextId, final UUID spaceId, final UUID agentId) {
super(uri);
this.contextId = contextId;
this.spaceId = spaceId;
this.agentId = agentId;
}

@Override
@Pure
@SyntheticMember
public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AgentName other = (AgentName) obj;
if (!Objects.equals(this.contextId, other.contextId))
return false;
if (!Objects.equals(this.spaceId, other.spaceId))
return false;
if (!Objects.equals(this.agentId, other.agentId))
return false;
return super.equals(obj);
}

@Override
@Pure
@SyntheticMember
public int hashCode() {
int result = super.hashCode();
final int prime = 31;
result = prime * result + Objects.hashCode(this.contextId);
result = prime * result + Objects.hashCode(this.spaceId);
result = prime * result + Objects.hashCode(this.agentId);
return result;
}

@Override
@Pure
@SyntheticMember
public AgentName clone() {
try {
return (AgentName) super.clone();
} catch (Throwable exception) {
throw new Error(exception);
}
}

@SyntheticMember
private static final long serialVersionUID = -2495352890L;

@Pure
public UUID getContextId() {
return this.contextId;
}

@Pure
public UUID getSpaceId() {
return this.spaceId;
}

@Pure
public UUID getAgentId() {
return this.agentId;
}
}

0 comments on commit 596873b

Please sign in to comment.