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;
public class IUPublishedException extends RuntimeException{
private static final long serialVersionUID = 1L;
private final AbstractIU iu;
public AbstractIU getIU() {
return iu;
}
public IUPublishedException(AbstractIU iu)
{
super("IU " + iu.getUid() + " is already present in the output buffer.");
this.iu = iu;
}
/**
* IUPublishedException exceptions occur when publishing (=putting it in an output buffer) an already published IU.
* @author hvanwelbergen
*
*/
public class IUPublishedException extends RuntimeException
{
private static final long serialVersionUID = 1L;
private final AbstractIU iu;
public AbstractIU getIU()
{
return iu;
}
public IUPublishedException(AbstractIU iu)
{
super("IU " + iu.getUid() + " is already present in the output buffer.");
this.iu = iu;
}
}
package ipaaca;
public class IUReadOnlyException extends RuntimeException{
private static final long serialVersionUID = 1L;
private final AbstractIU iu;
public AbstractIU getIU() {
return iu;
}
public IUReadOnlyException(AbstractIU iu)
{
super("Writing to IU " + iu.getUid() + " failed -- it is read-only.");
this.iu = iu;
}
/**
* IUReadOnlyException's occur when writing to a read-only IU
* @author hvanwelbergen
*
*/
public class IUReadOnlyException extends RuntimeException
{
private static final long serialVersionUID = 1L;
private final AbstractIU iu;
public AbstractIU getIU()
{
return iu;
}
public IUReadOnlyException(AbstractIU iu)
{
super("Writing to IU " + iu.getUid() + " failed -- it is read-only.");
this.iu = iu;
}
}
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;
}
package ipaaca;
public class IUUpdateFailedException extends RuntimeException{
private static final long serialVersionUID = 1L;
private final AbstractIU iu;
public AbstractIU getIU() {
return iu;
}
public IUUpdateFailedException(AbstractIU iu)
{
super("Remote update failed for IU " + iu.getUid() + ".");
this.iu = iu;
}
/**
* Indicates that a remote update failed
* @author hvanwelbergen
*
*/
public class IUUpdateFailedException extends RuntimeException
{
private static final long serialVersionUID = 1L;
private final AbstractIU iu;
public AbstractIU getIU()
{
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;
import rsb.converter.DefaultConverterRepository;
import rsb.converter.ProtocolBufferConverter;
public final class Initializer {
// def initialize_ipaaca_rsb():#{{{
// rsb.transport.converter.registerGlobalConverter(
// IntConverter(wireSchema="int32", dataType=int))
// rsb.transport.converter.registerGlobalConverter(
// IUConverter(wireSchema="ipaaca-iu", dataType=IU))
// rsb.transport.converter.registerGlobalConverter(
// IUPayloadUpdateConverter(
// wireSchema="ipaaca-iu-payload-update",
// dataType=IUPayloadUpdate))
// rsb.transport.converter.registerGlobalConverter(
// rsb.transport.converter.ProtocolBufferConverter(
// messageClass=iuProtoBuf_pb2.IUCommission))
// rsb.__defaultParticipantConfig = rsb.ParticipantConfig.fromDefaultSources()
// #}}}
public static void initializeIpaacaRsb()
{
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(
/**
* Hooks up the ipaaca converters, call initializeIpaacaRsb() before using ipaaca.
* @author hvanwelbergen
*
*/
public final class Initializer
{
private Initializer(){}
public static void initializeIpaacaRsb()
{
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)));
DefaultConverterRepository.getDefaultConverterRepository().addConverter(
new PayloadConverter());
DefaultConverterRepository.getDefaultConverterRepository().addConverter(
new LinkUpdateConverter());
}
DefaultConverterRepository.getDefaultConverterRepository().addConverter(new PayloadConverter());
DefaultConverterRepository.getDefaultConverterRepository().addConverter(new LinkUpdateConverter());
}
}
......@@ -11,6 +11,11 @@ import rsb.converter.WireContents;
import com.google.protobuf.InvalidProtocolBufferException;
/**
* Serializer/deserializer for ints
* @author hvanwelbergen
*
*/
public class IntConverter implements Converter<ByteBuffer>
{
......
......@@ -12,6 +12,11 @@ import rsb.converter.WireContents;
import com.google.protobuf.InvalidProtocolBufferException;
/**
* Serializer/deserializer for IULinkUpdate
* @author hvanwelbergen
*
*/
public class LinkUpdateConverter implements Converter<ByteBuffer>
{
private static final String LINKUPDATE_WIRESCHEMA = "ipaaca-iu-link-update";
......
......@@ -12,6 +12,11 @@ import rsb.converter.WireContents;
import com.google.protobuf.InvalidProtocolBufferException;
/**
* Serializer/deserializer for IUPayloadUpdate
* @author hvanwelbergen
*
*/
public class PayloadConverter implements Converter<ByteBuffer>
{
private static final String PAYLOAD_WIRESCHEMA = "ipaaca-iu-payload-update";
......
......@@ -6,6 +6,11 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* Demonstrates how to call a python script from java
* @author hvanwelbergen
*
*/
public class PythonCall
{
......
......@@ -14,6 +14,11 @@ import rsb.RSBException;
import com.google.common.collect.ImmutableSet;
/**
* Unit testcases for the input buffer
* @author hvanwelbergen
*
*/
public class InputBufferTest
{
private static final String COMPID = "Comp1";
......
......@@ -27,6 +27,11 @@ import rsb.converter.WireContents;
import rsb.patterns.RemoteServer;
import static ipaaca.IUTestUtil.*;
/**
* Unit test cases for the IUConverter
* @author hvanwelbergen
*
*/
public class IuConverterTest
{
private static final String CATEGORY = "category1";
......
......@@ -6,7 +6,10 @@ import ipaaca.protobuf.Ipaaca.IUPayloadUpdate;
import org.junit.Before;
import org.junit.Test;
import static org.mockito.Mockito.*;
/**
* Unit testcases for the LocalIU
* @author hvanwelbergen
*/
public class LocalIUTest
{
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