Class AccessModel
- java.lang.Object
-
- org.jivesoftware.openfire.pubsub.models.AccessModel
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AuthorizeAccess
,OpenAccess
,PresenceAccess
,RosterAccess
,WhitelistAccess
public abstract class AccessModel extends Object implements Serializable
Policy that defines who is allowed to subscribe and retrieve items.- Author:
- Matt Tucker
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static AccessModel
authorize
static AccessModel
open
static AccessModel
presence
static AccessModel
roster
static AccessModel
whitelist
-
Constructor Summary
Constructors Constructor Description AccessModel()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
canAccessItems(Node node, org.xmpp.packet.JID owner, org.xmpp.packet.JID subscriber)
Returns true if the entity is allowed to get the node published items.abstract boolean
canSubscribe(Node node, org.xmpp.packet.JID owner, org.xmpp.packet.JID subscriber)
Returns true if the entity is allowed to subscribe to the specified node.abstract String
getName()
Returns the name as defined by the JEP-60 spec.abstract org.xmpp.packet.PacketError.Condition
getSubsriptionError()
Returns the error condition that should be returned to the subscriber when subscription is not allowed.abstract org.dom4j.Element
getSubsriptionErrorDetail()
Returns the error element that should be returned to the subscriber as error detail when subscription is not allowed.abstract boolean
isAuthorizationRequired()
Returns true if the new subscription should be authorized by a node owner.static AccessModel
valueOf(String name)
Returns the specific subclass of AccessModel as specified by the access model name.
-
-
-
Field Detail
-
whitelist
public static final AccessModel whitelist
-
open
public static final AccessModel open
-
authorize
public static final AccessModel authorize
-
presence
public static final AccessModel presence
-
roster
public static final AccessModel roster
-
-
Method Detail
-
valueOf
public static AccessModel valueOf(String name)
Returns the specific subclass of AccessModel as specified by the access model name. If an unknown name is specified then an IllegalArgumentException is going to be thrown.- Parameters:
name
- the name of the subsclass.- Returns:
- the specific subclass of AccessModel as specified by the access model name.
-
getName
public abstract String getName()
Returns the name as defined by the JEP-60 spec.- Returns:
- the name as defined by the JEP-60 spec.
-
canSubscribe
public abstract boolean canSubscribe(Node node, org.xmpp.packet.JID owner, org.xmpp.packet.JID subscriber)
Returns true if the entity is allowed to subscribe to the specified node.- Parameters:
node
- the node that the subscriber is trying to subscribe to.owner
- the JID of the owner of the subscription.subscriber
- the JID of the subscriber.- Returns:
- true if the subscriber is allowed to subscribe to the specified node.
-
canAccessItems
public abstract boolean canAccessItems(Node node, org.xmpp.packet.JID owner, org.xmpp.packet.JID subscriber)
Returns true if the entity is allowed to get the node published items.- Parameters:
node
- the node that the entity is trying to get the node's items.owner
- the JID of the owner of the subscription.subscriber
- the JID of the subscriber.- Returns:
- true if the subscriber is allowed to get the node's published items.
-
getSubsriptionError
public abstract org.xmpp.packet.PacketError.Condition getSubsriptionError()
Returns the error condition that should be returned to the subscriber when subscription is not allowed.- Returns:
- the error condition that should be returned to the subscriber when subscription is not allowed.
-
getSubsriptionErrorDetail
public abstract org.dom4j.Element getSubsriptionErrorDetail()
Returns the error element that should be returned to the subscriber as error detail when subscription is not allowed. The returned element is created each time this message is sent so it is safe to include the returned element in the parent element.- Returns:
- the error element that should be returned to the subscriber as error detail when subscription is not allowed.
-
isAuthorizationRequired
public abstract boolean isAuthorizationRequired()
Returns true if the new subscription should be authorized by a node owner.- Returns:
- true if the new subscription should be authorized by a node owner.
-
-