Changeset 808 for raptor-client


Ignore:
Timestamp:
05/16/11 00:22:54 (9 years ago)
Author:
philsmart
Message:
 
Location:
raptor-client/trunk
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • raptor-client/trunk/pom.xml

    r783 r808  
    176176 
    177177        <!--  Spring ORM and Hibernate for the DAO --> 
    178         <dependency> 
     178     <!--    <dependency> 
    179179            <groupId>hibernate</groupId> 
    180180            <artifactId>hibernate</artifactId> 
    181             <version>3.1rc2</version> 
    182         </dependency> 
    183  
     181            <version>3.1.3</version> 
     182        </dependency> 
     183 --> 
    184184 
    185185        <dependency> 
     
    193193                <artifactId>commons-pool</artifactId> 
    194194                <version>1.5.6</version> 
     195        </dependency> 
     196        <dependency> 
     197                <groupId>org.hibernate</groupId> 
     198                <artifactId>hibernate</artifactId> 
     199                <version>3.2.7.ga</version> 
    195200        </dependency> 
    196201    </dependencies> 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/event/expansion/AttributeAssociationEngine.java

    r802 r808  
    6262 
    6363            int attached=0; 
    64             int noPrincipal=0; 
     64            int failedToAssociate=0; 
    6565            int current=0; 
    6666            final int noOfEvents = events.size(); 
     
    7272                } 
    7373                else{ 
    74                     noPrincipal++; 
     74                        failedToAssociate++; 
    7575                } 
    7676                current++; 
    7777            } 
    78             log.info("Attribute Association Definition {} finished, associated information to {} events, where {} events where not of a valid class type or did not have the correct principal", 
    79                     new Object[]{attributeAssociationDefinition.getDefiniationName(),attached,noPrincipal}); 
     78            log.info("Attribute Association Definition {} finished, associated information to {} events, where {} events had no attributes associated", 
     79                    new Object[]{attributeAssociationDefinition.getDefiniationName(),attached,failedToAssociate}); 
    8080        } 
    8181 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/event/expansion/ResourceCategoryAttributeAssociationDefinition.java

    r802 r808  
    4343    private final Logger log = LoggerFactory.getLogger(ResourceCategoryAttributeAssociationDefinition.class); 
    4444 
    45  
    46     private List<AttributeLookup> lookupAttributes; 
    47  
    4845    /** The data connector used to acquire the attributes*/ 
    4946    private RaptorDataConnection dataConnection; 
     
    5956     */ 
    6057    public boolean associate(Event event) { 
    61  
     58     
    6259       ResourceMetadata resourceMetadata = null; 
    6360       Object result =  dataConnection.runQueryUnique("from ResourceMetadata where resourceId=?", new Object[]{event.getResourceId()}); 
     
    7774           resourceNew.setInternal(false); 
    7875           resourceNew.setResourceId(event.getResourceId()); 
     76           event.setResourceIdCategory(2); 
    7977           try{ 
    8078               dataConnection.save(resourceNew); 
     
    8886 
    8987    } 
    90  
    91  
    92     /** 
    93      * @param lookupAttributes the lookupAttributes to set 
    94      */ 
    95     public void setLookupAttributes(List<AttributeLookup> lookupAttributes) { 
    96         this.lookupAttributes = lookupAttributes; 
    97     } 
    98  
    99     /** 
    100      * @return the lookupAttributes 
    101      */ 
    102     public List<AttributeLookup> getLookupAttributes() { 
    103         return lookupAttributes; 
    104     } 
    105  
    10688 
    10789 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/server/sei/MultiUnitAggregator.java

    r736 r808  
    2828import uk.ac.cardiff.model.AdministrativeFunction; 
    2929import uk.ac.cardiff.model.report.AggregatorGraphModel; 
     30import uk.ac.cardiff.model.resource.ResourceMetadata; 
    3031import uk.ac.cardiff.model.wsmodel.Capabilities; 
    3132import uk.ac.cardiff.model.wsmodel.EventPushMessage; 
     
    4445 
    4546        public String getVersion(); 
    46  
    4747 
    4848        public Capabilities getCapabilities(); 
     
    6969        public List<LogFileUploadResult>  batchUpload(List<LogFileUpload> uploadFiles); 
    7070 
     71 
     72        public void saveResourceMetadata(List<ResourceMetadata> resourceMetadata); 
     73 
    7174} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/store/EntryHandler.java

    r790 r808  
    2222package uk.ac.cardiff.raptor.store; 
    2323 
     24import java.util.Collection; 
    2425import java.util.List; 
    2526import java.util.Set; 
    2627 
     28import org.hibernate.exception.DataException; 
    2729import org.joda.time.DateTime; 
    2830 
     
    6769         */ 
    6870        public void removeAllEntries(); 
    69  
     71         
     72        public void update(String query, Object[] parameters) throws StorageException; 
    7073 
    7174        /** 
     
    9598         */ 
    9699        public List query(String query, Object[] parameters, int maxNoResults); 
    97  
     100         
     101        public void save(Object object) throws StorageException; 
     102         
     103        public void saveAll(Collection object) throws StorageException; 
    98104        /** 
    99105         * 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/store/dao/DefaultDataConnection.java

    r775 r808  
    5050        } 
    5151 
    52         public List runQuery(String query, Object[] parameters) { 
     52        public List runQuery(String query, Object[] parameters)  throws DataAccessException{ 
    5353                return hibernateTemplate.find(query, parameters); 
     54        } 
     55         
     56        public void runUpdate(String query, Object[] parameters) throws DataAccessException{ 
     57                hibernateTemplate.bulkUpdate(query,parameters); 
    5458        } 
    5559 
     
    6165        } 
    6266 
    63         public Object runQueryUnique(String query, Object[] parameters) { 
     67        public Object runQueryUnique(String query, Object[] parameters)  throws DataAccessException{ 
    6468                if (parameters!=null) 
    6569                        log.trace("Query to db, {}, with params [{}]",query,Arrays.asList(parameters)); 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/store/dao/RaptorDataConnection.java

    r775 r808  
    3232public interface RaptorDataConnection { 
    3333 
    34         public List runQuery(String query, Object[] parameters); 
    35         public Object runQueryUnique(String query, Object[] parameters); 
     34        public List runQuery(String query, Object[] parameters)  throws DataAccessException; 
     35        public Object runQueryUnique(String query, Object[] parameters)  throws DataAccessException; 
    3636        public void save(Object object) throws DataAccessException; 
    3737        public void deleteAllEntries(Collection entries) throws DataAccessException; 
    3838        public void saveAll(Collection collection) throws DataAccessException; 
    3939        public List runQuery(String query, Object[] parameters, int maxResultSize)throws DataAccessException; 
     40        public void runUpdate(String query, Object[] parameters)  throws DataAccessException; 
    4041 
    4142 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/store/impl/LogFileMemoryEntryHandler.java

    r796 r808  
    2525 
    2626import java.util.ArrayList; 
    27 import java.util.Iterator; 
    2827import java.util.LinkedHashSet; 
    2928import java.util.List; 
     
    3130 
    3231import uk.ac.cardiff.model.event.Event; 
    33 import uk.ac.cardiff.model.event.ShibbolethIdpAuthenticationEvent; 
    3432import uk.ac.cardiff.raptor.runtimeutils.ReflectionHelper; 
    35 import uk.ac.cardiff.raptor.store.EntryHandler; 
     33import uk.ac.cardiff.raptor.store.IncrementalEntryHandler; 
    3634 
    3735import org.joda.time.DateTime; 
     
    3937import org.slf4j.LoggerFactory; 
    4038 
    41 public class LogFileMemoryEntryHandler implements EntryHandler { 
     39public class LogFileMemoryEntryHandler implements IncrementalEntryHandler { 
    4240 
    4341        /** Class logger */ 
     
    105103 
    106104        } 
     105         
     106        public void reset() { 
     107                entries.clear(); 
     108                latestEqualEntries.clear(); 
     109                latestEntryTime = null;  
     110        } 
    107111 
    108112        /** 
     
    220224        } 
    221225 
    222         /** 
    223          * This is a no-op method for all in-memory entry handlers 
    224          */ 
    225         public List query(String query) { 
    226                 return null; 
    227         } 
    228  
    229         /** 
    230          * This is a no-op method for all in-memory entry handlers 
    231          */ 
    232         public Object queryUnique(String query) { 
    233                 return null; 
    234         } 
    235  
    236         /** 
    237          * This is a no-op method for all in-memory entry handlers 
    238          */ 
    239         public Object queryUnique(String query, Object[] parameters) { 
    240                 return null; 
    241         } 
    242226 
    243227        public void setEntries(Set<Event> entries) { 
     
    246230        } 
    247231 
    248         /** 
    249          * This is a no-op method for all in-memory entry handlers 
    250          */ 
    251         public List query(String query, Object[] parameters) { 
    252                 return null; 
    253         } 
    254  
    255         /** 
    256          * This is a no-op method for all in-memory entry handlers 
    257          */ 
    258         public List query(String query, Object[] parameters, int maxNoResults) { 
    259                 return null; 
    260         } 
     232 
    261233 
    262234} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/store/impl/MemoryEntryHandler.java

    r796 r808  
    2525 
    2626import java.util.ArrayList; 
     27import java.util.Collection; 
    2728import java.util.HashMap; 
    2829import java.util.LinkedHashSet; 
     
    222223        } 
    223224 
     225        /** 
     226         * This is a no-op method for all in-memory entry handlers 
     227         */ 
     228        public void save(Object object) { 
     229                 
     230        } 
     231 
     232        /** 
     233         * This is a no-op method for all in-memory entry handlers 
     234         */ 
     235        public void saveAll(Collection object) { 
     236                 
     237        } 
     238 
     239        /** 
     240         * This is a no-op method for all in-memory entry handlers 
     241         */ 
     242        public void update(String query, Object[] parameters) { 
     243                 
     244        } 
     245 
    224246} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/store/impl/PersistantEntryHandler.java

    r802 r808  
    2121import java.util.ArrayList; 
    2222import java.util.Arrays; 
     23import java.util.Collection; 
    2324import java.util.Date; 
    2425import java.util.HashSet; 
     
    3233import java.util.concurrent.FutureTask; 
    3334 
     35import org.hibernate.exception.DataException; 
    3436import org.jaxen.function.LastFunction; 
    3537import org.joda.time.DateTime; 
     
    106108        } 
    107109 
     110        public void update(String query, Object[] parameters) throws StorageException{ 
     111                try{ 
     112                        dataConnection.runUpdate(query, parameters); 
     113                } 
     114                catch(DataAccessException e){ 
     115                        throw new StorageException("Could not perform entry handler update",e); 
     116                } 
     117        } 
    108118 
    109119        public List query(String query, Object[] parameters, int maxNoResults) { 
    110120              return dataConnection.runQuery(query, parameters, maxNoResults); 
     121        } 
     122         
     123        public void save(Object object) throws StorageException { 
     124                try{ 
     125                        dataConnection.save(object); 
     126                } 
     127                catch (DataException e){ 
     128                        throw new StorageException("Could not save object",e); 
     129                } 
     130        } 
     131 
     132        public void saveAll(Collection object) throws StorageException { 
     133                try{ 
     134                        dataConnection.saveAll(object); 
     135                } 
     136                catch (DataException e){ 
     137                        throw new StorageException("Could not save collection",e); 
     138                }        
    111139        } 
    112140 
     
    208236        } 
    209237 
    210  
    211  
    212  
    213  
    214  
    215238} 
Note: See TracChangeset for help on using the changeset viewer.