Class Permission
- java.lang.Object
-
- com.caplin.keymaster.permissioning.Permission
-
- All Implemented Interfaces:
IPermission
public class Permission extends java.lang.Object implements IPermission
An implementation of theIPermission
interface. You should create instances of this class if you want to use the KeyMaster permissioning system.The permissioning system can control read and write access to subjects selected by the specified SubjectPattern.
Within the Caplin Xaqua environment there is a dedicated trade channel (subject) per asset class, for each user. If the trade channel subject is within the ^/TRADE/FX namespace and you wish to permit trading for the user on subjects within the ^/FX/ namespace, then the permissions should be configured as follows:
SubjectPattern ReadAllowed WriteAllowed TradeAllowed InstrumentField ^/TRADE/FX true true false InstrumentField ^/FX true false true null
-
-
Constructor Summary
Constructors Constructor Description Permission(java.lang.String subjectPattern)
Initializes a new instance of thePermission
class with a subject pattern.Permission(java.lang.String subjectPattern, boolean allowRead, boolean allowWrite, boolean allowTrade)
Initializes a new instance of thePermission
class with permissions for a subject pattern.Permission(java.lang.String subjectPattern, boolean allowRead, boolean allowWrite, boolean allowTrade, java.lang.String instrumentField)
Initializes a new instance of thePermission
class with permissions for a subject pattern, and the name of a field specifying an instrument that can be traded.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getInstrumentField()
Gets the instrument field.boolean
getReadAllowed()
Gets a value indicating whether the user can read subjects matchingIPermission.getSubjectPattern()
java.lang.String
getSubjectPattern()
Gets the regular expression representing the subjects that should have the permissions defined by this IPermission.boolean
getTradeAllowed()
Gets a value indicating whether the user can trade on subjects matchingIPermission.getSubjectPattern()
.boolean
getWriteAllowed()
Gets a value indicating whether the user can contribute to (publish to) subjects matchingIPermission.getSubjectPattern()
.void
setInstrumentField(java.lang.String value)
Sets the instrument field.void
setReadAllowed(boolean value)
Sets a value indicating whether the user can read subjects matchingIPermission.getSubjectPattern()
void
setSubjectPattern(java.lang.String value)
Sets the regular expression representing the subjects that should have the permissions defined by this IPermission.void
setTradeAllowed(boolean value)
Sets a value indicating whether the user can trade on subjects matchingIPermission.getSubjectPattern()
.void
setWriteAllowed(boolean value)
Sets a value indicating whether the user can contribute to (publish to) subjects matchingIPermission.getSubjectPattern()
.java.lang.String
toString()
Returns a String that represents this instance.
-
-
-
Constructor Detail
-
Permission
public Permission(java.lang.String subjectPattern)
Initializes a new instance of thePermission
class with a subject pattern.The initial permission settings deny all access to the subjects that match the subject pattern.
- Parameters:
subjectPattern
- The subject pattern.
-
Permission
public Permission(java.lang.String subjectPattern, boolean allowRead, boolean allowWrite, boolean allowTrade)
Initializes a new instance of thePermission
class with permissions for a subject pattern.- Parameters:
subjectPattern
- The subject pattern.allowRead
- If set totrue
, the user can read subjects matchingsubjectPattern
allowWrite
- If set totrue
, the user can contribute to (publish to) subjects matchingsubjectPattern
.allowTrade
- If set totrue
, the user can trade on subjects matchingsubjectPattern
.
-
Permission
public Permission(java.lang.String subjectPattern, boolean allowRead, boolean allowWrite, boolean allowTrade, java.lang.String instrumentField)
Initializes a new instance of thePermission
class with permissions for a subject pattern, and the name of a field specifying an instrument that can be traded.- Parameters:
subjectPattern
- The subject pattern.allowRead
- If set totrue
, the user can read subjects matchingsubjectPattern
.allowWrite
- If set totrue
, the user can contribute to (publish to) subjects matchingsubjectPattern
.allowTrade
- If set totrue
, the user can trade on subjects matchingsubjectPattern
.instrumentField
- The name of the field that will contain the name of the instrument being traded.
-
-
Method Detail
-
getSubjectPattern
public java.lang.String getSubjectPattern()
Description copied from interface:IPermission
Gets the regular expression representing the subjects that should have the permissions defined by this IPermission.The regular expression syntaxes supported by the Liberator are Basic and Extended. The full Java regular expressions syntax is not supported. However, the syntax for the most common regular expression operations is the same in each case. For more information on the various regular expression syntaxes, see www .regular-expressions.info.
- Specified by:
getSubjectPattern
in interfaceIPermission
- Returns:
- The regular expression.
-
setSubjectPattern
public void setSubjectPattern(java.lang.String value)
Description copied from interface:IPermission
Sets the regular expression representing the subjects that should have the permissions defined by this IPermission.The regular expression syntaxes supported by the Liberator are Basic and Extended. The full Java regular expressions syntax is not supported. However, the syntax for the most common regular expression operations is the same in each case. For more information on the various regular expression syntaxes, see www .regular-expressions.info.
- Specified by:
setSubjectPattern
in interfaceIPermission
- Parameters:
value
- the subject pattern to set.
-
getReadAllowed
public boolean getReadAllowed()
Description copied from interface:IPermission
Gets a value indicating whether the user can read subjects matchingIPermission.getSubjectPattern()
- Specified by:
getReadAllowed
in interfaceIPermission
- Returns:
true
if reading is allowed, otherwisefalse
.
-
setReadAllowed
public void setReadAllowed(boolean value)
Description copied from interface:IPermission
Sets a value indicating whether the user can read subjects matchingIPermission.getSubjectPattern()
- Specified by:
setReadAllowed
in interfaceIPermission
- Parameters:
value
- boolean indicating if read is allowed.
-
getWriteAllowed
public boolean getWriteAllowed()
Description copied from interface:IPermission
Gets a value indicating whether the user can contribute to (publish to) subjects matchingIPermission.getSubjectPattern()
.- Specified by:
getWriteAllowed
in interfaceIPermission
- Returns:
true
if contributing is allowed, otherwisefalse
.
-
setWriteAllowed
public void setWriteAllowed(boolean value)
Description copied from interface:IPermission
Sets a value indicating whether the user can contribute to (publish to) subjects matchingIPermission.getSubjectPattern()
.- Specified by:
setWriteAllowed
in interfaceIPermission
- Parameters:
value
- boolean value indicating if write is allowed.
-
getTradeAllowed
public boolean getTradeAllowed()
Description copied from interface:IPermission
Gets a value indicating whether the user can trade on subjects matchingIPermission.getSubjectPattern()
.- Specified by:
getTradeAllowed
in interfaceIPermission
- Returns:
true
if trading is allowed, otherwisefalse
-
setTradeAllowed
public void setTradeAllowed(boolean value)
Description copied from interface:IPermission
Sets a value indicating whether the user can trade on subjects matchingIPermission.getSubjectPattern()
.- Specified by:
setTradeAllowed
in interfaceIPermission
- Parameters:
value
- boolean value indicating if trading is allowed.
-
getInstrumentField
public java.lang.String getInstrumentField()
Description copied from interface:IPermission
Gets the instrument field.The instrument field must be present on StreamLink contributions to trade channels. It contains the name of a field specifying the name of an instrument that can be traded.
The default value of null implies that the field is not defined.
- Specified by:
getInstrumentField
in interfaceIPermission
- Returns:
- The instrument field.
-
setInstrumentField
public void setInstrumentField(java.lang.String value)
Description copied from interface:IPermission
Sets the instrument field.The instrument field must be present on StreamLink contributions to trade channels. It contains the name of a field specifying the name of an instrument that can be traded.
The default value of null implies that the field is not defined.
- Specified by:
setInstrumentField
in interfaceIPermission
- Parameters:
value
- the instrument field.
-
toString
public java.lang.String toString()
Returns a String that represents this instance.- Overrides:
toString
in classjava.lang.Object
-
-