### Java Component Initialization Example Source: https://redmine.irit.fr/projects/may/wiki/Reference_Guides/13/annotate Illustrates how to perform component initialization by overriding the `start()` method. This method is called during the `newComponent()` process and can be used for setup tasks. ```java public class MySimpleComponentImpl extends MySimpleComponent { @Override protected AnotherJavaInterface make_p1() { return new AnotherJavaInterface() { @Override public Integer test() { return 10; } }; } @Override protected void start() { // do some initialisation using the requires() or the parts(), create a GUI, etc... } } ``` -------------------------------- ### Create Application Entry Point in Java Source: https://redmine.irit.fr/projects/may/wiki/SpeADL_Minus_Tutorial/6 This Java code snippet demonstrates the creation of an application entry point. It instantiates a composite component using `new CompositeImpl().newComponent()`. This code requires the `CompositeComponentType` and `CompositeImpl` classes to be available. ```java package tutorial1; import tutorial1.composite.CompositeComponentType; import tutorial1.composite.impl.CompositeImpl; public class Application { public static void main(String[] args) { CompositeComponentType.Component component = new CompositeImpl().newComponent(); } } ``` -------------------------------- ### Download SpeADL MAY Source Code Source: https://redmine.irit.fr/projects/may/wiki/MAY_Install/38/diff Commands to clone the SpeADL MAY project and its associated libraries and examples using the Mercurial Distributed Version Control System (DVCS). ```bash hg clone https://anon@wwwsecu.irit.fr/hg/SMAC/victor-noel-phd/may/may/ hg clone https://anon@wwwsecu.irit.fr/hg/SMAC/victor-noel-phd/may/lib/ ``` -------------------------------- ### Java Test Program Setup Source: https://redmine.irit.fr/projects/may/wiki/SpeADL_Dynamic_Tutorial/15/annotate Sets up a test program in the tutorial2.logging.tests package. It imports necessary classes like File and tutorial2.logging.Logging, preparing the environment for testing the logging implementation. ```Java package tutorial2.logging.tests; import java.io.File; import tutorial2.logging.Logging; ``` -------------------------------- ### Install MAVEN Plugin for Eclipse Source: https://redmine.irit.fr/projects/may/wiki/MAY_Install/37/annotate Information and a link to instructions for installing the MAVEN plugin for Eclipse. This plugin facilitates publishing project information and sharing JARs across projects. ```text Follow the instructions on this page to install it : [[Maven Plugin Install for Eclipse]] ``` -------------------------------- ### Install Maven Eclipse Plugin (M2E) Source: https://redmine.irit.fr/projects/may/wiki/MAY_Maven_Eclipse_Setup/10/annotate Instructions for installing the Maven Integration for Eclipse (M2E) plugin. This involves navigating to 'Help' > 'Install New Software...' in Eclipse and selecting the plugin from the available sites. ```text Go to *Help* / *Install New Software...* and select the *All available site* in the drop-down list (it may take some time to load). Expand the *Collaboration* category and select *m2e - Maven Integration for Eclipse*. Click *Next*, finish the installation procedure and restart Eclipse when asked to. ``` -------------------------------- ### Application Entry Point in Java Source: https://redmine.irit.fr/projects/may/wiki/SpeADL_Dynamic_Tutorial/36/annotate This is the main method for the application, serving as the entry point. It instantiates the BankImpl with a file path for logs and then calls newComponent() to initialize the application's components. ```java public static void main(String[] args) { new BankImpl(new File("/tmp/tutorial2-bank-logs/")).newComponent(); } ``` -------------------------------- ### Run Tutorial Application in Java Source: https://redmine.irit.fr/projects/may/wiki/SpeADL_Minus_Tutorial/6/annotate Demonstrates how to run a tutorial application by creating an instance of CompositeImpl, obtaining a component, creating a Request object, computing the result using the component's service, and printing the output. This code is part of the main Application class. ```Java package tutorial1; import tutorial1.client.datatypes.Request; import tutorial1.composite.CompositeComponentType; import tutorial1.composite.impl.CompositeImpl; public class Application { public static void main(String[] args) { CompositeComponentType.Component component = new CompositeImpl().newComponent(); Request input = new Request(true); Request output = component.service().compute(input); System.out.println(output.b); } } ``` -------------------------------- ### Clone MAY Libraries with Mercurial Source: https://redmine.irit.fr/projects/may/wiki/MAY_Install/10/annotate Command to clone the MAY libraries repository using Mercurial. This is a separate repository from the main source code and contains necessary libraries and examples for MAY. ```bash hg clone https://anon@wwwsecu.irit.fr/hg/SMAC/victor-noel-phd/may/lib/ ``` -------------------------------- ### Edit POM File for MAY Project Source: https://redmine.irit.fr/projects/may/wiki/MAY_Maven_Eclipse_Setup/10/annotate An example of a POM (Project Object Model) file configuration for a MAY project. It includes dependency management for the 'common-components' library, repository configuration, and build settings. ```xml 4.0.0 XXX XXX XXX 3.3.0 fr.irit.smac.lib.may common-components ${may-lib-version} fr.irit.smac http://www.irit.fr/~Victor.Noel/maven-repos/ src src **/*.java maven-compiler-plugin 3.1 1.7 1.7 org.codehaus.mojo build-helper-maven-plugin 1.8 ``` -------------------------------- ### Initialize BankImpl with Logging and Banking Components (Java) Source: https://redmine.irit.fr/projects/may/wiki/SpeADL_Dynamic_Tutorial/37 This snippet shows the initialization of the BankImpl class, setting up the logging and banking components. It extends the base Bank class and overrides methods to provide specific implementations for logging and banking services. Dependencies include tutorial2.bank.Bank, tutorial2.banking.Banking, tutorial2.logging.Logging, and tutorial2.logging.interfaces.ILog. ```Java package tutorial2.bank.impl; import tutorial2.bank.Bank; import tutorial2.banking.Banking; import tutorial2.logging.Logging; import tutorial2.logging.interfaces.ILog; public class BankImpl extends Bank { @Override protected ILog make_elog() { // TODO Auto-generated method stub return null; } @Override protected Logging make_l() { // TODO Auto-generated method stub return null; } @Override protected Banking make_b() { // TODO Auto-generated method stub return null; } } ``` ```Java public class BankImpl extends Bank { private final File logDir; public BankImpl(File logDir) { this.logDir = logDir; } @Override protected Logging make_l() { return new LoggingImplDirectory(logDir); } @Override protected Banking make_b() { return new BankingImpl(); } // ... } ``` ```Java public class BankImpl extends Bank { // ... @Override protected ILog make_elog() { Logging.Logger.Component eLogger = parts().l().create().createStandaloneLogger("BANK"); return eLogger.log(); } // ... } ``` -------------------------------- ### Java Test Program Setup Source: https://redmine.irit.fr/projects/may/wiki/SpeADL_Dynamic_Tutorial/13/annotate Sets up a test program within the `tutorial2.logging.tests` package. It imports necessary classes like `File` and `Logging` to demonstrate the usage of the logging implementation. This snippet is the beginning of a test class. ```java package tutorial2.logging.tests; import java.io.File; import tutorial2.logging.Logging; ``` -------------------------------- ### Clone SpeADL MAY Source Code with Mercurial Source: https://redmine.irit.fr/projects/may/wiki/MAY_Install/46/diff Provides commands to clone the SpeADL MAY project and its associated libraries and examples using the Mercurial Distributed Version Control System (DVCS). It also mentions a Mercurial integration plugin for Eclipse. ```bash hg clone https://anon@wwwsecu.irit.fr/hg/SMAC/victor-noel-phd/may/may/ hg clone https://anon@wwwsecu.irit.fr/hg/SMAC/victor-noel-phd/may/lib/ ``` -------------------------------- ### Resolve Maven POM file errors Source: https://redmine.irit.fr/projects/may/wiki/MAY_Maven_Eclipse_Setup/6/annotate This section addresses common errors encountered with Maven's pom.xml file, particularly when using plugins like 'build-helper-maven-plugin'. It provides instructions on how to update the project configuration or discover and install missing Maven connectors. ```text Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.8:add-source (execution: add-source, phase: generate-sources) Click on *Discover new m2e connectors*, it should pre-check *buildhelper*, simply click *Finish* to accept and do the installation. ``` -------------------------------- ### Java Component Implementation Example Source: https://redmine.irit.fr/projects/may/wiki/SpeADL_Minus_Reference/3/diff Demonstrates the implementation of component parts and overriding the 'start()' method for initialization. It shows how to define provided interfaces and access component parts. ```java protected AnotherJavaInterface make_p1() { return new AnotherJavaInterface() { @Override public Integer test() { return parts().s().p1().test(); } }; } @Override protected MyBeautifulComponent make_b1() { return new MyComponentImpl(); } @Override protected MyBeautifulComponent make_b2() { return new MyComponentImpl(); } @Override protected MyBeautifulComponent make_b3() { return new MyComponentImpl(); } } ``` ```java public class MySimpleComponentImpl extends MySimpleComponent { @Override protected AnotherJavaInterface make_p1() { return new AnotherJavaInterface() { @Override public Integer test() { return 10; } }; } @Override protected void start() { // do some initialisation using the requires() or the parts(), create a GUI, etc... } } ``` -------------------------------- ### Implement Logging and Banking Services in BankImpl Source: https://redmine.irit.fr/projects/may/wiki/SpeADL_Dynamic_Tutorial/12/diff This snippet shows the implementation of the make_l() and make_b() methods in the BankImpl class. It demonstrates how to initialize LoggingImplDirectory and BankingImpl, which are essential for the bank's operations. The logDir is passed to the LoggingImplDirectory constructor. ```java public class BankImpl extends Bank { private final File logDir; public BankImpl(File logDir) { this.logDir = logDir; } @Override protected Logging make_l() { return new LoggingImplDirectory(logDir); } @Override protected Banking make_b() { return new BankingImpl(); } // ... } ``` -------------------------------- ### Initialize Component During Instantiation (Java) Source: https://redmine.irit.fr/projects/may/wiki/SpeADL_Minus_Reference/36/annotate Illustrates how to perform component initialization during instantiation by overriding the 'start()' method. This method is called when 'newComponent()' is invoked, allowing for setup logic before the component is fully operational. The example shows returning a value from a test method within a provided port. ```Java public class MySimpleComponentImpl extends MySimpleComponent { @Override protected AnotherJavaInterface make_p1() { return new AnotherJavaInterface() { @Override public Integer test() { return 10; } }; } } ``` -------------------------------- ### Install MAY Plugin in Eclipse Source: https://redmine.irit.fr/projects/may/wiki/MAY_Install/10/annotate Steps to install the MAY plugin in Eclipse Helios. This involves navigating to 'Help' > 'Install New Software...' and adding a new remote site. The name 'may' and the provided location are required. ```text Help / Install New Software... / Add... Name: may Location: http://www.irit.fr/~Victor.Noel/may/update-snapshots/ ``` -------------------------------- ### Implement Account Start Method Source: https://redmine.irit.fr/projects/may/wiki/SpeADL_Dynamic_Tutorial/15/annotate This Java code defines the `start` method for an account implementation within an ecosystem. It logs a message indicating a new account has been added for a specific owner using the ecosystem's logging service. ```Java @Override protected void start() { eco_requires().elog().addLine("Added a new account for "+owner); } ``` -------------------------------- ### Initial BankImpl Methods (Placeholder) Source: https://redmine.irit.fr/projects/may/wiki/SpeADL_Dynamic_Tutorial/12/diff This snippet shows the initial, unimplemented methods of the BankImpl class, marked with TODO comments. These include make_elog(), make_l(), make_b(), and make_LoggedAccount(), which are later implemented in the class. ```java protected ILog make_elog() { // TODO Auto-generated method stub return null; } @Override protected Logging make_l() { // TODO Auto-generated method stub return null; } @Override protected Banking make_b() { // TODO Auto-generated method stub return null; } @Override protected LoggedAccount make_LoggedAccount(String owner) { // TODO Auto-generated method stub return null; } } ``` -------------------------------- ### SpeADL MAY Installation and Setup Source: https://redmine.irit.fr/projects/may/wiki/Make_Agents_Yourself/27/annotate Instructions for installing SpeADL MAY using Eclipse update sites and setting up a new project. This includes adding the SpeADL Nature to a Java project and creating new files with the .speadl extension. ```text To install it: [[SpeADL MAY Install]] To set-up a new project: [[SpeADL MAY Project SetUp]] To install it, use the following update site with Eclipse Helios: http://www.irit.fr/~Victor.Noel/may/update-may-2/ Development version is at (careful, could be buggy and breaking everything), this is an implementation for the paper "Une approche architecturale à base de composants pour l'implémentation des SMA". It must be used with the version 3.X.X of the components and Eclipse Helios. http://www.irit.fr/~Victor.Noel/may/update-may-3-snapshots/ After creating a Java project, don't forget to add the SpeADL Nature to the project (right-click, configure). Then create a new file with the speadl extension. ``` -------------------------------- ### Install Maven Plugin in Eclipse Source: https://redmine.irit.fr/projects/may/wiki/MAY_Install/10/annotate Instructions for installing the Maven plugin (m2e) in Eclipse. Similar to the MAY plugin, this requires adding a new remote site via 'Help' > 'Install New Software...' with the name 'maven' and the specified location. ```text Help / Install New Software... / Add... Name: maven Location: http://download.eclipse.org/technology/m2e/releases ``` -------------------------------- ### Java: Component Instantiation Example Source: https://redmine.irit.fr/projects/may/wiki/SpeADL_Minus_Reference/3/annotate This Java code snippet provides a basic example of how to instantiate a component. It shows the direct creation of a component instance and then demonstrates accessing a method on one of its provided ports. ```java return new MyComponentImpl(); ``` -------------------------------- ### Start Method - Java Source: https://redmine.irit.fr/projects/may/wiki/SpeADL_Dynamic_Tutorial/28/annotate This Java code snippet shows the implementation of a start method, likely within a component or species. It logs a message indicating that a new account has been added, utilizing the eco_requires().elog().addLine() method, which suggests a dependency on a logging service within an ecosystem. ```java @Override protected void start() { eco_requires().elog().addLine("Added a new account for "+owner); } ``` -------------------------------- ### Install 'Make Agents Yourself' Plugin for Eclipse Source: https://redmine.irit.fr/projects/may/wiki/MAY_Install/62/diff Instructions for adding and installing the 'Make Agents Yourself' plugin in Eclipse. This involves navigating to 'Install New Software', adding a new repository with a specified name and location, selecting the plugin, and completing the installation process, including accepting license agreements and restarting Eclipse. ```text Help / Install New Software... / Add... *Name* : may *Location* : http://www.irit.fr/~Victor.Noel/may/update-may-2/ Select *Make Agents Yourself* and click *Next*. It will take some times calculating requirements and dependencies. Click *Next* again when it shows you the install details and accept the terms of the licence agreements, then *Finish*. Click *OK* when you get the security warning, and accept to restart Eclipse now. ```