Coder Social home page Coder Social logo

actoron / jadex Goto Github PK

View Code? Open in Web Editor NEW
41.0 9.0 14.0 460.76 MB

Jadex Active Components

Home Page: https://www.activecomponents.org

License: GNU General Public License v3.0

Java 76.61% Groovy 0.06% HTML 0.21% JavaScript 19.77% CSS 1.81% Batchfile 0.01% XSLT 1.22% TypeScript 0.12% GAP 0.17%

jadex's Introduction

Jadex Active Components

The Jadex Active Components Framework provides programming and execution facilities for distributed and concurrent systems. The general idea is to consider systems to be composed of components acting as service providers and consumers. Hence, it is very similar to the Service Component Architecture (SCA) approach and extends it with agents-oriented concepts. In contrast to SCA, components are always active entities, i.e. they posses autonomy with respect to what they do and when they perform actions making them akin to agents. In contrast to agents, communication is preferably done using service invocations.

Read more about Active Components at https://www.activecomponents.org and visit the documentation overview.

Maven/Gradle dependencies

Gradle:

implementation 'org.activecomponents.jadex:jadex-distribution-minimal:'+jadex_version

Maven:

<dependency>
    <groupId>org.activecomponents.jadex</groupId>
    <artifactId>jadex-distribution-minimal</artifactId>
    <version>${jadexversion}</version>
</dependency>

For more details on setting up a development project see the Getting Started Guide.

Releases

For the latest release versions, please have a look at our download page.

jadex's People

Contributors

ap-actoron avatar heikobornholdt avatar jellelicht avatar jkactoron avatar kalinjul avatar kj-actoron avatar lb-actoron avatar theflipflop avatar yashikno avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jadex's Issues

How to use Maintain Goals without getting BodyAborted

I have a belief that consists of a simple queue of items, where I basically want to maintain a goal as long as there are items in this queue.

This leads me to believe that setting both GoalTargetCondition and GoalMaintainCondition to be implemented as queue.size() == 0 should do what I want.

This works well in the sense that plans are being deliberated and started as soon as anything is put in my queue, but the issue is what happens when I am in the (for now) last round of executing a plan; the moment (or very soon after) I empty out my queue of the last item, the plan that did this gets stopped. Any statements after the line of code where I empty the queue (queue.poll()) seems to not be executed, among which adapting some other beliefs or some logging.

How can I make sure my plan still finishes? I can hack around this by creating a GoalRecurCondition-annotated goal and playing around with orsuccess, retrydelay, recur, but the semantics of a Maintain Goal seem like a much better fit;

How to inject POJO with generated classes

I’m trying to define agents in an interactive environment;
Using the recently released jadex.bdiv3.runtime.BDIAgent I can easily define my agents without a separate bytecode enhancement step, but I still need to have a ComponentFactory for the generated class;

Problem is that component factories seem to assume/require an on-disk .class file, which naturally does not exist for classes that only exist in-memory of the JVM process.

Provided I stick to POJO’s that I manually construct, Is there a trick or short-circuit I can use to not need a ComponentFactory? Alternatively, is there a way for ComponentFactory to support classes that only exist in-process? Obviously this is about explorative programming, so there is no need to support with distributed/networked/multi-process JVM situations.

For some context, the problematic stack trace I get on trying to load my in-process defined agent POJO, a subclass of BDIAgent:

2. Unhandled jadex.bridge.service.search.ServiceNotFoundException                                                                      
                                                                                                                                       
1. Caused by jadex.bridge.service.search.ServiceNotFoundException                                                                      
   filter=FactoryFilter(xyz.jlicht.integration_test.proxy$jadex.bdiv3.runtime.BDIAgent$Foobar$144232d7.class)                          
                                                                                                                                       
    SComponentFactory.java:  810  jadex.bridge.service.types.factory.SComponentFactory/doFindFactory                                   
    SComponentFactory.java:  801  jadex.bridge.service.types.factory.SComponentFactory$11/customResultAvailable                        
ExceptionDelegationResultListener.java:   55  jadex.commons.future.ExceptionDelegationResultListener/resultAvailable                   
ExceptionDelegationResultListener.java:  122  jadex.commons.future.ExceptionDelegationResultListener/resultAvailableIfUndone

NB, everything works as expected if I have the same code, but pre-compile it to class files. I just would like the option to make changes in a running process (perhaps restarting the jadex platform) without having to also write class files to disk.

ASMBDIClassGenerator generates broken bytecode /w branching

Given the following (simplified) Agent:

package hello;
import jadex.micro.annotation.Agent;

@Agent(type="bdi")
public class Broken
{
    public Broken() {
        String s = "hello";
        if (s.equals("hello")) {
            return;
        }
        throw new UnsupportedOperationException("This should never happen!");
    }
}

Bytecode-enhancing this using e.g. BDIEnhancer leads to the following error when trying to load the resulting .class-file:

Expecting a stackmap frame at branch target 21
Exception Details:
  Location:
    hello/Broken.__init_expressions_hello_Broken()V @9: ifeq
  Reason:
    Expected stackmap frame at this location.
  Bytecode:
    0000000: 1228 4c2b 1228 b600 2e99 000c b1       

My uneducated guess is that the current bytecode rewriter simply 'forgets' that the return statement is found in a 'one-deep' if-statement.

Would it be possible to document or explain which transformations are applied, on a non-bytecode level, and why they are required? It might be easier to simply apply them manually to client code, as an option.

Adding components only works with a magic string path (Jadex 3.0.117)

I found a strange issue when starting a platform over a PlatformConfiguration with added components. The platform starts up fine if I directly use a magic string for the full path of the added component:

config.addComponent("myproject.mypackage.MyAgent.class");

However, config.addComponent(MyAgent.class); does not work (the platform does not start properly and Jadex hangs up), although Jadex should support Class objects.
Interestingly, even this does not work, although the same string content is passed:

String path = MyAgent.class.getName() + ".class";
config.addComponent(path);

So the only possibility is to use the magic string as argument as shown above, which makes platform definitions quite error-prone for refactorings. I cannot explain this behavior, but it should be a bug, I guess.

Run capability in new thread

I have created a capability (from this tutorial: https://download.actoron.com/docs/releases/latest/jadex-mkdocs/tutorials/bdiv3/06%20Using%20Capabilities/).

I call my capability:

String msg = (String) ibdiAgentFeature.dispatchTopLevelGoal(capability.new Check(msg)).get();
In the main thread it works. But I need to call my capability from another thread. How can I do this?

Here is my thread:

Thread t = new Thread(() -> {
   System.out.println((String) ibdiAgentFeature.dispatchTopLevelGoal(capability.new Check("my message")).get());
});
t.start();

P.S. when I call it from another thread - nothing happens.

Hope you will help me. Thank you in advance.

How to define Agents without nullary constructor

Because of library constraints, my @Agent-annotated class MyAgent cannot have a nullary constructor.

Would it be possible to introduce a way to register a factory method (e.g. as a Supplier<MyAgent>, perhaps with a mapping from MyAgent.class to this factory object)

How to actually build and install local version

How does one actually build and use the project locally?

With maven projects, it usually is only a mvn install away, but running ./gradlew -Pdist=publishdists -x test -x javadoc install leads to only jadex-platform-webservice-websocket being installed to my ~/.m2.

How do you do local development while being able to use your local builds in combination with your maven/gradle projects?

The 'full' output:

Warning: Build script reduced to find dependencies for project :tools:gradle-plugin
Warning: Build script reduced to find dependencies for project :kernels:bdiv3
Project dependencies evaluated in 1691ms.
Build Mode: development
Available Distributions: addon3d,addongradleplugin,addonjavadoc,addonws,editorbpmn,editorgpmn,everything,minimal,server,standard
Selected distributions: [minimal, standard, addon3d, addonws, editorbpmn]

> Configure project :
Jadex Build Version 4.0.9999-SNAPSHOT
[configuration ':distributions:standard:compileClasspath', configuration ':platform:webservice-websocket:compileClasspath', configuration ':util:commons:compileClasspath', configuration ':tools:runtimetools-swing:compileClasspath', configuration ':applications:bpmn:compileClasspath', configuration ':util:gui:compileClasspath', configuration ':tools:runtimetools-web:compileClasspath', configuration ':serialization:json:compileClasspath', configuration ':tools:servletfilter-web:compileClasspath', configuration ':transports:base:compileClasspath', configuration ':kernels:application:compileClasspath', configuration ':rules:base:compileClasspath', configuration ':distributions:minimal:compileClasspath', configuration ':kernels:bpmn:compileClasspath', configuration ':transports:tcp:compileClasspath', configuration ':kernels:model-bpmn:compileClasspath', configuration ':tools:bdi:compileClasspath', configuration ':platform:bridge:compileClasspath', configuration ':addons:3d:compileClasspath', configuration ':serialization:traverser:compileClasspath', configuration ':tools:base-swing:compileClasspath', configuration ':distributions:editorbpmn:compileClasspath', configuration ':applications:applib-bdi:compileClasspath', configuration ':addons:ws:compileClasspath', configuration ':applications:micro:compileClasspath', configuration ':applications:web:compileClasspath', configuration ':kernels:micro:compileClasspath', configuration ':environments:envsupport:compileClasspath', configuration ':platform:webservice-desktop-jetty:compileClasspath', configuration ':applications:quickstart:compileClasspath', configuration ':platform:base:compileClasspath', configuration ':transports:intravm:compileClasspath', configuration ':util:security:compileClasspath', configuration ':rules:tools:compileClasspath', configuration ':tools:bpmn:compileClasspath', configuration ':applications:bdi:compileClasspath', configuration ':kernels:microservice:compileClasspath', configuration ':util:bytecode:compileClasspath', configuration ':serialization:binary:compileClasspath', configuration ':applications:mixed:compileClasspath', configuration ':applications:webservice:compileClasspath', configuration ':serialization:xml:compileClasspath', configuration ':util:javaparser:compileClasspath', configuration ':applications:java8:compileClasspath', configuration ':transports:relaytransport:compileClasspath', configuration ':util:concurrent:compileClasspath', configuration ':applications:bdiv3:compileClasspath', configuration ':environments:agr:compileClasspath', configuration ':platform:webservice-desktop-grizzly:compileClasspath', configuration ':tools:base:compileClasspath', configuration ':platform:webservice-desktop:compileClasspath', configuration ':kernels:component:compileClasspath', configuration ':tools:servletfilter:compileClasspath', configuration ':kernels:base:compileClasspath', configuration ':environments:envsupport-jmonkey:compileClasspath', configuration ':rules:eca:compileClasspath', configuration ':platform:webservice:compileClasspath', configuration ':transports:websockettransport:compileClasspath', configuration ':kernels:bdiv3:compileClasspath', configuration ':editors:bpmn:compileClasspath', configuration ':tools:comanalyzer:compileClasspath']
public javadocs: task 'publicJavadoc' output files

> Configure project :util:javaparser
Disabled task ':util:javaparser:compileJavacc'
Disabled task ':util:javaparser:compileJjtree'
Distribution "addon3d" is non-commercial and an add-on.
Distribution "addonws" is non-commercial and an add-on.
Distribution "editorbpmn" is non-commercial and standalone.
Distribution "minimal" is non-commercial and standalone.
Distribution "standard" is non-commercial and standalone.

> Task :util:javaparser:compileJjtree SKIPPED
> Task :util:javaparser:compileJavacc SKIPPED
> Task :createVersionInfo UP-TO-DATE
> Task :platform:webservice-websocket:processResources UP-TO-DATE
> Task :util:commons:compileJava UP-TO-DATE
> Task :serialization:traverser:compileJava UP-TO-DATE
> Task :platform:webservice-websocket:javadocJar
> Task :serialization:binary:compileJava UP-TO-DATE
> Task :util:concurrent:compileJava UP-TO-DATE
> Task :util:bytecode:compileJava UP-TO-DATE
> Task :util:javaparser:compileJava UP-TO-DATE
> Task :serialization:xml:compileJava UP-TO-DATE
> Task :serialization:json:compileJava UP-TO-DATE
> Task :rules:eca:compileJava UP-TO-DATE
> Task :util:security:compileJava UP-TO-DATE
> Task :platform:bridge:compileJava UP-TO-DATE
> Task :platform:webservice-websocket:sourcesJar
> Task :kernels:model-bpmn:compileJava UP-TO-DATE
> Task :kernels:base:compileJava UP-TO-DATE
> Task :kernels:micro:compileJava UP-TO-DATE
> Task :util:gui:compileJava UP-TO-DATE
> Task :kernels:microservice:compileJava UP-TO-DATE
> Task :transports:base:compileJava UP-TO-DATE
> Task :kernels:bpmn:compileJava UP-TO-DATE
> Task :transports:relaytransport:compileJava UP-TO-DATE
> Task :transports:tcp:compileJava UP-TO-DATE
> Task :platform:base:compileJava UP-TO-DATE
> Task :transports:websockettransport:compileJava UP-TO-DATE
> Task :distributions:minimal:compileJava NO-SOURCE
> Task :platform:webservice-websocket:compileJava UP-TO-DATE
> Task :platform:webservice-websocket:classes UP-TO-DATE
> Task :platform:webservice-websocket:jar
> Task :platform:webservice-websocket:install

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 9s
29 actionable tasks: 4 executed, 25 up-to-date

[RFC] Resolve Runtime Annotations via Interfaces

Currently, reflection to retrieve Runtime annotations such as Belief and RequiredServices is done on a class and all its superclasses in the MicroClassReader and all its Agent/Capability-annotated superclasses in the BDIClassReader.

Would you be open to accepting a PR to extend this mechanism to also work via interfaces?
This would make it possible to have e.g.

@RequiredServices({                                                                                                                    
    @RequiredService(name="context", type=IContextService.class, binding=@Binding(scope=ServiceScope.PLATFORM))                        
})                                                                                                                                     
public interface Foo {
    @Belief
    long getBaz();
   
    @Belief
    void setBaz(long value);
}

, and allow having pretty ‘clean’ agent implementations for the actual classes.
E.g.:

class MyAgent extends BDIAgent implements Foo

Thanks for the consideration

IPojoComponentFeature not working in the latest version (jadex-3.0.113)

A defined POJO Agent with correctly getters and setters currently can only be accessed by injection Inside a Service:

@ServiceComponent
POJOAgent pojoAgent;

Following the tutorial (Docs » Active Components Tutorial » External Access), I cannot perform the following instruction:

public class BotGuiF3 extends AbstractComponentViewerPanel {
	@Override
	public JComponent getComponent() {
		final BotPanel botPanel = new BotPanel();
		final IExternalAccess agent = getActiveComponent();
		IFuture<String[]> fut = agent.scheduleStep(new IComponentStep<String[]>() {
		
			//@ServiceComponent
			//ChatBotF2Agent chatbot; // this injection not happens, since it is not a service procedure.

			public IFuture<String[]> execute(IInternalAccess ia) {
				ChatBotF3Agent chatbot = (ChatBotF3Agent)((IPojoComponentFeature)ia).getPojoAgent();
				return new Future<String[]>(new String[] {chatbot.getKeyword(), chatbot.getReply()});
			}
		
		});

		fut.addResultListener(new SwingDefaultResultListener<String[]>() {
		
			@Override
			public void customResultAvailable(String[] result) {
				botPanel.getKeywordTextField().setText(result[0]);
				botPanel.getReplyTextField().setText(result[1]);
			}
		
		});
		
		...
}

When executing the following line ChatBotF3Agent chatbot = (ChatBotF3Agent)((IPojoComponentFeature)ia).getPojoAgent(); Throws:

java.lang.ClassCastException: class jadex.platform.service.cms.PlatformComponent cannot be cast to class jadex.bridge.component.IPojoComponentFeature (jadex.platform.service.cms.PlatformComponent and jadex.bridge.component.IPojoComponentFeature are in unnamed module of loader 'app')
	at tutorial.chatservice.BotGuiF3$1.execute(BotGuiF3.java:32)
	at jadex.bridge.component.impl.ExecutionComponentFeature.execute(ExecutionComponentFeature.java:1176)
	at jadex.commons.concurrent.Executor.code(Executor.java:299)
	at jadex.commons.concurrent.Executor.run(Executor.java:126)
	at jadex.platform.service.execution.AsyncExecutionService$1.run(AsyncExecutionService.java:109)
	at jadex.commons.concurrent.ThreadPool$ServiceThread.run(ThreadPool.java:515)

Dec 21, 2018 11:54:47 PM jadex.commons.future.DefaultResultListener exceptionOccurred
WARNING: Exception occurred: tutorial.chatservice.BotGuiF3$2@410f4d40, java.lang.ClassCastException: class jadex.platform.service.cms.PlatformComponent cannot be cast to class jadex.bridge.component.IPojoComponentFeature (jadex.platform.service.cms.PlatformComponent and jadex.bridge.component.IPojoComponentFeature are in unnamed module of loader 'app')

IPojoComponentFeature are in unnamed module of loader 'app'

Java Environment that reproduced this problem:

openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment (build 11.0.1+13-suse-lp150.2.9.1-x8664)
OpenJDK 64-Bit Server VM (build 11.0.1+13-suse-lp150.2.9.1-x8664, mixed mode)

The tutorial points to (ChatBotF3Agent)((IPojoMicroAgent)ia).getPojoAgent();, whose IPojoMicroAgent no longer exists in this Jadex version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.