Changeset 1176 for raptor-client


Ignore:
Timestamp:
10/26/11 23:07:47 (9 years ago)
Author:
philsmart
Message:
 
Location:
raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor
Files:
32 edited
2 moved

Legend:

Unmodified
Added
Removed
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/attribute/AttributeRule.java

    r1025 r1176  
    2222import uk.ac.cardiff.raptor.attribute.filtering.match.MatchRule; 
    2323 
    24 /** 
    25  * This is a poor implementation of an attributeRule as taken from the ShibbolethIDP. 
     24/* 
     25 * This is a poor implementation of an attributeRule as taken from the ShibbolethIDP. But as this will be replaced by Shib, leave for now 
    2626 */ 
    2727public class AttributeRule { 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/attribute/filtering/AttributeFilterException.java

    r1025 r1176  
    1717package uk.ac.cardiff.raptor.attribute.filtering; 
    1818 
    19 /** 
    20  * @author philsmart 
    21  *  
    22  */ 
    2319public class AttributeFilterException extends Exception { 
    2420 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/attribute/filtering/AttrributeFilterEngine.java

    r1049 r1176  
    2929import uk.ac.cardiff.model.event.Event; 
    3030 
    31 /** 
    32  * 
    33  */ 
    3431public class AttrributeFilterEngine { 
    3532 
     
    4037     * Only runs against the deny rules, and only denies basic:ANY attributes, does not deny individual values. 
    4138     *  
    42      * @param attributeFilterPolicy 
    43      * @param entries 
    44      * @return 
     39     * @param attributeFilterPolicy the policy used to filter attributes from the set <code>events</code> 
     40     * @param metadata the metadata of the service this attribute filter engine is operating within 
     41     * @param events the list of events to filter 
     42     * @return a cloned set of filtered events 
    4543     */ 
    4644    public List<Event> filter(final AttributeFilterPolicy attributeFilterPolicy, final ServiceMetadata metadata, 
     
    6058     * Only process deny rules on the level of basic:ANY attributes. Hence will not deny individual values 
    6159     *  
    62      * @param entry 
    63      * @param attributeRule 
    64      * @param metadata 
     60     * @param event the events whose attributes need filtering 
     61     * @param attributeRule the attribute rule used to filter these events 
     62     * @param metadata the service metadata passed to the attribute rule for use. 
    6563     */ 
    6664    private void filterAttributes(final Event event, final BaseAttributeRule attributeRule, 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/attribute/filtering/BaseAttributeRule.java

    r1026 r1176  
    2222import uk.ac.cardiff.raptor.runtimeutils.ReflectionHelper; 
    2323 
    24 /** 
     24/* 
    2525 * A naive implementation of an attributeRule. 
    2626 *  
     
    3939 
    4040    /** 
    41      * Abstract method that Filters an attribute. This *must* be implemented by all concrete classes. 
     41     * Abstract method that Filters an attribute based on the concrete implementation of the AttributeRule. This *must* 
     42     * be implemented by all concrete classes. 
    4243     *  
    4344     * @param event the event 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/attribute/filtering/match/MatchRule.java

    r1049 r1176  
    3535     * @param enabled the new enabled 
    3636     */ 
    37     public void setEnabled(final boolean enabled) { 
    38         this.enabled = enabled; 
     37    public void setEnabled(final boolean isEnabled) { 
     38        enabled = isEnabled; 
    3939    } 
    4040 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/event/expansion/AttributeAssociationEngine.java

    r1049 r1176  
    1717 * 
    1818 */ 
     19 
    1920package uk.ac.cardiff.raptor.event.expansion; 
    2021 
    2122import java.util.List; 
    22  
    2323 
    2424import org.slf4j.Logger; 
     
    3030/** 
    3131 * @author philsmart 
    32  * 
     32 *  
    3333 */ 
    34 public class AttributeAssociationEngine { 
     34public final class AttributeAssociationEngine { 
    3535 
    3636    /** Class logger. */ 
    3737    private final Logger log = LoggerFactory.getLogger(AttributeAssociationEngine.class); 
    3838 
    39     /** Defines which attributes to add, and what principal to attach to*/ 
     39    /** Defines which attributes to add, and what principal to attach to */ 
    4040    private List<BaseAttributeAssociationDefinition> attributeAssociationDefinitions; 
    4141 
     
    4343     * Default Constructor 
    4444     */ 
    45     public AttributeAssociationEngine(){ 
     45    public AttributeAssociationEngine() { 
    4646 
    4747    } 
     
    5050     * Gets associated attributes for the given ... 
    5151     */ 
    52     public void associateAttributes(List<Event> events) throws AttributeAssociationException{ 
    53         for (BaseAttributeAssociationDefinition attributeAssociationDefinition: attributeAssociationDefinitions){ 
    54             log.info("Attribute Association Definition [{}], is enabled [{}]",attributeAssociationDefinition.getDefiniationName(), attributeAssociationDefinition.isEnabled()); 
     52    public void associateAttributes(final List<Event> events) throws AttributeAssociationException { 
     53        for (BaseAttributeAssociationDefinition attributeAssociationDefinition : attributeAssociationDefinitions) { 
     54            log.info("Attribute Association Definition [{}], is enabled [{}]", 
     55                    attributeAssociationDefinition.getDefiniationName(), attributeAssociationDefinition.isEnabled()); 
    5556 
    56             if (!attributeAssociationDefinition.isEnabled()){ 
     57            if (!attributeAssociationDefinition.isEnabled()) { 
    5758                continue; 
    5859            } 
    5960 
    60             int attached=0; 
    61             int failedToAssociate=0; 
    62             int current=0; 
     61            int attached = 0; 
     62            int failedToAssociate = 0; 
     63            int current = 0; 
    6364            final int noOfEvents = events.size(); 
    64             for (Event event : events){ 
     65            for (Event event : events) { 
    6566                printProgressPosition(current, noOfEvents); 
    6667                boolean associated = attributeAssociationDefinition.associate(event); 
    67                 if (associated){ 
     68                if (associated) { 
    6869                    attached++; 
    69                 } 
    70                 else{ 
    71                         failedToAssociate++; 
     70                } else { 
     71                    failedToAssociate++; 
    7272                } 
    7373                current++; 
    7474            } 
    75             log.info("Attribute Association Definition {} finished, associated information to {} events, where {} events had no attributes associated", 
    76                     new Object[]{attributeAssociationDefinition.getDefiniationName(),attached,failedToAssociate}); 
     75            log.info( 
     76                    "Attribute Association Definition {} finished, associated information to {} events, where {} events had no attributes associated", 
     77                    new Object[] {attributeAssociationDefinition.getDefiniationName(), attached, failedToAssociate}); 
    7778        } 
    7879 
    7980    } 
    8081 
    81  
    8282    /** 
    8383     * Prints, as a percentage of the total, the event currently being processed. 
    84      * 
     84     *  
    8585     * @param lineCount 
    8686     * @param totalNoLines 
    8787     */ 
    88     private void printProgressPosition(int lineCount, int totalNoLines) { 
    89             double linePercentage = (((double) lineCount / (double) totalNoLines) * 100); 
    90             if (linePercentage % 25 >= 0 && linePercentage % 25 <= 0.003) 
    91                     log.debug("Attribute Association, Complete {}%", linePercentage); 
     88    private void printProgressPosition(final int lineCount, final int totalNoLines) { 
     89        double linePercentage = (((double) lineCount / (double) totalNoLines) * 100); 
     90        if (linePercentage % 25 >= 0 && linePercentage % 25 <= 0.003) 
     91            log.debug("Attribute Association, Complete {}%", linePercentage); 
    9292    } 
    9393 
    9494    /** 
    9595     * Also initialises the definitions 
    96      * 
     96     *  
    9797     * @param attributeAssociationDefinitions the attributeAssociationDefinitions to set 
    9898     */ 
    99     public void setAttributeAssociationDefinitions(List<BaseAttributeAssociationDefinition> attributeAssociationDefinitions) { 
     99    public void setAttributeAssociationDefinitions( 
     100            final List<BaseAttributeAssociationDefinition> attributeAssociationDefinitions) { 
    100101        this.attributeAssociationDefinitions = attributeAssociationDefinitions; 
    101         for (BaseAttributeAssociationDefinition definition : attributeAssociationDefinitions){ 
    102               definition.initialise(); 
     102        for (BaseAttributeAssociationDefinition definition : attributeAssociationDefinitions) { 
     103            definition.initialise(); 
    103104        } 
    104105    } 
     
    111112    } 
    112113 
    113  
    114  
    115  
    116114} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/event/expansion/AttributeLookup.java

    r756 r1176  
    1717 * 
    1818 */ 
     19 
    1920package uk.ac.cardiff.raptor.event.expansion; 
    2021 
    2122/** 
    2223 * @author philsmart 
    23  * 
     24 *  
    2425 */ 
    2526public class AttributeLookup { 
    2627 
    27     /** The name of the attribute in the source data store */ 
     28    /** The name of the attribute in the source data store. */ 
    2829    private String sourceAttributeName; 
    2930 
    30     /** The name of the attribute in the internal model that this attribute maps to*/ 
     31    /** The name of the attribute in the internal model that this attribute maps to. */ 
    3132    private String internalAttributeName; 
    3233 
     
    3435     * @param sourceAttributeName the sourceAttributeName to set 
    3536     */ 
    36     public void setSourceAttributeName(String sourceAttributeName) { 
     37    public void setSourceAttributeName(final String sourceAttributeName) { 
    3738        this.sourceAttributeName = sourceAttributeName; 
    3839    } 
     
    4849     * @param internalAttributeName the internalAttributeName to set 
    4950     */ 
    50     public void setInternalAttributeName(String internalAttributeName) { 
     51    public void setInternalAttributeName(final String internalAttributeName) { 
    5152        this.internalAttributeName = internalAttributeName; 
    5253    } 
     
    5960    } 
    6061 
    61  
    6262} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/event/expansion/PrincipalAttributeAssociationDefinition.java

    r1049 r1176  
    8080     * @throws AttributeAssociationException the attribute association exception 
    8181     */ 
    82     public String getInternalAttributeName(String attributeSourceName) throws AttributeAssociationException { 
     82    public String getInternalAttributeName(final String attributeSourceName) throws AttributeAssociationException { 
    8383        for (AttributeLookup lookupAttribute : lookupAttributes) { 
    8484            if (lookupAttribute.getSourceAttributeName().equals(attributeSourceName)) { 
     
    9898     * @throws IllegalAccessException the illegal access exception 
    9999     */ 
    100     private void populate(Map<String, String> attributes, Event event) throws InstantiationException, 
     100    private void populate(final Map<String, String> attributes, final Event event) throws InstantiationException, 
    101101            IllegalAccessException { 
    102102 
     
    121121 
    122122    @Override 
    123     public boolean associate(Event event) { 
     123    public boolean associate(final Event event) { 
    124124 
    125125        if (!event.getClass().getCanonicalName().equals(associateWithClass)) { 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/event/expansion/ResourceCategoryAttributeAssociationDefinition.java

    r1049 r1176  
    4848 
    4949    @Override 
    50     public boolean associate(Event event) { 
     50    public boolean associate(final Event event) { 
    5151 
    5252        ResourceMetadata resourceMetadata = null; 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/event/expansion/connector/DataConnector.java

    r756 r1176  
    1717 * 
    1818 */ 
     19 
    1920package uk.ac.cardiff.raptor.event.expansion.connector; 
    2021 
     
    2324/** 
    2425 * @author philsmart 
    25  * 
     26 *  
    2627 */ 
    2728public interface DataConnector { 
    2829 
    29     public  Map<String, String> lookup(String principal) throws AttributeAssociationException; 
     30    /** 
     31     * Use this data connector to resolve attributes about the <code>principal</code> 
     32     *  
     33     * @param principal the principal name of the subject to resolve attributes about 
     34     * @return a <code>Map</code> of attribute value pairs resolved about the <code>principal</code> 
     35     * @throws AttributeAssociationException 
     36     */ 
     37    public Map<String, String> lookup(final String principal) throws AttributeAssociationException; 
    3038 
     39    /** 
     40     * Initiliases the concrete implementation of this data connector 
     41     */ 
    3142    public void initialise(); 
    3243 
    33     public void setReturnAttributes(String[] s); 
     44    /** 
     45     * Sets which attributes should be returned by this data connector 
     46     *  
     47     * @param attributes the set of attributes which should be returned by this data connector 
     48     */ 
     49    public void setReturnAttributes(final String[] attributes); 
    3450 
    35     public void setSearchFilterTemplate(String searchFilterTemplate); 
     51    /** 
     52     * Sets the search template specific to the concrete implementation of the data connector used to query this data 
     53     * connector. 
     54     *  
     55     * @param searchFilterTemplate the search template specific to the concrete implementation of the data connector 
     56     *            used to query this data connector. 
     57     */ 
     58    public void setSearchFilterTemplate(final String searchFilterTemplate); 
    3659 
    3760} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/event/expansion/connector/LdapDataConnector.java

    r756 r1176  
    1414 * limitations under the License. 
    1515 */ 
     16 
    1617package uk.ac.cardiff.raptor.event.expansion.connector; 
    1718 
     
    3637import javax.net.ssl.TrustManagerFactory; 
    3738 
    38  
    3939import org.opensaml.xml.security.x509.X509Credential; 
    4040import org.opensaml.xml.util.DatatypeHelper; 
     
    4242import org.slf4j.LoggerFactory; 
    4343 
    44  
    4544import edu.vt.middleware.ldap.Ldap; 
    4645import edu.vt.middleware.ldap.LdapConfig; 
     
    5049/** 
    5150 * <code>LdapDataConnector</code> provides a plugin to retrieve attributes from an LDAP. 
     51 */ 
     52/* 
     53 * STOLEN from Shib, needs converting to shib attribute resolution. 
    5254 */ 
    5355public class LdapDataConnector implements DataConnector { 
     
    120122    private boolean initialized; 
    121123 
    122     /** The ldap search filter template*/ 
     124    /** The ldap search filter template */ 
    123125    private String searchFilterTemplate; 
    124126 
     
    126128    private long cacheTimeoutMs; 
    127129 
    128     /** The time at which the cache was last reset*/ 
     130    /** The time at which the cache was last reset */ 
    129131    private long cacheResetTimeMs; 
    130132 
     
    140142     */ 
    141143    public void initialise() { 
    142         if (!initialized){ 
     144        if (!initialized) { 
    143145            initialized = true; 
    144146            initializeLdapPool(); 
     
    178180    } 
    179181 
    180  
    181182    /** 
    182183     * This returns whether this connector will merge multiple search results into one result. The default is false. 
    183      * 
     184     *  
    184185     * @return <code>boolean</code> 
    185186     */ 
     
    191192     * This sets whether this connector will merge multiple search results into one result. This method will remove any 
    192193     * cached results. 
    193      * 
    194      * @see #clearCache() 
    195      * 
     194     *  
     195     * @see #clearCache() 
     196     *  
    196197     * @param b <code>boolean</code> 
    197198     */ 
     
    203204    /** 
    204205     * This returns whether this connector will cache search results. The default is false. 
    205      * 
     206     *  
    206207     * @return <code>boolean</code> 
    207208     */ 
     
    212213    /** 
    213214     * This sets whether this connector will cache search results. 
    214      * 
     215     *  
    215216     * @see #initializeCache() 
    216      * 
     217     *  
    217218     * @param b <code>boolean</code> 
    218219     */ 
     
    228229    /** 
    229230     * This returns whether this connector will throw an exception if no search results are found. The default is false. 
    230      * 
     231     *  
    231232     * @return <code>boolean</code> 
    232233     */ 
     
    237238    /** 
    238239     * This sets whether this connector will throw an exception if no search results are found. 
    239      * 
     240     *  
    240241     * @param b <code>boolean</code> 
    241242     */ 
     
    244245    } 
    245246 
    246  
    247247    /** 
    248248     * This returns the URL this connector is using. 
    249      * 
     249     *  
    250250     * @return <code>String</code> 
    251251     */ 
     
    256256    /** 
    257257     * This returns the base DN this connector is using. 
    258      * 
     258     *  
    259259     * @return <code>String</code> 
    260260     */ 
     
    265265    /** 
    266266     * This returns whether this connector will start TLS for all connections to the ldap. 
    267      * 
     267     *  
    268268     * @return <code>boolean</code> 
    269269     */ 
     
    274274    /** 
    275275     * This returns the SSL Socket Factory that will be used for all TLS and SSL connections to the ldap. 
    276      * 
     276     *  
    277277     * @return <code>SSLSocketFactory</code> 
    278278     */ 
     
    284284     * This sets the SSL Socket Factory that will be used for all TLS and SSL connections to the ldap. This method will 
    285285     * remove any cached results and initialize the ldap pool. 
    286      * 
     286     *  
    287287     * @see #clearCache() 
    288288     * @see #initializeLdapPool() 
    289      * 
     289     *  
    290290     * @param sf <code>SSLSocketFactory</code> 
    291291     */ 
     
    296296    /** 
    297297     * This returns the trust managers that will be used for all TLS and SSL connections to the ldap. 
    298      * 
     298     *  
    299299     * @return <code>TrustManager[]</code> 
    300300     */ 
     
    306306     * This sets the trust managers that will be used for all TLS and SSL connections to the ldap. This method will 
    307307     * remove any cached results and initialize the ldap pool. 
    308      * 
     308     *  
    309309     * @see #clearCache() 
    310310     * @see #initializeLdapPool() 
    311311     * @see #setSslSocketFactory(SSLSocketFactory) 
    312      * 
     312     *  
    313313     * @param tc <code>X509Credential</code> to create TrustManagers with 
    314314     */ 
     
    339339    /** 
    340340     * This returns the key managers that will be used for all TLS and SSL connections to the ldap. 
    341      * 
     341     *  
    342342     * @return <code>KeyManager[]</code> 
    343343     */ 
     
    349349     * This sets the key managers that will be used for all TLS and SSL connections to the ldap. This method will remove 
    350350     * any cached results and initialize the ldap pool. 
    351      * 
     351     *  
    352352     * @see #clearCache() 
    353353     * @see #initializeLdapPool() 
    354354     * @see #setSslSocketFactory(SSLSocketFactory) 
    355      * 
     355     *  
    356356     * @param kc <code>X509Credential</code> to create KeyManagers with 
    357357     */ 
     
    381381    /** 
    382382     * This returns the hostname verifier that will be used for all TLS and SSL connections to the ldap. 
    383      * 
     383     *  
    384384     * @return <code>HostnameVerifier</code> 
    385385     */ 
     
    391391     * This sets the hostname verifier that will be used for all TLS and SSL connections to the ldap. This method will 
    392392     * remove any cached results and initialize the ldap pool. 
    393      * 
     393     *  
    394394     * @see #clearCache() 
    395395     * @see #initializeLdapPool() 
    396      * 
     396     *  
    397397     * @param hv <code>HostnameVerifier</code> 
    398398     */ 
     
    405405    /** 
    406406     * This returns the authentication type used when binding to the ldap. 
    407      * 
     407     *  
    408408     * @return <code>AUTHENTICATION_TYPE</code> 
    409409     */ 
     
    431431     * This sets the authentication type used when binding to the ldap. This method will remove any cached results and 
    432432     * initialize the ldap pool. 
    433      * 
     433     *  
    434434     * @see #clearCache() 
    435435     * @see #initializeLdapPool() 
    436      * 
     436     *  
    437437     * @param type <code>AUTHENTICATION_TYPE</code> 
    438438     */ 
     
    459459    /** 
    460460     * This returns the search scope used when searching the ldap. 
    461      * 
     461     *  
    462462     * @return <code>int</code> 
    463463     */ 
     
    476476    /** 
    477477     * This sets the search scope used when searching the ldap. This method will remove any cached results. 
    478      * 
    479      * @see #clearCache() 
    480      * 
     478     *  
     479     * @see #clearCache() 
     480     *  
    481481     * @param scope directory search scope 
    482482     */ 
     
    494494    /** 
    495495     * This returns the attributes that all searches will request from the ldap. 
    496      * 
     496     *  
    497497     * @return <code>String[]</code> 
    498498     */ 
     
    504504     * This sets the attributes that all searches will request from the ldap. This method will remove any cached 
    505505     * results. 
    506      * 
    507      * @see #clearCache() 
    508      * 
     506     *  
     507     * @see #clearCache() 
     508     *  
    509509     * @param s <code>String[]</code> 
    510510     */ 
    511511    public void setReturnAttributes(String[] s) { 
    512512        returnAttributes = s; 
    513         //clearCache(); 
     513        // clearCache(); 
    514514    } 
    515515 
    516516    /** 
    517517     * This sets the attributes that all searches will request from the ldap. s should be a comma delimited string. 
    518      * 
     518     *  
    519519     * @param s <code>String[]</code> comma delimited returnAttributes 
    520520     */ 
     
    531531     * This returns the time in milliseconds that the ldap will wait for search results. A value of 0 means to wait 
    532532     * indefinitely. 
    533      * 
     533     *  
    534534     * @return <code>int</code> milliseconds 
    535535     */ 
     
    541541     * This sets the time in milliseconds that the ldap will wait for search results. A value of 0 means to wait 
    542542     * indefinitely. This method will remove any cached results. 
    543      * 
    544      * @see #clearCache() 
    545      * 
     543     *  
     544     * @see #clearCache() 
     545     *  
    546546     * @param i <code>int</code> milliseconds 
    547547     */ 
     
    554554     * This returns the maximum number of search results the ldap will return. A value of 0 all entries will be 
    555555     * returned. 
    556      * 
     556     *  
    557557     * @return <code>long</code> maximum number of search results 
    558558     */ 
     
    564564     * This sets the maximum number of search results the ldap will return. A value of 0 all entries will be returned. 
    565565     * This method will remove any cached results. 
    566      * 
    567      * @see #clearCache() 
    568      * 
     566     *  
     567     * @see #clearCache() 
     568     *  
    569569     * @param l <code>long</code> maximum number of search results 
    570570     */ 
     
    576576    /** 
    577577     * This returns whether objects will be returned in the search results. The default is false. 
    578      * 
     578     *  
    579579     * @return <code>boolean</code> 
    580580     */ 
     
    585585    /** 
    586586     * This sets whether objects will be returned in the search results. This method will remove any cached results. 
    587      * 
    588      * @see #clearCache() 
    589      * 
     587     *  
     588     * @see #clearCache() 
     589     *  
    590590     * @param b <code>boolean</code> 
    591591     */ 
     
    597597    /** 
    598598     * This returns whether link dereferencing will be used during the search. The default is false. 
    599      * 
     599     *  
    600600     * @return <code>boolean</code> 
    601601     */ 
     
    606606    /** 
    607607     * This sets whether link dereferencing will be used during the search. This method will remove any cached results. 
    608      * 
    609      * @see #clearCache() 
    610      * 
     608     *  
     609     * @see #clearCache() 
     610     *  
    611611     * @param b <code>boolean</code> 
    612612     */ 
     
    618618    /** 
    619619     * This returns the principal dn used to bind to the ldap for all searches. 
    620      * 
     620     *  
    621621     * @return <code>String</code> principal dn 
    622622     */ 
     
    628628     * This sets the principal dn used to bind to the ldap for all searches. This method will remove any cached results 
    629629     * and initialize the ldap pool. 
    630      * 
     630     *  
    631631     * @see #clearCache() 
    632632     * @see #initializeLdapPool() 
    633      * 
     633     *  
    634634     * @param s <code>String</code> principal dn 
    635635     */ 
     
    640640    /** 
    641641     * This returns the principal credential used to bind to the ldap for all searches. 
    642      * 
     642     *  
    643643     * @return <code>String</code> principal credential 
    644644     */ 
     
    650650     * This sets the principal credential used to bind to the ldap for all searches. This method will remove any cached 
    651651     * results and initialize the ldap pool. 
    652      * 
     652     *  
    653653     * @see #clearCache() 
    654654     * @see #initializeLdapPool() 
    655      * 
     655     *  
    656656     * @param s <code>String</code> principal credential 
    657657     */ 
     
    663663     * This sets additional ldap context environment properties. This method will remove any cached results and 
    664664     * initialize the ldap pool. 
    665      * 
     665     *  
    666666     * @see #clearCache() 
    667667     * @see #initializeLdapPool() 
    668      * 
     668     *  
    669669     * @param ldapProperties <code>Map</code> of name/value pairs 
    670670     */ 
     
    677677    } 
    678678 
    679     private void checkCacheValidity(){ 
    680         if (cacheTimeoutMs==0 || !cacheResults){ 
     679    private void checkCacheValidity() { 
     680        if (cacheTimeoutMs == 0 || !cacheResults) { 
    681681            return; 
    682682        } 
    683683        long currentTimeMillis = System.currentTimeMillis(); 
    684         boolean shouldReset  = (currentTimeMillis - cacheResetTimeMs) > cacheTimeoutMs; 
    685         if (shouldReset){ 
     684        boolean shouldReset = (currentTimeMillis - cacheResetTimeMs) > cacheTimeoutMs; 
     685        if (shouldReset) { 
    686686            log.info("Ldap cache was cleared, timeout reached"); 
    687687            clearCache(); 
     
    689689    } 
    690690 
    691  
    692691    /** {@inheritDoc} */ 
    693692    public Map<String, String> lookup(String principal) throws AttributeAssociationException { 
    694693 
    695         String searchFilter = searchFilterTemplate.replace("[principal]",principal); 
     694        String searchFilter = searchFilterTemplate.replace("[principal]", principal); 
    696695        searchFilter = searchFilter.trim(); 
    697         //log.debug("Search: "+searchFilter); 
    698         //check if cache is still valid 
     696        // log.debug("Search: "+searchFilter); 
     697        // check if cache is still valid 
    699698        checkCacheValidity(); 
    700699 
     
    712711            // check for empty result set 
    713712            if (noResultsIsError && !results.hasNext()) { 
    714                 throw new AttributeAssociationException("No LDAP entry found for "+principal); 
     713                throw new AttributeAssociationException("No LDAP entry found for " + principal); 
    715714            } 
    716715            // build resolved attributes from LDAP attributes 
     
    718717            if (cacheResults && attributes != null) { 
    719718                setCachedAttributes(principal, searchFilter, attributes); 
    720                 //log.debug("Stored results in the cache"); 
     719                // log.debug("Stored results in the cache"); 
    721720            } 
    722721        } 
     
    725724    } 
    726725 
    727  
    728726    /** 
    729727     * This searches the LDAP with the supplied filter. 
    730      * 
     728     *  
    731729     * @param searchFilter <code>String</code> the searchFilter that produced the attributes 
    732730     * @return <code>Iterator</code> of search results 
     
    739737            return ldap.search(searchFilter, returnAttributes); 
    740738        } catch (NamingException e) { 
    741             //log.error("An error occured when attempting to search the LDAP: {}, {}",ldapConfig.getEnvironment(), e.getMessage()); 
    742             throw new AttributeAssociationException("An error occurred when attempting to search the LDAP "+e.getMessage()); 
     739            // log.error("An error occured when attempting to search the LDAP: {}, {}",ldapConfig.getEnvironment(), 
     740            // e.getMessage()); 
     741            throw new AttributeAssociationException("An error occurred when attempting to search the LDAP " 
     742                    + e.getMessage()); 
    743743        } catch (Exception e) { 
    744744            log.error("Could not retrieve Ldap object from pool, {}", e.getMessage()); 
     
    758758    /** 
    759759     * This returns a map of attribute ids to attributes from the supplied search results. 
    760      * 
     760     *  
    761761     * @param results <code>Iterator</code> of LDAP search results 
    762762     * @return <code>Map</code> of attribute ids to attributes 
     
    772772        } 
    773773 
    774         do{ 
     774        do { 
    775775            SearchResult sr = results.next(); 
    776776            Map<String, List<String>> newAttrsMap = null; 
    777             try{ 
     777            try { 
    778778                newAttrsMap = LdapUtil.parseAttributes(sr.getAttributes(), true); 
    779779            } catch (NamingException e) { 
     
    781781                throw new AttributeAssociationException("Error parsing LDAP attributes"); 
    782782            } 
    783             //log.debug("Found {} attributes",newAttrsMap.size()); 
     783            // log.debug("Found {} attributes",newAttrsMap.size()); 
    784784            for (Map.Entry<String, List<String>> entry : newAttrsMap.entrySet()) { 
    785                 //log.debug("Found the following attribute: {}", entry); 
     785                // log.debug("Found the following attribute: {}", entry); 
    786786                String attribute = (String) attributes.get(entry.getKey()); 
    787                 if(attribute == null){ 
     787                if (attribute == null) { 
    788788                    attribute = new String(entry.getKey()); 
    789789 
     
    792792                List<String> values = entry.getValue(); 
    793793                StringBuilder builder = new StringBuilder(); 
    794                 if(values != null && !values.isEmpty()){ 
    795                     int count=0; 
    796                     for(String value : values){ 
    797                         if(!DatatypeHelper.isEmpty(value)){ 
     794                if (values != null && !values.isEmpty()) { 
     795                    int count = 0; 
     796                    for (String value : values) { 
     797                        if (!DatatypeHelper.isEmpty(value)) { 
    798798                            builder.append(DatatypeHelper.safeTrimOrNullString(value)); 
    799                             if (count < values.size()-1){ 
     799                            if (count < values.size() - 1) { 
    800800                                builder.append(","); 
    801801                            } 
     
    806806                attributes.put(entry.getKey(), builder.toString()); 
    807807            } 
    808         }while (mergeMultipleResults && results.hasNext()); 
     808        } while (mergeMultipleResults && results.hasNext()); 
    809809 
    810810        return attributes; 
     
    825825    } 
    826826 
    827  
    828827    /** 
    829828     * @param startTls the startTls to set 
     
    875874    } 
    876875 
    877  
    878876    /** 
    879877     * This stores the supplied attributes in the cache. 
    880      * 
     878     *  
    881879     * @param principalName 
    882880     * @param searchFiler the searchFilter that produced the attributes 
     
    896894    /** 
    897895     * This retrieves any cached attributes for the supplied resolution context. Returns null if nothing is cached. 
    898      * 
     896     *  
    899897     * @param principalName 
    900898     * @param searchFilter the search filter the produced the attributes 
    901      * 
     899     *  
    902900     * @return <code>Map</code> of attributes ids to attributes 
    903901     */ 
    904     protected Map<String, String> getCachedAttributes(String principalName, 
    905             String searchFilter) { 
     902    protected Map<String, String> getCachedAttributes(String principalName, String searchFilter) { 
    906903        Map<String, String> attributes = null; 
    907904        if (cacheResults) { 
     
    928925    } 
    929926 
    930  
    931  
    932927} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/registry/Endpoint.java

    r1049 r1176  
    2727import uk.ac.cardiff.model.event.Event; 
    2828import uk.ac.cardiff.raptor.attribute.filtering.AttributeFilterPolicy; 
    29 import uk.ac.cardiff.raptor.remoting.policy.AbstractPushPolicy; 
     29import uk.ac.cardiff.raptor.remoting.policy.PushPolicy; 
    3030 
    3131/** 
    3232 *  
    33  * Stores information about an endpoint that a client can send events to. Also includes the Push Policy to determine if 
    34  * events should be sent, an attribute filter policy for determining which attributes of each event should be sent, and 
    35  * information about previous event releases. 
     33 * Stores information about an endpoint that a client can send events to. Also includes the Push Policy used to 
     34 * determine if/when events should be sent, an attribute filter policy for determining which attributes of each event 
     35 * should be sent, and information about previous event releases. 
    3636 *  
    3737 * This class could be subclassed if additional functionality is required. 
     
    4747 
    4848    /** A List of the PushPolicies defined for this endpoint. */ 
    49     private List<AbstractPushPolicy> pushPolicies; 
     49    private List<PushPolicy> pushPolicies; 
    5050 
    5151    /** The filter policy defined for this endpoint *. */ 
     
    7070     * @param filteredEntries the filtered entries 
    7171     */ 
    72     public void releasePerformed(List<Event> filteredEntries) { 
     72    public void releasePerformed(final List<Event> filteredEntries) { 
    7373        releaseInformation.releasePerformed(filteredEntries); 
    7474    } 
     
    116116     * @param pushPolicies the new push policies 
    117117     */ 
    118     public void setPushPolicies(List<AbstractPushPolicy> pushPolicies) { 
     118    public void setPushPolicies(List<PushPolicy> pushPolicies) { 
    119119        this.pushPolicies = pushPolicies; 
    120120    } 
     
    125125     * @return the push policies 
    126126     */ 
    127     public List<AbstractPushPolicy> getPushPolicies() { 
     127    public List<PushPolicy> getPushPolicies() { 
    128128        return pushPolicies; 
    129129    } 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/registry/EndpointRegistry.java

    r1049 r1176  
    5555     * @param endpoints the new endpoints 
    5656     */ 
    57     public void setEndpoints(List<Endpoint> endpoints) { 
     57    public void setEndpoints(final List<Endpoint> endpoints) { 
    5858        for (Endpoint endpoint : endpoints) { 
    5959            log.info("Registering Service Endpoint: {}, persisting event release information {}", 
     
    102102     * @return the release information 
    103103     */ 
    104     public ReleaseInformation loadReleaseInformation(Endpoint endpoint) { 
     104    public ReleaseInformation loadReleaseInformation(final Endpoint endpoint) { 
    105105        List<?> releaseInfoResults = 
    106106                dataConnection.runQuery("from ReleaseInformation where serviceEndpoint=?", 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/registry/ReleaseInformation.java

    r1049 r1176  
    6565     * @param releasedEvents 
    6666     */ 
    67     public void releasePerformed(List<Event> releasedEvents) { 
     67    public void releasePerformed(final List<Event> releasedEvents) { 
    6868 
    6969        for (Event event : releasedEvents) { 
     
    9393     * @return true if the event has not been released before, false otherwise 
    9494     */ 
    95     public boolean hasNotBeenReleased(Event event) { 
     95    public boolean hasNotBeenReleased(final Event event) { 
    9696        if (event.getEventTime().isAfter(getLastReleasedEventTime())) { 
    9797            return true; 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/client/DefaultEventReleaseClient.java

    r1049 r1176  
    5050     * uk.ac.cardiff.model.ServiceMetadata) 
    5151     */ 
    52     public boolean release(List<Event> events, ServiceMetadata serviceMetadata) throws ReleaseFailureException { 
     52    public boolean release(final List<Event> events, final ServiceMetadata serviceMetadata) 
     53            throws ReleaseFailureException { 
    5354        boolean success = false; 
    5455        if (enableEventRelease) { 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/client/EventReleaseClient.java

    r1049 r1176  
    4646 
    4747    /** 
    48      * A way of accessing the list of endpoints it is communicating with 
     48     * A way of accessing the list of endpoints this client is communicating with 
    4949     *  
    5050     * @return a list of endpoints 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/client/EventReleaseEngine.java

    r1043 r1176  
    2424import java.util.List; 
    2525 
     26import org.slf4j.Logger; 
     27import org.slf4j.LoggerFactory; 
     28 
     29import uk.ac.cardiff.model.ServiceMetadata; 
     30import uk.ac.cardiff.model.event.Event; 
     31import uk.ac.cardiff.model.event.auxiliary.EventMetadata; 
     32import uk.ac.cardiff.model.wsmodel.EventPushMessage; 
    2633import uk.ac.cardiff.raptor.attribute.filtering.AttrributeFilterEngine; 
    2734import uk.ac.cardiff.raptor.registry.Endpoint; 
    2835import uk.ac.cardiff.raptor.registry.EndpointRegistry; 
    2936import uk.ac.cardiff.raptor.remoting.client.sei.ServiceEndpointClient; 
    30 import uk.ac.cardiff.raptor.remoting.policy.AbstractPushPolicy; 
    31  
    32 import org.slf4j.Logger; 
    33 import org.slf4j.LoggerFactory; 
    34  
    35 import uk.ac.cardiff.model.ServiceMetadata; 
    36 import uk.ac.cardiff.model.event.Event; 
    37 import uk.ac.cardiff.model.event.auxiliary.EventMetadata; 
    38 import uk.ac.cardiff.model.wsmodel.EventPushMessage; 
     37import uk.ac.cardiff.raptor.remoting.policy.PushPolicy; 
    3938 
    4039/** 
     
    151150     * @return the list of filtered events 
    152151     */ 
    153     private List<Event> chronologicalFilter(Endpoint endpoint, List<Event> events) { 
     152    private List<Event> chronologicalFilter(final Endpoint endpoint, final List<Event> events) { 
    154153        ArrayList<Event> applicableEvents = new ArrayList<Event>(); 
    155154 
     
    172171     * @return true iff at least one push policy evaluates to true, false otherwise 
    173172     */ 
    174     private boolean shouldRelease(Endpoint endpoint, List<Event> events) { 
     173    private boolean shouldRelease(final Endpoint endpoint, final List<Event> events) { 
    175174        boolean shouldRelease = false; 
    176         for (AbstractPushPolicy policy : endpoint.getPushPolicies()) { 
     175        for (PushPolicy policy : endpoint.getPushPolicies()) { 
    177176            if (policy.evaluatePolicy(events)) 
    178177                shouldRelease = true; 
     
    185184     * no work is done, and the input allEvents is returned without modification 
    186185     *  
    187      * @param endpoint 
    188      * @param allEvents 
    189      * @return 
     186     * @param endpoint the endpoint that the engine is sending to 
     187     * @param allEvents the list of <code>Event</code>s to filter 
     188     * @return a filtered set of events based on any defined attribute filter policies. 
    190189     */ 
    191190    private List<Event> filterAttributes(ServiceMetadata metadata, Endpoint endpoint, List<Event> allEvents) { 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/client/ReleaseFailureException.java

    r713 r1176  
    1414 * limitations under the License. 
    1515 */ 
     16 
    1617package uk.ac.cardiff.raptor.remoting.client; 
    1718 
    18 public class ReleaseFailureException extends Exception{ 
     19public class ReleaseFailureException extends Exception { 
    1920 
    20         /** 
    21         * Generated serialUID 
    22         */ 
    23         private static final long serialVersionUID = -1091443418866759066L; 
     21    /** 
     22    * Generated serialUID 
     23    */ 
     24    private static final long serialVersionUID = -1091443418866759066L; 
    2425 
    25         public ReleaseFailureException (String message, Exception wrappedException){ 
    26                 super (message,wrappedException); 
    27         } 
     26    /** Constructor. */ 
     27    public ReleaseFailureException() { 
     28        super(); 
     29    } 
     30 
     31    /** 
     32     * Constructor. 
     33     *  
     34     * @param message exception message 
     35     */ 
     36    public ReleaseFailureException(final String message) { 
     37        super(message); 
     38    } 
     39 
     40    /** 
     41     * Constructor. 
     42     *  
     43     * @param wrappedException exception to be wrapped by this one 
     44     */ 
     45    public ReleaseFailureException(final Exception wrappedException) { 
     46        super(wrappedException); 
     47    } 
     48 
     49    /** 
     50     * Constructor. 
     51     *  
     52     * @param message exception message 
     53     * @param wrappedException exception to be wrapped by this one 
     54     */ 
     55    public ReleaseFailureException(final String message, final Exception wrappedException) { 
     56        super(message, wrappedException); 
     57    } 
    2858 
    2959} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/client/sei/ServiceEndpointClient.java

    r639 r1176  
    1414 * limitations under the License. 
    1515 */ 
     16 
    1617package uk.ac.cardiff.raptor.remoting.client.sei; 
    1718 
     
    2122public interface ServiceEndpointClient { 
    2223 
    23         public boolean sendEvents(EventPushMessage pushed, Endpoint endpoint); 
     24    /** 
     25     * Sends the <code>EventPushMessage</code> to the endpoint <code>endpoint</code> 
     26     *  
     27     * @param pushed the <code>EventPushMessage</code> to send to the <code>endpoint</code> 
     28     * @param endpoint the endpoint to send the <code>EventPushMessage</code> to 
     29     * @return true iff event release was successful, false otherwise. Note, this describes success of the transmission 
     30     *         to the client, and not reporting successful processing of that information within the client. 
     31     */ 
     32    public boolean sendEvents(final EventPushMessage pushed, final Endpoint endpoint); 
    2433 
    2534} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/client/sei/impl/ClientTLSParameters.java

    r1025 r1176  
    1717 * 
    1818 */ 
     19 
    1920package uk.ac.cardiff.raptor.remoting.client.sei.impl; 
    2021 
     
    3637import org.apache.cxf.configuration.jsse.TLSClientParameters; 
    3738 
    38  
    3939/** 
    40  * Raptor client specific class to hold TLS parameters for easy configuration. Will then 
    41  * produce an implementation specific TLS parameter class. Like a factory. 
    42  * 
     40 * Raptor client specific class to hold TLS parameters for easy configuration. Will then produce an implementation 
     41 * specific TLS parameter class. Like a factory. 
     42 *  
    4343 * @author philsmart 
    44  * 
     44 *  
    4545 */ 
    4646public class ClientTLSParameters { 
    4747 
    48         /** The public certificates for trusted servers*/ 
    49         private String trustStoreLocation; 
     48    /** The public certificates for trusted servers. */ 
     49    private String trustStoreLocation; 
    5050 
    51         /** The private certificate for this client */ 
    52         private String keyStoreLocation; 
     51    /** The private certificate for this client. */ 
     52    private String keyStoreLocation; 
    5353 
    54         /** The password for the trust store*/ 
    55         private String trustStorePassword; 
     54    /** The password for the trust store. */ 
     55    private String trustStorePassword; 
    5656 
    57         /** The password for the key store */ 
    58         private String keyStorePassword; 
     57    /** The password for the key store. */ 
     58    private String keyStorePassword; 
    5959 
    60         public TLSClientParameters getTlsClientParameters() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, IOException, UnrecoverableKeyException{ 
    61             final TLSClientParameters tls = new TLSClientParameters(); 
     60    /** 
     61     * Gets the tls client parameters. 
     62     *  
     63     * @return the tls client parameters 
     64     * @throws KeyStoreException the key store exception 
     65     * @throws NoSuchAlgorithmException the no such algorithm exception 
     66     * @throws CertificateException the certificate exception 
     67     * @throws FileNotFoundException the file not found exception 
     68     * @throws IOException Signals that an I/O exception has occurred. 
     69     * @throws UnrecoverableKeyException the unrecoverable key exception 
     70     */ 
     71    public TLSClientParameters getTlsClientParameters() throws KeyStoreException, NoSuchAlgorithmException, 
     72            CertificateException, FileNotFoundException, IOException, UnrecoverableKeyException { 
     73        final TLSClientParameters tls = new TLSClientParameters(); 
    6274 
    63             tls.setDisableCNCheck(true);//disable URL and CN on cert match 
     75        tls.setDisableCNCheck(true);// disable URL and CN on cert match 
    6476 
    65             //clients private key / public key 
    66             final KeyStore keyStoreKeyManager = KeyStore.getInstance("JKS"); 
    67             final File keyStoreFile = new File(keyStoreLocation); 
    68             keyStoreKeyManager.load(new FileInputStream(keyStoreFile), keyStorePassword.toCharArray()); 
    69             final KeyManagerFactory keyFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); 
    70             keyFactory.init(keyStoreKeyManager, keyStorePassword.toCharArray()); 
     77        // clients private key / public key 
     78        final KeyStore keyStoreKeyManager = KeyStore.getInstance("JKS"); 
     79        final File keyStoreFile = new File(keyStoreLocation); 
     80        keyStoreKeyManager.load(new FileInputStream(keyStoreFile), keyStorePassword.toCharArray()); 
     81        final KeyManagerFactory keyFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); 
     82        keyFactory.init(keyStoreKeyManager, keyStorePassword.toCharArray()); 
    7183 
    72             final KeyManager[] km = keyFactory.getKeyManagers(); 
    73             tls.setKeyManagers(km); 
     84        final KeyManager[] km = keyFactory.getKeyManagers(); 
     85        tls.setKeyManagers(km); 
    7486 
    75             //servers public key 
    76             final KeyStore keyStore = KeyStore.getInstance("JKS"); 
    77             final File truststore = new File(trustStoreLocation); 
    78             keyStore.load(new FileInputStream(truststore),  trustStorePassword.toCharArray()); 
    79             final TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); 
    80             trustFactory.init(keyStore); 
     87        // servers public key 
     88        final KeyStore keyStore = KeyStore.getInstance("JKS"); 
     89        final File truststore = new File(trustStoreLocation); 
     90        keyStore.load(new FileInputStream(truststore), trustStorePassword.toCharArray()); 
     91        final TrustManagerFactory trustFactory = 
     92                TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); 
     93        trustFactory.init(keyStore); 
    8194 
    82             final TrustManager[] tm = trustFactory.getTrustManagers(); 
    83             tls.setTrustManagers(tm); 
     95        final TrustManager[] tm = trustFactory.getTrustManagers(); 
     96        tls.setTrustManagers(tm); 
    8497 
    85             return tls; 
     98        return tls; 
    8699 
    87         } 
     100    } 
    88101 
    89         public void setTrustStoreLocation(final String trustStoreLocation) { 
    90                 this.trustStoreLocation = trustStoreLocation; 
    91         } 
     102    /** 
     103     * Sets the trust store location. 
     104     *  
     105     * @param trustStoreLocation the new trust store location 
     106     */ 
     107    public void setTrustStoreLocation(final String trustStoreLocation) { 
     108        this.trustStoreLocation = trustStoreLocation; 
     109    } 
    92110 
    93         public String getTrustStoreLocation() { 
    94                 return trustStoreLocation; 
    95         } 
     111    /** 
     112     * Gets the trust store location. 
     113     *  
     114     * @return the trust store location 
     115     */ 
     116    public String getTrustStoreLocation() { 
     117        return trustStoreLocation; 
     118    } 
    96119 
    97         public void setKeyStoreLocation(final String keyStoreLocation) { 
    98                 this.keyStoreLocation = keyStoreLocation; 
    99         } 
     120    /** 
     121     * Sets the key store location. 
     122     *  
     123     * @param keyStoreLocation the new key store location 
     124     */ 
     125    public void setKeyStoreLocation(final String keyStoreLocation) { 
     126        this.keyStoreLocation = keyStoreLocation; 
     127    } 
    100128 
    101         public String getKeyStoreLocation() { 
    102                 return keyStoreLocation; 
    103         } 
     129    /** 
     130     * Gets the key store location. 
     131     *  
     132     * @return the key store location 
     133     */ 
     134    public String getKeyStoreLocation() { 
     135        return keyStoreLocation; 
     136    } 
    104137 
    105         public void setTrustStorePassword(final String trustStorePassword) { 
    106                 this.trustStorePassword = trustStorePassword; 
    107         } 
     138    /** 
     139     * Sets the trust store password. 
     140     *  
     141     * @param trustStorePassword the new trust store password 
     142     */ 
     143    public void setTrustStorePassword(final String trustStorePassword) { 
     144        this.trustStorePassword = trustStorePassword; 
     145    } 
    108146 
    109         public String getTrustStorePassword() { 
    110                 return trustStorePassword; 
    111         } 
     147    /** 
     148     * Gets the trust store password. 
     149     *  
     150     * @return the trust store password 
     151     */ 
     152    public String getTrustStorePassword() { 
     153        return trustStorePassword; 
     154    } 
    112155 
    113         public void setKeyStorePassword(final String keyStorePassword) { 
    114                 this.keyStorePassword = keyStorePassword; 
    115         } 
     156    /** 
     157     * Sets the key store password. 
     158     *  
     159     * @param keyStorePassword the new key store password 
     160     */ 
     161    public void setKeyStorePassword(final String keyStorePassword) { 
     162        this.keyStorePassword = keyStorePassword; 
     163    } 
    116164 
    117         public String getKeyStorePassword() { 
    118                 return keyStorePassword; 
    119         } 
     165    /** 
     166     * Gets the key store password. 
     167     *  
     168     * @return the key store password 
     169     */ 
     170    public String getKeyStorePassword() { 
     171        return keyStorePassword; 
     172    } 
    120173 
    121174} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/client/sei/impl/CxfServiceEndpointClient.java

    r1025 r1176  
    4646    private final Logger log = LoggerFactory.getLogger(CxfServiceEndpointClient.class); 
    4747 
    48     /** Raptor specific TLS parameters class, that can return cxf TLSParameters */ 
     48    /** Raptor specific TLS parameters class, that can return cxf specific TLSParameters */ 
    4949    private ClientTLSParameters tlsParameters; 
    5050 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/client/sei/impl/DefaultServiceEndpointClient.java

    r639 r1176  
    1414 * limitations under the License. 
    1515 */ 
     16 
    1617package uk.ac.cardiff.raptor.remoting.client.sei.impl; 
    1718 
     
    2223public class DefaultServiceEndpointClient implements ServiceEndpointClient { 
    2324 
    24         /* (non-Javadoc) 
    25          * @see uk.ac.cardiff.raptor.remoting.client.sei.ServiceEndpointClient#sendEvents(uk.ac.cardiff.model.wsmodel.EventPushMessage, uk.ac.cardiff.raptor.registry.Endpoint) 
    26          */ 
    27         @Override 
    28         public boolean sendEvents(EventPushMessage pushed, Endpoint endpoint) { 
    29             // TODO Auto-generated method stub 
    30             return false; 
    31         } 
     25    /* 
     26     * (non-Javadoc) 
     27     *  
     28     * @see uk.ac.cardiff.raptor.remoting.client.sei.ServiceEndpointClient#sendEvents(uk.ac.cardiff.model.wsmodel. 
     29     * EventPushMessage, uk.ac.cardiff.raptor.registry.Endpoint) 
     30     */ 
     31    @Override 
     32    public boolean sendEvents(EventPushMessage pushed, Endpoint endpoint) { 
     33        // TODO a default? 
     34        return false; 
     35    } 
    3236 
    3337} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/policy/ElapsedTimePushPolicy.java

    r1043 r1176  
    1414 * limitations under the License. 
    1515 */ 
     16 
    1617package uk.ac.cardiff.raptor.remoting.policy; 
    1718 
     
    2223 
    2324import uk.ac.cardiff.model.event.Event; 
    24 import uk.ac.cardiff.raptor.remoting.client.EventReleaseEngine; 
    2525 
    26 public class ElapsedTimePushPolicy extends AbstractPushPolicy{ 
    27          
    28         /** Class logger */ 
    29         private final Logger log = LoggerFactory.getLogger(ElapsedTimePushPolicy.class); 
    30          
    31         /** The time, in milliseconds, that this policy was last evaluated */ 
    32         private long lastReleasedTime; 
    33          
    34         /** How long, in milliseconds, should elapse before release*/ 
    35         private long pushInterval; 
    36          
    37          
    38         /** 
    39          * Default constructor, which sets the last evaluated time on initialisation 
    40          */ 
    41         public ElapsedTimePushPolicy(){ 
    42                 super(); 
    43                 lastReleasedTime = System.currentTimeMillis(); 
    44         } 
     26/** 
     27 * The Class ElapsedTimePushPolicy. 
     28 */ 
     29public class ElapsedTimePushPolicy implements PushPolicy { 
    4530 
    46         public boolean evaluatePolicy(List<Event> events) { 
    47                 long currentTime = System.currentTimeMillis(); 
    48                 long difference = currentTime-lastReleasedTime; 
    49                 log.debug("ElapsedTime difference {}, pushInterval {}",difference,pushInterval); 
    50                 if (difference>=getPushInterval()){ 
    51                         lastReleasedTime = currentTime; 
    52                         return true; 
    53                 } 
    54                 return false; 
    55         } 
     31    /** Class logger. */ 
     32    private final Logger log = LoggerFactory.getLogger(ElapsedTimePushPolicy.class); 
    5633 
    57         public void setPushInterval(long pushInterval) { 
    58                 this.pushInterval = pushInterval; 
    59         } 
     34    /** The time, in milliseconds, that this policy was last evaluated. */ 
     35    private long lastReleasedTime; 
    6036 
    61         public long getPushInterval() { 
    62                 return pushInterval; 
    63         } 
     37    /** How long, in milliseconds, should elapse before release. */ 
     38    private long pushInterval; 
     39 
     40    /** 
     41     * Default constructor, which sets the last evaluated time on initialisation. 
     42     */ 
     43    public ElapsedTimePushPolicy() { 
     44        super(); 
     45        lastReleasedTime = System.currentTimeMillis(); 
     46    } 
     47 
     48    /* 
     49     * (non-Javadoc) 
     50     *  
     51     * @see uk.ac.cardiff.raptor.remoting.policy.AbstractPushPolicy#evaluatePolicy(java.util.List) 
     52     */ 
     53    public boolean evaluatePolicy(List<Event> events) { 
     54        long currentTime = System.currentTimeMillis(); 
     55        long difference = currentTime - lastReleasedTime; 
     56        log.debug("ElapsedTime difference {}, pushInterval {}", difference, pushInterval); 
     57        if (difference >= getPushInterval()) { 
     58            lastReleasedTime = currentTime; 
     59            return true; 
     60        } 
     61        return false; 
     62    } 
     63 
     64    /** 
     65     * Sets the push interval. 
     66     *  
     67     * @param pushInterval the new push interval 
     68     */ 
     69    public void setPushInterval(long pushInterval) { 
     70        this.pushInterval = pushInterval; 
     71    } 
     72 
     73    /** 
     74     * Gets the push interval. 
     75     *  
     76     * @return the push interval 
     77     */ 
     78    public long getPushInterval() { 
     79        return pushInterval; 
     80    } 
    6481 
    6582} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/policy/EntryNoElapsedTimePushPolicy.java

    r1119 r1176  
    3434 *  
    3535 */ 
    36 public class EntryNoElapsedTimePushPolicy extends AbstractPushPolicy { 
     36public class EntryNoElapsedTimePushPolicy implements PushPolicy { 
    3737 
    38     /** Class logger */ 
     38    /** Class logger. */ 
    3939    private final Logger log = LoggerFactory.getLogger(EntryNoElapsedTimePushPolicy.class); 
    4040 
    41     /** The time, in milliseconds, that this policy was last evaluated */ 
     41    /** The time, in milliseconds, that this policy was last evaluated. */ 
    4242    private long lastReleasedTime; 
    4343 
    44     /** How long, in milliseconds, should elapse before release */ 
     44    /** How long, in milliseconds, should elapse before release. */ 
    4545    private long pushInterval; 
    4646 
    47     /** The threshold on the number of events needed before release */ 
     47    /** The threshold on the number of events needed before release. */ 
    4848    private int pushOnOrAfterNoEntries; 
    4949 
    5050    /** 
    51      * Default constructor, which sets the last evaluated time on initialisation 
     51     * Default constructor, which sets the last evaluated time on initialisation. 
    5252     */ 
    5353    public EntryNoElapsedTimePushPolicy() { 
     
    8686    } 
    8787 
     88    /** 
     89     * Sets the push interval. 
     90     *  
     91     * @param pushInterval the new push interval 
     92     */ 
    8893    public void setPushInterval(long pushInterval) { 
    8994        this.pushInterval = pushInterval; 
    9095    } 
    9196 
     97    /** 
     98     * Gets the push interval. 
     99     *  
     100     * @return the push interval 
     101     */ 
    92102    public long getPushInterval() { 
    93103        return pushInterval; 
    94104    } 
    95105 
     106    /** 
     107     * Sets the push on or after no entries. 
     108     *  
     109     * @param pushOnOrAfterNoEntries the new push on or after no entries 
     110     */ 
    96111    public void setPushOnOrAfterNoEntries(int pushOnOrAfterNoEntries) { 
    97112        this.pushOnOrAfterNoEntries = pushOnOrAfterNoEntries; 
    98113    } 
    99114 
     115    /** 
     116     * Gets the push on or after no entries. 
     117     *  
     118     * @return the push on or after no entries 
     119     */ 
    100120    public int getPushOnOrAfterNoEntries() { 
    101121        return pushOnOrAfterNoEntries; 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/policy/EntryNoPushPolicy.java

    r1043 r1176  
    1414 * limitations under the License. 
    1515 */ 
     16 
    1617package uk.ac.cardiff.raptor.remoting.policy; 
    1718 
     
    2021import uk.ac.cardiff.model.event.Event; 
    2122 
    22 public class EntryNoPushPolicy extends AbstractPushPolicy{ 
    23          
    24         /** The threshold on the number of events needed before release*/ 
    25         private int pushOnOrAfterNoEntries; 
    26          
    27          
    28         public boolean evaluatePolicy(List<Event> events) { 
    29                 if (pushOnOrAfterNoEntries <= events.size())  
    30                         return true; 
    31                 return false; 
    32         } 
     23public class EntryNoPushPolicy implements PushPolicy { 
     24 
     25    /** The threshold on the number of events needed before release */ 
     26    private int pushOnOrAfterNoEntries; 
     27 
     28    public boolean evaluatePolicy(List<Event> events) { 
     29        if (pushOnOrAfterNoEntries <= events.size()) 
     30            return true; 
     31        return false; 
     32    } 
    3333 
    3434    public void setPushOnOrAfterNoEntries(int pushOnOrAfterNoEntries) { 
    35         this.pushOnOrAfterNoEntries = pushOnOrAfterNoEntries; 
     35        this.pushOnOrAfterNoEntries = pushOnOrAfterNoEntries; 
    3636    } 
    3737 
    3838    public int getPushOnOrAfterNoEntries() { 
    39         return pushOnOrAfterNoEntries; 
     39        return pushOnOrAfterNoEntries; 
    4040    } 
    4141 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/policy/PushPolicy.java

    r1103 r1176  
    1717 * 
    1818 */ 
     19 
    1920package uk.ac.cardiff.raptor.remoting.policy; 
    2021 
     
    2526/** 
    2627 * @author philsmart 
    27  * 
     28 *  
    2829 */ 
    29 public abstract class AbstractPushPolicy { 
     30public interface PushPolicy { 
    3031 
    31     public abstract boolean evaluatePolicy(List<Event> events); 
    32  
     32    /** 
     33     * Determines if the list of <code>events</code> should be sent to an endpoint 
     34     *  
     35     * @param events the list of events to evaluate 
     36     * @return true iff the concrete implementation of this push policy determines the list of events are appropriate to 
     37     *         send to an endpoint, false otherwise 
     38     */ 
     39    public boolean evaluatePolicy(final List<Event> events); 
    3340 
    3441} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/runtimeutils/DateUtils.java

    r1090 r1176  
    2727 *  
    2828 */ 
    29 public class DateUtils { 
     29public final class DateUtils { 
    3030 
    31     public static String getCurrentTimeFormatted() { 
     31    public final static String getCurrentTimeFormatted() { 
    3232        DateTime current = new DateTime(); 
    3333        DateTimeFormatter dateFormat = DateTimeFormat.forPattern("HH:mm:ss (dd/MM/yy)"); 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/runtimeutils/ReflectionHelper.java

    r1142 r1176  
    3636import uk.ac.cardiff.model.wsmodel.Suggestion; 
    3737 
    38 /** 
    39  * @author philsmart 
     38/* 
     39 * Complete mess of a class, but with operations fundamental to Raptor, so clean  
    4040 *  
    4141 */ 
    42 public class ReflectionHelper { 
     42public final class ReflectionHelper { 
    4343 
    4444    /** Class logger */ 
     
    6262            return true; 
    6363        } catch (Throwable e) { 
    64             log.error("{}", e.getMessage()); 
     64            log.error("Could not determine if class has attribute", e); 
    6565            return false; 
    6666 
     
    9595            } 
    9696        } catch (Throwable e) { 
    97             log.error("Field name '" + attributeID + "' does not match internal model attribute"); 
    98             e.printStackTrace(); 
    99             System.exit(1); 
     97            log.error("Field name '{}' does not match internal model attribute", attributeID, e); 
     98 
    10099        } 
    101100 
     
    199198                log.error("{}", cnfex); 
    200199            } catch (InstantiationException iex) { 
    201                 // We try to instantiate an interface 
    202                 // or an object that does not have a 
    203                 // default constructor 
     200                // do nothing 
    204201            } catch (IllegalAccessException iaex) { 
    205                 // The class is not public 
     202                // do nothing 
    206203            } 
    207204        } 
     
    247244                log.error("{}", cnfex); 
    248245            } catch (InstantiationException iex) { 
    249                 // We try to instantiate an interface 
    250                 // or an object that does not have a 
    251                 // default constructor 
     246                // do nothing 
    252247            } catch (IllegalAccessException iaex) { 
    253                 // The class is not public 
     248                // do nothing 
    254249            } 
    255250        } 
     
    379374        File directory = new File(url.getFile()); 
    380375 
    381         // New code 
    382         // ====== 
    383376        if (directory.exists()) { 
    384377            // Get the list of the files contained in the package 
     
    416409     * Checks whether the Object <code>object</code> has the field <code>fieldName</code> 
    417410     *  
    418      * @param object 
    419      * @param fieldName 
    420      * @return 
     411     * @param object the object to check 
     412     * @param fieldName the fieldname to check if present on <code>object</code> 
     413     * @return true iff the object has a field name called <code>fieldName</code>, false otherwise 
    421414     */ 
    422415    private static Boolean hasField(Object object, String fieldName) { 
     
    437430        if (method.length() > 0) { 
    438431            String name = "set"; 
    439             // now capitalise the first letter of the method name 
    440432            Character firstLetter = method.charAt(0); 
    441433            firstLetter = Character.toUpperCase(firstLetter); 
    442434            String newMethodName = method.substring(1, method.length()); 
    443435            name += firstLetter + newMethodName; 
    444             // System.out.println("method name: " + name); 
    445436            return name; 
    446437 
     
    457448        if (method.length() > 0) { 
    458449            String name = "get"; 
    459             // now capitalise the first letter of the method name 
    460450            Character firstLetter = method.charAt(0); 
    461451            firstLetter = Character.toUpperCase(firstLetter); 
    462452            String newMethodName = method.substring(1, method.length()); 
    463453            name += firstLetter + newMethodName; 
    464             // System.out.println("method name: " + name); 
    465454            return name; 
    466455 
     
    478467        } catch (Throwable e) { 
    479468            log.error("Field name '" + fieldname + "' does not match internal model attribute"); 
    480             e.printStackTrace(); 
    481469 
    482470        } 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/store/AsynchronousEntryStoragePipeline.java

    r1043 r1176  
    1414 * limitations under the License. 
    1515 */ 
     16 
    1617package uk.ac.cardiff.raptor.store; 
    1718 
     
    2829public class AsynchronousEntryStoragePipeline { 
    2930 
    30     /** class logger */ 
     31    /** class logger. */ 
    3132    private final Logger log = LoggerFactory.getLogger(AsynchronousEntryStoragePipeline.class); 
    3233 
    33     /** An ID used to track the progress of any transaction */ 
     34    /** An ID used to track the progress of any transaction. */ 
    3435    private int transactionId; 
    3536 
     
    3738    private EventHandler eventHandler; 
    3839 
    39     /** Attribute association engine, used to attach additional attributes to events */ 
     40    /** Attribute association engine, used to attach additional attributes to events. */ 
    4041    private AttributeAssociationEngine attributeAssociationEngine; 
    4142 
    42     public AsynchronousEntryStoragePipeline(int transactionId, EventHandler entryHandler, AttributeAssociationEngine attributeAssociationEngine) { 
     43    public AsynchronousEntryStoragePipeline(final int transactionId, final EventHandler entryHandler, 
     44            final AttributeAssociationEngine attributeAssociationEngine) { 
    4345        this.eventHandler = entryHandler; 
    4446        this.attributeAssociationEngine = attributeAssociationEngine; 
     
    4749 
    4850    /** 
     51     * Executes the storage pipeline task to store the list of <code>events</code> into the <code>eventHandler</code> . 
    4952     * Starts and shuts down the <code>storeEntryTask</code> immediately, so that when it completes it can be re-used. 
    5053     *  
    51      * @param events 
    52      *            the events to store 
     54     * @param events the events to store 
    5355     */ 
    54     public void execute(List<Event> events, StoreEntriesTaskCallbackInterface callback) { 
    55         StoreEntriesPipelineTask storeEntryTask = new StoreEntriesPipelineTask(eventHandler, attributeAssociationEngine, events, callback); 
     56    public void execute(final List<Event> events, final StoreEntriesTaskCallbackInterface callback) { 
     57        StoreEventsPipelineTask storeEntryTask = 
     58                new StoreEventsPipelineTask(eventHandler, attributeAssociationEngine, events, callback); 
    5659        ExecutorService es = Executors.newSingleThreadExecutor(); 
    5760        es.submit(storeEntryTask); 
     
    6063 
    6164    /** 
    62      * @param transactionId 
    63      *            the transactionId to set 
     65     * @param transactionId the transactionId to set 
    6466     */ 
    6567    public void setTransactionId(int transactionId) { 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/store/StorageEngine.java

    r1045 r1176  
    1717 * 
    1818 */ 
     19 
    1920package uk.ac.cardiff.raptor.store; 
    2021 
     
    2627import org.slf4j.LoggerFactory; 
    2728 
    28  
    2929import uk.ac.cardiff.model.event.Event; 
    3030import uk.ac.cardiff.model.wsmodel.Suggestion; 
    31 import uk.ac.cardiff.raptor.store.EventHandler; 
    32 import uk.ac.cardiff.raptor.store.dao.StorageException; 
    3331import uk.ac.cardiff.raptor.event.expansion.AttributeAssociationEngine; 
    3432import uk.ac.cardiff.raptor.event.expansion.connector.AttributeAssociationException; 
     33import uk.ac.cardiff.raptor.store.dao.StorageException; 
    3534 
    3635/** 
     
    4039public class StorageEngine implements StoreEntriesTaskCallbackInterface { 
    4140 
    42         /** Class logger */ 
    43         private final Logger log = LoggerFactory.getLogger(StorageEngine.class); 
    44  
    45         /** Responsible for storing all entries (e.g. events) */ 
    46         private EventHandler eventHandler; 
    47  
    48         /** Engine used to associate attributes to existing events in the MUA */ 
    49         private AttributeAssociationEngine attributeAssociationEngine; 
    50  
    51         /** The ID of the currently executing transaction */ 
    52         private int currentTransactionId; 
    53  
    54         /** Whether a transaction is currently in progress */ 
    55         private boolean transactionInProgress; 
    56  
    57         /** Default Constructor */ 
    58         public StorageEngine() { 
    59  
    60         } 
    61  
    62         public void storageResultCallback(Object result) { 
    63                 log.debug("Storage task completed {}, for transaction id [{}]", result, currentTransactionId); 
    64                 transactionInProgress = false; 
    65  
    66         } 
    67  
    68         /** 
    69          * Stores the <code>events</code> asynchronously through the {@link uk.ac.cardiff.raptor.store.EventHandler} 
    70          *  
    71          * @param transactionId the numerical Id of this transaction 
    72          * @param events the events to store 
    73          */ 
    74         public void performAsynchronousEntryStoragePipeline(int transactionId, List<Event> events) throws TransactionInProgressException { 
    75                 if (transactionInProgress) { 
    76                         throw new TransactionInProgressException("Transaction " + currentTransactionId + " currently in processing"); 
    77                 } 
    78                 log.info("Committing {} entries to the storage engine, with transaction id [{}]", events.size(), transactionId); 
    79                 this.currentTransactionId = transactionId; 
    80                 transactionInProgress = true; 
    81                 AsynchronousEntryStoragePipeline asyncEntryStorage = new AsynchronousEntryStoragePipeline(transactionId, eventHandler, attributeAssociationEngine); 
    82                 asyncEntryStorage.execute(events, this); 
    83  
    84         } 
    85  
    86         public void performSynchronousEntryStoragePipeline(int transactionId, List<Event> events) throws TransactionInProgressException { 
    87                 if (transactionInProgress) { 
    88                         throw new TransactionInProgressException("Transaction " + currentTransactionId + " currently in processing"); 
    89                 } 
    90                 log.info("Committing {} entries to the storage engine, with transaction id [{}]", events.size(), transactionId); 
    91                 this.currentTransactionId = transactionId; 
    92                 transactionInProgress = true; 
    93                 try { 
    94                         attributeAssociationEngine.associateAttributes(events); 
    95                         eventHandler.addEvents(events); 
    96                         log.debug("Storage task completed true, for transaction id [{}]", currentTransactionId); 
    97                 } catch (StorageException e) { 
    98                         log.error("Could not store events for transaction id [{}], {}", transactionId); 
    99                 } catch (AttributeAssociationException e) { 
    100                         log.error("Could not store events for transaction id [{}], {}", transactionId); 
    101                 } 
    102                 transactionInProgress = false; 
    103         } 
    104  
    105         /** 
    106          * Returns events on or after the input time 
    107          * <code>earliestReleaseTime</code>. 
    108          *  
    109          * @param earliestReleaseTime 
    110          * @return 
    111          */ 
    112         public List<Event> getEventsOnOrAfter(DateTime earliestReleaseTime) { 
    113                 List<Event> query = (List<Event>) eventHandler.query("from Event where eventTime >= ?", new Object[] { earliestReleaseTime }); 
    114                 return query; 
    115         } 
    116  
    117         /** 
    118          * Returns events on or after the input time 
    119          * <code>earliestReleaseTime</code>, but with a maximum of 
    120          * <code>maxNoResults</code> results (in chronological order). 
    121          *  
    122          * @param earliestReleaseTime 
    123          * @param maxNoResults 
    124          * @return 
    125          */ 
    126         public List<Event> getEventsOnOrAfter(DateTime earliestReleaseTime, int maxNoResults) { 
    127                 List<Event> query = (List<Event>) eventHandler.query("from Event where eventTime >= ? order by eventTime asc", new Object[] { earliestReleaseTime }, 
    128                                 maxNoResults); 
    129                 return query; 
    130         } 
    131  
    132         /** 
     41    /** Class logger */ 
     42    private final Logger log = LoggerFactory.getLogger(StorageEngine.class); 
     43 
     44    /** Responsible for storing all entries (e.g. events) */ 
     45    private EventHandler eventHandler; 
     46 
     47    /** Engine used to associate attributes to existing events in the MUA */ 
     48    private AttributeAssociationEngine attributeAssociationEngine; 
     49 
     50    /** The ID of the currently executing transaction */ 
     51    private int currentTransactionId; 
     52 
     53    /** Whether a transaction is currently in progress */ 
     54    private boolean transactionInProgress; 
     55 
     56    /** Default Constructor */ 
     57    public StorageEngine() { 
     58 
     59    } 
     60 
     61    public void storageResultCallback(Object result) { 
     62        log.debug("Storage task completed {}, for transaction id [{}]", result, currentTransactionId); 
     63        transactionInProgress = false; 
     64 
     65    } 
     66 
     67    /** 
     68     * Stores the <code>events</code> asynchronously through the configured 
     69     * {@link uk.ac.cardiff.raptor.store.EventHandler} 
     70     *  
     71     * @param transactionId the numerical Id of this transaction 
     72     * @param events the events to store 
     73     */ 
     74    public void performAsynchronousEntryStoragePipeline(int transactionId, List<Event> events) 
     75            throws TransactionInProgressException { 
     76        if (transactionInProgress) { 
     77            throw new TransactionInProgressException("Transaction " + currentTransactionId + " currently in processing"); 
     78        } 
     79        log.info("Committing {} entries to the storage engine, with transaction id [{}]", events.size(), transactionId); 
     80        currentTransactionId = transactionId; 
     81        transactionInProgress = true; 
     82        AsynchronousEntryStoragePipeline asyncEntryStorage = 
     83                new AsynchronousEntryStoragePipeline(transactionId, eventHandler, attributeAssociationEngine); 
     84        asyncEntryStorage.execute(events, this); 
     85 
     86    } 
     87 
     88    public void performSynchronousEntryStoragePipeline(int transactionId, List<Event> events) 
     89            throws TransactionInProgressException { 
     90        if (transactionInProgress) { 
     91            throw new TransactionInProgressException("Transaction " + currentTransactionId + " currently in processing"); 
     92        } 
     93        log.info("Committing {} entries to the storage engine, with transaction id [{}]", events.size(), transactionId); 
     94        currentTransactionId = transactionId; 
     95        transactionInProgress = true; 
     96        try { 
     97            attributeAssociationEngine.associateAttributes(events); 
     98            eventHandler.addEvents(events); 
     99            log.debug("Storage task completed true, for transaction id [{}]", currentTransactionId); 
     100        } catch (StorageException e) { 
     101            log.error("Could not store events for transaction id [{}], {}", transactionId); 
     102        } catch (AttributeAssociationException e) { 
     103            log.error("Could not store events for transaction id [{}], {}", transactionId); 
     104        } 
     105        transactionInProgress = false; 
     106    } 
     107 
     108    /** 
     109     * Returns events on or after the input time <code>earliestReleaseTime</code>. 
     110     *  
     111     * @param earliestReleaseTime 
     112     * @return 
     113     */ 
     114    public List<Event> getEventsOnOrAfter(DateTime earliestReleaseTime) { 
     115        List<Event> query = 
     116                (List<Event>) eventHandler.query("from Event where eventTime >= ?", new Object[] {earliestReleaseTime}); 
     117        return query; 
     118    } 
     119 
     120    /** 
     121     * Returns events on or after the input time <code>earliestReleaseTime</code>, but with a maximum of 
     122     * <code>maxNoResults</code> results (in chronological order). 
     123     *  
     124     * @param earliestReleaseTime 
     125     * @param maxNoResults 
     126     * @return 
     127     */ 
     128    public List<Event> getEventsOnOrAfter(DateTime earliestReleaseTime, int maxNoResults) { 
     129        List<Event> query = 
     130                (List<Event>) eventHandler.query("from Event where eventTime >= ? order by eventTime asc", 
     131                        new Object[] {earliestReleaseTime}, maxNoResults); 
     132        return query; 
     133    } 
     134 
     135    /** 
    133136     * 
    134137     */ 
    135         public void removeAllEntries() { 
    136                 eventHandler.removeAllEvents(); 
    137         } 
    138  
    139         /** 
    140          * Sets the configured entry handler. Must also then initialise that entry 
    141          * handler 
    142          *  
    143          * @param entryHandler 
    144          *            the entryHandler to set 
    145          */ 
    146         public void setEntryHandler(EventHandler entryHandler) { 
    147                 this.eventHandler = entryHandler; 
    148                 entryHandler.initialise(); 
    149         } 
    150  
    151         /** 
    152          * @return the entryHandler 
    153          */ 
    154         public EventHandler getEntryHandler() { 
    155                 return eventHandler; 
    156         } 
    157  
    158         /** 
    159          * @param attributeAssociationEngine 
    160          *            the attributeAssociationEngine to set 
    161          */ 
    162         public void setAttributeAssociationEngine(AttributeAssociationEngine attributeAssociationEngine) { 
    163                 this.attributeAssociationEngine = attributeAssociationEngine; 
    164         } 
    165  
    166         /** 
    167          * @return the attributeAssociationEngine 
    168          */ 
    169         public AttributeAssociationEngine getAttributeAssociationEngine() { 
    170                 return attributeAssociationEngine; 
    171         } 
    172  
    173         /** 
    174          * Returns the possible values that each of the input field names can take 
    175          *  
    176          * @param possibleFieldNameValuesList 
    177          * @return 
    178          */ 
    179         public List<Suggestion> getPossibleValuesFor(List<String> possibleFieldNameValuesList) { 
    180                 ArrayList<Suggestion> suggestions = new ArrayList<Suggestion>(); 
    181  
    182                 for (String fieldName : possibleFieldNameValuesList) { 
    183                         try { 
    184                                 String query = "select " + fieldName + " from Event group by (" + fieldName + ")"; 
    185                                 List results = eventHandler.query(query); 
    186                                 log.trace("Looking for possible values for field {} using query [{}]",fieldName, query); 
    187                                 int noResults=0; 
    188                                 for (Object result : results) { 
    189                                         if (result instanceof String) { 
    190                                                 Suggestion suggestion = new Suggestion(); 
    191                                                 suggestion.setBase(fieldName); 
    192                                                 suggestion.setValue((String) result); 
    193                                                 suggestions.add(suggestion); 
    194                                                 noResults++; 
    195                                         } 
    196                                 } 
    197                                 log.debug("Field {} has {} suggestion values",fieldName,noResults); 
    198                         } catch (RuntimeException e) { 
    199                                 log.warn("Caught a runtime exception. Error trying to find possible values for {}, probably nothing to worry about", fieldName); 
    200                         } 
    201  
    202                 } 
    203  
    204                 return suggestions; 
    205         } 
     138    public void removeAllEntries() { 
     139        eventHandler.removeAllEvents(); 
     140    } 
     141 
     142    /** 
     143     * Sets the configured entry handler. Must also then initialise that entry handler 
     144     *  
     145     * @param entryHandler the entryHandler to set 
     146     */ 
     147    public void setEntryHandler(EventHandler entryHandler) { 
     148        this.eventHandler = entryHandler; 
     149        entryHandler.initialise(); 
     150    } 
     151 
     152    /** 
     153     * @return the entryHandler 
     154     */ 
     155    public EventHandler getEntryHandler() { 
     156        return eventHandler; 
     157    } 
     158 
     159    /** 
     160     * @param attributeAssociationEngine the attributeAssociationEngine to set 
     161     */ 
     162    public void setAttributeAssociationEngine(AttributeAssociationEngine attributeAssociationEngine) { 
     163        this.attributeAssociationEngine = attributeAssociationEngine; 
     164    } 
     165 
     166    /** 
     167     * @return the attributeAssociationEngine 
     168     */ 
     169    public AttributeAssociationEngine getAttributeAssociationEngine() { 
     170        return attributeAssociationEngine; 
     171    } 
     172 
     173    /** 
     174     * Returns the possible values that each of the input field names can take 
     175     *  
     176     * @param possibleFieldNameValuesList 
     177     * @return 
     178     */ 
     179    public List<Suggestion> getPossibleValuesFor(List<String> possibleFieldNameValuesList) { 
     180        ArrayList<Suggestion> suggestions = new ArrayList<Suggestion>(); 
     181 
     182        for (String fieldName : possibleFieldNameValuesList) { 
     183            try { 
     184                String query = "select " + fieldName + " from Event group by (" + fieldName + ")"; 
     185                List results = eventHandler.query(query); 
     186                log.trace("Looking for possible values for field {} using query [{}]", fieldName, query); 
     187                int noResults = 0; 
     188                for (Object result : results) { 
     189                    if (result instanceof String) { 
     190                        Suggestion suggestion = new Suggestion(); 
     191                        suggestion.setBase(fieldName); 
     192                        suggestion.setValue((String) result); 
     193                        suggestions.add(suggestion); 
     194                        noResults++; 
     195                    } 
     196                } 
     197                log.debug("Field {} has {} suggestion values", fieldName, noResults); 
     198            } catch (RuntimeException e) { 
     199                log.warn( 
     200                        "Caught a runtime exception. Error trying to find possible values for {}, probably nothing to worry about", 
     201                        fieldName); 
     202            } 
     203 
     204        } 
     205 
     206        return suggestions; 
     207    } 
    206208 
    207209} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/store/StoreEventsPipelineTask.java

    r1103 r1176  
    3535 *  
    3636 */ 
    37 public class StoreEntriesPipelineTask implements Callable<Boolean> { 
     37public class StoreEventsPipelineTask implements Callable<Boolean> { 
    3838 
    3939    /** class logger */ 
    40     private final Logger log = LoggerFactory.getLogger(StoreEntriesPipelineTask.class); 
     40    private final Logger log = LoggerFactory.getLogger(StoreEventsPipelineTask.class); 
    4141 
    4242    /** The entry handler used to store entries (e.g. events) */ 
     
    5252    private List<Event> events; 
    5353 
    54     public StoreEntriesPipelineTask(EventHandler entryHandler, AttributeAssociationEngine attributeAssociationEngine, 
     54    public StoreEventsPipelineTask(EventHandler entryHandler, AttributeAssociationEngine attributeAssociationEngine, 
    5555            List<Event> events, StoreEntriesTaskCallbackInterface storeCallback) { 
    5656        this.storeCallback = storeCallback; 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/store/dao/StorageException.java

    r672 r1176  
    1414 * limitations under the License. 
    1515 */ 
     16 
    1617package uk.ac.cardiff.raptor.store.dao; 
    1718 
    18 public class StorageException extends Exception{ 
     19public class StorageException extends Exception { 
    1920 
    20         /** 
    21          * 
    22         */ 
    23         private static final long serialVersionUID = -4614661463043866258L; 
     21    /** 
     22     * Generated serial UID. 
     23    */ 
     24    private static final long serialVersionUID = -4614661463043866258L; 
    2425 
    25         public StorageException (String message){ 
    26                 super(message); 
    27         } 
    28  
    29         public StorageException (String message, Exception wrappedException){ 
    30             super(message,wrappedException); 
     26    /** Constructor. */ 
     27    public StorageException() { 
     28        super(); 
    3129    } 
    3230 
     31    /** 
     32     * Constructor. 
     33     *  
     34     * @param message exception message 
     35     */ 
     36    public StorageException(final String message) { 
     37        super(message); 
     38    } 
     39 
     40    /** 
     41     * Constructor. 
     42     *  
     43     * @param wrappedException exception to be wrapped by this one 
     44     */ 
     45    public StorageException(final Exception wrappedException) { 
     46        super(wrappedException); 
     47    } 
     48 
     49    /** 
     50     * Constructor. 
     51     *  
     52     * @param message exception message 
     53     * @param wrappedException exception to be wrapped by this one 
     54     */ 
     55    public StorageException(final String message, final Exception wrappedException) { 
     56        super(message, wrappedException); 
     57    } 
    3358 
    3459} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/store/impl/LogFileMemoryEventHandler.java

    r1046 r1176  
    2929import java.util.Set; 
    3030 
     31import org.joda.time.DateTime; 
     32import org.slf4j.Logger; 
     33import org.slf4j.LoggerFactory; 
     34 
    3135import uk.ac.cardiff.model.event.Event; 
    3236import uk.ac.cardiff.raptor.runtimeutils.ReflectionHelper; 
    3337import uk.ac.cardiff.raptor.store.IncrementalEventHandler; 
    3438 
    35 import org.joda.time.DateTime; 
    36 import org.slf4j.Logger; 
    37 import org.slf4j.LoggerFactory; 
    38  
    3939public class LogFileMemoryEventHandler implements IncrementalEventHandler { 
    4040 
    41         /** Class logger */ 
    42         private final Logger log = LoggerFactory.getLogger(MemoryEventHandler.class); 
    43  
    44         /** Pointer to the last recorded entry, for incremental update. */ 
    45         private DateTime latestEntryTime; 
    46  
    47         /** Set of all entries stored by this EntryHandler. */ 
    48         private Set<Event> entries; 
    49  
    50         /** 
    51          * Stores the set of latest unique entries. That is, those with the latest 
    52          * and same DateTime, but different state (attribute values). This set is 
    53          * checked when adding new entries, and is not removed when records are 
    54          * removed. 
    55          */ 
    56         private Set<Event> latestEqualEntries; 
    57  
    58         public LogFileMemoryEventHandler() { 
    59                 entries = new LinkedHashSet<Event>(); 
    60                 latestEqualEntries = new LinkedHashSet<Event>(); 
    61         } 
    62  
    63         public void addEntries(List<Event> entries) { 
    64                 log.debug("Current: " + this.entries.size() + " in: " + entries.size()); 
    65  
    66                 for (Event event : entries) { 
    67                         addEntry(event); 
    68  
    69                 } 
    70                 log.debug("Total No. of Entries " + this.entries.size() + " Latest Entry at: " + getLatestEntryTime()); 
    71         } 
    72  
    73         /** 
    74          * First copy the hash of this entry into the <code>eventId</code> column if 
    75          * its empty. Then, add to the entry set iff its a newer entry. If equal, 
    76          * first check the <code>latestEqualEntries</code> set, if contained in this 
    77          * set, then it has already been added, if not add. 
    78          *  
    79          * @return true if this event was added to the entry handler, false 
    80          *         otherwise 
    81          */ 
    82         public boolean addEntry(Event event) { 
    83                 addEventIdIfNull(event); 
    84                 boolean isAfter = isAfter(event); 
    85                 boolean isEqual = isEqual(event); 
    86                 if (isAfter) { 
    87                         entries.add(event); 
    88                         updateLastEntry(event); 
    89                         return true; 
    90                 } else if (isEqual) { 
    91                         boolean isAlreadyInLatest = latestEqualEntries.contains(event); 
    92                         if (isAlreadyInLatest) { 
    93                                 log.trace("Duplicated, probably same event [{}]", event); 
    94                                 return false; 
    95                         } 
    96                         if (!isAlreadyInLatest) { 
    97                                 entries.add(event); 
    98                                 updateLastEntry(event); 
    99                                 return true; 
    100                         } 
    101                 } 
    102                 return false; 
    103  
    104         } 
    105          
    106         public void reset() { 
    107                 entries.clear(); 
    108                 latestEqualEntries.clear(); 
    109                 latestEntryTime = null;  
    110         } 
    111  
    112         /** 
    113          * Stores the hashcode of the event as the <code>eventId</code> iff there is 
    114          * no existing eventId (defined as 0), and the event has a valid hashcode. 
    115          *  
    116          * @param event 
    117          */ 
    118         private void addEventIdIfNull(Event event) { 
    119                 if (event.getEventId() != 0) { 
    120                         return; 
    121                 } 
    122                 int hashCode = ReflectionHelper.getHashCodeFromEventOrNull(event); 
    123                 if (hashCode != 0) { 
    124                         event.setEventId(hashCode); 
    125                 } 
    126         } 
    127  
    128         public void removeEventsBefore(DateTime earliestReleaseTime, Set<Integer> latestEqualEntries) { 
    129                 log.debug("Removing events earlier than {}, or in the set of last equal events sent (from {} events)", earliestReleaseTime, latestEqualEntries.size()); 
    130                 ArrayList<Event> toRemove = new ArrayList<Event>(); 
    131                 for (Event event : entries) { 
    132                         if (event.getEventTime().isBefore(earliestReleaseTime)) 
    133                                 toRemove.add(event); 
    134                         if (event.getEventTime().isEqual(earliestReleaseTime)) { 
    135                                 if (latestEqualEntries.contains(event.getEventId())) { 
    136                                         toRemove.add(event); 
    137                                 } 
    138                         } 
    139                 } 
    140                 entries.removeAll(toRemove); 
    141  
    142         } 
    143  
    144         private void updateLastEntry(Event entry) { 
    145                 DateTime entryTime = entry.getEventTime(); 
    146                 if (getLatestEntryTime() == null) 
    147                         setLatestEntryTime(entryTime); 
    148                 if (entryTime.isAfter(getLatestEntryTime())) { 
    149                         setLatestEntryTime(entryTime); 
    150                         latestEqualEntries.clear(); 
    151                         latestEqualEntries.add(entry); 
    152                 } 
    153                 if (entryTime.isEqual(getLatestEntryTime())) { 
    154                         latestEqualEntries.add(entry); 
    155                 } 
    156         } 
    157  
    158         public void setLatestEntryTime(DateTime latestEntryTime) { 
    159                 this.latestEntryTime = latestEntryTime; 
    160         } 
    161  
    162         public DateTime getLatestEntryTime() { 
    163                 return latestEntryTime; 
    164         } 
    165  
    166         /** 
    167          * @param authE 
    168          * @return 
    169          */ 
    170         public boolean isNewerOrEqual(Event event) { 
    171                 if (latestEntryTime == null) 
    172                         return true; 
    173                 if (!event.getEventTime().isBefore(latestEntryTime)) 
    174                         return true; 
    175                 return false; 
    176         } 
    177  
    178         public boolean isEqual(Event event) { 
    179                 if (latestEntryTime == null) 
    180                         return false; 
    181                 return event.getEventTime().isEqual(latestEntryTime); 
    182         } 
    183  
    184         public boolean isAfter(Event event) { 
    185                 if (latestEntryTime == null) 
    186                         return true; 
    187                 return event.getEventTime().isAfter(latestEntryTime); 
    188         } 
    189  
    190         /** 
    191          * pushes the latestEntryTime by 1 millisecond (see LogFileParser.java for 
    192          * explanation) 
    193          */ 
    194         public void endTransaction() { 
    195                 latestEntryTime = new DateTime(latestEntryTime.getMillis() + 1); 
    196  
    197         } 
    198  
    199         /** 
    200          * @return the list of entries currently stored by the entry handler 
    201          */ 
    202         public List<Event> getEntries() { 
    203                 return new ArrayList<Event>(entries); 
    204  
    205         } 
    206  
    207         /** 
    208          * Removes all entries, but does not reset last entry, as this is still used 
    209          * so as not to add previously parsed entries. 
    210          */ 
    211         public void removeAllEntries() { 
    212                 entries.clear(); 
    213         } 
    214  
    215         /** 
    216          * This is a no-op method for the memory entry handler 
    217          */ 
    218         public void initialise() { 
    219  
    220         } 
    221  
    222         public int getNumberOfEntries() { 
    223                 return entries.size(); 
    224         } 
    225  
    226  
    227         public void setEntries(Set<Event> entries) { 
    228                 this.entries = entries; 
    229  
    230         } 
    231  
    232  
     41    /** Class logger */ 
     42    private final Logger log = LoggerFactory.getLogger(MemoryEventHandler.class); 
     43 
     44    /** Pointer to the last recorded entry, for incremental update. */ 
     45    private DateTime latestEntryTime; 
     46 
     47    /** Set of all entries stored by this EntryHandler. */ 
     48    private Set<Event> entries; 
     49 
     50    /** 
     51     * Stores the set of latest unique entries. That is, those with the latest and same Date and Time, but different 
     52     * state (attribute values). This set is checked when adding new entries, and is not removed when records are 
     53     * removed. 
     54     */ 
     55    private Set<Event> latestEqualEntries; 
     56 
     57    public LogFileMemoryEventHandler() { 
     58        entries = new LinkedHashSet<Event>(); 
     59        latestEqualEntries = new LinkedHashSet<Event>(); 
     60    } 
     61 
     62    public void addEntries(List<Event> entries) { 
     63        log.debug("Current: " + this.entries.size() + " in: " + entries.size()); 
     64 
     65        for (Event event : entries) { 
     66            addEntry(event); 
     67 
     68        } 
     69        log.debug("Total No. of Entries " + this.entries.size() + " Latest Entry at: " + getLatestEntryTime()); 
     70    } 
     71 
     72    /** 
     73     * First copy the hash of this entry into the <code>eventId</code> column if its empty. Then, add to the entry set 
     74     * iff its a newer entry. If equal, first check the <code>latestEqualEntries</code> set, if contained in this set, 
     75     * then it has already been added, if not add. 
     76     *  
     77     * @return true if this event was added to the entry handler, false otherwise 
     78     */ 
     79    public boolean addEntry(Event event) { 
     80        addEventIdIfNull(event); 
     81        boolean isAfter = isAfter(event); 
     82        boolean isEqual = isEqual(event); 
     83        if (isAfter) { 
     84            entries.add(event); 
     85            updateLastEntry(event); 
     86            return true; 
     87        } else if (isEqual) { 
     88            boolean isAlreadyInLatest = latestEqualEntries.contains(event); 
     89            if (isAlreadyInLatest) { 
     90                log.trace("Duplicated, probably same event [{}]", event); 
     91                return false; 
     92            } 
     93            if (!isAlreadyInLatest) { 
     94                entries.add(event); 
     95                updateLastEntry(event); 
     96                return true; 
     97            } 
     98        } 
     99        return false; 
     100 
     101    } 
     102 
     103    /** 
     104     * Clears the set of <code>entries</code>, the set of <code>latestEqualEntries</code> and dereferences the 
     105     * <code>latestEntryTime</code> 
     106     */ 
     107    public void reset() { 
     108        entries.clear(); 
     109        latestEqualEntries.clear(); 
     110        latestEntryTime = null; 
     111    } 
     112 
     113    /** 
     114     * Stores the hashcode of the event as the <code>eventId</code> iff there is no existing eventId (defined as 0), and 
     115     * the event has a valid hashcode. 
     116     *  
     117     * @param event 
     118     */ 
     119    private void addEventIdIfNull(Event event) { 
     120        if (event.getEventId() != 0) { 
     121            return; 
     122        } 
     123        int hashCode = ReflectionHelper.getHashCodeFromEventOrNull(event); 
     124        if (hashCode != 0) { 
     125            event.setEventId(hashCode); 
     126        } 
     127    } 
     128 
     129    public void removeEventsBefore(DateTime earliestReleaseTime, Set<Integer> latestEqualEntries) { 
     130        log.debug("Removing events earlier than {}, or in the set of last equal events sent (from {} events)", 
     131                earliestReleaseTime, latestEqualEntries.size()); 
     132        ArrayList<Event> toRemove = new ArrayList<Event>(); 
     133        for (Event event : entries) { 
     134            if (event.getEventTime().isBefore(earliestReleaseTime)) 
     135                toRemove.add(event); 
     136            if (event.getEventTime().isEqual(earliestReleaseTime)) { 
     137                if (latestEqualEntries.contains(event.getEventId())) { 
     138                    toRemove.add(event); 
     139                } 
     140            } 
     141        } 
     142        entries.removeAll(toRemove); 
     143 
     144    } 
     145 
     146    private void updateLastEntry(Event entry) { 
     147        DateTime entryTime = entry.getEventTime(); 
     148        if (getLatestEntryTime() == null) 
     149            setLatestEntryTime(entryTime); 
     150        if (entryTime.isAfter(getLatestEntryTime())) { 
     151            setLatestEntryTime(entryTime); 
     152            latestEqualEntries.clear(); 
     153            latestEqualEntries.add(entry); 
     154        } 
     155        if (entryTime.isEqual(getLatestEntryTime())) { 
     156            latestEqualEntries.add(entry); 
     157        } 
     158    } 
     159 
     160    public void setLatestEntryTime(DateTime latestEntryTime) { 
     161        this.latestEntryTime = latestEntryTime; 
     162    } 
     163 
     164    public DateTime getLatestEntryTime() { 
     165        return latestEntryTime; 
     166    } 
     167 
     168    /** 
     169     * @param authE 
     170     * @return 
     171     */ 
     172    public boolean isNewerOrEqual(Event event) { 
     173        if (latestEntryTime == null) 
     174            return true; 
     175        if (!event.getEventTime().isBefore(latestEntryTime)) 
     176            return true; 
     177        return false; 
     178    } 
     179 
     180    public boolean isEqual(Event event) { 
     181        if (latestEntryTime == null) 
     182            return false; 
     183        return event.getEventTime().isEqual(latestEntryTime); 
     184    } 
     185 
     186    public boolean isAfter(Event event) { 
     187        if (latestEntryTime == null) 
     188            return true; 
     189        return event.getEventTime().isAfter(latestEntryTime); 
     190    } 
     191 
     192    /** 
     193     * pushes the latestEntryTime by 1 millisecond (see LogFileParser.java for explanation) 
     194     */ 
     195    public void endTransaction() { 
     196        latestEntryTime = new DateTime(latestEntryTime.getMillis() + 1); 
     197 
     198    } 
     199 
     200    /** 
     201     * @return the list of entries currently stored by the entry handler 
     202     */ 
     203    public List<Event> getEntries() { 
     204        return new ArrayList<Event>(entries); 
     205 
     206    } 
     207 
     208    /** 
     209     * Removes all entries, but does not reset last entry, as this is still used so as not to add previously parsed 
     210     * entries. 
     211     */ 
     212    public void removeAllEntries() { 
     213        entries.clear(); 
     214    } 
     215 
     216    /** 
     217     * This is a no-op method for the memory entry handler 
     218     */ 
     219    public void initialise() { 
     220 
     221    } 
     222 
     223    public int getNumberOfEntries() { 
     224        return entries.size(); 
     225    } 
     226 
     227    public void setEntries(Set<Event> entries) { 
     228        this.entries = entries; 
     229 
     230    } 
    233231 
    234232} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/store/impl/PersistantEventHandler.java

    r1142 r1176  
    6969 
    7070    public PersistantEventHandler(RaptorDataConnection dataConnection) { 
    71         this.setDataConnection(dataConnection); 
     71        setDataConnection(dataConnection); 
    7272        persistQueue = new HashSet<Event>(); 
    7373 
     
    7575 
    7676    /** 
    77      * Initialises the entry handler. In particular, loads all entries from the main datastore, through the 
    78      * <code>dataConnection</code> instance. 
     77     * Initialises the entry handler. 
    7978     */ 
    8079    public void initialise() { 
     
    134133     * The <code>entries</code> are stored in the <code>persistQueue</code> until they are persisted. If an exception is 
    135134     * thrown before they are persisted, they remain in the <code>persistQueue</code>. This method then saves this 
    136      * collection in batch, as opposed to the <code>addEntry</code> method which stores events one at a time. In order 
     135     * collection in batch, as opposed to the <code>addEvent</code> method which stores events one at a time. In order 
    137136     * to detect duplicates, a query is run over the database in order to check duplicates within already stored events, 
    138137     * as well as adding new events to a <code>Set</code> <code>persist</code> which prevents duplicates in the 
     
    182181            return true; 
    183182        } else { 
    184             log.error("Duplicated event found\n{}", event); 
     183            log.warn("Duplicated event found\n{}", event); 
    185184            return false; 
    186185        } 
Note: See TracChangeset for help on using the changeset viewer.