Changeset 749


Ignore:
Timestamp:
05/05/11 18:59:55 (8 years ago)
Author:
philsmart
Message:
 
Location:
raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor
Files:
4 edited

Legend:

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

    r616 r749  
    2929import com.rits.cloning.Cloner; 
    3030 
     31import uk.ac.cardiff.model.ServiceMetadata; 
    3132import uk.ac.cardiff.model.event.Event; 
    3233import uk.ac.cardiff.raptor.runtimeutils.ReflectionHelper; 
     
    3435/** 
    3536 * @author philsmart 
    36  *  
     37 * 
    3738 */ 
    3839public class AttrributeFilterEngine { 
    3940 
    40         /* class logger. */ 
     41        /** class logger. */ 
    4142        private final Logger log = LoggerFactory.getLogger(AttrributeFilterEngine.class); 
    4243 
     
    4445         * Only runs against the deny rules, and only denies basic:ANY attributes, 
    4546         * does not deny individual values. 
    46          *  
     47         * 
    4748         * @param attributeFilterPolicy 
    4849         * @param entries 
    4950         * @return 
    5051         */ 
    51         public List<Event> filter(AttributeFilterPolicy attributeFilterPolicy, List<Event> events) { 
     52        public List<Event> filter(AttributeFilterPolicy attributeFilterPolicy, ServiceMetadata metadata, List<Event> events) { 
    5253                log.debug("Applying attribute filter policy {} to event set", attributeFilterPolicy.getPolicyName()); 
    5354                List<Event> filteredEntries = clone(events); 
     
    6566         * Only process deny rules on the level of basic:ANY attributes. Hence will 
    6667         * not deny individual values 
    67          *  
     68         * 
    6869         * @param entry 
    6970         * @param attributeRule 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/registry/EventReleaseEngine.java

    r656 r749  
    2020 
    2121import java.util.Date; 
    22 import java.util.LinkedHashSet; 
    2322import java.util.List; 
    24 import java.util.Set; 
    2523 
    26 import uk.ac.cardiff.raptor.attribute.filtering.AttributeFilterPolicy; 
    2724import uk.ac.cardiff.raptor.attribute.filtering.AttrributeFilterEngine; 
    2825import uk.ac.cardiff.raptor.remoting.client.sei.ServiceEndpointClient; 
     
    3229import org.slf4j.LoggerFactory; 
    3330 
    34 import uk.ac.cardiff.model.ClientMetadata; 
     31import uk.ac.cardiff.model.ServiceMetadata; 
    3532import uk.ac.cardiff.model.event.Event; 
    3633import uk.ac.cardiff.model.wsmodel.EventPushMessage; 
     
    4239public class EventReleaseEngine { 
    4340 
     41        /** Engine that provides attribute filtering before events are released */ 
    4442        private AttrributeFilterEngine attributeFilterEngine; 
     43 
     44        /** Class that handles the transport of events to the endpoint */ 
    4545        private ServiceEndpointClient serviceEndpointInterface; 
    4646 
     
    5757         * @param authenticationModules 
    5858         */ 
    59         public boolean release(EndpointRegistry endpointRegistry, List<Event> events, ClientMetadata clientMetadata) { 
     59        public boolean release(EndpointRegistry endpointRegistry, List<Event> events, ServiceMetadata serviceMetadata) { 
    6060                boolean releasedtoAll = true; 
    6161                int releaseCount = 0; 
     
    6363                        boolean shouldRelease = shouldRelease(endpoint,events);//(endpoint.getPushPolicy().getPushOnOrAfterNoEntries() <= events.size()); 
    6464                        log.debug("Endpoint {}, should release {}", endpoint.getServiceEndpoint(), shouldRelease); 
    65                         List<Event> filteredEntries = filterAttributes(endpoint, events); 
    66                         EventPushMessage pushMessage = constructEventPush(clientMetadata, filteredEntries); 
     65                        List<Event> filteredEntries = filterAttributes(serviceMetadata, endpoint, events); 
     66                        EventPushMessage pushMessage = constructEventPush(serviceMetadata, filteredEntries); 
    6767                        if (shouldRelease) { 
    6868                                log.debug("Pushing {} entries to the Endpoint [{}]", filteredEntries.size(),endpoint.getServiceEndpoint()); 
     
    8484 
    8585        } 
    86          
     86 
    8787        /** 
    8888         * Iterates through all push policies attached to the <code>endpoint</code> parameter 
    8989         * to determine if events should be released to this endpoint 
    90          *  
     90         * 
    9191         * @param endpoint the endpoint to evaluate the policy on 
    9292         * @param events the events ready to be released. 
     
    9898                        if (policy.evaluatePolicy(events)) 
    9999                                shouldRelease = true; 
    100                 }                
     100                } 
    101101                return shouldRelease; 
    102102        } 
     
    111111         * @return 
    112112         */ 
    113         private List<Event> filterAttributes(Endpoint endpoint, List<Event> allEvents) { 
     113        private List<Event> filterAttributes(ServiceMetadata metadata, Endpoint endpoint, List<Event> allEvents) { 
    114114                if (endpoint.getAttributeFilterPolicy() == null) 
    115115                        return allEvents; 
    116                 return attributeFilterEngine.filter(endpoint.getAttributeFilterPolicy(), allEvents); 
     116                return attributeFilterEngine.filter(endpoint.getAttributeFilterPolicy(), metadata, allEvents); 
    117117        } 
    118118 
     
    124124         * @return 
    125125         */ 
    126         private EventPushMessage constructEventPush(ClientMetadata clientMetadata, List<Event> events) { 
     126        private EventPushMessage constructEventPush(ServiceMetadata clientMetadata, List<Event> events) { 
    127127                EventPushMessage pushMessage = new EventPushMessage(); 
    128128                pushMessage.setClientMetadata(clientMetadata); 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/client/EventReleaseClient.java

    r672 r749  
    2121import java.util.List; 
    2222 
    23 import uk.ac.cardiff.model.ClientMetadata; 
     23import uk.ac.cardiff.model.ServiceMetadata; 
    2424import uk.ac.cardiff.model.event.Event; 
    2525 
     
    3030 */ 
    3131public interface EventReleaseClient { 
    32          
    33         public boolean release(List<Event> events, ClientMetadata clientMetadata) throws ReleaseFailureException; 
     32 
     33    /** 
     34     * Release the <code>events</code> to the endpoint specified in this clients implementation 
     35     * 
     36     * @param events the <code>List</code> of events that are to be released 
     37     * @param ServiceMetadata 
     38     * @return true of the release was successful and false otherwise 
     39     * @throws ReleaseFailureException 
     40     */ 
     41        public boolean release(List<Event> events, ServiceMetadata serviceMetadata) throws ReleaseFailureException; 
    3442 
    3543} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/client/impl/EventReleaseClientImpl.java

    r672 r749  
    1818import java.util.List; 
    1919 
    20 import uk.ac.cardiff.model.ClientMetadata; 
     20import uk.ac.cardiff.model.ServiceMetadata; 
     21import uk.ac.cardiff.model.ServiceMetadata; 
    2122import uk.ac.cardiff.model.event.Event; 
    2223import uk.ac.cardiff.raptor.registry.EndpointRegistry; 
     
    2728 
    2829public class EventReleaseClientImpl implements EventReleaseClient{ 
    29          
     30 
     31        /** Encapsulation of all endpoints this client can communication with*/ 
    3032        private EndpointRegistry endpointRegistry; 
     33 
     34        /** The engine that performs event release to a client endpoint */ 
    3135        private EventReleaseEngine eventReleaseEngine; 
    32          
     36 
    3337        public EventReleaseClientImpl(){ 
    3438                eventReleaseEngine = new EventReleaseEngine(); 
     
    3741 
    3842        @Override 
    39         public boolean release(List<Event> events, ClientMetadata clientMetadata) throws ReleaseFailureException{ 
    40                 boolean success = eventReleaseEngine.release(endpointRegistry, events, clientMetadata);          
     43        public boolean release(List<Event> events, ServiceMetadata serviceMetadata) throws ReleaseFailureException{ 
     44                boolean success = eventReleaseEngine.release(endpointRegistry, events, serviceMetadata); 
    4145                return success; 
    42                  
     46 
    4347        } 
    4448 
Note: See TracChangeset for help on using the changeset viewer.