Skip to content
Permalink
Browse files

Big merge of Steve's and my changes

  • Loading branch information...
frandallfarmer committed Jan 23, 2017
2 parents bb39749 + 58e0570 commit e954108caf607166dab997390db2b5f6f410112f
Showing with 158 additions and 29 deletions.
  1. +6 −0 .gitignore
  2. +9 −0 ServerCore/build/gen_templates.sh
  3. +1 −1 ServerCore/java/org/elkoserver/foundation/actor/RoutingActor.java
  4. +1 −1 ServerCore/java/org/elkoserver/foundation/boot/Boot.java
  5. +4 −2 ServerCore/java/org/elkoserver/foundation/json/DispatchTarget.java
  6. +3 −3 ServerCore/java/org/elkoserver/foundation/net/ChunkyByteArrayInputStream.java
  7. +1 −1 ServerCore/java/org/elkoserver/foundation/net/NetAddr.java
  8. +1 −1 ServerCore/java/org/elkoserver/foundation/net/NetworkManager.java
  9. +3 −3 ServerCore/java/org/elkoserver/foundation/net/RTCPRequestByteIOFramerFactory.java
  10. +1 −0 ServerCore/java/org/elkoserver/foundation/server/.gitignore
  11. +1 −1 ServerCore/java/org/elkoserver/objdb/ObjDBRemote.java
  12. +2 −5 ServerCore/java/org/elkoserver/objdb/store/mongostore/MongoObjectStore.java
  13. +2 −0 ServerCore/java/org/elkoserver/server/context/Msg.java
  14. +1 −1 ServerCore/java/org/elkoserver/server/context/test/Counter.java
  15. +2 −2 ServerCore/java/org/elkoserver/server/context/test/Die.java
  16. +3 −3 ServerCore/java/org/elkoserver/server/context/users/DeviceEphemeralUserFactory.java
  17. +1 −1 ServerCore/java/org/elkoserver/server/context/users/DevicePersistentUserFactory.java
  18. +2 −2 ServerCore/java/org/elkoserver/server/workshop/bank/client/BankClient.java
  19. +0 −1 ServerCore/java/org/elkoserver/util/ExcludingIterator.java
  20. +2 −1 ServerCore/java/org/elkoserver/util/trace/logeater/LogEater.java
  21. +112 −0 pom.xml
@@ -1,2 +1,8 @@
Distrib
logs
target
bin
lib
.project
.classpath
.settings
@@ -0,0 +1,9 @@
#!/bin/bash
# Generates all templated files.

set -uexo pipefail

GIT_BASE_DIR=$(git rev-parse --show-toplevel)

cd ${GIT_BASE_DIR}/ServerCore/build
make generated
@@ -17,7 +17,7 @@
* org.elkoserver.foundation.net.MessageHandler#processMessage processMessage()}
* method, but subclasses must implement {@link
* org.elkoserver.foundation.net.MessageHandler#connectionDied connectionDied()}
* method (as well as any {@link JSONMethod} methods for whatever specific
* method (as well as any {@link org.elkoserver.foundation.json.JSONMethod} methods for whatever specific
* object behavior the subclass is intended for).
*/
abstract public class RoutingActor extends Actor implements DispatchTarget
@@ -95,7 +95,7 @@ public void uncaughtException(Thread thread, Throwable ex) {
* required to be public by Java's scoping rules, but you should not call
* it yourself.
*
* @internal Java's rules don't allow you to declare run() to throw any
* Java's rules don't allow you to declare run() to throw any
* exceptions, so this just wraps a call to the private method
* startApplication() in a try/catch block. The guts of startup are in
* another method for improved legibility.
@@ -12,8 +12,10 @@
* declare themselves as implementing this interface, since the normal coding
* pattern for such things is to subclass a standard base class (such as {@link
* org.elkoserver.server.context.BasicObject BasicObject}, {@link
* org.elkoserver.server.context.Mod Mod}, {@link BasicProtocolHandler}, or
* {@link NonRoutingActor}) that already implements it.
* org.elkoserver.server.context.Mod Mod},
* {@link org.elkoserver.foundation.actor.BasicProtocolHandler BasicProtocolHandler}, or
* {@link org.elkoserver.foundation.actor.NonRoutingActor NonRoutingActor})
* that already implements it.
*/
public interface DispatchTarget {
}
@@ -122,11 +122,11 @@ public ChunkyByteArrayInputStream() {
* use of the contents of the byte buffer that is given to this method
* (i.e., without copying it to internal storage) until {@link
* #preserveBuffers} is called; after that, the buffer contents may be
* modifed externally. This is somewhat delicate, but eliminates a vast
* amount of unnecessary byte array allocation and copying.
* modified externally. This is somewhat delicate, but eliminates a vast
* amount of unnecessary byte array allocation and copying.</p>
*
* @param buf The bytes themselves.
* @param length Number of bytes in 'buf' to read (<= buf.length).
* @param length Number of bytes in 'buf' to read (&lt;= buf.length).
*/
public void addBuffer(byte[] buf, int length) {
if (Trace.comm.debug && Trace.ON) {
@@ -54,7 +54,7 @@ public NetAddr(String addressStr) throws UnknownHostException {
/**
* Construct a new NetAddr given an IP address and a port number.
*
* @param inetAddress An IP address, where null => all local IP addresses.
* @param inetAddress An IP address, where null =&gt; all local IP addresses.
* @param portNumber A port at that IP address.
*/
public NetAddr(InetAddress inetAddress, int portNumber) {
@@ -287,7 +287,7 @@ public NetAddr listenWebSocket(String listenAddress,
* @param framerFactory Byte I/O framer factory for the new connection.
* @param secure If true, use SSL.
* @param portTrace Trace object for logging activity associated with this
* port & its connections
* port &amp; its connections
*
* @return the address that ended up being listened upon
*/
@@ -8,7 +8,7 @@

/**
* Byte I/O framer factory for RTCP requests. The framing rule used is: read
* one line & interpret it as an RTCP request line. If the request is not a
* one line &amp; interpret it as an RTCP request line. If the request is not a
* message delivery, then framing is complete at this point. If it *is* a
* message delivery, then continue, following exactly the message framing rule
* implemented by the {@link
@@ -20,11 +20,11 @@
* matching the JSON framing rule is regarded as a parseable unit; that is, it
* is expected to contain one or more syntactically complete JSON messages.
* The entire block is read into an internal buffer, then parsed for JSON
* messages that are fed to the receiver.
* messages that are fed to the receiver.</p>
*
* <p>On output, each thing being sent is always in the form of a string by the
* time this class gets its hands on it, so output framing consists of merely
* ensuring that the proper character encoding is used.
* ensuring that the proper character encoding is used.</p>
*/
public class RTCPRequestByteIOFramerFactory implements ByteIOFramerFactory {
/** Trace object for logging message traffic. */
@@ -0,0 +1 @@
BuildVersion.java
@@ -95,7 +95,7 @@
* read from the repository at startup time.
*
* @param serviceFinder Access to broker, to locate repository server.
* @param networkManger Network manager, for making outbound connections.
* @param networkManager Network manager, for making outbound connections.
* @param localName Name of this server.
* @param props Properties that the hosting server was configured with
* @param propRoot Prefix string for generating relevant configuration
@@ -24,6 +24,7 @@
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
import com.mongodb.Mongo;
import com.mongodb.MongoException;
import com.mongodb.WriteResult;
import org.bson.types.ObjectId;
import java.net.UnknownHostException;
@@ -98,7 +99,7 @@ public void initialize(BootProperties props, String propRoot,
}
try {
myMongo = new Mongo(host, port);
} catch (UnknownHostException e) {
} catch (MongoException e) {
tr.fatalError("mongodb server " + addressStr + ": unknown host");
}
String dbName = props.getProperty(propRoot + ".dbname", "elko");
@@ -326,10 +327,6 @@ private ResultDesc doPut(String ref, String obj, DBCollection collection,
DBObject objectToWrite = jsonLiteralToDBObject(obj, ref);
if (requireNew) {
WriteResult wr = collection.insert(objectToWrite);
String error = wr.getError();
if (error != null) {
failure = error;
}
} else {
DBObject query = new BasicDBObject();
query.put("ref", ref);
@@ -36,6 +36,8 @@ static public JSONLiteral msgDelete(Referenceable target) {
*
* @param target Object the message is being sent to (the object being
* informed).
* @param op Operation to be performed.
* @param error Contents of the error message.
*/
static public JSONLiteral msgError(Referenceable target, String op,
String error)
@@ -47,7 +47,7 @@ public JSONLiteral encode(EncodeControl control) {
* <u>recv</u>: <tt> { to:<i>REF</i>, op:"inc" } </tt><br>
*
* <u>send</u>: <tt> { to:<i>REF</i>, op:"set",
* from:<i>REF></i>, count:<i>int</i> } </tt>
* from:<i>REF</i>, count:<i>int</i> } </tt>
*
* @param from The user requesting the census.
*
@@ -43,10 +43,10 @@ public JSONLiteral encode(EncodeControl control) {
*
* This message requests a die roll.
*
* <u>recv</u>: <tt> { to:<i>REF</i>, op:"roll" } </tt><br>
* <u>recv</u>: <tt> { to:<i>REF</i>, op:"roll" } </tt>
*
* <u>send</u>: <tt> { to:<i>REF</i>, op:"roll",
* from:<i>REF></i>, value:<i>int</i> } </tt>
* from:<i>REF</i>, value:<i>int</i> } </tt>
*
* @param from The user requesting the census.
*
@@ -30,13 +30,13 @@ public DeviceEphemeralUserFactory(String device) {
*
* @param contextor The contextor of the server in which the synthetic
* user will be present
* @param connection The connection over which the new user presented
* themself.
* @param connection The connection over which the new user presented
* themself.
* @param param Arbitary JSON object parameterizing the construction.
* @param handler Handler to invoke with the resulting user object, or
* with null if the user object could not be produced.
*/
public void provideUser(Contextor contextor, Connection connnection,
public void provideUser(Contextor contextor, Connection connection,
JSONObject param, ArgRunnable handler)
{
DeviceCredentials creds =
@@ -36,7 +36,7 @@ public DevicePersistentUserFactory(String device) {
/**
* Obtain the name of the device this factory works with.
*
* @param return this factory's device string.
* @return this factory's device string.
*/
public String getDevice() {
return myDevice;
@@ -619,7 +619,7 @@ public void mint(String key, String memo, String dst, int amount,
*
* @param key Authorizing key.
* @param memo Transaction annotation.
* @param account Ref of the account being queried.
* @param accounts Refs of the accounts being queried.
* @param encs Flag that is true if the results should also include
* information about extant encumbrances on the account.
* @param resultHandler Callback to be invoked on the result.
@@ -759,7 +759,7 @@ public void unmint(String key, String memo, String src, int amount,
*
* @param key Authorizing key.
* @param memo Transaction annotation
* @param src Ref of encumbrance that reserves the funds to be destroyed.
* @param enc Ref of encumbrance that reserves the funds to be destroyed.
* @param resultHandler Callback to be invoked on the result.
*/
public void unmintEncumbrance(String key, String memo, String enc,
@@ -17,7 +17,6 @@
* Constructor.
*
* @param base The underlying iterator.
* @param exclusion The distinguished element to exclude.
*/
public ExcludingIterator(Iterator<V> base) {
myBase = base;
@@ -27,6 +27,7 @@
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
import com.mongodb.Mongo;
import com.mongodb.MongoException;
import com.mongodb.WriteResult;

/**
@@ -230,7 +231,7 @@ public static void main(String args[]) {
Mongo mongo;
try {
mongo = new Mongo(host, port);
} catch (UnknownHostException e) {
} catch (MongoException e) {
e("mongodb server " + dbHost + ": unknown host");
System.exit(1);
return; // to make the compiler shut up.
112 pom.xml
@@ -0,0 +1,112 @@
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.elko</groupId>
<artifactId>elkoserver</artifactId>
<packaging>jar</packaging>
<version>2.0.4-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>3.4.1</version>
</dependency>
</dependencies>

<build>
<sourceDirectory>ServerCore/java</sourceDirectory>

<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<versionRange>[1.0,)</versionRange>
<goals>
<goal>prepare-sources</goal>
<goal>test-compile</goal>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<versionRange>[1.0.0,)</versionRange>
<goals>
<goal>exec</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<id>runTemplates</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>ServerCore/build/gen_templates.sh</executable>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

0 comments on commit e954108

Please sign in to comment.
You can’t perform that action at this time.