com.silverpeas.util.security
Interface EncryptionContentIterator

All Superinterfaces:
Iterator<Map<String,String>>
All Known Implementing Classes:
FormEncryptionContentIterator

public interface EncryptionContentIterator
extends Iterator<Map<String,String>>

An iterator over a collection of contents for encryption purpose. The content is here represented by a Map object in which each entry represents a field or a property of a content.

Any provider of contents to be encrypted or decrypted must provide an implementation of this interface. It has been defined to be used in conjunction with ContentEncryptionService. The provider can implement this interface by wrapping the retrieve of the contents to be encrypted or to be decrypted and to put them at disposition of the caller.

It extends the Iterator interface by adding the following methods:


Method Summary
 boolean hasNext()
          Is there another content in this iteration?
 void init()
          Initialize contents to iterate.
 Map<String,String> next()
          Gets the next content in the iteration.
 void onError(Map<String,String> content, CryptoException ex)
          An error occurred while processing the last content returned by this iterator.
 void update(Map<String,String> updatedContent)
          Updates the last content returned by this iterator.
 
Methods inherited from interface java.util.Iterator
remove
 

Method Detail

init

void init()
Initialize contents to iterate. It prepares iterator for the encryption operations. It will be invoked by content encryption service before any iteration.


next

Map<String,String> next()
Gets the next content in the iteration.

Specified by:
next in interface Iterator<Map<String,String>>
Returns:
the next content to update in the form of a Map object in which each entry represents a field or a property of the content.

hasNext

boolean hasNext()
Is there another content in this iteration?

This method is called by the encryption service each time before asking the next content to encrypt or to decrypt with the next() method.

Specified by:
hasNext in interface Iterator<Map<String,String>>
Returns:
true if there is another content in the iteration. False otherwise.

update

void update(Map<String,String> updatedContent)
Updates the last content returned by this iterator.

Parameters:
updatedContent - the content updated by the encryption service in the form of a Map object in which each entry represents a field or a property of the content.

onError

void onError(Map<String,String> content,
             CryptoException ex)
An error occurred while processing the last content returned by this iterator.

This method is invoked by the encryption service when an error occurs while processing the last content returned by the iterator.

Parameters:
content - the content with which the error occurred.
ex - the exception raised at the error.


Copyright © 2016 Silverpeas. All Rights Reserved.