Skip to content

Commit 7331c15

Browse files
chore: init jacamo project
1 parent ce71d15 commit 7331c15

19 files changed

+411
-39
lines changed

.gitignore

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,44 @@ bin/
3838
!**/test/**/build
3939
*.iml
4040
!**/testData/**/*.iml
41-
.idea/
41+
.idea/remote-targets.xml
42+
.idea/libraries/Gradle*.xml
43+
.idea/libraries/Maven*.xml
44+
.idea/artifacts/PILL_*.xml
45+
.idea/artifacts/KotlinPlugin.xml
46+
.idea/modules
47+
.idea/runConfigurations/*
48+
.idea/libraries
49+
.idea/modules.xml
50+
.idea/gradle.xml
51+
.idea/compiler.xml
52+
.idea/inspectionProfiles/profiles_settings.xml
53+
.idea/.name
54+
.idea/artifacts/dist_auto_*
55+
.idea/artifacts/dist.xml
56+
.idea/artifacts/ideaPlugin.xml
57+
.idea/artifacts/kotlinc.xml
58+
.idea/artifacts/kotlin_compiler_jar.xml
59+
.idea/artifacts/kotlin_plugin_jar.xml
60+
.idea/artifacts/kotlin_jps_plugin_jar.xml
61+
.idea/artifacts/kotlin_daemon_client_jar.xml
62+
.idea/artifacts/kotlin_imports_dumper_compiler_plugin_jar.xml
63+
.idea/artifacts/kotlin_main_kts_jar.xml
64+
.idea/artifacts/kotlin_compiler_client_embeddable_jar.xml
65+
.idea/artifacts/kotlin_reflect_jar.xml
66+
.idea/artifacts/kotlin_stdlib_js_ir_*
67+
.idea/artifacts/kotlin_test_js_ir_*
68+
.idea/artifacts/kotlin_stdlib_wasm_*
69+
.idea/artifacts/kotlinx_atomicfu_runtime_*
70+
.idea/artifacts/kotlinx_cli_jvm_*
71+
.idea/jarRepositories.xml
72+
.idea/csv-plugin.xml
73+
.idea/libraries-with-intellij-classes.xml
74+
.idea/misc.xml
75+
.idea/protoeditor.xml
76+
.idea/kotlinc.xml
77+
.idea/vcs.xml
78+
.idea/checkstyle-idea.xml
79+
.idea/git_toolbox_prj.xml
80+
.idea/uiDesigner.xml
4281
.vscode/*

.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/Project.xml

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/codeStyleConfig.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copyright/SmartOperatingBlock.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copyright/profiles_settings.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM jomifred/jacamo:1.1
2+
COPY ./ .
3+
RUN ./gradlew compileJava
4+
ENTRYPOINT ./gradlew run
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
9+
mas automation_management_microservice {
10+
agent bob: sample_agent.asl {
11+
focus: w.c1
12+
}
13+
14+
workspace w {
15+
artifact c1: example.Counter(3)
16+
}
17+
}

build.gradle

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
defaultTasks 'run'
2+
3+
apply plugin: 'java'
4+
apply plugin: 'eclipse'
5+
6+
group 'io.github.smartoperatingblock'
7+
8+
java {
9+
toolchain {
10+
languageVersion = JavaLanguageVersion.of(15)
11+
}
12+
}
13+
14+
repositories {
15+
maven { url "https://raw.githubusercontent.com/jacamo-lang/mvn-repo/master" }
16+
maven { url "https://repo.gradle.org/gradle/libs-releases" }
17+
18+
flatDir { dirs 'lib' }
19+
20+
mavenCentral()
21+
}
22+
23+
dependencies {
24+
implementation('org.jacamo:jacamo:1.1')
25+
}
26+
27+
sourceSets {
28+
main {
29+
java {
30+
srcDir 'src/env'
31+
srcDir 'src/agt'
32+
srcDir 'src/org'
33+
srcDir 'src/int'
34+
srcDir 'src/java'
35+
}
36+
resources {
37+
srcDir 'src/resources'
38+
}
39+
}
40+
}
41+
42+
task run (type: JavaExec, dependsOn: 'classes') {
43+
group ' JaCaMo'
44+
description 'runs the JaCaMo application'
45+
doFirst {
46+
mkdir 'log'
47+
}
48+
main 'jacamo.infra.JaCaMoLauncher'
49+
args 'automation_management_microservice.jcm'
50+
// jvmArgs '-Xss15m'
51+
classpath sourceSets.main.runtimeClasspath
52+
}
53+
54+
55+
task uberJar(type: Jar, dependsOn: 'classes') {
56+
group ' JaCaMo'
57+
description 'creates a single runnable jar file with all dependencies'
58+
duplicatesStrategy 'exclude'
59+
60+
manifest {
61+
attributes 'Main-Class': 'jacamo.infra.JaCaMoLauncher'
62+
}
63+
archiveBaseName = 'jacamo-automation_management_microservice' // the name must start with jacamo so that jacamo...jar is found in the classpath
64+
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
65+
from (project.projectDir.absolutePath) {
66+
include '**/*.asl'
67+
include '**/*.xml'
68+
include '**/*.sai'
69+
include '**/*.ptl'
70+
include '**/*.jcm'
71+
include '*.properties'
72+
}
73+
from (project.buildDir.absolutePath + '/jcm') {
74+
include '**/*'
75+
}
76+
with jar
77+
78+
doFirst {
79+
copy {
80+
from 'automation_management_microservice.jcm'
81+
rename 'automation_management_microservice.jcm','default.jcm'
82+
into project.buildDir.absolutePath + '/jcm'
83+
}
84+
}
85+
}
86+
87+
clean {
88+
delete 'bin'
89+
delete 'build'
90+
delete 'log'
91+
}

build.gradle.kts

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1+
#
2+
# Copyright (c) 2023. Smart Operating Block
3+
#
4+
# Use of this source code is governed by an MIT-style
5+
# license that can be found in the LICENSE file or at
6+
# https://opensource.org/licenses/MIT.
7+
#
8+
19
distributionBase=GRADLE_USER_HOME
210
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
11+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
412
zipStoreBase=GRADLE_USER_HOME
513
zipStorePath=wrapper/dists

gradlew

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
#!/bin/sh
22

33
#
4-
# Copyright © 2015-2021 the original authors.
4+
# Copyright (c) 2023. Smart Operating Block
55
#
6-
# Licensed under the Apache License, Version 2.0 (the "License");
7-
# you may not use this file except in compliance with the License.
8-
# You may obtain a copy of the License at
9-
#
10-
# https://www.apache.org/licenses/LICENSE-2.0
11-
#
12-
# Unless required by applicable law or agreed to in writing, software
13-
# distributed under the License is distributed on an "AS IS" BASIS,
14-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
# See the License for the specific language governing permissions and
16-
# limitations under the License.
6+
# Use of this source code is governed by an MIT-style
7+
# license that can be found in the LICENSE file or at
8+
# https://opensource.org/licenses/MIT.
179
#
1810

1911
##############################################################################

logging.properties

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#
2+
# Copyright (c) 2023. Smart Operating Block
3+
#
4+
# Use of this source code is governed by an MIT-style
5+
# license that can be found in the LICENSE file or at
6+
# https://opensource.org/licenses/MIT.
7+
#
8+
9+
# JaCaMo Default log configuration
10+
#
11+
# Comment/uncomment the following lines to setup your log
12+
#
13+
14+
# default Jason MAS Console
15+
#handlers = jason.runtime.MASConsoleLogHandler
16+
17+
# To use the ConsoleHandler, use the following line instead.
18+
handlers= java.util.logging.ConsoleHandler
19+
20+
# To also add the FileHandler, use the following line instead.
21+
#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler
22+
23+
# Default logging level. Other values are:
24+
# SEVERE (only severe messages)
25+
# WARNING (only warnings and severe messages)
26+
# INFO (normal output)
27+
# FINE (debug level of messages)
28+
.level = INFO
29+
30+
############################################################
31+
# Handler specific properties.
32+
# Describes specific configuration info for Handlers.
33+
############################################################
34+
35+
# Jason Handler parameters
36+
jason.runtime.MASConsoleLogHandler.level = ALL
37+
jason.runtime.MASConsoleLogHandler.formatter = jason.runtime.MASConsoleLogFormatter
38+
# set one text area for each agent
39+
jason.runtime.MASConsoleLogHandler.tabbed = true
40+
jason.runtime.MASConsoleLogHandler.colors = false
41+
42+
# default file output is in project's directory.
43+
java.util.logging.FileHandler.pattern = log/mas-%g.log
44+
java.util.logging.FileHandler.limit = 500000
45+
java.util.logging.FileHandler.count = 10
46+
java.util.logging.FileHandler.formatter = jason.runtime.MASConsoleLogFormatter
47+
#java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
48+
49+
# Limit the message that are printed on the console to FINE and above.
50+
java.util.logging.ConsoleHandler.level = FINE
51+
java.util.logging.ConsoleHandler.formatter = jason.runtime.MASConsoleLogFormatter
52+
53+
java.level=OFF
54+
javax.level=OFF
55+
sun.level=OFF
56+
jade.level=OFF

settings.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
19
rootProject.name = "automation-management-microservice"
210

src/agt/sample_agent.asl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
9+
/* Initial beliefs and rules */
10+
11+
/* Initial goals */
12+
13+
!start.
14+
15+
/* Plans */
16+
17+
+!start : true <- .print("hello world.").
18+
19+
{ include("$jacamoJar/templates/common-cartago.asl") }
20+
{ include("$jacamoJar/templates/common-moise.asl") }
21+
22+
// uncomment the include below to have an agent compliant with its organisation
23+
//{ include("$moiseJar/asl/org-obedient.asl") }

src/env/example/Counter.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
9+
// CArtAgO artifact code for project automation_management_microservice
10+
11+
package example;
12+
13+
import cartago.*;
14+
15+
public class Counter extends Artifact {
16+
void init(int initialValue) {
17+
defineObsProperty("count", initialValue);
18+
}
19+
20+
@OPERATION
21+
void inc() {
22+
ObsProperty prop = getObsProperty("count");
23+
prop.updateValue(prop.intValue()+1);
24+
signal("tick");
25+
}
26+
}
27+

0 commit comments

Comments
 (0)