public class ServiceMessage
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ServiceMessage.Timestamp |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ARG_ATTRIBUTE |
static java.lang.String |
DISABLE |
static java.lang.String |
ENABLE |
static java.lang.String |
PARSE_SERVICE_MESSAGES_INSIDE_TAG
This tag can be used to inform that service message can have other service messages inside its attributes.
|
static @NotNull java.lang.String |
SERVICE_MESSAGE_END |
static @NotNull java.lang.String |
SERVICE_MESSAGE_START |
static java.lang.String |
TAGS_ATRRIBUTE |
static java.lang.String |
TAGS_SEPARATOR |
| Modifier | Constructor and Description |
|---|---|
protected |
ServiceMessage(@NotNull java.lang.String messageName) |
protected |
ServiceMessage(@NotNull java.lang.String messageName,
@NotNull java.util.Map<java.lang.String,java.lang.String> attributes) |
protected |
ServiceMessage(@NotNull java.lang.String messageName,
@Nullable java.lang.String argument) |
| Modifier and Type | Method and Description |
|---|---|
void |
addTag(@NotNull java.lang.String tag)
Adds a new tag to service message.
|
@NotNull java.lang.String |
asString()
Converts this service message to service message string
|
static @NotNull java.lang.String |
asString(@NotNull java.lang.String messageName,
@NotNull java.util.Map<java.lang.String,java.lang.String> attributes)
Returns a string representation of a service message with attribute map.
|
static @NotNull java.lang.String |
asString(@NotNull java.lang.String messageName,
@NotNull java.lang.String argument)
Returns a string representation of a service message with a single argument.
|
@Nullable java.lang.String |
getArgument() |
@NotNull java.util.Map<java.lang.String,java.lang.String> |
getAttributes()
Returns map of parameters of the message in format ##teamcity[<message name> <param name>='<param value>' <param name>='<param value>'...]
if parameters were specified, and empty map otherwise
|
protected @Nullable java.lang.String |
getAttributeValue(@NotNull java.lang.String attrName) |
@Nullable ServiceMessage.Timestamp |
getCreationTimestamp()
Returns service message creation timestamp in case it was specified with attribute "timestamp".
|
@Nullable java.lang.String |
getFlowId()
Returns service message flow id in case it was specified and null otherwise
|
@NotNull java.lang.String |
getMessageName() |
@NotNull java.util.Collection<java.lang.String> |
getTags() |
static @Nullable ServiceMessage |
parse(@NotNull java.lang.String text)
If message is text message according to the pattern ##teamcity[key...], return parsed message.
|
static void |
parse(@NotNull java.lang.String text,
@NotNull ServiceMessageParserCallback parserCallback)
Accepts mixed text (text that can contain service messages inside) and parser callback.
|
static @NotNull ServiceMessage |
parseSimple(@NotNull java.lang.String text,
boolean shouldValidate)
Creates a ServiceMessage instance out of the specified text.
|
void |
setFlowId(@NotNull java.lang.String flowId) |
void |
setTimestamp(@NotNull java.util.Date timestamp) |
java.lang.String |
toString() |
protected void |
validate()
Service message validator checks that all methods which marked with
RequiredAttribute annotation
return not-null value after initialization. |
void |
visit(@NotNull ServiceMessageVisitor visitor)
Depending on this service message type calls corresponding method in the supplied visitor.
|
@NotNull public static final @NotNull java.lang.String SERVICE_MESSAGE_START
@NotNull public static final @NotNull java.lang.String SERVICE_MESSAGE_END
public static final java.lang.String TAGS_SEPARATOR
@NonNls public static final java.lang.String ENABLE
@NonNls public static final java.lang.String DISABLE
public static final java.lang.String ARG_ATTRIBUTE
public static final java.lang.String TAGS_ATRRIBUTE
public static final java.lang.String PARSE_SERVICE_MESSAGES_INSIDE_TAG
protected ServiceMessage(@NotNull
@NotNull java.lang.String messageName)
protected ServiceMessage(@NotNull
@NotNull java.lang.String messageName,
@Nullable
@Nullable java.lang.String argument)
protected ServiceMessage(@NotNull
@NotNull java.lang.String messageName,
@NotNull
@NotNull java.util.Map<java.lang.String,java.lang.String> attributes)
@Nullable public static @Nullable ServiceMessage parse(@NotNull @NotNull java.lang.String text) throws java.text.ParseException
text - text to parsejava.text.ParseException - if parsing failedpublic static void parse(@NotNull
@NotNull java.lang.String text,
@NotNull
@NotNull ServiceMessageParserCallback parserCallback)
text - text with service messagesparserCallback - callback@NotNull public @NotNull java.lang.String getMessageName()
@Nullable public @Nullable java.lang.String getArgument()
@Nullable public @Nullable ServiceMessage.Timestamp getCreationTimestamp()
@Nullable public @Nullable java.lang.String getFlowId()
@NotNull public @NotNull java.util.Collection<java.lang.String> getTags()
@NotNull public @NotNull java.util.Map<java.lang.String,java.lang.String> getAttributes()
public void visit(@NotNull
@NotNull ServiceMessageVisitor visitor)
visitor - visitorpublic void setTimestamp(@NotNull
@NotNull java.util.Date timestamp)
public void setFlowId(@NotNull
@NotNull java.lang.String flowId)
public void addTag(@NotNull
@NotNull java.lang.String tag)
tag - a tag to add@Nullable
protected @Nullable java.lang.String getAttributeValue(@NotNull
@NotNull java.lang.String attrName)
@NotNull public static @NotNull ServiceMessage parseSimple(@NotNull @NotNull java.lang.String text, boolean shouldValidate) throws java.text.ParseException
RequiredAttribute so
validation is not performedtext - text to parseshouldValidate - whether to validate required attributes or not (currently ignored)java.text.ParseException - if parsing failsprotected void validate()
throws java.text.ParseException
RequiredAttribute annotation
return not-null value after initialization.java.text.ParseException@NotNull public @NotNull java.lang.String asString()
@NotNull
public static @NotNull java.lang.String asString(@NotNull
@NotNull java.lang.String messageName,
@NotNull
@NotNull java.util.Map<java.lang.String,java.lang.String> attributes)
messageName - name of the messageattributes - attribute map@NotNull
public static @NotNull java.lang.String asString(@NotNull
@NotNull java.lang.String messageName,
@NotNull
@NotNull java.lang.String argument)
messageName - name of the messageargument - the argumentpublic java.lang.String toString()
toString in class java.lang.Object