Class AMPExtension
- java.lang.Object
-
- org.jivesoftware.smackx.amp.packet.AMPExtension
-
- All Implemented Interfaces:
org.jivesoftware.smack.packet.Element
,org.jivesoftware.smack.packet.ExtensionElement
,org.jivesoftware.smack.packet.NamedElement
,org.jivesoftware.smack.packet.XmlElement
,org.jivesoftware.smack.packet.XmlLangElement
public class AMPExtension extends java.lang.Object implements org.jivesoftware.smack.packet.ExtensionElement
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AMPExtension.Action
amp action attribute.static interface
AMPExtension.Condition
Interface for defining XEP-0079 Conditions and their values.static class
AMPExtension.Rule
XEP-0079 Rule element.static class
AMPExtension.Status
amp notification status as defined by XEP-0079.
-
Constructor Summary
Constructors Constructor Description AMPExtension()
Create a new amp request extension to be used with outgoing message.AMPExtension(java.lang.String from, java.lang.String to, AMPExtension.Status status)
Create a new AMPExtension instance with defined from, to and status attributes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRule(AMPExtension.Rule rule)
Adds a rule to the amp element.java.lang.String
getElementName()
Returns the XML element name of the extension sub-packet root element.java.lang.String
getFrom()
Get the JID that triggered this AMP callback.java.lang.String
getNamespace()
Returns the XML namespace of the extension sub-packet root element.java.util.List<AMPExtension.Rule>
getRules()
Returns a unmodifiable List of the rules in the packet.int
getRulesCount()
Returns a count of the rules in the AMP packet.AMPExtension.Status
getStatus()
Status of this amp notification.java.lang.String
getTo()
Get the receiver of this AMP receipt.boolean
isPerHop()
Returns true is this ruleset is "per-hop".void
setPerHop(boolean enabled)
Sets this amp ruleset to be "per-hop".java.lang.String
toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace)
Returns the XML representation of a XHTML extension according the specification.
-
-
-
Field Detail
-
NAMESPACE
public static final java.lang.String NAMESPACE
- See Also:
- Constant Field Values
-
ELEMENT
public static final java.lang.String ELEMENT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AMPExtension
public AMPExtension(java.lang.String from, java.lang.String to, AMPExtension.Status status)
Create a new AMPExtension instance with defined from, to and status attributes. Used to create incoming packets.- Parameters:
from
- jid that triggered this amp callback.to
- receiver of this amp receipt.status
- status of this amp receipt.
-
AMPExtension
public AMPExtension()
Create a new amp request extension to be used with outgoing message.
-
-
Method Detail
-
getFrom
public java.lang.String getFrom()
Get the JID that triggered this AMP callback.- Returns:
- jid that triggered this amp callback.
-
getTo
public java.lang.String getTo()
Get the receiver of this AMP receipt.- Returns:
- receiver of this amp receipt.
-
getStatus
public AMPExtension.Status getStatus()
Status of this amp notification.- Returns:
- Status for this amp
-
getRules
public java.util.List<AMPExtension.Rule> getRules()
Returns a unmodifiable List of the rules in the packet.- Returns:
- a unmodifiable List of the rules in the packet.
-
addRule
public void addRule(AMPExtension.Rule rule)
Adds a rule to the amp element. Amp can have any number of rules.- Parameters:
rule
- the rule to add.
-
getRulesCount
public int getRulesCount()
Returns a count of the rules in the AMP packet.- Returns:
- the number of rules in the AMP packet.
-
setPerHop
public void setPerHop(boolean enabled)
Sets this amp ruleset to be "per-hop".- Parameters:
enabled
- true if "per-hop" should be enabled
-
isPerHop
public boolean isPerHop()
Returns true is this ruleset is "per-hop".- Returns:
- true is this ruleset is "per-hop".
-
getElementName
public java.lang.String getElementName()
Returns the XML element name of the extension sub-packet root element. Always returns "amp"- Specified by:
getElementName
in interfaceorg.jivesoftware.smack.packet.NamedElement
- Returns:
- the XML element name of the stanza extension.
-
getNamespace
public java.lang.String getNamespace()
Returns the XML namespace of the extension sub-packet root element. According the specification the namespace is always "http://jabber.org/protocol/xhtml-im"- Specified by:
getNamespace
in interfaceorg.jivesoftware.smack.packet.XmlElement
- Returns:
- the XML namespace of the stanza extension.
-
toXML
public java.lang.String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace)
Returns the XML representation of a XHTML extension according the specification.- Specified by:
toXML
in interfaceorg.jivesoftware.smack.packet.Element
-
-