Skip to content
Snippets Groups Projects
Commit f22dbc4c authored by hvanwelbergen's avatar hvanwelbergen
Browse files

added some javadoc

parent e825a241
No related branches found
No related tags found
No related merge requests found
package ipaaca; package ipaaca;
public class IUPublishedException extends RuntimeException{ /**
private static final long serialVersionUID = 1L; * IUPublishedException exceptions occur when publishing (=putting it in an output buffer) an already published IU.
private final AbstractIU iu; * @author hvanwelbergen
*
public AbstractIU getIU() { */
return iu; public class IUPublishedException extends RuntimeException
} {
private static final long serialVersionUID = 1L;
public IUPublishedException(AbstractIU iu) private final AbstractIU iu;
{
super("IU " + iu.getUid() + " is already present in the output buffer."); public AbstractIU getIU()
this.iu = iu; {
} return iu;
}
public IUPublishedException(AbstractIU iu)
{
super("IU " + iu.getUid() + " is already present in the output buffer.");
this.iu = iu;
}
} }
package ipaaca; package ipaaca;
public class IUReadOnlyException extends RuntimeException{ /**
private static final long serialVersionUID = 1L; * IUReadOnlyException's occur when writing to a read-only IU
private final AbstractIU iu; * @author hvanwelbergen
*
public AbstractIU getIU() { */
return iu; public class IUReadOnlyException extends RuntimeException
} {
private static final long serialVersionUID = 1L;
public IUReadOnlyException(AbstractIU iu) private final AbstractIU iu;
{
super("Writing to IU " + iu.getUid() + " failed -- it is read-only."); public AbstractIU getIU()
this.iu = iu; {
} return iu;
}
public IUReadOnlyException(AbstractIU iu)
{
super("Writing to IU " + iu.getUid() + " failed -- it is read-only.");
this.iu = iu;
}
} }
package ipaaca; package ipaaca;
import java.util.HashMap;
import java.util.HashMap;
public class IUStore<X extends AbstractIU> extends HashMap<String,X>{ /**
* An IUStore maps an IUid to an IU
* @author hvanwelbergen
*
* @param <X> type of AbstractIU stored in the store
*/
public class IUStore<X extends AbstractIU> extends HashMap<String, X>
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }
package ipaaca; package ipaaca;
public class IUUpdateFailedException extends RuntimeException{ /**
private static final long serialVersionUID = 1L; * Indicates that a remote update failed
private final AbstractIU iu; * @author hvanwelbergen
*
public AbstractIU getIU() { */
return iu; public class IUUpdateFailedException extends RuntimeException
} {
private static final long serialVersionUID = 1L;
public IUUpdateFailedException(AbstractIU iu) private final AbstractIU iu;
{
super("Remote update failed for IU " + iu.getUid() + "."); public AbstractIU getIU()
this.iu = iu; {
} return iu;
}
public IUUpdateFailedException(AbstractIU iu)
{
super("Remote update failed for IU " + iu.getUid() + ".");
this.iu = iu;
}
} }
...@@ -5,35 +5,26 @@ import rsb.converter.ConverterSignature; ...@@ -5,35 +5,26 @@ import rsb.converter.ConverterSignature;
import rsb.converter.DefaultConverterRepository; import rsb.converter.DefaultConverterRepository;
import rsb.converter.ProtocolBufferConverter; import rsb.converter.ProtocolBufferConverter;
public final class Initializer { /**
// def initialize_ipaaca_rsb():#{{{ * Hooks up the ipaaca converters, call initializeIpaacaRsb() before using ipaaca.
// rsb.transport.converter.registerGlobalConverter( * @author hvanwelbergen
// IntConverter(wireSchema="int32", dataType=int)) *
// rsb.transport.converter.registerGlobalConverter( */
// IUConverter(wireSchema="ipaaca-iu", dataType=IU)) public final class Initializer
// rsb.transport.converter.registerGlobalConverter( {
// IUPayloadUpdateConverter( private Initializer(){}
// wireSchema="ipaaca-iu-payload-update", public static void initializeIpaacaRsb()
// dataType=IUPayloadUpdate)) {
// rsb.transport.converter.registerGlobalConverter( DefaultConverterRepository.getDefaultConverterRepository().addConverter(new IntConverter());
// rsb.transport.converter.ProtocolBufferConverter( DefaultConverterRepository.getDefaultConverterRepository().addConverter(
// messageClass=iuProtoBuf_pb2.IUCommission)) new ProtocolBufferConverter<IUCommission>(IUCommission.getDefaultInstance()));
// rsb.__defaultParticipantConfig = rsb.ParticipantConfig.fromDefaultSources()
// #}}} DefaultConverterRepository.getDefaultConverterRepository().addConverter(
public static void initializeIpaacaRsb() new IUConverter(new ConverterSignature("ipaaca-iu", RemotePushIU.class)));
{ DefaultConverterRepository.getDefaultConverterRepository().addConverter(
DefaultConverterRepository.getDefaultConverterRepository().addConverter(new IntConverter());
DefaultConverterRepository.getDefaultConverterRepository()
.addConverter(new ProtocolBufferConverter<IUCommission>(IUCommission.getDefaultInstance()));
DefaultConverterRepository.getDefaultConverterRepository().addConverter(
new IUConverter(new ConverterSignature("ipaaca-iu", RemotePushIU.class)));
DefaultConverterRepository.getDefaultConverterRepository().addConverter(
new IUConverter(new ConverterSignature("ipaaca-localiu", LocalIU.class))); new IUConverter(new ConverterSignature("ipaaca-localiu", LocalIU.class)));
DefaultConverterRepository.getDefaultConverterRepository().addConverter( DefaultConverterRepository.getDefaultConverterRepository().addConverter(new PayloadConverter());
new PayloadConverter()); DefaultConverterRepository.getDefaultConverterRepository().addConverter(new LinkUpdateConverter());
DefaultConverterRepository.getDefaultConverterRepository().addConverter(
new LinkUpdateConverter()); }
}
} }
...@@ -11,6 +11,11 @@ import rsb.converter.WireContents; ...@@ -11,6 +11,11 @@ import rsb.converter.WireContents;
import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.InvalidProtocolBufferException;
/**
* Serializer/deserializer for ints
* @author hvanwelbergen
*
*/
public class IntConverter implements Converter<ByteBuffer> public class IntConverter implements Converter<ByteBuffer>
{ {
......
...@@ -12,6 +12,11 @@ import rsb.converter.WireContents; ...@@ -12,6 +12,11 @@ import rsb.converter.WireContents;
import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.InvalidProtocolBufferException;
/**
* Serializer/deserializer for IULinkUpdate
* @author hvanwelbergen
*
*/
public class LinkUpdateConverter implements Converter<ByteBuffer> public class LinkUpdateConverter implements Converter<ByteBuffer>
{ {
private static final String LINKUPDATE_WIRESCHEMA = "ipaaca-iu-link-update"; private static final String LINKUPDATE_WIRESCHEMA = "ipaaca-iu-link-update";
......
...@@ -12,6 +12,11 @@ import rsb.converter.WireContents; ...@@ -12,6 +12,11 @@ import rsb.converter.WireContents;
import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.InvalidProtocolBufferException;
/**
* Serializer/deserializer for IUPayloadUpdate
* @author hvanwelbergen
*
*/
public class PayloadConverter implements Converter<ByteBuffer> public class PayloadConverter implements Converter<ByteBuffer>
{ {
private static final String PAYLOAD_WIRESCHEMA = "ipaaca-iu-payload-update"; private static final String PAYLOAD_WIRESCHEMA = "ipaaca-iu-payload-update";
......
...@@ -6,6 +6,11 @@ import java.io.IOException; ...@@ -6,6 +6,11 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
/**
* Demonstrates how to call a python script from java
* @author hvanwelbergen
*
*/
public class PythonCall public class PythonCall
{ {
......
...@@ -14,6 +14,11 @@ import rsb.RSBException; ...@@ -14,6 +14,11 @@ import rsb.RSBException;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
/**
* Unit testcases for the input buffer
* @author hvanwelbergen
*
*/
public class InputBufferTest public class InputBufferTest
{ {
private static final String COMPID = "Comp1"; private static final String COMPID = "Comp1";
......
...@@ -27,6 +27,11 @@ import rsb.converter.WireContents; ...@@ -27,6 +27,11 @@ import rsb.converter.WireContents;
import rsb.patterns.RemoteServer; import rsb.patterns.RemoteServer;
import static ipaaca.IUTestUtil.*; import static ipaaca.IUTestUtil.*;
/**
* Unit test cases for the IUConverter
* @author hvanwelbergen
*
*/
public class IuConverterTest public class IuConverterTest
{ {
private static final String CATEGORY = "category1"; private static final String CATEGORY = "category1";
......
...@@ -6,7 +6,10 @@ import ipaaca.protobuf.Ipaaca.IUPayloadUpdate; ...@@ -6,7 +6,10 @@ import ipaaca.protobuf.Ipaaca.IUPayloadUpdate;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import static org.mockito.Mockito.*; import static org.mockito.Mockito.*;
/**
* Unit testcases for the LocalIU
* @author hvanwelbergen
*/
public class LocalIUTest public class LocalIUTest
{ {
OutputBuffer mockBuffer = mock(OutputBuffer.class); OutputBuffer mockBuffer = mock(OutputBuffer.class);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment