Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions org.javabip.api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>7</source>
<target>7</target>
</configuration>
</plugin>
</plugins>
Expand Down
7 changes: 7 additions & 0 deletions org.javabip.api/src/main/java/org/javabip/api/DataWire.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ public interface DataWire {
*/
public PortBase getTo();

/**
* Gets the port to which the data is being sent to.
*
* @return the port to which the data is being sent to.
*/
public Boolean isCopy();

/**
* Checks if the given input data of the given component type is at the incoming end of the wire. The function is
* used by the BIP Engine.
Expand Down
15 changes: 15 additions & 0 deletions org.javabip.glue/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@
<groupId>org.javabip</groupId>
<artifactId>org.javabip.api</artifactId>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>17-ea+11</version>
</dependency>

</dependencies>

Expand Down
15 changes: 7 additions & 8 deletions org.javabip.glue/src/main/java/org/javabip/glue/BIPGlueImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,19 @@
*/
package org.javabip.glue;

import java.io.OutputStream;
import java.util.ArrayList;
import org.javabip.api.Accept;
import org.javabip.api.BIPGlue;
import org.javabip.api.DataWire;
import org.javabip.api.Require;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;

import org.javabip.api.Accept;
import org.javabip.api.BIPGlue;
import org.javabip.api.DataWire;
import org.javabip.api.Require;
import java.io.OutputStream;
import java.util.ArrayList;

/**
* Class implementing the functionality of the BIP Glue.
Expand Down Expand Up @@ -72,7 +71,7 @@ public BIPGlueImpl(ArrayList<Accept> acceptConstraints, ArrayList<Require> requi

this.dataWires = new ArrayList<DataWireImpl>();
for (DataWire dataWire : dataWires) {
this.dataWires.add(new DataWireImpl(dataWire.getFrom(), dataWire.getTo()));
this.dataWires.add(new DataWireImpl(dataWire.getFrom(), dataWire.getTo(), dataWire.isCopy()));
}

}
Expand Down
19 changes: 16 additions & 3 deletions org.javabip.glue/src/main/java/org/javabip/glue/DataWireImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
*/
package org.javabip.glue;

import javax.xml.bind.annotation.XmlElement;

import org.javabip.api.DataWire;
import org.javabip.api.PortBase;

import javax.xml.bind.annotation.XmlElement;

/**
* Class implementing the data wire functionality. Data wires are sued to specify the data connections between different
* components.
Expand All @@ -36,12 +36,15 @@ class DataWireImpl implements DataWire {
@XmlElement(name = "to")
private PortBaseImpl to;

private Boolean isCopy;

public DataWireImpl() {
}

public DataWireImpl(PortBase from, PortBase to) {
public DataWireImpl(PortBase from, PortBase to, Boolean copy) {
this.from = new PortBaseImpl(from.getId(), from.getSpecType());
this.to = new PortBaseImpl(to.getId(), to.getSpecType());
this.isCopy = copy;
}

public PortBase getFrom() {
Expand All @@ -52,6 +55,16 @@ public PortBase getTo() {
return to;
}

/**
* Gets the boolean value indicating if the data shall be copied or passed by reference
*
* @return true if the value shall be copied, false otherwise
*/
@Override
public Boolean isCopy() {
return isCopy;
}

/**
* Defines whether this wire provides this required data for this requiring component.
*
Expand Down
36 changes: 21 additions & 15 deletions org.javabip.glue/src/main/java/org/javabip/glue/GlueBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,17 @@
*/
package org.javabip.glue;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.javabip.annotations.ComponentType;
import org.javabip.api.BIPGlue;
import org.javabip.api.PortBase;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;

import org.javabip.annotations.ComponentType;
import org.javabip.api.BIPGlue;
import org.javabip.api.PortBase;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.annotation.Annotation;
import java.util.*;

/**
* Provides functionality to build BIP Glue.
Expand Down Expand Up @@ -339,7 +332,20 @@ public void to(Class<?> spec, String dataId) {
if (dataId.equals(""))
throw new IllegalArgumentException("DataId can not be an empty string.");

glue.addDataWire(new DataWireImpl(from, new PortBaseImpl(dataId, getComponentType(spec))));
glue.addDataWire(new DataWireImpl(from, new PortBaseImpl(dataId, getComponentType(spec)), false));

}

public void copyTo(Class<?> spec, String dataId) {

if (dataId == null)
throw new IllegalArgumentException("DataId can not be null.");
if (spec == null)
throw new IllegalArgumentException("Spec type can not be null");
if (dataId.equals(""))
throw new IllegalArgumentException("DataId can not be an empty string.");

glue.addDataWire(new DataWireImpl(from, new PortBaseImpl(dataId, getComponentType(spec)), true));

}

Expand Down
18 changes: 17 additions & 1 deletion org.javabip.spec.examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@
<groupId>org.javabip</groupId>
<artifactId>org.javabip.executor</artifactId>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor_2.11</artifactId>
</dependency>
<dependency>
<groupId>org.javabip</groupId>
<artifactId>org.javabip.engine.factory</artifactId>
</dependency>

</dependencies>

Expand Down Expand Up @@ -118,7 +126,15 @@
<target>1.6</target>
</configuration>
</plugin>
</plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>7</source>
<target>7</target>
</configuration>
</plugin>
</plugins>
</build>

</project>