Skip to content

Commit

Permalink
Merge pull request #28 from rwth-acis/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
derjasper authored May 23, 2017
2 parents 48f3e05 + 9531a63 commit 0080c45
Show file tree
Hide file tree
Showing 24 changed files with 574 additions and 364 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ivy.jar
/out
/.idea
*.iml
/.DS_Store
*.DS_Store
.settings/org.eclipse.jdt.core.prefs
.settings/org.eclipse.jdt.ui.prefs
/junitvmwatcher*.properties
Expand Down
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ jdk:
#- openjdk7
- oraclejdk8
script: "ant all"
sudo: false
sudo: false
after_success:
- bash <(curl -s https://codecov.io/bash)
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
![las2peer](https://github.com/rwth-acis/las2peer/blob/master/img/logo/bitmap/las2peer-logo-128x128.png)
![las2peer](https://rwth-acis.github.io/las2peer/logo/vector/las2peer-logo.svg)

# [![Build Status](http://layers.dbis.rwth-aachen.de/jenkins/buildStatus/icon?job=las2peer%20Core)](http://layers.dbis.rwth-aachen.de/jenkins/job/las2peer%20Core/) [![Build Status](https://travis-ci.org/rwth-acis/las2peer.svg?branch=master)](https://travis-ci.org/rwth-acis/las2peer) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/rwth-acis/las2peer)

las2peer is a Java-based server framework for developing and deploying services in a distributed Peer-to-Peer (P2P) environment. las2peer was developed by the Advanced Community Information Systems (ACIS) group at the Chair of Computer Science 5 (Information Systems & Databases), RWTH Aachen University, Germany. It's main focus lies on providing developers with a tool to easily develop and test their services and deploy them in a P2P network without having to rely on a centralized infrastructure.

Expand Down Expand Up @@ -34,9 +36,6 @@ To build the las2peer jar file simply run default target:
or directly
```ant jars```

Jenkins: [![Build Status](http://layers.dbis.rwth-aachen.de/jenkins/buildStatus/icon?job=las2peer Core)](http://layers.dbis.rwth-aachen.de/jenkins/job/las2peer%20Core/)

Travis CI: [![Build Status](https://travis-ci.org/rwth-acis/las2peer.svg?branch=master)](https://travis-ci.org/rwth-acis/las2peer)

JUnit Tests
-----------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ cd %~dp0

java -cp %CLASSPATH% i5.las2peer.tools.L2pNodeLauncher %*
pause

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fi;

if [ $(uname -o) = "Cygwin" ]
then
# we're in cygwin
# we're in cygwin
export COLOR_DISABLED=1
export CLASSPATH="${BASE}lib/*;${BASE}export/jars/las2peer.jar;"
else
Expand Down
14 changes: 11 additions & 3 deletions bin/start-network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@
# this script is an example on how to launch a persistent network with multiple nodes at once
# it assumes that you have your las2peer.jar and all other dependencies in ./lib/

PIDFILE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/las2peer-network-screens.pid
echo "$PIDFILE"

# launch bootstrap node at first
screen -S 9085 -d -m java -cp "lib/*" i5.las2peer.tools.L2pNodeLauncher --port 9085 --node-id-seed=9085 interactive
echo "launching bootstrap node at port 14501"
screen -S 14501 -D -m java -cp "lib/*" i5.las2peer.tools.L2pNodeLauncher --port 14501 --node-id-seed 14501 interactive &
# save process id to be used in stop-network.sh later
echo $! > "$PIDFILE"

# launch other network nodes
for i in {9086..9089}; do
screen -S $i -d -m java -cp "lib/*" i5.las2peer.tools.L2pNodeLauncher --port $i --bootstrap localhost:9085 --node-id-seed=$i interactive
for port in {14502..14510}; do
echo "launching node at port $port"
screen -S $port -D -m java -cp "lib/*" i5.las2peer.tools.L2pNodeLauncher --port $port --bootstrap localhost:14501 --node-id-seed $port interactive &
echo $! >> "$PIDFILE"
done
12 changes: 12 additions & 0 deletions bin/stop-network.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# this files kills all processes listed in the pid file
# it can be used to shutdown multiple nodes at once

PIDFILE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/las2peer-network-screens.pid

while read pid; do
kill $pid
done < "$PIDFILE"

/bin/rm "$PIDFILE"
65 changes: 43 additions & 22 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<property name="ivy.organisation" value="i5" />
<property name="ivy.module" value="las2peer" />
<property name="ivy.revision" value="0.6" />
<property name="ivy.build.number" value="8" />
<property name="ivy.build.number" value="9" />
<property name="ivy.deliver.revision" value="${ivy.revision}" />
<property name="ivy.pom.version" value="${ivy.revision}" />

Expand Down Expand Up @@ -378,7 +378,7 @@
windowtitle="las2peer Documentation"
failonerror="yes"
encoding="utf8"
classpath="${lib.cp}:${tmp.classes}"
classpath="${lib.cp}:${tmp.classes}:${lib.junit}"
>
<packageset dir="${src.main}" defaultexcludes="yes">
<include name="i5/las2peer/**" />
Expand Down Expand Up @@ -412,26 +412,30 @@
<fileset file="${test.source.absolute}" />
<map from="${src.junit}/" to="" />
</pathconvert>

<basename property="filename" file="${test.source.relative}"/>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpathref="classpath"/>
<jacoco:coverage destfile="${export}/reports/${filename}.exec" xmlns:jacoco="antlib:org.jacoco.ant">
<!-- run one particular test -->
<junit fork="yes" haltonerror="yes" haltonfailure="yes" printsummary="yes">

<classpath>
<pathelement path="${tmp.classes}" />
<pathelement path="${tmp.junit}" />
<pathelement path="${lib.cp}" />
<pathelement path="${lib.junit}" />
</classpath>

<formatter type="plain" usefile="false" />
<formatter type="plain" />

<batchtest todir="${junit.report}">
<fileset dir="${src.junit}">
<filename name="${test.source.relative}" />
</fileset>
</batchtest>
</junit>
<junit fork="yes" haltonerror="yes" haltonfailure="yes" printsummary="yes">

<classpath>
<pathelement path="${tmp.classes}" />
<pathelement path="${tmp.junit}" />
<pathelement path="${lib.cp}" />
<pathelement path="${lib.junit}" />
</classpath>

<formatter type="plain" usefile="false" />
<formatter type="plain" />

<batchtest todir="${junit.report}">
<fileset dir="${src.junit}">
<filename name="${test.source.relative}" />
</fileset>
</batchtest>
</junit>
</jacoco:coverage>


</target>

Expand All @@ -446,7 +450,7 @@
</target>

<target name="junit_tests" depends="init_junit, junit_jars, compile_all">
<for threadCount="9" parallel="true" param="test.source.absolute">
<for threadCount="9" parallel="false" param="test.source.absolute">
<path>
<fileset dir="${src.junit}">
<include name="**/*Test.java"/>
Expand All @@ -461,6 +465,23 @@
</antcall>
</sequential>
</for>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpathref="classpath"/>
<jacoco:report xmlns:jacoco="antlib:org.jacoco.ant">
<executiondata>
<fileset dir="${export}/reports/" includes="*.exec"/>
</executiondata>

<structure name="jacoco">
<classfiles>
<fileset dir="${tmp.classes}" />
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${src.main}" />
</sourcefiles>
</structure>

<xml destfile="coverage.xml" />
</jacoco:report>
</target>

<target name="test_colored" depends="init_general">
Expand Down
8 changes: 8 additions & 0 deletions ivy/ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,13 @@
<dependency org="xpp3" name="xpp3" rev="1.1.4c" />

<dependency org="javax.xml.parsers" name="jaxp-api" rev="1.4.5" />

<!-- UPnP libs for NAT handling -->
<dependency org="commons-jxpath" name="commons-jxpath" rev="1.1" />
<dependency org="commons-logging" name="commons-logging" rev="1.2" />
<dependency org="net" name="sbbi-upnplib" rev="1.0.4" />

<!-- CodeCoverage -->
<dependency org="org.jacoco" name="org.jacoco.ant" rev="0.7.5.201505241946"/>
</dependencies>
</ivy-module>
18 changes: 9 additions & 9 deletions src/main/java/i5/las2peer/api/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ public interface Context {
* @throws StorageException
*/
@Deprecated
public Envelope getStoredObject(String className, String identifier) throws ArtifactNotFoundException,
StorageException;
public Envelope getStoredObject(String className, String identifier)
throws ArtifactNotFoundException, StorageException;

/**
* Gives access to the local node.
Expand Down Expand Up @@ -186,8 +186,8 @@ public Envelope createEnvelope(Envelope previousVersion, Serializable content, A
public Envelope createEnvelope(Envelope previousVersion, Serializable content, List<Agent> readers)
throws IllegalArgumentException, SerializationException, CryptoException;

public Envelope createUnencryptedEnvelope(String identifier, Serializable content) throws IllegalArgumentException,
SerializationException, CryptoException;
public Envelope createUnencryptedEnvelope(String identifier, Serializable content)
throws IllegalArgumentException, SerializationException, CryptoException;

public Envelope createUnencryptedEnvelope(Envelope previousVersion, Serializable content)
throws IllegalArgumentException, SerializationException, CryptoException;
Expand All @@ -202,11 +202,11 @@ public void storeEnvelopeAsync(Envelope envelope, Agent author, StorageStoreResu
public void fetchEnvelopeAsync(String identifier, StorageEnvelopeHandler envelopeHandler,
StorageExceptionHandler exceptionHandler);

public Envelope createEnvelope(String identifier, Serializable content) throws IllegalArgumentException,
SerializationException, CryptoException;
public Envelope createEnvelope(String identifier, Serializable content)
throws IllegalArgumentException, SerializationException, CryptoException;

public Envelope createEnvelope(Envelope previousVersion, Serializable content) throws IllegalArgumentException,
SerializationException, CryptoException;
public Envelope createEnvelope(Envelope previousVersion, Serializable content)
throws IllegalArgumentException, SerializationException, CryptoException;

public void storeEnvelope(Envelope envelope) throws StorageException;

Expand Down Expand Up @@ -246,7 +246,7 @@ public Serializable invoke(String service, String method, Serializable... parame
* @throws ServiceNotAvailableException If the service is temporarily not available.
* @throws RemoteServiceException If the remote service throws an exception.
*/
public Serializable invokeInterally(String service, String method, Serializable... parameters)
public Serializable invokeInternally(String service, String method, Serializable... parameters)
throws ServiceNotFoundException, ServiceNotAvailableException, RemoteServiceException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,17 @@
*/
public abstract class LoadedLibrary {

private HashSet<LoadedLibrary> resolvedDependencies;
private LibraryDependency[] initialDependencies;

private LibraryIdentifier myLibrary;
private final HashSet<LoadedLibrary> resolvedDependencies;
private final LibraryDependency[] initialDependencies;
private final LibraryIdentifier myLibrary;

/**
* generates a new CL without any dependencies i.e. this ClassLoader may not use any other registered libraries
*
* @param libraryIdentifier identifier of the library bound to this ClassLoader
*/
LoadedLibrary(String libraryIdentifier) {
super();

myLibrary = new LibraryIdentifier(libraryIdentifier);
this(new LibraryIdentifier(libraryIdentifier));
}

/**
Expand All @@ -40,9 +37,7 @@ public abstract class LoadedLibrary {
* @param lib identifier of the library bound to this ClassLoader
*/
LoadedLibrary(LibraryIdentifier lib) {
super();

myLibrary = lib;
this(lib, new LibraryDependency[0]);
}

/**
Expand All @@ -62,8 +57,9 @@ public abstract class LoadedLibrary {
* @param initialDependencies array with ClassLoaders this one may use for class loading
*/
LoadedLibrary(LibraryIdentifier lib, LibraryDependency[] initialDependencies) {
this(lib);
this.myLibrary = lib;
this.initialDependencies = initialDependencies;
resolvedDependencies = new HashSet<>();
}

/**
Expand All @@ -88,7 +84,7 @@ public LibraryDependency[] getDependencies() {
* @param libs
*/
void setResolvedDependencies(LoadedLibrary[] libs) {
resolvedDependencies = new HashSet<LoadedLibrary>();
resolvedDependencies.clear();
for (LoadedLibrary lib : libs) {
resolvedDependencies.add(lib);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import i5.las2peer.tools.CryptoException;
import i5.las2peer.tools.SerializationException;
import i5.las2peer.tools.XmlTools;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;

/**
* This class is stored as meta information in the network and represents a network library. All getter refer to
Expand All @@ -42,7 +41,8 @@ public LoadedNetworkLibrary(NodeStorageInterface node, LibraryIdentifier lib,
@Override
public URL getResourceAsUrl(String resourceName) throws ResourceNotFoundException {
// TODO implement get resource as URL in network library
throw new NotImplementedException();
// return las2peer:// URL or https:// URL?
throw new ResourceNotFoundException("getResourceAsUrl not implemented, yet", getIdentifier().toString());
}

@Override
Expand Down
21 changes: 11 additions & 10 deletions src/main/java/i5/las2peer/execution/L2pThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,14 @@ public Envelope getStoredObject(long id) throws ArtifactNotFoundException, Stora
}

@Override
public Envelope getStoredObject(Class<?> cls, String identifier) throws ArtifactNotFoundException, StorageException {
public Envelope getStoredObject(Class<?> cls, String identifier)
throws ArtifactNotFoundException, StorageException {
return null;
}

@Override
public Envelope getStoredObject(String className, String identifier) throws ArtifactNotFoundException,
StorageException {
public Envelope getStoredObject(String className, String identifier)
throws ArtifactNotFoundException, StorageException {
return null;
}

Expand Down Expand Up @@ -270,8 +271,8 @@ public Envelope createEnvelope(Envelope previousVersion, Serializable content, L
}

@Override
public Envelope createUnencryptedEnvelope(String identifier, Serializable content) throws IllegalArgumentException,
SerializationException, CryptoException {
public Envelope createUnencryptedEnvelope(String identifier, Serializable content)
throws IllegalArgumentException, SerializationException, CryptoException {
return callerContext.createUnencryptedEnvelope(identifier, content);
}

Expand Down Expand Up @@ -304,14 +305,14 @@ public void fetchEnvelopeAsync(String identifier, StorageEnvelopeHandler envelop
}

@Override
public Envelope createEnvelope(String identifier, Serializable content) throws IllegalArgumentException,
SerializationException, CryptoException {
public Envelope createEnvelope(String identifier, Serializable content)
throws IllegalArgumentException, SerializationException, CryptoException {
return callerContext.createEnvelope(identifier, content);
}

@Override
public Envelope createEnvelope(Envelope previousVersion, Serializable content) throws IllegalArgumentException,
SerializationException, CryptoException {
public Envelope createEnvelope(Envelope previousVersion, Serializable content)
throws IllegalArgumentException, SerializationException, CryptoException {
return callerContext.createEnvelope(previousVersion, content);
}

Expand Down Expand Up @@ -342,7 +343,7 @@ public Serializable invoke(String service, String method, Serializable... parame
}

@Override
public Serializable invokeInterally(String service, String method, Serializable... parameters)
public Serializable invokeInternally(String service, String method, Serializable... parameters)
throws ServiceNotFoundException, ServiceNotAvailableException, RemoteServiceException {
return invokeWithAgent(serviceAgent, service, method, parameters);
}
Expand Down
Loading

0 comments on commit 0080c45

Please sign in to comment.