uk.ac.soton.itinnovation.grid.service.account
Class TradeAccountServiceImpl

java.lang.Object
  extended by uk.ac.soton.itinnovation.grid.service.utils.gridservit.GridServiceLite
      extended by uk.ac.soton.itinnovation.grid.service.account.AccountServiceImpl
          extended by uk.ac.soton.itinnovation.grid.service.account.TradeAccountServiceImpl
All Implemented Interfaces:
AccountResource, AccountService, TradeAccountResource, TradeAccountService, TradeAccountServiceSOAP, WebAdmin, WSRFService, WSTrust, GridService, IdentifiableResource, PolicyManagement, ResourceMetadata, Signallable

public class TradeAccountServiceImpl
extends AccountServiceImpl
implements TradeAccountServiceSOAP


Field Summary
static String TRADE_ACCOUNT_SERVICE_RESOURCE_TYPE
           
 
Fields inherited from class uk.ac.soton.itinnovation.grid.service.utils.gridservit.GridServiceLite
factory, groupUtils, management, NO_ACCOUNT_NEEDED, pbacUtils, pdp, proxyFactory, thisServiceAddress, wsdlCache
 
Fields inherited from interface uk.ac.soton.itinnovation.grid.comms.account.TradeAccountResource
TRADE_ACCOUNT_RESOURCE_TYPE
 
Fields inherited from interface uk.ac.soton.itinnovation.grid.comms.wstrust.WSTrust
DEFAULT_WSTRUST_ISSUER, requestSecurityToken, VALIDATE_SUBJECT_DESCRIPTION, WSTRUST_REQUEST_TYPE_ISSUANCE, WSTRUST_REQUEST_TYPE_VALIDATION, WSTRUST_SAML_1_1, WSTRUST_STATUS, WSTRUST_STATUS_INVALID, WSTRUST_STATUS_VALID, XMLNS_WSTRUST, XMLNS_WSU
 
Constructor Summary
TradeAccountServiceImpl()
           
 
Method Summary
 void addBudgetHolderRule(MatchRule rule)
          Deprecated. 
 void bill(IDType onBehalfOf, BigDecimal amount, String currency, String resource, String message)
          Charge something to the account.
 void checkCreditAvailable(BigDecimal amount, String currency)
          Test whether we can withdraw this amount now.
 void checkWhetherCreditAvailable(BigDecimal amount)
          Deprecated. 
 void closeAccount()
          Close an account
 void disableAccess(MatchRule delegate)
          Deprecated. 
 void enableAccess(MatchRule delegate)
          Deprecated. 
 void ensurePoliciesDeployed()
          Ensure that any required PBAC policies are deployed.
 AccountStatement generateStatement(Account account, Date startDate, Date endDate)
          Used by web-admin interface.
 Account[] getAccountsByStatus(String status)
           
 AccountStatement getAccountStatement(Date startDate, Date endDate)
          Get a statement for an account
 String getAccountStatus()
          Get the current status of an account
 Document getAtomFeed(String atomFeed, String serviceBase)
          Return notices from the account service as an Atom feed.
 org.apache.axis.message.addressing.EndpointReferenceType[] getResources()
          List the resources managed by this service for which the caller has some role.
 MatchRule[] getUserAccessRules()
          Deprecated. 
 void makePayment(IDType paidBy, BigDecimal amount, String currency, String resource, String message)
          Make a payment on an account
 void makePaymentInternal(String conversationID, IDType user, IDType paidBy, BigDecimal amount, String currency, String resource, String message)
           
 org.apache.axis.message.addressing.EndpointReferenceType openAccount(String budgetHolderName, String budgetHolderTelephone, String budgetHolderEmail, AddressType clientOrganisationAddress, String clientOrganisationCreditDetails, String label, MatchRule owner)
          Attempt to open a new account.
 void reloadConfiguration()
          Reload the configuration.
 void removeBudgetHolderRule(MatchRule rule)
          Deprecated. 
 Document RequestSecurityToken_Validation(Element request)
          Validate security tokens.
 void setCreditLimit(BigDecimal creditLimit)
          Set the account's credit limit
 void setCreditLimit(String conversationID, BigDecimal creditLimit)
           
 
Methods inherited from class uk.ac.soton.itinnovation.grid.service.account.AccountServiceImpl
addUserRule, checkUser, getAccount, getAccount, getBudgetHolderRules, getResourceType, getUserRules, removeUserRule
 
Methods inherited from class uk.ac.soton.itinnovation.grid.service.utils.gridservit.GridServiceLite
addHibernatedObject, addPolicyRule, addTrustedAccountService, deleteHibernatedObject, generateEPR, getAvailableSignals, getConversationFromContext, getCurrentUser, getEPR, getEPR, getManagingConversation, getPolicyRules, getPrivateKey, getResourceFromEPR, GetResourceProperty, getResources, getResources, getResourcesFromEPRs, getSelectedRegistries, getServiceDatabaseKey, getServiceFromEPR, getServiceMatchPattern, getServiceProviderCertificate, getServiceProviderID, getServiceProviderIssuer, getTrustedAccountServices, getValidRoles, loadLocalRegistry, removePolicyRule, removeTrustedAccountService, RequestSecurityToken_Issuance, RequestSecurityToken, setLabel, setLabel, signal, toMatchRules, validateOwner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.comms.account.AccountResource
addUserRule, checkUser, getBudgetHolderRules, getUserRules, removeUserRule
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.types.PolicyManagement
addPolicyRule, getPolicyRules, getValidRoles, removePolicyRule
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.types.ResourceMetadata
getEPR, setLabel
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.types.Signallable
getAvailableSignals, signal
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.comms.wstrust.WSTrust
RequestSecurityToken
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.comms.wsrf.WSRFService
GetResourceProperty
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.types.GridService
getServiceProviderID, getServiceProviderIssuer
 

Field Detail

TRADE_ACCOUNT_SERVICE_RESOURCE_TYPE

public static final String TRADE_ACCOUNT_SERVICE_RESOURCE_TYPE
See Also:
Constant Field Values
Constructor Detail

TradeAccountServiceImpl

public TradeAccountServiceImpl()
                        throws RemoteException
Throws:
RemoteException
Method Detail

reloadConfiguration

public void reloadConfiguration()
Reload the configuration. Used by the admin tool.

Throws:
Exception - if the configuration is not yet valid

ensurePoliciesDeployed

public void ensurePoliciesDeployed()
                            throws RemoteException
Description copied from interface: WebAdmin
Ensure that any required PBAC policies are deployed.

Specified by:
ensurePoliciesDeployed in interface WebAdmin
Throws:
RemoteException

openAccount

public org.apache.axis.message.addressing.EndpointReferenceType openAccount(String budgetHolderName,
                                                                            String budgetHolderTelephone,
                                                                            String budgetHolderEmail,
                                                                            AddressType clientOrganisationAddress,
                                                                            String clientOrganisationCreditDetails,
                                                                            String label,
                                                                            MatchRule owner)
                                                                     throws RemoteException
Description copied from interface: TradeAccountService
Attempt to open a new account. The arguments are the account and billing details to be used.

Specified by:
openAccount in interface AccountService
Specified by:
openAccount in interface TradeAccountService
label - A human-readable label for the account (for other clients)
owner - A rule to allow access for the owner role
Returns:
The endpoint for the new account resource.
Throws:
RemoteException

getAccountsByStatus

public Account[] getAccountsByStatus(String status)
Specified by:
getAccountsByStatus in class AccountServiceImpl

getAccountStatement

public AccountStatement getAccountStatement(Date startDate,
                                            Date endDate)
                                     throws RemoteException
Description copied from interface: AccountResource
Get a statement for an account

Specified by:
getAccountStatement in interface AccountResource
Parameters:
startDate - - the start of the period the statement should cover
endDate - - the start of the period the statement should cover
Returns:
A generated statement for the account
Throws:
RemoteException - If the account statement cannot be generated

generateStatement

public AccountStatement generateStatement(Account account,
                                          Date startDate,
                                          Date endDate)
                                   throws RemoteException
Used by web-admin interface.

Throws:
RemoteException

getAccountStatus

public String getAccountStatus()
                        throws RemoteException
Description copied from interface: AccountResource
Get the current status of an account

Specified by:
getAccountStatus in interface AccountResource
Overrides:
getAccountStatus in class AccountServiceImpl
Returns:
the account's status
Throws:
RemoteException - If the account status cannot be accessed

addBudgetHolderRule

@Deprecated
public void addBudgetHolderRule(MatchRule rule)
                         throws RemoteException
Deprecated. 

Description copied from interface: AccountResource
Add a rule controlling access to the budget-holder role.

Specified by:
addBudgetHolderRule in interface AccountResource
Overrides:
addBudgetHolderRule in class AccountServiceImpl
Parameters:
rule - - the rule to add (role must be "budget-holder")
Throws:
RemoteException

removeBudgetHolderRule

@Deprecated
public void removeBudgetHolderRule(MatchRule rule)
                            throws RemoteException
Deprecated. 

Description copied from interface: AccountResource
Remove a rule controlling access to the budget-holder role.

Specified by:
removeBudgetHolderRule in interface AccountResource
Overrides:
removeBudgetHolderRule in class AccountServiceImpl
Parameters:
rule - - the rule to remove (role must be "budget-holder")
Throws:
RemoteException

enableAccess

@Deprecated
public void enableAccess(MatchRule delegate)
                  throws RemoteException
Deprecated. 

Throws:
RemoteException

disableAccess

@Deprecated
public void disableAccess(MatchRule delegate)
                   throws RemoteException
Deprecated. 

Throws:
RemoteException

getResources

public org.apache.axis.message.addressing.EndpointReferenceType[] getResources()
                                                                        throws RemoteException
Description copied from interface: GridService
List the resources managed by this service for which the caller has some role.

Specified by:
getResources in interface GridService
Throws:
RemoteException

closeAccount

public void closeAccount()
                  throws RemoteException
Description copied from interface: AccountResource
Close an account

Specified by:
closeAccount in interface AccountResource
Overrides:
closeAccount in class AccountServiceImpl
Throws:
RemoteException - If the account cannot be closed

bill

public void bill(IDType onBehalfOf,
                 BigDecimal amount,
                 String currency,
                 String resource,
                 String message)
          throws RemoteException
Description copied from interface: TradeAccountResource
Charge something to the account. This is normally called by a service which wants to charge a user for using it. Since a service will have permission to bill to an account even though the client of the service doesn't, services should call AccountResource.checkUser(uk.ac.soton.itinnovation.grid.types.SubjectDescription) first.

If the new liability is greater than the credit limit a warning is logged but the transaction is still recorded. Call TradeAccountResource.checkWhetherCreditAvailable(java.math.BigDecimal) before starting an activity to ensure that credit is available.

Specified by:
bill in interface TradeAccountResource
Parameters:
onBehalfOf - - the user we are billing on behalf of (may be same as caller)
amount - - the amount to bill
currency - - the currency code for the amount (must match the account's currency)
resource - - the resource which was paid for (optional)
message - - the message to show on the statement
Throws:
RemoteException - for other errors

makePayment

public void makePayment(IDType paidBy,
                        BigDecimal amount,
                        String currency,
                        String resource,
                        String message)
                 throws RemoteException
Description copied from interface: TradeAccountResource
Make a payment on an account

Specified by:
makePayment in interface TradeAccountResource
Parameters:
paidBy - the user who made the payment (usually the budget holder)
amount - the amount paid in (must be greater than or equal to zero)
resource - a resource which the payment is for (optional)
message - a message to show on the statement for this payment
Throws:
RemoteException

makePaymentInternal

public void makePaymentInternal(String conversationID,
                                IDType user,
                                IDType paidBy,
                                BigDecimal amount,
                                String currency,
                                String resource,
                                String message)
                         throws RemoteException
Throws:
RemoteException

getUserAccessRules

@Deprecated
public MatchRule[] getUserAccessRules()
                               throws RemoteException
Deprecated. 

Throws:
RemoteException

setCreditLimit

public void setCreditLimit(BigDecimal creditLimit)
                    throws RemoteException
Description copied from interface: TradeAccountResource
Set the account's credit limit

Specified by:
setCreditLimit in interface TradeAccountResource
Parameters:
creditLimit - the new limit
Throws:
RemoteException

setCreditLimit

public void setCreditLimit(String conversationID,
                           BigDecimal creditLimit)
                    throws RemoteException
Throws:
RemoteException

checkWhetherCreditAvailable

@Deprecated
public void checkWhetherCreditAvailable(BigDecimal amount)
                                 throws InsufficientCreditException,
                                        RemoteException
Deprecated. 

Description copied from interface: TradeAccountResource
Test whether we can withdraw this amount now.

Specified by:
checkWhetherCreditAvailable in interface TradeAccountResource
Parameters:
amount - amount to test
Throws:
InsufficientCreditException - if there are insufficient funds
RemoteException - for other errors

checkCreditAvailable

public void checkCreditAvailable(BigDecimal amount,
                                 String currency)
                          throws InsufficientCreditException,
                                 RemoteException
Description copied from interface: TradeAccountResource
Test whether we can withdraw this amount now.

Specified by:
checkCreditAvailable in interface TradeAccountResource
Parameters:
amount - amount to test
currency - units for amount
Throws:
InsufficientCreditException - if there are insufficient funds
RemoteException - for other errors

getAtomFeed

public Document getAtomFeed(String atomFeed,
                            String serviceBase)
                     throws RemoteException
Return notices from the account service as an Atom feed. The feed includes details such as bad configuration and notices of pending accounts.

Specified by:
getAtomFeed in interface WebAdmin
Parameters:
atomFeed - the URL of the feed
serviceBase - the service administration URL (for creating hyperlinks)
Throws:
RemoteException
See Also:
AtomUtils

RequestSecurityToken_Validation

public Document RequestSecurityToken_Validation(Element request)
                                         throws RemoteException
Description copied from class: GridServiceLite
Validate security tokens. Called by GridServiceLite.RequestSecurityToken(org.w3c.dom.Element) for validation requests.

Overrides:
RequestSecurityToken_Validation in class GridServiceLite
Throws:
RemoteException


Copyright © 2001-2008 University of Southampton IT Innovation Centre. All Rights Reserved.