public class ContentManager extends java.lang.Object implements Serializable
ContentManager
object accessible through
the getContentManager()
method of the Agent
class.Constructor and Description |
---|
ContentManager() |
Modifier and Type | Method and Description |
---|---|
AbsContentElement |
extractAbsContent(ACLMessage msg)
Translates the
:content slot of an
ACLMessage msg into an AbsContentElement
using the content language and ontology indicated in the
:language and :ontology fields of msg . |
ContentElement |
extractContent(ACLMessage msg)
Translates the
:content slot of an
ACLMessage msg into a ContentElement
using the content language and ontology indicated in the
:language and :ontology fields of msg . |
void |
fillContent(ACLMessage msg,
AbsContentElement content)
Fills the
:content slot of an
ACLMessage msg using the content language
and ontology indicated in the :language and
:ontology fields of msg . |
void |
fillContent(ACLMessage msg,
ContentElement content)
Fills the
:content slot of an
ACLMessage msg using the content language
and ontology indicated in the :language and
:ontology fields of msg . |
java.lang.String[] |
getLanguageNames() |
java.lang.String[] |
getOntologyNames() |
boolean |
getValidationMode()
Return the currently set validation mode i.e. whether
contents that are managed by this content manager should
be validated during message content filling/extraction.
|
Codec |
lookupLanguage(java.lang.String name)
Retrieves a previously registered
Codec
giving its name . |
Ontology |
lookupOntology(java.lang.String name)
Retrieves a previously registered
Ontology
giving its name . |
void |
registerLanguage(Codec c)
Registers a
Codec for a given content language
with its default name (i.e. |
void |
registerLanguage(Codec c,
java.lang.String name)
Registers a
Codec for a given content language
with a given name. |
void |
registerOntology(Ontology o)
Registers an
Ontology with its default name (i.e. |
void |
registerOntology(Ontology o,
java.lang.String name)
Registers an
Ontology with a given name. |
void |
setValidationMode(boolean mode)
Set the validation mode i.e. whether contents that are managed
by this content manager should be validated during
message content filling/extraction.
|
java.lang.String |
toString() |
public void registerLanguage(Codec c)
Codec
for a given content language
with its default name (i.e.
the name returned by its getName()
method.
Since this operation is performed the agent that owns this
ContentManager
is able to "speak" the language
corresponding to the registered Codec
.c
- the Codec
to be registered.public void registerLanguage(Codec c, java.lang.String name)
Codec
for a given content language
with a given name.c
- the Codec
to be registered.name
- the name associated to the registered codec.public void registerOntology(Ontology o)
Ontology
with its default name (i.e.
the name returned by its getName()
method.
Since this operation is performed the agent that owns this
ContentManager
"knows" the registered
Ontology
.o
- the Ontology
to be registered.public void registerOntology(Ontology o, java.lang.String name)
Ontology
with a given name.o
- the Ontology
to be registered.name
- the name associated to the registered Ontology.public Codec lookupLanguage(java.lang.String name)
Codec
giving its name
.name
- the name associated to the Codec
to be retrieved.Codec
associated to
name
or null
if no Codec was registered
with the given name.public Ontology lookupOntology(java.lang.String name)
Ontology
giving its name
.name
- the name associated to the Ontology
to be retrieved.Ontology
associated to
name
or null
if no Ontology was registered
with the given name.public void fillContent(ACLMessage msg, AbsContentElement content) throws Codec.CodecException, OntologyException
:content
slot of an
ACLMessage msg
using the content language
and ontology indicated in the :language
and
:ontology
fields of msg
.msg
- the message whose content has to be filled.content
- the content of the message represented as an
AbsContentElement
.Codec.CodecException
- if content
is not compliant
to the content language used for this operation.OntologyException
- if content
is not compliant
to the ontology used for this operation.public void fillContent(ACLMessage msg, ContentElement content) throws Codec.CodecException, OntologyException
:content
slot of an
ACLMessage msg
using the content language
and ontology indicated in the :language
and
:ontology
fields of msg
.msg
- the message whose content has to be filled.content
- the content of the message represented as a
ContentElement
.Codec.CodecException
- if content
is not compliant
to the content language used for this operation.OntologyException
- if content
is not compliant
to the ontology used for this operation.public AbsContentElement extractAbsContent(ACLMessage msg) throws Codec.CodecException, OntologyException
:content
slot of an
ACLMessage msg
into an AbsContentElement
using the content language and ontology indicated in the
:language
and :ontology
fields of msg
.msg
- the message whose content has to be extracted.AbsContentElement
.Codec.CodecException
- if the content of the message is not compliant
to the content language used for this operation.OntologyException
- if the content of the message is not compliant
to the ontology used for this operation.public ContentElement extractContent(ACLMessage msg) throws Codec.CodecException, UngroundedException, OntologyException
:content
slot of an
ACLMessage msg
into a ContentElement
using the content language and ontology indicated in the
:language
and :ontology
fields of msg
.msg
- the message whose content has to be extracted.ContentElement
.Codec.CodecException
- if the content of the message is not compliant
to the content language used for this operation.OntologyException
- if the content of the message is not compliant
to the ontology used for this operation.UngroundedException
public void setValidationMode(boolean mode)
true
mode
- the new validation modepublic boolean getValidationMode()
true
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String[] getLanguageNames()
public java.lang.String[] getOntologyNames()