Package psidev.psi.mi.jami.json.nary
Class AbstractMIJsonWriter<I extends Interaction>
- java.lang.Object
-
- psidev.psi.mi.jami.json.nary.AbstractMIJsonWriter<I>
-
- All Implemented Interfaces:
InteractionWriter<I>
- Direct Known Subclasses:
AbstractMIJsonBinaryWriter
,LightMIJsonWriter
,MIJsonEvidenceWriter
,MIJsonModelledWriter
,MIJsonWriter
public abstract class AbstractMIJsonWriter<I extends Interaction> extends Object implements InteractionWriter<I>
Abstract JSON writer for interactions (n-ary json format)- Since:
03/07/13
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Modifier Constructor Description AbstractMIJsonWriter()
Constructor for AbstractMIJsonWriter.AbstractMIJsonWriter(File file, OntologyTermFetcher fetcher)
Constructor for AbstractMIJsonWriter.AbstractMIJsonWriter(OutputStream output, OntologyTermFetcher fetcher)
Constructor for AbstractMIJsonWriter.AbstractMIJsonWriter(Writer writer, OntologyTermFetcher fetcher)
Constructor for AbstractMIJsonWriter.protected
AbstractMIJsonWriter(Writer writer, OntologyTermFetcher fetcher, Map<String,String> processedInteractors, Map<Feature,Integer> processedFeatures, Map<Entity,Integer> processedParticipants, IncrementalIdGenerator idGenerator)
Constructor for AbstractMIJsonWriter.protected
AbstractMIJsonWriter(Map<String,String> processedInteractors, Map<Feature,Integer> processedFeatures, Map<Entity,Integer> processedParticipants, IncrementalIdGenerator idGenerator)
Constructor for AbstractMIJsonWriter.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
clear()
clear.void
close()
close.void
end()
end.void
flush()
flush.protected OntologyTermFetcher
getFetcher()
Getter for the fieldfetcher
.protected IncrementalIdGenerator
getIdGenerator()
Getter for the fieldidGenerator
.JsonElementWriter<I>
getInteractionWriter()
Getter for the fieldinteractionWriter
.JsonElementWriter<Interactor>
getInteractorWriter()
Getter for the fieldinteractorWriter
.protected Map<Feature,Integer>
getProcessedFeatures()
Getter for the fieldprocessedFeatures
.protected Map<String,String>
getProcessedInteractors()
Getter for the fieldprocessedInteractors
.protected Map<Entity,Integer>
getProcessedParticipants()
Getter for the fieldprocessedParticipants
.protected Writer
getWriter()
Getter for the fieldwriter
.void
initialiseContext(Map<String,Object> options)
Initialise the context of the InteractionWriter given a map of optionsprotected abstract void
initialiseInteractionWriter()
initialiseInteractionWriter.protected void
registerAndWriteInteractor(Participant participant)
registerAndWriteInteractor.void
reset()
reset.protected void
setFetcher(OntologyTermFetcher fetcher)
Setter for the fieldfetcher
.protected void
setInteractionWriter(JsonElementWriter<I> interactionWriter)
Setter for the fieldinteractionWriter
.void
start()
start.void
write(I interaction)
write.void
write(Collection<? extends I> interactions)
write.void
write(Iterator<? extends I> interactions)
Writes Interaction objects using iteratorprotected abstract void
writeComplex(Complex complex)
writeComplex.protected void
writeEnd()
writeEnd.protected void
writeStart()
writeStart.
-
-
-
Constructor Detail
-
AbstractMIJsonWriter
public AbstractMIJsonWriter()
Constructor for AbstractMIJsonWriter.
-
AbstractMIJsonWriter
public AbstractMIJsonWriter(File file, OntologyTermFetcher fetcher) throws IOException
Constructor for AbstractMIJsonWriter.
- Parameters:
file
- aFile
object.fetcher
- aOntologyTermFetcher
object.- Throws:
IOException
- if any.
-
AbstractMIJsonWriter
public AbstractMIJsonWriter(OutputStream output, OntologyTermFetcher fetcher)
Constructor for AbstractMIJsonWriter.
- Parameters:
output
- aOutputStream
object.fetcher
- aOntologyTermFetcher
object.
-
AbstractMIJsonWriter
public AbstractMIJsonWriter(Writer writer, OntologyTermFetcher fetcher)
Constructor for AbstractMIJsonWriter.
- Parameters:
writer
- aWriter
object.fetcher
- aOntologyTermFetcher
object.
-
AbstractMIJsonWriter
protected AbstractMIJsonWriter(Writer writer, OntologyTermFetcher fetcher, Map<String,String> processedInteractors, Map<Feature,Integer> processedFeatures, Map<Entity,Integer> processedParticipants, IncrementalIdGenerator idGenerator)
Constructor for AbstractMIJsonWriter.
- Parameters:
writer
- aWriter
object.fetcher
- aOntologyTermFetcher
object.processedInteractors
- aMap
object.processedFeatures
- aMap
object.processedParticipants
- aMap
object.idGenerator
- aIncrementalIdGenerator
object.
-
AbstractMIJsonWriter
protected AbstractMIJsonWriter(Map<String,String> processedInteractors, Map<Feature,Integer> processedFeatures, Map<Entity,Integer> processedParticipants, IncrementalIdGenerator idGenerator)
Constructor for AbstractMIJsonWriter.
- Parameters:
processedInteractors
- aMap
object.processedFeatures
- aMap
object.processedParticipants
- aMap
object.idGenerator
- aIncrementalIdGenerator
object.
-
-
Method Detail
-
initialiseContext
public void initialiseContext(Map<String,Object> options)
Initialise the context of the InteractionWriter given a map of options- Specified by:
initialiseContext
in interfaceInteractionWriter<I extends Interaction>
- Parameters:
options
- : the options given by the user
-
start
public void start() throws MIIOException
start.
- Specified by:
start
in interfaceInteractionWriter<I extends Interaction>
- Throws:
MIIOException
- if any.
-
end
public void end() throws MIIOException
end.
- Specified by:
end
in interfaceInteractionWriter<I extends Interaction>
- Throws:
MIIOException
- if any.
-
write
public void write(I interaction) throws MIIOException
write.
- Specified by:
write
in interfaceInteractionWriter<I extends Interaction>
- Parameters:
interaction
- a I object.- Throws:
MIIOException
- if any.
-
write
public void write(Collection<? extends I> interactions) throws MIIOException
write.
- Specified by:
write
in interfaceInteractionWriter<I extends Interaction>
- Parameters:
interactions
- aCollection
object.- Throws:
MIIOException
- if any.
-
write
public void write(Iterator<? extends I> interactions) throws MIIOException
Writes Interaction objects using iterator- Specified by:
write
in interfaceInteractionWriter<I extends Interaction>
- Parameters:
interactions
- : the iterator of interactions to write- Throws:
MIIOException
- : if cannot write
-
flush
public void flush() throws MIIOException
flush.
- Specified by:
flush
in interfaceInteractionWriter<I extends Interaction>
- Throws:
MIIOException
- if any.
-
close
public void close() throws MIIOException
close.
- Specified by:
close
in interfaceInteractionWriter<I extends Interaction>
- Throws:
MIIOException
- if any.
-
clear
public void clear()
clear.
-
reset
public void reset() throws MIIOException
reset.
- Specified by:
reset
in interfaceInteractionWriter<I extends Interaction>
- Throws:
MIIOException
- if any.
-
writeComplex
protected abstract void writeComplex(Complex complex)
writeComplex.
- Parameters:
complex
- aComplex
object.
-
registerAndWriteInteractor
protected void registerAndWriteInteractor(Participant participant) throws IOException
registerAndWriteInteractor.
- Parameters:
participant
- aParticipant
object.- Throws:
IOException
- if any.
-
writeStart
protected void writeStart() throws IOException
writeStart.
- Throws:
IOException
- if any.
-
writeEnd
protected void writeEnd() throws IOException
writeEnd.
- Throws:
IOException
- if any.
-
getFetcher
protected OntologyTermFetcher getFetcher()
Getter for the field
fetcher
.- Returns:
- a
OntologyTermFetcher
object.
-
getInteractorWriter
public JsonElementWriter<Interactor> getInteractorWriter()
Getter for the field
interactorWriter
.- Returns:
- a
JsonElementWriter
object.
-
getInteractionWriter
public JsonElementWriter<I> getInteractionWriter()
Getter for the field
interactionWriter
.- Returns:
- a
JsonElementWriter
object.
-
initialiseInteractionWriter
protected abstract void initialiseInteractionWriter()
initialiseInteractionWriter.
-
setInteractionWriter
protected void setInteractionWriter(JsonElementWriter<I> interactionWriter)
Setter for the field
interactionWriter
.- Parameters:
interactionWriter
- aJsonElementWriter
object.
-
getProcessedInteractors
protected Map<String,String> getProcessedInteractors()
Getter for the field
processedInteractors
.- Returns:
- a
Map
object.
-
getProcessedFeatures
protected Map<Feature,Integer> getProcessedFeatures()
Getter for the field
processedFeatures
.- Returns:
- a
Map
object.
-
getProcessedParticipants
protected Map<Entity,Integer> getProcessedParticipants()
Getter for the field
processedParticipants
.- Returns:
- a
Map
object.
-
getIdGenerator
protected IncrementalIdGenerator getIdGenerator()
Getter for the field
idGenerator
.- Returns:
- a
IncrementalIdGenerator
object.
-
setFetcher
protected void setFetcher(OntologyTermFetcher fetcher)
Setter for the field
fetcher
.- Parameters:
fetcher
- aOntologyTermFetcher
object.
-
-