Commit 00350378 authored by Jaime Arias's avatar Jaime Arias
Browse files

first commit

parents
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**|target/generated-sources/annotations/|target/generated-sources/test-annotations/" kind="src" output="target/classes" path="target">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
{
"name": "Alligator",
"image": "alligator:dev",
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"vscjava.vscode-java-pack"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [9000],
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"
}
This diff is collapsed.
# Created by https://www.toptal.com/developers/gitignore/api/eclipse,maven,java
# Edit at https://www.toptal.com/developers/gitignore?templates=eclipse,maven,java
### Eclipse ###
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# PyDev specific (Python IDE for Eclipse)
*.pydevproject
# CDT-specific (C/C++ Development Tooling)
.cproject
# CDT- autotools
.autotools
# Java annotation processor (APT)
.factorypath
# PDT-specific (PHP Development Tools)
.buildpath
# sbteclipse plugin
.target
# Tern plugin
.tern-project
# TeXlipse plugin
.texlipse
# STS (Spring Tool Suite)
.springBeans
# Code Recommenders
.recommenders/
# Annotation Processing
.apt_generated/
.apt_generated_test/
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
# Uncomment this line if you wish to ignore the project description file.
# Typically, this file would be tracked if it contains build/dependency configurations:
#.project
### Eclipse Patch ###
# Spring Boot Tooling
.sts4-cache/
### Java ###
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### Maven ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar
# End of https://www.toptal.com/developers/gitignore/api/eclipse,maven,java
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>adt2amas</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
<filteredResources>
<filter>
<id>1605682696592</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//target/generated-sources=UTF-8
encoding/<project>=UTF-8
encoding/target=UTF-8
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=true
org.eclipse.jdt.apt.genSrcDir=target/generated-sources/annotations
org.eclipse.jdt.apt.genTestSrcDir=target/generated-sources/test-annotations
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.processAnnotations=enabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.6
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
{
"java.configuration.updateBuildConfiguration": "automatic"
}
\ No newline at end of file
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build Service",
"type": "shell",
"command": "mvn clean && mvn install",
"options": {
"cwd": "${workspaceFolder}"
},
"presentation": {
"reveal": "silent"
}
},
{
"label": "Create Release",
"type": "shell",
"command": "mv adt2amas-0.3.2-Linux-x86_64.jar adt2amas-0.3.2.jar",
"options": {
"cwd": "${env:HOME}/.m2/repository/org/cosyverif/service/adt2amas/0.3.2"
},
"presentation": {
"reveal": "silent"
}
},
{
"label": "Build Alligator",
"type": "shell",
"command": "mvn -f pom-service.xml clean && mvn -f pom-service.xml package",
"options": {
"cwd": "/alligator/bundle"
},
"presentation": {
"reveal": "silent"
}
},
{
"label": "Build",
"dependsOrder": "sequence",
"dependsOn": [
"Build Service",
"Create Release",
"Build Alligator"
],
},
{
"label": "Run Alligator",
"type": "shell",
"command": "./alligatord start",
"options": {
"cwd": "/alligator/bundle/target/alligator-bundle/alligator"
},
"dependsOn": [
"Build"
]
}
]
}
# adt2amas Service
# Dependencies
- maven
# Compilation
- `mvn compile`
# Installation
- `mvn install`
# Development
You can use the
[Alligator](https://depot.lipn.univ-paris13.fr/cosyverif/alligator/alligator)
Docker image as development environment.
To run tests you can use the tool [soapui](https://www.soapui.org/). An
example is shown below:
```xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:all="http://alligator.cosyverif.org/">
<soapenv:Header/>
<soapenv:Body>
<all:asynchronous-call xmlns:ns2="http://alligator.cosyverif.org/" xmlns:ns3="http://cosyverif.org/ns/model" xmlns:ns4="http://cosyverif.org/ns/formalism">
<service>
<authors>
<authors>Jaime Arias</authors>
<authors>Laure Petrucci</authors>
</authors>
<help>Computes the minimal attack time using minimal number of agents for a given attack-defence tree</help>
<identifier>org.cosyverif.service.adt2amas.MinimalScheduling</identifier>
<isOldService>false</isOldService>
<keywords/>
<name>Minimal Schedule with Minimal Number of Agents in Attack-Defence Trees</name>
<parameters>
<parameters xsi:type="ns2:modelParameter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>Model parameter</name>
<shortname/>
<help>Attack-Defence Tree model</help>
<direction>IN</direction>
<editable>false</editable>
<formalism>
<formalism>http://formalisms.cosyverif.org/adtree.fml</formalism>
</formalism>
<model formalismUrl="adtree.fml"
xmlns="http://cosyverif.org/ns/model">
<!-- root gate -->
<attribute name="root">9</attribute>
<!-- ================================================ -->
<!-- Leaves -->
<!-- ================================================ -->
<!-- bribe gatekeeper (leaf b) -->
<node id="1" nodeType="leaf">
<attribute name="name">bribe gatekeeper</attribute>
<attribute name="role">ATTACK</attribute>
<attribute name="attributes">
<attribute name="attribute">
<attribute name="name">cost</attribute>
<attribute name="value">500</attribute>
</attribute>
<attribute name="attribute">
<attribute name="name">time</attribute>
<attribute name="value">60</attribute>
</attribute>
</attribute>
</node>
<!-- force arm. door (leaf f) -->
<node id="2" nodeType="leaf">
<attribute name="name">force arm. door</attribute>
<attribute name="role">ATTACK</attribute>
<attribute name="attributes">
<attribute name="attribute">
<attribute name="name">cost</attribute>
<attribute name="value">100</attribute>
</attribute>
<attribute name="attribute">
<attribute name="name">time</attribute>
<attribute name="value">120</attribute>
</attribute>
</attribute>
</node>
<!-- helicopter (leaf h) -->
<node id="3" nodeType="leaf">
<attribute name="name">helicopter</attribute>
<attribute name="role">ATTACK</attribute>
<attribute name="attributes">
<attribute name="attribute">
<attribute name="name">cost</attribute>
<attribute name="value">500</attribute>
</attribute>
<attribute name="attribute">
<attribute name="name">time</attribute>
<attribute name="value">3</attribute>
</attribute>
</attribute>
</node>
<!-- emergency exit (leaf e) -->
<node id="4" nodeType="leaf">
<attribute name="name">emergency exit</attribute>
<attribute name="role">ATTACK</attribute>
<attribute name="attributes">
<attribute name="attribute">
<attribute name="name">cost</attribute>
<attribute name="value">0</attribute>
</attribute>
<attribute name="attribute">
<attribute name="name">time</attribute>
<attribute name="value">10</attribute>
</attribute>
</attribute>
</node>
<!-- police (leaf p) -->
<node id="5" nodeType="leaf">
<attribute name="name">police</attribute>
<attribute name="role">DEFENCE</attribute>
<attribute name="attributes">
<attribute name="attribute">
<attribute name="name">cost</attribute>
<attribute name="value">100</attribute>
</attribute>
<attribute name="attribute">
<attribute name="name">time</attribute>
<attribute name="value">10</attribute>
</attribute>
</attribute>
</node>
<!-- ================================================ -->
<!-- Gates -->
<!-- ================================================ -->
<!-- steal treasure (ST) -->
<node id="6" nodeType="AND">
<attribute name="name">steal treasure</attribute>
<attribute name="role">ATTACK</attribute>
<attribute name="attributes">
<attribute name="attribute">
<attribute name="name">cost</attribute>
<attribute name="value">0</attribute>
</attribute>
<attribute name="attribute">
<attribute name="name">time</attribute>
<attribute name="value">2</attribute>
</attribute>
</attribute>
</node>
<!-- get away (GA) -->
<node id="7" nodeType="OR">
<attribute name="name">get away</attribute>
<attribute name="role">ATTACK</attribute>
<attribute name="attributes">
<attribute name="attribute">
<attribute name="name">cost</attribute>
<attribute name="value">0</attribute>
</attribute>
<attribute name="attribute">
<attribute name="name">time</attribute>
<attribute name="value">0</attribute>
</attribute>
</attribute>
</node>
<!-- thieves fleeing (TF) -->
<node id="8" nodeType="SAND">
<attribute name="name">thieves fleeing</attribute>
<attribute name="role">ATTACK</attribute>
<attribute name="attributes">
<attribute name="attribute">
<attribute name="name">cost</attribute>
<attribute name="value">0</attribute>
</attribute>
<attribute name="attribute">
<attribute name="name">time</attribute>
<attribute name="value">0</attribute>
</attribute>
</attribute>
</node>
<!-- treasure stolen (TS) -->
<node id="9" nodeType="CAND">
<attribute name="name">treasure stolen</attribute>
<attribute name="role">ATTACK</attribute>
<attribute name="attributes">
<attribute name="attribute">
<attribute name="name">cost</attribute>
<attribute name="value">0</attribute>
</attribute>
<attribute name="attribute">
<attribute name="name">time</attribute>
<attribute name="value">0</attribute>
</attribute>
</attribute>
</node>
<!-- ================================================ -->
<!-- Arcs -->
<!-- ================================================ -->
<arc id="10" arcType="arc" source="6" target="1"/> <!-- ST->b -->
<arc id="11" arcType="arc" source="6" target="2"/> <!-- ST->f -->
<arc id="12" arcType="arc" source="7" target="3"/> <!-- GA->h -->
<arc id="13" arcType="arc" source="7" target="4"/> <!-- GA->e -->
<arc id="14" arcType="arc" source="8" target="6"/> <!-- TF->ST -->
<arc id="15" arcType="arc" source="8" target="7"/> <!-- TF->GA -->
<arc id="16" arcType="arc" source="9" target="8"/> <!-- TS->TF -->
<arc id="17" arcType="arc" source="9" target="5"/> <!-- TS->p -->
</model>
</parameters>
<parameters xsi:type="ns2:multipleLineTextParameter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>Scheduling Table</name>
<shortname/>
<help>String parameter help message.</help>
<direction>OUT</direction>
<editable>false</editable>
<defaultValue/>
<value/>
</parameters>
</parameters>
<shortname/>
<tool>adt2amas</tool>
<version>0.1</version>
</service>
</all:asynchronous-call>
</soapenv:Body>
</soapenv:Envelope>
```
<?xml version="1.0" encoding="UTF-8"?>
<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>org.cosyverif.service</groupId>
<artifactId>project-base</artifactId>
<version>0.3.2</version>
</parent>
<name>Services of adt2amas</name>
<artifactId>adt2amas</artifactId>
<version>0.3.2</version>
<description>Services available through the adt2amas tool.</description>
<packaging>jar</packaging>
<url>https://depot.lipn.univ-paris13.fr/cosyverif/services/service-adt2amas</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<toolDir>${project.build.directory}/generated-sources/tools/linux</toolDir>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>RELEASE</version>
</dependency>
<dependency>
<groupId>fr.lip6.move.grml</groupId>
<artifactId>grml-helpers</artifactId>
<version>LATEST</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>generate-resources</phase>
<configuration>
<target>
<echo message="unzipping adt2amas binaries" />
<unzip src="${toolDir}/linux-x86_64.zip" dest="${toolDir}/">
<patternset>
<include name="**/adt2amas"/>
</patternset>
<mapper type="flatten"/>
</unzip>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
package org.cosyverif.service.adt2amas;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;