org.openadaptor.security
Class SimplePolicy

java.lang.Object
  extended by org.openadaptor.security.SimplePolicy
All Implemented Interfaces:
Policy

public class SimplePolicy
extends java.lang.Object
implements Policy

This class represents a Security Policy that is used by the adaptor to apply security operations on a DO (DO[]) with a specific DOType before publishing onto to messaging layer like ETX.

There can be more than only policy for a DOType, the distinguishing factor amongst them is based on actual data contents. For this purpose, policy contains a DOPredicate, which specifies the condition based on DOAttributes.

A policy contains the following details:

An example properties representation of a Policy -


        Policy.PolicyName                                               = allTrades

        Policy.allTrades.EncodingOrder                  = ENCRYPT-COMPRESS-SIGN
        Policy.allTrades.DecodingOrder                  = SIGN-COMPRESS-ENCRYPT
        Policy.allTrades.ENCRYPT.Algo                   = DES
        Policy.allTrades.ENCRYPT.ClassName              = com.cryptix.encryptor
        Policy.allTrades.SIGN.Algo                              = MD5
        Policy.allTrades.SIGN.ClassName                 = com.cryptix.sign
        Policy.allTrades.COMPRESS.Algo                  = ZIP
        Policy.allTrades.COMPRESS.ClassName             = com.cryptix.compressor
        Policy.allTrades.Timeout                                = 10000 (in ms)

        Policy.allTrades.DOType1                                = TRADE
        Policy.allTrades.DOType2                                = ORDER

        Policy.allTrades.Filter.TRADE.AttName1                  = Counterparty
        Policy.allTrades.Filter.TRADE.AttValue1                 =
        Policy.allTrades.Filter.TRADE.AttValueRegExp1   = London*[a-zA-Z]
        Policy.allTrades.Filter.TRADE.AttName2                  = Quantity
        Policy.allTrades.Filter.TRADE.AttValue2                 = 200
        Policy.allTrades.Filter.TRADE.AttValueRegExp2   =

        Policy.allTrades.TRADE.mCounterparty.PolicyName                 = allCPs
        Policy.allTrades.TRADE.mInstrument.Exchange.PolicyName  = allExs
  

See Also:
DOPredicate, SimpleDOPredicate

Constructor Summary
SimplePolicy()
           
 
Method Summary
 DOPredicate getDOPredicate(java.lang.String doType)
          Returns the DOPredicate
 java.lang.String getName()
          Returns the name of the Policy
 java.util.Properties getPolicyForSubDOs(DOType doType)
          Searches the properties of this to find if any attribute of doType requires to be encoded in a separate way.
 java.util.Properties getPolicyForSubDOs(java.lang.String doType)
          Searches the properties of this to find if any attribute of doType Name requires to be encoded in a separate way.
 java.util.Properties getProperties()
          Returns all the properties in the policy
 java.lang.String getProperty(java.lang.String attr)
          Returns the requested property in the policy object
 java.lang.String getPropsPrefix()
          Policy property prefix
 void init(java.lang.String name, java.util.Properties props, java.lang.String propsPrefix)
          The Security Manager class creates the policy and calls the init function
 boolean isApplicableForDO(DataObject doObj)
          Checks whether this Policy is applicable for the DataObject Provided
 boolean isApplicableForType(DOType doType)
          Checks wether this policy is applicable to the DOType
 boolean isApplicableForType(java.lang.String doType)
          Checks wether this policy is applicable to the DOType Name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimplePolicy

public SimplePolicy()
Method Detail

init

public void init(java.lang.String name,
                 java.util.Properties props,
                 java.lang.String propsPrefix)
          throws java.lang.SecurityException
The Security Manager class creates the policy and calls the init function

Specified by:
init in interface Policy
Parameters:
name - The name of the Polciy created
properties - The properties object used the security agents
propsPrefix - The policy's property prefix
Throws:
java.lang.SecurityException - If anything fails during initialization

getDOPredicate

public DOPredicate getDOPredicate(java.lang.String doType)
Returns the DOPredicate

Specified by:
getDOPredicate in interface Policy

getName

public java.lang.String getName()
Returns the name of the Policy

Specified by:
getName in interface Policy

getProperty

public java.lang.String getProperty(java.lang.String attr)
Returns the requested property in the policy object

Specified by:
getProperty in interface Policy

getProperties

public java.util.Properties getProperties()
Returns all the properties in the policy

Specified by:
getProperties in interface Policy

getPropsPrefix

public java.lang.String getPropsPrefix()
Policy property prefix

Specified by:
getPropsPrefix in interface Policy

getPolicyForSubDOs

public java.util.Properties getPolicyForSubDOs(DOType doType)
Searches the properties of this to find if any attribute of doType requires to be encoded in a separate way.

Specified by:
getPolicyForSubDOs in interface Policy

getPolicyForSubDOs

public java.util.Properties getPolicyForSubDOs(java.lang.String doType)
Searches the properties of this to find if any attribute of doType Name requires to be encoded in a separate way.

Specified by:
getPolicyForSubDOs in interface Policy

isApplicableForType

public boolean isApplicableForType(DOType doType)
Checks wether this policy is applicable to the DOType

Specified by:
isApplicableForType in interface Policy

isApplicableForType

public boolean isApplicableForType(java.lang.String doType)
Checks wether this policy is applicable to the DOType Name

Specified by:
isApplicableForType in interface Policy

isApplicableForDO

public boolean isApplicableForDO(DataObject doObj)
Checks whether this Policy is applicable for the DataObject Provided

Specified by:
isApplicableForDO in interface Policy