Skip to content

Commit

Permalink
Merge pull request #22 from rwth-acis/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
derjasper authored Nov 16, 2016
2 parents d9ee916 + 75ea2c4 commit a21a2ad
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 44 deletions.
2 changes: 1 addition & 1 deletion 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="2" />
<property name="ivy.build.number" value="3" />
<property name="ivy.deliver.revision" value="${ivy.revision}" />
<property name="ivy.pom.version" value="${ivy.revision}" />

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/i5/las2peer/security/MonitoringAgent.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
public class MonitoringAgent extends PassphraseAgent {

public static final String PROCESSING_SERVICE_ClASS_NAME = "i5.las2peer.services.monitoring.processing.MonitoringDataProcessingService";
public static final String PROCESSING_SERVICE_CLASS_NAME = "i5.las2peer.services.mobsos.dataProcessing.MonitoringDataProcessingService";

/**
*
Expand Down Expand Up @@ -106,7 +106,7 @@ public void receiveMessage(Message message, AgentContext context) throws Message
Serializable[] parameters = { (Serializable) content };
try {
// Try to send the content of the message to the Processing Service
boolean success = (Boolean) getRunningAtNode().invoke(this, PROCESSING_SERVICE_ClASS_NAME,
boolean success = (Boolean) getRunningAtNode().invoke(this, PROCESSING_SERVICE_CLASS_NAME,
"getMessages", parameters);
if (!success) {
// TODO: Check for performance of message receiving
Expand Down
83 changes: 42 additions & 41 deletions src/main/java/i5/las2peer/tools/L2pNodeLauncher.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
package i5.las2peer.tools;

import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import i5.las2peer.api.Connector;
import i5.las2peer.api.ConnectorException;
import i5.las2peer.api.exceptions.ArtifactNotFoundException;
Expand Down Expand Up @@ -50,6 +33,24 @@
import i5.simpleXML.Element;
import i5.simpleXML.Parser;
import i5.simpleXML.XMLSyntaxException;

import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import rice.p2p.commonapi.NodeHandle;

/**
Expand Down Expand Up @@ -98,8 +99,8 @@ public PastryNodeImpl getNode() {
* @throws NumberFormatException
* @throws SerializationException
*/
public String getEnvelope(String id)
throws NumberFormatException, ArtifactNotFoundException, StorageException, SerializationException {
public String getEnvelope(String id) throws NumberFormatException, ArtifactNotFoundException, StorageException,
SerializationException {
return node.fetchEnvelope(id).toXmlString();
}

Expand Down Expand Up @@ -228,8 +229,8 @@ public boolean accept(File dir, String name) {
node.storeArtifact(e);
printMessage("\t- stored artifact from " + xmlFile);
} else {
printWarning(
"Ingoring unknown XML object (" + xmlRoot.getName() + ") in '" + xmlFile.toString() + "'!");
printWarning("Ingoring unknown XML object (" + xmlRoot.getName() + ") in '" + xmlFile.toString()
+ "'!");
}
} catch (XMLSyntaxException e1) {
printError("Unable to parse XML contents of '" + xmlFile.toString() + "'!");
Expand Down Expand Up @@ -387,8 +388,8 @@ public void stopConnector(String connectorClass) {
* @throws InstantiationException
* @throws IllegalAccessException
*/
private Connector loadConnector(String classname)
throws ClassNotFoundException, InstantiationException, IllegalAccessException {
private Connector loadConnector(String classname) throws ClassNotFoundException, InstantiationException,
IllegalAccessException {
Class<?> connectorClass = L2pNodeLauncher.class.getClassLoader().loadClass(classname);
Connector connector = (Connector) connectorClass.newInstance();
return connector;
Expand Down Expand Up @@ -432,8 +433,8 @@ public boolean registerUserAgent(String id, String passphrase) {
* @throws AgentAlreadyRegisteredException
* @throws AgentException
*/
public void registerUserAgent(UserAgent agent)
throws L2pSecurityException, AgentAlreadyRegisteredException, AgentException {
public void registerUserAgent(UserAgent agent) throws L2pSecurityException, AgentAlreadyRegisteredException,
AgentException {
registerUserAgent(agent, null);
}

Expand Down Expand Up @@ -538,9 +539,9 @@ private Serializable invoke(String serviceIdentifier, String serviceMethod, Seri
* @throws EncodingFailedException
* @throws TimeoutException
*/
public ListMethodsContent getServiceMethods(String serviceNameVersion)
throws L2pSecurityException, AgentNotKnownException, InterruptedException, EncodingFailedException,
SerializationException, TimeoutException {
public ListMethodsContent getServiceMethods(String serviceNameVersion) throws L2pSecurityException,
AgentNotKnownException, InterruptedException, EncodingFailedException, SerializationException,
TimeoutException {
if (currentUser == null) {
throw new IllegalStateException("please log in a valid user with registerUserAgent before!");
}
Expand Down Expand Up @@ -597,9 +598,8 @@ public void startService(String serviceNameVersion, String defaultPass) throws E
Files.write(file.toPath(), a.toXmlString().getBytes());

// save passphrase
Files.write(Paths.get(DEFAULT_SERVICE_AGENT_DIRECTORY + "passphrases.txt"),
(serviceNameVersion + ".xml;" + defaultPass + "\n").getBytes(), StandardOpenOption.CREATE,
StandardOpenOption.APPEND);
Files.write(Paths.get(DEFAULT_SERVICE_AGENT_DIRECTORY + "passphrases.txt"), ("\n" + serviceNameVersion
+ ".xml;" + defaultPass).getBytes(), StandardOpenOption.CREATE, StandardOpenOption.APPEND);
}

// get passphrase from file
Expand Down Expand Up @@ -645,8 +645,8 @@ public ServiceAgent startServiceXml(String file, String passphrase) throws Excep
* @throws L2pSecurityException
* @throws AgentException
*/
public void startService(Agent serviceAgent)
throws AgentAlreadyRegisteredException, L2pSecurityException, AgentException {
public void startService(Agent serviceAgent) throws AgentAlreadyRegisteredException, L2pSecurityException,
AgentException {
if (!(serviceAgent instanceof ServiceAgent)) {
throw new IllegalArgumentException("given Agent is not a service agent!");

Expand All @@ -668,8 +668,8 @@ public void startService(Agent serviceAgent)
* @throws NoSuchServiceException
* @throws NodeException
*/
public void stopService(String serviceNameVersion)
throws AgentNotKnownException, NoSuchServiceException, NodeException {
public void stopService(String serviceNameVersion) throws AgentNotKnownException, NoSuchServiceException,
NodeException {
ServiceAgent agent = node.getLocalServiceAgent(ServiceNameVersion.fromString(serviceNameVersion));
node.unregisterReceiver(agent);
}
Expand Down Expand Up @@ -706,8 +706,9 @@ public void unlockAgent(PassphraseAgent agent, String passphrase) throws L2pSecu
* start interactive console mode based on a {@link i5.las2peer.tools.CommandPrompt}
*/
public void interactive() {
System.out.println("Entering interactive mode for node " + this.getNode().getPastryNode().getId().toStringFull()
+ "\n" + "-----------------------------------------------\n"
System.out.println("Entering interactive mode for node "
+ this.getNode().getPastryNode().getId().toStringFull() + "\n"
+ "-----------------------------------------------\n"
+ "Enter 'help' for further information of the console.\n"
+ "Use all public methods of the L2pNodeLauncher class for interaction with the P2P network.\n\n");

Expand Down Expand Up @@ -990,11 +991,11 @@ public static void printHelp(String message) {
System.out.println("\t--port|-p [port] specifies the port number of the node\n");
System.out.println("\tno bootstrap argument states, that a complete new las2peer network is to start");
System.out.println("\tor");
System.out.println(
"\t--bootstrap|-b [host-list] requires a comma seperated list of [address:ip] pairs of bootstrap nodes to connect to. This argument can occur multiple times.\n");
System.out
.println("\t--bootstrap|-b [host-list] requires a comma seperated list of [address:ip] pairs of bootstrap nodes to connect to. This argument can occur multiple times.\n");
System.out.println("\t--observer|-o starts a monitoring observer at this node\n");
System.out.println(
"\t--node-id-seed|-n [long] generates the node id by using this seed to provide persistence\n");
System.out
.println("\t--node-id-seed|-n [long] generates the node id by using this seed to provide persistence\n");
System.out
.println("\t--storage-mode|-m filesystem|memory sets Pastry's storage mode, defaults to filesystem\n");

Expand Down

0 comments on commit a21a2ad

Please sign in to comment.