Changeset 1445


Ignore:
Timestamp:
08/23/12 17:48:26 (8 years ago)
Author:
philsmart
Message:
 
Location:
raptor-client/trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • raptor-client/trunk/.classpath

    r627 r1445  
    11<?xml version="1.0" encoding="UTF-8"?> 
    22<classpath> 
    3         <classpathentry kind="src" output="target/classes" path="src/main/java"/> 
     3        <classpathentry including="**/*.java" kind="src" output="target/classes" path="src/main/java"> 
     4                <attributes> 
     5                        <attribute name="optional" value="true"/> 
     6                        <attribute name="maven.pomderived" value="true"/> 
     7                </attributes> 
     8        </classpathentry> 
    49        <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/> 
    5         <classpathentry kind="src" output="target/test-classes" path="src/test/java"/> 
    6         <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/> 
     10        <classpathentry kind="src" output="target/test-classes" path="src/test/java"> 
     11                <attributes> 
     12                        <attribute name="optional" value="true"/> 
     13                        <attribute name="maven.pomderived" value="true"/> 
     14                </attributes> 
     15        </classpathentry> 
     16        <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> 
     17                <attributes> 
     18                        <attribute name="maven.pomderived" value="true"/> 
     19                </attributes> 
     20        </classpathentry> 
    721        <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"> 
    822                <attributes> 
     
    1125        </classpathentry> 
    1226        <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> 
    13         <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> 
     27        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> 
     28                <attributes> 
     29                        <attribute name="maven.pomderived" value="true"/> 
     30                </attributes> 
     31        </classpathentry> 
     32        <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> 
     33                <attributes> 
     34                        <attribute name="maven.pomderived" value="true"/> 
     35                </attributes> 
     36        </classpathentry> 
    1437        <classpathentry kind="output" path="target/classes"/> 
    1538</classpath> 
  • raptor-client/trunk/.project

    r622 r1445  
    2626                        </arguments> 
    2727                </buildCommand> 
     28                <buildCommand> 
     29                        <name>org.eclipse.m2e.core.maven2Builder</name> 
     30                        <arguments> 
     31                        </arguments> 
     32                </buildCommand> 
    2833        </buildSpec> 
    2934        <natures> 
     35                <nature>org.eclipse.m2e.core.maven2Nature</nature> 
    3036                <nature>org.eclipse.jem.workbench.JavaEMFNature</nature> 
    3137                <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> 
  • raptor-client/trunk/pom.xml

    r1432 r1445  
    6363            <groupId>uk.ac.cardiff.raptor</groupId> 
    6464            <artifactId>raptor-information-model</artifactId> 
    65             <version>1.1.1</version> 
     65            <version>1.1.2</version> 
    6666            <exclusions> 
    6767                <exclusion> 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/client/EventReleaseEngine.java

    r1424 r1445  
    6060     * @param authenticationModules 
    6161     */ 
    62     public boolean release(EndpointRegistry endpointRegistry, List<Event> events, ServiceMetadata serviceMetadata) { 
     62    public boolean release(EndpointRegistry endpointRegistry, List<Event> events, 
     63            ServiceMetadata serviceMetadata) { 
    6364        boolean releasedtoAll = true; 
    6465        int releaseCount = 0; 
     
    6869            applicableEvents = eventResourceCategoryFilter(endpoint, applicableEvents); 
    6970            boolean shouldRelease = shouldRelease(endpoint, applicableEvents); 
    70             log.debug("Endpoint {}, should release {}", endpoint.getServiceEndpoint(), shouldRelease); 
     71            log.debug("Endpoint {}, should release {}", endpoint.getServiceEndpoint(), 
     72                    shouldRelease); 
    7173            if (shouldRelease) { 
    72                 List<Event> filteredEntries = filterAttributes(serviceMetadata, endpoint, applicableEvents); 
     74                List<Event> filteredEntries = 
     75                        filterAttributes(serviceMetadata, endpoint, applicableEvents); 
    7376                appendMetadata(filteredEntries, serviceMetadata); 
    74                 EventPushMessage pushMessage = constructEventPush(serviceMetadata, filteredEntries); 
    75                 log.debug("Pushing {} entries to the Endpoint [{}]", filteredEntries.size(), 
    76                         endpoint.getServiceEndpoint()); 
    77                 boolean releaseSuccess = getServiceEndpointInterface().sendEvents(pushMessage, endpoint); 
    78                 log.debug("Release to [{}] succeeded {}", endpoint.getServiceEndpoint(), releaseSuccess); 
     77                EventPushMessage pushMessage = 
     78                        constructEventPush(serviceMetadata, filteredEntries); 
     79                log.debug("Pushing {} entries to the Endpoint [{}]", 
     80                        filteredEntries.size(), endpoint.getServiceEndpoint()); 
     81                boolean releaseSuccess = 
     82                        getServiceEndpointInterface().sendEvents(pushMessage, endpoint); 
     83                log.debug("Release to [{}] succeeded {}", endpoint.getServiceEndpoint(), 
     84                        releaseSuccess); 
    7985                if (releaseSuccess == false) 
    8086                    releasedtoAll = false; 
     
    8692                     */ 
    8793                    endpoint.releasePerformed(applicableEvents); 
    88                     log.debug("Endpoint [{}] has been sent events up to and including {}", 
    89                             endpoint.getServiceEndpoint(), endpoint.getReleaseInformation().getLastReleasedEventTime()); 
     94                    log.debug( 
     95                            "Endpoint [{}] has been sent events up to and including {}", 
     96                            endpoint.getServiceEndpoint(), endpoint 
     97                                    .getReleaseInformation().getLastReleasedEventTime()); 
    9098                } 
    9199            } else { 
     
    94102 
    95103        } 
    96         log.info("Released to {} listening Endpoints, out of a total of {}", releaseCount, endpointRegistry 
    97                 .getEndpoints().size()); 
     104        log.info("Released to {} listening Endpoints, out of a total of {}", 
     105                releaseCount, endpointRegistry.getEndpoints().size()); 
    98106 
    99107        return releasedtoAll; 
     
    114122            log.info( 
    115123                    "There are 0 events to send to the endpoint [{}] after event type filtering. Has the endpoint been set" 
    116                             + " with the correct supported event types?", endpoint.getServiceEndpoint()); 
     124                            + " with the correct supported event types?", 
     125                    endpoint.getServiceEndpoint()); 
    117126            return new ArrayList<Event>(); 
    118127        } 
     
    131140 
    132141        } 
    133         log.info("There are {} events to send to the endpoint [{}] after event type filtering", 
     142        log.info( 
     143                "There are {} events to send to the endpoint [{}] after event type filtering", 
    134144                applicableEvents.size(), endpoint.getServiceEndpoint()); 
    135145        return applicableEvents; 
     
    145155     * @return 
    146156     */ 
    147     private List<Event> eventResourceCategoryFilter(Endpoint endpoint, List<Event> events) { 
     157    private List<Event> 
     158            eventResourceCategoryFilter(Endpoint endpoint, List<Event> events) { 
    148159        if (endpoint.getSupportedResourceCategory() == null) { 
    149160            log.info( 
    150161                    "There are {} events to send to the endpoint [{}] after resource category type filtering. No filtering performed, has the endpoint been set" 
    151                             + " with a supported resource category type?", events.size(), endpoint.getServiceEndpoint()); 
    152             return new ArrayList<Event>(); 
     162                            + " with a supported resource category type?", events.size(), 
     163                    endpoint.getServiceEndpoint()); 
     164            return events; 
    153165        } 
    154166        ArrayList<Event> applicableEvents = new ArrayList<Event>(); 
     
    166178 
    167179        } 
    168         log.info("There are {} events to send to the endpoint [{}] after resource category type filtering", 
     180        log.info( 
     181                "There are {} events to send to the endpoint [{}] after resource category type filtering", 
    169182                applicableEvents.size(), endpoint.getServiceEndpoint()); 
    170183        return applicableEvents; 
     
    189202     * @return the list of filtered events 
    190203     */ 
    191     private List<Event> chronologicalFilter(final Endpoint endpoint, final List<Event> events) { 
     204    private List<Event> chronologicalFilter(final Endpoint endpoint, 
     205            final List<Event> events) { 
    192206        ArrayList<Event> applicableEvents = new ArrayList<Event>(); 
    193207 
     
    197211            } 
    198212        } 
    199         log.info("There are {} events to send to the endpoint [{}] after {}", new Object[] {applicableEvents.size(), 
    200                 endpoint.getServiceEndpoint(), endpoint.getReleaseInformation().getLastReleasedEventTime()}); 
     213        log.info("There are {} events to send to the endpoint [{}] after {}", 
     214                new Object[] {applicableEvents.size(), endpoint.getServiceEndpoint(), 
     215                        endpoint.getReleaseInformation().getLastReleasedEventTime()}); 
    201216        return applicableEvents; 
    202217    } 
     
    227242     * @return a filtered set of events based on any defined attribute filter policies. 
    228243     */ 
    229     private List<Event> filterAttributes(ServiceMetadata metadata, Endpoint endpoint, List<Event> allEvents) { 
     244    private List<Event> filterAttributes(ServiceMetadata metadata, Endpoint endpoint, 
     245            List<Event> allEvents) { 
    230246        if (endpoint.getAttributeFilterPolicy() == null) 
    231247            return allEvents; 
    232         return attributeFilterEngine.filter(endpoint.getAttributeFilterPolicy(), metadata, allEvents); 
     248        return attributeFilterEngine.filter(endpoint.getAttributeFilterPolicy(), 
     249                metadata, allEvents); 
    233250    } 
    234251 
     
    241258     * @return 
    242259     */ 
    243     private EventPushMessage constructEventPush(ServiceMetadata clientMetadata, List<Event> events) { 
     260    private EventPushMessage constructEventPush(ServiceMetadata clientMetadata, 
     261            List<Event> events) { 
    244262        EventPushMessage pushMessage = new EventPushMessage(); 
    245263        pushMessage.setClientMetadata(clientMetadata); 
     
    257275    } 
    258276 
    259     public void setServiceEndpointInterface(ServiceEndpointClient serviceEndpointInterface) { 
     277    public void 
     278            setServiceEndpointInterface(ServiceEndpointClient serviceEndpointInterface) { 
    260279        this.serviceEndpointInterface = serviceEndpointInterface; 
    261280    } 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/client/sei/impl/CxfServiceEndpointClient.java

    r1176 r1445  
    1818 
    1919import java.util.HashSet; 
     20import java.util.List; 
    2021import java.util.Set; 
    2122 
     
    3233import org.slf4j.LoggerFactory; 
    3334 
    34 import uk.ac.cardiff.model.event.AuthenticationEvent; 
    35 import uk.ac.cardiff.model.event.EzproxyAuthenticationEvent; 
    36 import uk.ac.cardiff.model.event.OpenathenslaAuthenticationEvent; 
    37 import uk.ac.cardiff.model.event.ShibbolethIdpAuthenticationEvent; 
     35import uk.ac.cardiff.model.event.Event; 
    3836import uk.ac.cardiff.model.wsmodel.EventPushMessage; 
    3937import uk.ac.cardiff.raptor.registry.Endpoint; 
     
    4947    private ClientTLSParameters tlsParameters; 
    5048 
     49    /** 
     50     * The class of allowed types. That is, only these classes are registered with the AegisDataBinding and hence only 
     51     * these specific types are sent through SOAP - if specific type is omitted, but superclass is contained, then 
     52     * instance is serialized as superclass type. 
     53     */ 
     54    private List<Class<? extends Event>> allowedClassTypes; 
     55 
    5156    @Override 
    5257    public boolean sendEvents(EventPushMessage pushed, Endpoint endpoint) { 
     
    5661            AegisDatabinding databinding = new AegisDatabinding(); 
    5762 
    58             org.apache.cxf.aegis.AegisContext context = new org.apache.cxf.aegis.AegisContext(); 
     63            org.apache.cxf.aegis.AegisContext context = 
     64                    new org.apache.cxf.aegis.AegisContext(); 
    5965            context.setWriteXsiTypes(true); 
    6066 
     
    6268 
    6369            Set<String> overrides = new HashSet<String>(); 
    64             overrides.add(ShibbolethIdpAuthenticationEvent.class.getName()); 
    65             overrides.add(AuthenticationEvent.class.getName()); 
    66             overrides.add(EzproxyAuthenticationEvent.class.getName()); 
    67             overrides.add(OpenathenslaAuthenticationEvent.class.getName()); 
     70            for (Class<? extends Event> type : allowedClassTypes) { 
     71                overrides.add(type.getName()); 
     72            } 
    6873            databinding.setOverrideTypes(overrides); 
    6974 
     
    7378                    c = ClassLoaderUtils.loadClass(typeName, TypeUtil.class); 
    7479                } catch (ClassNotFoundException e) { 
    75                     throw new DatabindingException("Could not find override type class: " + typeName, e); 
     80                    throw new DatabindingException("Could not find override type class: " 
     81                            + typeName, e); 
    7682                } 
    7783                rootClasses.add(c); 
     
    9197 
    9298            if (getTlsParameters() != null) 
    93                 httpConduit.setTlsClientParameters(getTlsParameters().getTlsClientParameters()); 
     99                httpConduit.setTlsClientParameters(getTlsParameters() 
     100                        .getTlsClientParameters()); 
    94101 
    95102            log.debug("Accessing the endpoint version " + client.getVersion()); 
     
    99106            return true; 
    100107        } catch (SoapFault e) { 
    101             log.error("Could not send events to endpoint [{}]", endpoint.getServiceEndpoint(), e); 
     108            log.error("Could not send events to endpoint [{}]", 
     109                    endpoint.getServiceEndpoint(), e); 
    102110            return false; 
    103111        } catch (Exception e) { 
    104             log.error("Could not send events to endpoint [{}]", endpoint.getServiceEndpoint(), e); 
     112            log.error("Could not send events to endpoint [{}]", 
     113                    endpoint.getServiceEndpoint(), e); 
    105114            return false; 
    106115        } 
     
    122131    } 
    123132 
     133    /** 
     134     * @return Returns the allowedClassTypes. 
     135     */ 
     136    public List<Class<? extends Event>> getAllowedClassTypes() { 
     137        return allowedClassTypes; 
     138    } 
     139 
     140    /** 
     141     * @param allowedClassTypes The allowedClassTypes to set. 
     142     */ 
     143    public void setAllowedClassTypes(List<Class<? extends Event>> allowedClassTypes) { 
     144        this.allowedClassTypes = allowedClassTypes; 
     145    } 
     146 
    124147} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/policy/EntryNoElapsedTimePushPolicy.java

    r1176 r1445  
    3737 
    3838    /** Class logger. */ 
    39     private final Logger log = LoggerFactory.getLogger(EntryNoElapsedTimePushPolicy.class); 
     39    private final Logger log = LoggerFactory 
     40            .getLogger(EntryNoElapsedTimePushPolicy.class); 
    4041 
    4142    /** The time, in milliseconds, that this policy was last evaluated. */ 
     
    6465     *         than 0, false otherwise. 
    6566     */ 
     67    @Override 
    6668    public boolean evaluatePolicy(List<Event> events) { 
     69        log.trace("Push Policy has {} event(s) input", events.size()); 
    6770        long currentTime = System.currentTimeMillis(); 
    6871        if (pushOnOrAfterNoEntries <= events.size()) { 
     
    7174        } else { 
    7275            long difference = currentTime - lastReleasedTime; 
    73             log.trace("ElapsedTime difference {}, pushInterval {}", difference, pushInterval); 
     76            log.trace("ElapsedTime difference {}, pushInterval {}", difference, 
     77                    pushInterval); 
    7478            if (difference >= getPushInterval() && events.size() > 0) { 
    7579                log.trace("Elapsed time passed and {} events to send", events.size()); 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/store/dao/DefaultDataConnection.java

    r1046 r1445  
    4848    private static Logger log = LoggerFactory.getLogger(DefaultDataConnection.class); 
    4949 
     50    @Override 
    5051    public void save(Object object) throws DataAccessException { 
    5152        hibernateTemplate.saveOrUpdate(object); 
    5253    } 
    5354 
    54     public void saveAll(@SuppressWarnings("rawtypes") Collection collection) throws DataAccessException { 
     55    @Override 
     56    public void saveAll(@SuppressWarnings("rawtypes") Collection collection) 
     57            throws DataAccessException { 
    5558        hibernateTemplate.saveOrUpdateAll(collection); 
    5659    } 
    5760 
     61    @Override 
    5862    @SuppressWarnings("rawtypes") 
    5963    public List runQuery(String query, Object[] parameters) throws DataAccessException { 
     
    6165    } 
    6266 
     67    @Override 
    6368    public void runUpdate(String query, Object[] parameters) throws DataAccessException { 
    6469        hibernateTemplate.bulkUpdate(query, parameters); 
    6570    } 
    6671 
     72    @Override 
    6773    @SuppressWarnings("rawtypes") 
    68     public List runQuery(String query, Object[] parameters, int maxResultSize) throws DataAccessException { 
     74    public List runQuery(String query, Object[] parameters, int maxResultSize) 
     75            throws DataAccessException { 
    6976        hibernateTemplate.setMaxResults(maxResultSize); 
    7077        List result = hibernateTemplate.find(query, parameters); 
     
    8390     */ 
    8491    @SuppressWarnings("rawtypes") 
    85     public List runQueryPaged(final String query, final int pageSize, final int pageNumber) throws DataAccessException { 
     92    public List 
     93            runQueryPaged(final String query, final int pageSize, final int pageNumber) 
     94                    throws DataAccessException { 
    8695        HibernateTemplate template = getHibernateTemplate(); 
    8796        return template.executeFind(new HibernateCallback() { 
    88             public Object doInHibernate(Session session) throws HibernateException, SQLException { 
     97            @Override 
     98            public Object doInHibernate(Session session) throws HibernateException, 
     99                    SQLException { 
    89100                Query queryToRun = session.createQuery(query); 
    90101                queryToRun.setMaxResults(pageSize); 
     
    95106    } 
    96107 
    97     public Object runQueryUnique(String query, Object[] parameters) throws DataAccessException { 
    98         if (parameters != null) 
    99             log.trace("Query to db, {}, with params [{}]", query, Arrays.asList(parameters)); 
    100         Object object = DataAccessUtils.uniqueResult(getHibernateTemplate().find(query, parameters)); 
     108    @Override 
     109    public Object runQueryUnique(String query, Object[] parameters) 
     110            throws DataAccessException { 
     111        if (parameters != null) { 
     112            log.trace("Query to database, {}, with params [{}]", query, 
     113                    Arrays.asList(parameters)); 
     114        } else { 
     115            log.trace("Query to database, {}]", query); 
     116        } 
     117        Object object = 
     118                DataAccessUtils.uniqueResult(getHibernateTemplate().find(query, 
     119                        parameters)); 
    101120        return object; 
    102121    } 
Note: See TracChangeset for help on using the changeset viewer.