diff --git a/README.md b/README.md index f61a803104f1d379428c7fac5210e3ca8a957cdd..1e105c6a9c42f82db4c420f3895264f56b4ef133 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,21 @@ Supplementary material for the [COP 2021](https://conf.researchr.org/track/ecoop The repository contains the source code of a library to be used as a core for systems synchronizing heterogenous object-oriented models. -## Installation +## Prerequisites + +* Java SE Development Kit 8 (minimum) +* Maven 3.6.0 (minimum) + +## Example + +A minimal example project is available in `quickstart`, which just creates a new element at the central hub. + +To run it, clone the repository and run `mvn package exec:java` in `quickstart`. + +## Development + +If you want to work on the actual library: +### Installation This project is based on Maven, thus building it is simple: @@ -13,18 +27,13 @@ This project is based on Maven, thus building it is simple: 3. run mvn -compile 4. run mvn -package -## Setting up IntelliJ +### Setting up IntelliJ 1. Install IntelliJ's Plugin for Scala-Support 2. Clone this maven project 3. Import the project into IntelliJ 4. Wait till all dependencies are downloaded / installed -### Prerequisites - -* Java SE Development Kit 8 (minimum) -* Maven 3.6.0 (minimum) - ### Example Model Code * see https://git-st.inf.tu-dresden.de/rosi/parallel-rsync/-/tree/master/crm-example diff --git a/quickstart/pom.xml b/quickstart/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..cb596a4e207bccb60fc4f3917c2a848c8c4bdacc --- /dev/null +++ b/quickstart/pom.xml @@ -0,0 +1,79 @@ +<?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> + + <groupId>de.tudresden.inf.st.rmsc</groupId> + <artifactId>quickstart</artifactId> + <version>1.0.0</version> + <packaging>jar</packaging> + + <name>Role-Model-Sync Conflict-Resolver Quickstart example</name> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <java.version>1.8</java.version> + </properties> + + <repositories> + <repository> + <id>gitlab-maven</id> + <url>https://git-st.inf.tu-dresden.de/api/v4/projects/959/packages/maven</url> + </repository> + </repositories> + + <distributionManagement> + <repository> + <id>gitlab-maven</id> + <url>https://git-st.inf.tu-dresden.de/api/v4/projects/959/packages/maven</url> + </repository> + + <snapshotRepository> + <id>gitlab-maven</id> + <url>https://git-st.inf.tu-dresden.de/api/v4/projects/959/packages/maven</url> + </snapshotRepository> + </distributionManagement> + + <dependencies> + <!-- SCALA LANGUAGE --> + <dependency> + <groupId>org.scala-lang</groupId> + <artifactId>scala-library</artifactId> + <version>2.12.8</version> + </dependency> + <!-- Parallel RSYNC --> + <dependency> + <groupId>de.tudresden.inf.st.rmsc</groupId> + <artifactId>crm-example</artifactId> + <version>1.0.2</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>net.alchim31.maven</groupId> + <artifactId>scala-maven-plugin</artifactId> + <version>3.1.3</version> + <executions> + <execution> + <goals> + <goal>compile</goal> + <goal>testCompile</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.1</version> + <configuration> + <mainClass>de.tudresden.inf.st.rmsc.quickstart.Main</mainClass> + </configuration> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file diff --git a/quickstart/src/main/scala/de/tudresden/inf/st/rmsc/quickstart/Main.scala b/quickstart/src/main/scala/de/tudresden/inf/st/rmsc/quickstart/Main.scala new file mode 100644 index 0000000000000000000000000000000000000000..65878c012737eeed580da949cda0912bdb1b2cb3 --- /dev/null +++ b/quickstart/src/main/scala/de/tudresden/inf/st/rmsc/quickstart/Main.scala @@ -0,0 +1,26 @@ +package de.tudresden.inf.st.rmsc.quickstart + +import de.tudresden.inf.st.crme.models.MetaModels +import org.rosi_project.model_management.{ClientChangeRecord, ConflictResolution} +import org.rosi_project.model_management.sync.procedures.data.ClientEntireRecord + +import scala.collection.mutable.ListBuffer + + +object Main { + final val MEMBER_MODEL_TYPE = "de.tudresden.inf.st.crme.models.modelB.Member" + + def main(args: Array[String]): Unit = { + MetaModels.initCrmMetaModels() + + val clientChangeRecords = ListBuffer[ClientChangeRecord]() + val clientEntireRecords = ListBuffer[ClientEntireRecord]() + + // Add an example member object + clientChangeRecords.append(ClientChangeRecord(MEMBER_MODEL_TYPE, s"e1", 0, 0, + Map("birthday" -> s"01.01.1995", "lastName" -> s"Member 1", "address" -> "Dresden"), Map(), Map(), s"e1", s"testuser1", refonly = false)) + clientEntireRecords.append(ClientEntireRecord(s"e1", 0, 0, MEMBER_MODEL_TYPE)) + + ConflictResolution.syncModel("creation", clientChangeRecords, clientEntireRecords, 1, s"testuser1") + } +}