Changeset 807
- Timestamp:
- 05/16/11 00:22:45 (2 years ago)
- Location:
- raptor-mua/trunk
- Files:
-
- 10 added
- 28 edited
- 1 moved
-
.classpath (modified) (1 diff)
-
.settings/org.eclipse.jdt.core.prefs (modified) (1 diff)
-
.settings/org.eclipse.wst.common.component (modified) (1 diff)
-
pom.xml (modified) (3 diffs)
-
src/main/bin (added)
-
src/main/bin/raptormuad (added)
-
src/main/config/attribute-association.xml (modified) (2 diffs)
-
src/main/config/batch-event-parse.xml (modified) (1 diff)
-
src/main/config/database.xml (modified) (2 diffs)
-
src/main/config/logging.xml (modified) (4 diffs)
-
src/main/config/mua-core.xml (modified) (3 diffs)
-
src/main/config/statistical-units-system.xml (modified) (6 diffs)
-
src/main/config/statistical-units.xml (modified) (4 diffs)
-
src/main/data (added)
-
src/main/java/uk/ac/cardiff/raptormua/engine/MUAEngine.java (modified) (5 diffs)
-
src/main/java/uk/ac/cardiff/raptormua/engine/classification (added)
-
src/main/java/uk/ac/cardiff/raptormua/engine/classification/ResourceClassificationBackgroundService.java (moved) (moved from raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/BackgroundServices.java) (2 diffs)
-
src/main/java/uk/ac/cardiff/raptormua/engine/classification/SaveAndApplyResourceClassificationCallbackInterface.java (added)
-
src/main/java/uk/ac/cardiff/raptormua/engine/classification/SaveAndApplyResourceClassificationTask.java (added)
-
src/main/java/uk/ac/cardiff/raptormua/engine/statistics/CutRowsPostProcessor.java (modified) (1 diff)
-
src/main/java/uk/ac/cardiff/raptormua/engine/statistics/NumberFormatterPostProcessor.java (modified) (1 diff)
-
src/main/java/uk/ac/cardiff/raptormua/engine/statistics/PercentagePostProcessor.java (modified) (2 diffs)
-
src/main/java/uk/ac/cardiff/raptormua/engine/statistics/RowSortPostProcessor.java (modified) (2 diffs)
-
src/main/java/uk/ac/cardiff/raptormua/engine/statistics/ShibbolethMetadataNameFormatter.java (modified) (2 diffs)
-
src/main/java/uk/ac/cardiff/raptormua/engine/statistics/SortGroupsAlphabeticallyPostProcessor.java (added)
-
src/main/java/uk/ac/cardiff/raptormua/engine/statistics/Statistic.java (modified) (4 diffs)
-
src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/CountEntry.java (modified) (2 diffs)
-
src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/CountEntryPerInterval.java (modified) (2 diffs)
-
src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/GroupBy.java (modified) (2 diffs)
-
src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/GroupByCountDistinct.java (modified) (1 diff)
-
src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/GroupByFrequency.java (modified) (1 diff)
-
src/main/java/uk/ac/cardiff/raptormua/engine/statistics/helper/ObservationComparator.java (modified) (1 diff)
-
src/main/java/uk/ac/cardiff/raptormua/engine/statistics/helper/StringGroupComparator.java (added)
-
src/main/java/uk/ac/cardiff/raptormua/service/MUAProcess.java (modified) (2 diffs)
-
src/main/java/uk/ac/cardiff/raptormua/service/impl/MUAProcessImpl.java (modified) (10 diffs)
-
src/main/java/uk/ac/cardiff/raptormua/wsinterface/impl/MultiUnitAggregatorImpl.java (modified) (6 diffs)
-
src/main/keys (added)
-
src/main/keys/authorised-keys.jks (added)
-
src/main/resources/package.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
raptor-mua/trunk/.classpath
r635 r807 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <classpath> 3 <classpathentry kind="src" path="src/main/java"/> 4 <classpathentry kind="src" path="src/main/resources"/> 5 <classpathentry kind="src" output="target/conf" path="src/main/config"/> 6 <classpathentry kind="src" path="src/test/java/"/> 7 <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"> 8 <attributes> 9 <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> 10 </attributes> 11 </classpathentry> 12 <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/> 13 <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> 14 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"> 15 <attributes> 16 <attribute name="owner.project.facets" value="jst.java"/> 17 </attributes> 18 </classpathentry> 19 <classpathentry kind="output" path="target/classes"/> 20 3 <classpathentry kind="src" path="src/main/java"/> 4 <classpathentry kind="src" path="src/main/resources"/> 5 <classpathentry kind="src" output="target/conf" path="src/main/config"/> 6 <classpathentry kind="src" path="src/test/java"/> 7 <classpathentry kind="src" output="target/data" path="src/main/data"/> 8 <classpathentry kind="src" output="target/keys" path="src/main/keys"/> 9 <classpathentry kind="src" output="target/bin" path="src/main/bin"/> 10 <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"> 11 <attributes> 12 <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> 13 </attributes> 14 </classpathentry> 15 <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/> 16 <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> 17 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"> 18 <attributes> 19 <attribute name="owner.project.facets" value="jst.java"/> 20 </attributes> 21 </classpathentry> 22 <classpathentry kind="output" path="target/classes"/> 21 23 </classpath> -
raptor-mua/trunk/.settings/org.eclipse.jdt.core.prefs
r363 r807 1 # Thu Jul 15 16:12:11 BST 20101 #Sun May 15 15:43:02 BST 2011 2 2 eclipse.preferences.version=1 3 3 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -
raptor-mua/trunk/.settings/org.eclipse.wst.common.component
r733 r807 7 7 <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/config"/> 8 8 <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/> 9 <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/data"/> 10 <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/keys"/> 11 <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/bin"/> 9 12 <dependent-module deploy-path="/WEB-INF/lib" handle="module:/resource/raptor-parse/raptor-parse"> 10 13 <dependency-type>uses</dependency-type> -
raptor-mua/trunk/pom.xml
r760 r807 212 212 <artifactId>jetty</artifactId> 213 213 <groupId>org.mortbay.jetty</groupId> 214 </exclusion> 215 <exclusion> 216 <artifactId>hibernate</artifactId> 217 <groupId>org.hibernate</groupId> 214 218 </exclusion> 215 219 </exclusions> … … 365 369 <artifactId>maven-compiler-plugin</artifactId> 366 370 <configuration> 367 <source>1. 6</source>368 <target>1. 6</target>371 <source>1.5</source> 372 <target>1.5</target> 369 373 </configuration> 370 374 </plugin> … … 390 394 <artifactId>maven-jar-plugin</artifactId> 391 395 <configuration> 392 <finalName>raptor-mua -${project.version}</finalName>396 <finalName>raptor-mua</finalName> 393 397 <archive> 394 398 <manifest> -
raptor-mua/trunk/src/main/config/attribute-association.xml
r799 r807 16 16 <ref bean="shibPrincipalAttributeAssociationDefinition"/> 17 17 <ref bean="ezproxyPrincipalAttributeAssociationDefinition"/> 18 <ref bean="shibResourceCategoryAttributeAssociationDefinition"/> 18 19 </list> 19 20 </property> … … 22 23 <!-- Association policies to mark resources as internal or external --> 23 24 <bean id="shibResourceCategoryAttributeAssociationDefinition" class="uk.ac.cardiff.raptor.event.expansion.ResourceCategoryAttributeAssociationDefinition"> 24 <property name="definiationName"><value>Shib AssociationDefinition</value></property>25 <property name="definiationName"><value>Shib Resource Category Definition</value></property> 25 26 <property name="dataConnection"><ref bean="dataConnectionImpl"/></property> 26 27 <property name="enabled"><value>true</value></property> -
raptor-mua/trunk/src/main/config/batch-event-parse.xml
r787 r807 102 102 103 103 <!-- Create the entry handler --> 104 <bean name="memoryEntryHandler" class="uk.ac.cardiff.raptor.store.impl. MemoryEntryHandler"></bean>104 <bean name="memoryEntryHandler" class="uk.ac.cardiff.raptor.store.impl.LogFileMemoryEntryHandler"></bean> 105 105 106 106 <!-- -
raptor-mua/trunk/src/main/config/database.xml
r799 r807 22 22 <property name="hibernateProperties"> 23 23 <props> 24 <prop key="hibernate.dialect"> org.hibernate.dialect.PostgreSQLDialect</prop>25 <!--<prop key="hibernate.dialect"> org.hibernate.dialect.HSQLDialect</prop>26 --><prop key="hibernate.show_sql">false</prop>24 <prop key="hibernate.dialect"> org.hibernate.dialect.PostgreSQLDialect</prop> 25 <!--<prop key="hibernate.dialect"> org.hibernate.dialect.HSQLDialect</prop>--> 26 <prop key="hibernate.show_sql">false</prop> 27 27 <prop key="hibernate.hbm2ddl.auto">update</prop> 28 28 </props> … … 77 77 </property> 78 78 <property name="jdbcUrl"> 79 <value>jdbc:hsqldb:file:data/mua- init;hsqldb.default_table_type=cached</value>79 <value>jdbc:hsqldb:file:data/mua-two;hsqldb.default_table_type=cached</value> 80 80 </property> 81 81 <property name="user"> -
raptor-mua/trunk/src/main/config/logging.xml
r787 r807 20 20 <configuration> 21 21 22 <property name=" USER_HOME" value="/tmp/" />22 <property name="LOG_HOME" value="/tmp/" /> 23 23 24 24 <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"> … … 29 29 30 30 <appender name="FILE" class="ch.qos.logback.core.FileAppender"> 31 <file>${ USER_HOME}/raptor-mua-process.log</file>31 <file>${LOG_HOME}/raptor-mua-process.log</file> 32 32 <encoder> 33 33 <pattern>%5p %d \(%C{3}:%L\) ---> %m%n</pattern> … … 38 38 <appender-ref ref="stdout"/> 39 39 </logger> 40 <logger name="uk " level="DEBUG">40 <logger name="uk.ac.cardiff" level="DEBUG"> 41 41 <appender-ref ref="stdout"/> 42 42 <appender-ref ref="FILE"/> … … 44 44 <logger name="org.mortbay" level="INFO"> 45 45 <appender-ref ref="stdout"/> 46 <appender-ref ref="FILE"/> 46 47 </logger> 47 48 <logger name="org.hibernate" level="ERROR"> 48 49 <appender-ref ref="stdout"/> 50 <appender-ref ref="FILE"/> 49 51 </logger> 50 52 -
raptor-mua/trunk/src/main/config/mua-core.xml
r799 r807 80 80 <ref bean="MUAEngine"></ref> 81 81 </property> 82 <property name="backgroundServices">83 <ref bean="backgroundServices"/>84 </property>85 82 </bean> 86 83 … … 132 129 </bean> 133 130 134 <!-- release trigger setup -->135 <bean id="muaResourceClassificationQuickTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">136 <property name="jobDetail">137 <ref local="muaResourceClassificationJobDetail" />138 </property>139 <property name="startDelay" value="5000" />140 <property name="repeatInterval" value="100000" />141 </bean>142 143 <bean id="muaResourceClassificationJobDetail"144 class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">145 <property name="targetObject">146 <ref bean="MUAProcess" />147 </property>148 <property name="targetMethod">149 <value>resourceClassification</value>150 </property>151 <property name="concurrent">152 <value>false</value>153 </property>154 </bean>155 156 131 <!-- Trigger setup --> 157 132 <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> 158 133 <property name="triggers"> 159 134 <list> 160 <ref local="muaReleaseQuickTrigger" /> 161 <ref local="muaResourceClassificationQuickTrigger"/> 135 <ref local="muaReleaseQuickTrigger" /> 162 136 </list> 163 137 </property> … … 172 146 173 147 174 <!-- Class to handle processing of background services -->175 <bean name="backgroundServices" class="uk.ac.cardiff.raptormua.engine.BackgroundServices">176 <property name="dataConnection"><ref bean="dataConnectionImpl"></ref></property>177 </bean>178 148 179 149 <bean name="persistantEntryHandler" class="uk.ac.cardiff.raptor.store.impl.PersistantEntryHandler"> -
raptor-mua/trunk/src/main/config/statistical-units-system.xml
r697 r807 29 29 <bean class="uk.ac.cardiff.model.wsmodel.StatisticParameters"> 30 30 <property name="statisticType"><value>System</value></property> 31 <property name="resourceCategory"><value>EXTERNAL</value></property> 31 32 <property name="unitName"><value>numberOfAuthenticationsPer</value></property> 32 33 <property name="methodParams"> … … 62 63 <bean class="uk.ac.cardiff.model.wsmodel.StatisticParameters"> 63 64 <property name="statisticType"><value>System</value></property> 65 <property name="resourceCategory"><value>EXTERNAL</value></property> 64 66 <property name="unitName"><value>numberOfUnqiueUsersPer</value></property> 65 67 <property name="methodParams"> … … 94 96 <bean class="uk.ac.cardiff.model.wsmodel.StatisticParameters"> 95 97 <property name="statisticType"><value>System</value></property> 98 <property name="resourceCategory"><value>EXTERNAL</value></property> 96 99 <property name="unitName"><value>numberOfAuthenticationsPerIntervalNumber</value></property> 97 100 <property name="methodParams"> … … 127 130 <bean class="uk.ac.cardiff.model.wsmodel.StatisticParameters"> 128 131 <property name="statisticType"><value>System</value></property> 132 <property name="resourceCategory"><value>EXTERNAL</value></property> 129 133 <property name="unitName"><value>top5Resources</value></property> 130 134 <property name="methodParams"> … … 167 171 <bean class="uk.ac.cardiff.model.wsmodel.StatisticParameters"> 168 172 <property name="statisticType"><value>System</value></property> 173 <property name="resourceCategory"><value>EXTERNAL</value></property> 169 174 <property name="unitName"><value>numberOfUniqueAuthenticationsPerSP</value></property> 170 175 <property name="methodParams"> … … 211 216 <bean class="uk.ac.cardiff.model.wsmodel.StatisticParameters"> 212 217 <property name="statisticType"><value>System</value></property> 218 <property name="resourceCategory"><value>EXTERNAL</value></property> 213 219 <property name="unitName"><value>bottom5Resources</value></property> 214 220 <property name="methodParams"> -
raptor-mua/trunk/src/main/config/statistical-units.xml
r746 r807 159 159 </bean> 160 160 </property> 161 <property name="postprocessor"> 162 <list> 163 <ref bean="groupNameSort"></ref> 164 </list> 165 </property> 161 166 </bean> 162 167 … … 263 268 </bean> 264 269 </property> 270 <property name="postprocessor"> 271 <list> 272 <ref bean="groupNameSort"></ref> 273 </list> 274 </property> 265 275 </bean> 266 276 … … 299 309 </bean> 300 310 </property> 311 <property name="postprocessor"> 312 <list> 313 <ref bean="groupNameSort"></ref> 314 </list> 315 </property> 301 316 </bean> 302 317 … … 305 320 <bean id="percentagePost" class = "uk.ac.cardiff.raptormua.engine.statistics.PercentagePostProcessor"> 306 321 </bean> 322 323 <bean id="groupNameSort" class = "uk.ac.cardiff.raptormua.engine.statistics.SortGroupsAlphabeticallyPostProcessor"> 324 </bean> 307 325 308 326 <bean id="ShibbolethMetadataNameFormatter" class = "uk.ac.cardiff.raptormua.engine.statistics.ShibbolethMetadataNameFormatter"> -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/MUAEngine.java
r799 r807 30 30 import uk.ac.cardiff.model.event.Event; 31 31 import uk.ac.cardiff.model.report.AggregatorGraphModel; 32 import uk.ac.cardiff.model.resource.ResourceMetadata; 32 33 import uk.ac.cardiff.model.wsmodel.Capabilities; 33 34 import uk.ac.cardiff.model.wsmodel.EventPushMessage; … … 44 45 import uk.ac.cardiff.raptor.remoting.client.ReleaseFailureException; 45 46 import uk.ac.cardiff.raptor.runtimeutils.ReflectionHelper; 47 import uk.ac.cardiff.raptor.store.EntryHandler; 46 48 import uk.ac.cardiff.raptor.store.StorageEngine; 47 49 import uk.ac.cardiff.raptor.store.TransactionInProgressException; 50 import uk.ac.cardiff.raptormua.engine.classification.ResourceClassificationBackgroundService; 48 51 import uk.ac.cardiff.raptormua.engine.statistics.Statistic; 49 52 import uk.ac.cardiff.raptormua.engine.statistics.StatisticsHandler; … … 176 179 capabilities.setSuggestionValues(suggestionValues); 177 180 capabilities.setNumberOfAuthenticationsStored(storageEngine.getEntryHandler().getNumberOfEntries()); 181 182 //set resource metadata 183 List<ResourceMetadata> resourceMetadata = (List<ResourceMetadata>) storageEngine.getEntryHandler().query("from ResourceMetadata"); 184 log.debug("Setting {} resource metadata",resourceMetadata.size()); 185 capabilities.setResourceMetadata(resourceMetadata); 178 186 179 187 ArrayList<StatisticalUnitInformation> stats = new ArrayList(); … … 227 235 parser.parse(logfileUpload.getData()); 228 236 allEvents.addAll(parser.getEntryHandler().getEntries()); 229 parser.re moveAllEntries();237 parser.reset(); 230 238 result.setStatus("Parsed On the MUA"); 231 239 result.setProcessed(true); … … 259 267 statisticsHandler.updateStatisticalUnit(statisticalUnitInformation); 260 268 269 } 270 271 public void saveAndApplyResourceClassification(List<ResourceMetadata> resourceMetadata){ 272 ResourceClassificationBackgroundService backgroundService = new ResourceClassificationBackgroundService(storageEngine.getEntryHandler()); 273 backgroundService.saveResourceMetadataAndApplyAsync(resourceMetadata); 261 274 } 262 275 -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/classification/ResourceClassificationBackgroundService.java
r802 r807 1 /** 2 * Copyright (C) 2010 Cardiff University, Wales <smartp@cf.ac.uk> 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 1 16 /** 2 17 * 3 18 */ 4 package uk.ac.cardiff.raptormua.engine ;19 package uk.ac.cardiff.raptormua.engine.classification; 5 20 6 21 import java.util.List; 22 import java.util.concurrent.ExecutorService; 23 import java.util.concurrent.Executors; 7 24 8 25 import org.slf4j.Logger; … … 12 29 import uk.ac.cardiff.model.event.Event; 13 30 import uk.ac.cardiff.model.resource.ResourceMetadata; 14 import uk.ac.cardiff.raptor.store. dao.RaptorDataConnection;31 import uk.ac.cardiff.raptor.store.EntryHandler; 15 32 16 33 /** 17 * All background services that work directly off the database store.18 * Is not abstracted through the storage engine or entry handler, so changing19 * the persistence layer may break the functions of this class.20 34 * 21 35 * @author philsmart 22 36 * 23 37 */ 24 public class BackgroundServices{38 public class ResourceClassificationBackgroundService implements SaveAndApplyResourceClassificationCallbackInterface{ 25 39 26 40 /** Class logger. */ 27 private final Logger log = LoggerFactory.getLogger( BackgroundServices.class);41 private final Logger log = LoggerFactory.getLogger(ResourceClassificationBackgroundService.class); 28 42 29 43 /** The MUA's data connection */ 30 private RaptorDataConnection dataConnection; 44 private EntryHandler entryHandler; 45 46 /** The ID of the currently executing service */ 47 private int currentExecutionId; 48 49 50 public ResourceClassificationBackgroundService(EntryHandler entryHandler){ 51 this.entryHandler = entryHandler; 52 } 53 54 55 public void callback(Object result) { 56 log.debug("Resource Classification task completed {}, for transaction id [{}]",result, currentExecutionId); 57 58 } 31 59 32 60 33 public void resourceClassification(){ 34 List<String> uniqueResource = (List<String>) dataConnection.runQuery("select resourceId from Event group by resourceId",null); 35 List<ResourceMetadata> resourceClassification = (List<ResourceMetadata>) dataConnection.runQuery("from ResourceMetadata",null); 61 62 public void saveResourceMetadataAndApplyAsync(List<ResourceMetadata> resourceMetadata) { 63 currentExecutionId = (int)(Math.random()*100000); 64 log.info("Resource classification thread started, for transaction id [{}]",currentExecutionId); 65 SaveAndApplyResourceClassificationTask storeEntryTask = new SaveAndApplyResourceClassificationTask(entryHandler,resourceMetadata,this); 66 ExecutorService es = Executors.newSingleThreadExecutor(); 67 es.submit(storeEntryTask); 68 es.shutdown(); 69 70 } 36 71 37 72 38 for (String resourceId : uniqueResource){39 boolean resourceExists=false;40 for (ResourceMetadata resource : resourceClassification){41 if (resource.getResourceId().equals(resourceId)){42 resourceExists = true;43 }44 }45 if (!resourceExists){46 ResourceMetadata resourceMetadata = new ResourceMetadata();47 resourceMetadata.setResourceId(resourceId);48 resourceMetadata.setExternal(true);49 resourceMetadata.setInternal(false);50 resourceClassification.add(resourceMetadata);51 }52 73 53 54 }55 log.debug("Background Service has created or ammended {} resourceId classifications",resourceClassification.size());56 try{57 dataConnection.saveAll(resourceClassification);58 }59 catch(DataAccessException e){60 log.error("Resource Classification Saving Error",e);61 }62 63 //sets those that are not set. Does not change existing events64 try{65 List<Event> eventsNotClassified = (List<Event>) dataConnection.runQuery("from Event where resourceIdCategory=0", null);66 67 log.debug("Background Resource Classification Service is appending classifications to {} events",eventsNotClassified.size());68 for (Event event : eventsNotClassified){69 for (ResourceMetadata resource : resourceClassification){70 if (event.getResourceId().equals(resource.getResourceId())){71 if (resource.isExternal()){72 event.setResourceIdCategory(2);73 }74 else if (resource.isInternal()){75 event.setResourceIdCategory(1);76 }77 }78 79 }80 }81 dataConnection.saveAll(eventsNotClassified);82 log.debug("Finished adding event classifications");83 }84 catch(DataAccessException e){85 log.error("Error adding event classifications to events without existing classification",e);86 }87 88 89 }90 91 92 /**93 * @param dataConnection the dataConnection to set94 */95 public void setDataConnection(RaptorDataConnection dataConnection) {96 this.dataConnection = dataConnection;97 }98 99 100 /**101 * @return the dataConnection102 */103 public RaptorDataConnection getDataConnection() {104 return dataConnection;105 }106 74 107 75 -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/CutRowsPostProcessor.java
r619 r807 52 52 * @see uk.ac.cardiff.raptormua.engine.statistics.StatisticsPostProcessor#postProcess(uk.ac.cardiff.raptormua.engine.statistics.records.Observation[]) 53 53 */ 54 @Override 54 55 55 public Observation[] postProcess(Observation[] observations) throws PostprocessorException { 56 56 log.debug("Entries into postprocessor: " + observations.length); -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/NumberFormatterPostProcessor.java
r619 r807 52 52 * @see uk.ac.cardiff.raptormua.engine.statistics.StatisticsPostProcessor#postProcess(uk.ac.cardiff.raptormua.engine.statistics.records.Observation[]) 53 53 */ 54 @Override55 54 public Observation[] postProcess(Observation[] observations) throws PostprocessorException { 56 55 log.debug("Entries into postprocessor: "+observations.length); -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/PercentagePostProcessor.java
r683 r807 38 38 39 39 40 /* 40 /** 41 41 * <p> performs all actions directly ('live') on the input object, and passes that back as a reference 42 42 * to conform with the <code>StatisticsPostProcessor</code> interface </p> … … 45 45 * @see uk.ac.cardiff.raptormua.engine.statistics.StatisticsPostProcessor#postProcess(uk.ac.cardiff.raptormua.engine.statistics.records.Observation[]) 46 46 */ 47 @Override48 47 public Observation[] postProcess(Observation[] observations) throws PostprocessorException { 49 48 log.debug("Entries into postprocessor: "+observations.length); -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/RowSortPostProcessor.java
r683 r807 47 47 48 48 49 /* 49 /** 50 50 * <p> performs all actions directly ('live') on the input object, and passes that back as a reference 51 51 * to conform with the <code>StatisticsPostProcessor</code> interface </p> … … 54 54 * @see uk.ac.cardiff.raptormua.engine.statistics.StatisticsPostProcessor#postProcess(uk.ac.cardiff.raptormua.engine.statistics.records.Observation[]) 55 55 */ 56 @Override57 56 public Observation[] postProcess(Observation[] observations) throws PostprocessorException { 58 57 log.debug("Entries into postprocessor: "+observations.length); -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/ShibbolethMetadataNameFormatter.java
r489 r807 47 47 protected static BasicParserPool parser; 48 48 49 /* use SAML metadata off the filesystem */49 /** use SAML metadata off the filesystem */ 50 50 private FilesystemMetadataProvider provider; 51 51 52 /* class logger */53 staticLogger log = LoggerFactory.getLogger(ShibbolethMetadataNameFormatter.class);52 /** class logger */ 53 private final Logger log = LoggerFactory.getLogger(ShibbolethMetadataNameFormatter.class); 54 54 55 55 /** this is not a proper URI at the moment, just a UNC path */ … … 70 70 71 71 72 @Override73 72 public Observation[] postProcess(Observation[] observations) throws PostprocessorException { 74 73 log.debug("Entries into postprocessor: {}",observations.length); -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/Statistic.java
r746 r807 54 54 private final Logger log = LoggerFactory.getLogger(Statistic.class); 55 55 56 /** The <code>EntryHandler</code> that allows access to all <code>Event</code>s this 57 * statistic works off. 58 */ 56 59 private EntryHandler entryHandler; 57 60 61 /** The parameters used to configure this statistic*/ 58 62 protected StatisticParameters statisticParameters; 59 63 … … 64 68 private List<StatisticsPostProcessor> postprocessor; 65 69 70 /** After each statistic has been invoked, the results of each series 71 * are stored as <code>ObservationSeries</code> in this list. 72 */ 66 73 private List<ObservationSeries> observationSeries; 67 74 75 /** 76 * Default constructor. 77 */ 68 78 public Statistic() { 69 79 setObservationSeries(new ArrayList<ObservationSeries>()); 70 80 } 71 81 82 /** 83 * Method that performs the statistical operation. Overridden by each concrete statistic class. 84 * 85 * @param methodParams 86 * @param sqlWhere 87 * @return 88 * @throws StatisticalUnitException 89 */ 72 90 public abstract Boolean performStatistic(ArrayList<MethodParameter> methodParams, String sqlWhere) throws StatisticalUnitException; 73 91 … … 127 145 gmodel.addGroupLabel(group.getGroupName()); 128 146 } 147 148 129 149 //now add each series and their values 130 150 for (int i=0; i < observationSeries.size(); i++){ … … 160 180 gmodel.addGroupLabel(startParser.print(bucket.getStart()) + " " + endParser.print(bucket.getEnd())); 161 181 } 182 //Buckets are time series, and so are already sorted chronologically. 162 183 163 184 for (int i=0; i < observationSeries.size(); i++){ -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/CountEntry.java
r787 r807 60 60 throw new StatisticalUnitException("negative time difference"); 61 61 } 62 63 String resourceCategoryFilter = statisticParameters.getResourceCategory().getSql(); 64 log.debug("Resource Category Filter {}",resourceCategoryFilter); 62 65 63 66 /* now create that many buckets of length timeIntervalInt */ … … 115 118 String query=""; 116 119 if (sqlWhere.equals("")) 117 query ="select count(*) from "+tableName+" where (eventTime between ? and ?) and (eventTime !=?) ";120 query ="select count(*) from "+tableName+" where (eventTime between ? and ?) and (eventTime !=?) and resourceIdCategory "+resourceCategoryFilter; 118 121 else 119 query ="select count(*) from "+tableName+" where (eventTime between ? and ?) and (eventTime !=?) and "+sqlWhere;122 query ="select count(*) from "+tableName+" where (eventTime between ? and ?) and (eventTime !=?) and resourceIdCategory "+resourceCategoryFilter+" and "+sqlWhere; 120 123 121 124 Object[] params = new Object[]{bucket.getStart().toDate(),bucket.getEnd().toDate(),bucket.getEnd().toDate()}; -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/CountEntryPerInterval.java
r787 r807 76 76 throw new StatisticalUnitException("negative time difference"); 77 77 } 78 79 String resourceCategoryFilter = statisticParameters.getResourceCategory().getSql(); 80 log.debug("Resource Category Filter {}",resourceCategoryFilter); 78 81 79 82 /* now create that many buckets of length timeIntervalInt */ … … 130 133 String query=null; 131 134 if (sqlWhere.equals("")) 132 query ="select count(*) from "+tableName+" where (eventTime between ? and ?) and (eventTime !=?) ";135 query ="select count(*) from "+tableName+" where (eventTime between ? and ?) and (eventTime !=?) and resourceIdCategory "+resourceCategoryFilter; 133 136 else 134 query ="select count(*) from "+tableName+" where (eventTime between ? and ?) and (eventTime !=?) and "+sqlWhere;137 query ="select count(*) from "+tableName+" where (eventTime between ? and ?) and (eventTime !=?) and resourceIdCategory "+resourceCategoryFilter+" and "+sqlWhere; 135 138 136 139 Object[] params = new Object[]{bucket.getStart().toDate(),bucket.getEnd().toDate(),bucket.getEnd().toDate()}; -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/GroupBy.java
r799 r807 67 67 String tableName= statisticParameters.getEventType().getHibernateSimpleClassName(); 68 68 log.debug("Select {}, tableName {}", groupByField, tableName); 69 70 String resourceCategoryFilter = statisticParameters.getResourceCategory().getSql(); 71 log.debug("Resource Category Filter {}",resourceCategoryFilter); 69 72 70 73 String query=""; 71 74 72 75 if (sqlWhere.equals("")) { 73 query = "select "+groupByField+" from "+tableName+" where (eventTime between ? and ?) group by ("+groupByField+")";76 query = "select "+groupByField+" from "+tableName+" where (eventTime between ? and ?) and resourceIdCategory "+resourceCategoryFilter+" group by ("+groupByField+")"; 74 77 } else { 75 query = "select "+groupByField+" from "+tableName+" where (eventTime between ? and ?) and "+sqlWhere+" group by ("+groupByField+")";78 query = "select "+groupByField+" from "+tableName+" where (eventTime between ? and ?) and resourceIdCategory "+resourceCategoryFilter+" and "+sqlWhere+" group by ("+groupByField+")"; 76 79 } 80 77 81 78 82 Object[] params = new Object[]{start.toDate(),end.toDate()}; … … 95 99 } 96 100 97 // add the series label or if none specified, add a default98 // if (statisticParameters.getSeries().getSeriesLabel() == null)99 // statisticParameters.getSeries().setSeriesLabel("Distinct Values " + groupByField);100 101 101 102 if (groups.size() == 0) -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/GroupByCountDistinct.java
r787 r807 58 58 log.debug("Select {}, tableName {}", groupByField, tableName); 59 59 60 String resourceCategoryFilter = statisticParameters.getResourceCategory().getSql(); 61 log.debug("Resource Category Filter {}",resourceCategoryFilter); 62 60 63 String query=""; 61 64 62 65 if (sqlWhere.equals("")) { 63 66 query = "select " + groupByField + ",count(distinct " + countDistinctField + ") from " + tableName + " where (eventTime between ?" + 64 " and ?) group by (" + groupByField + ")";67 " and ?) and resourceIdCategory "+resourceCategoryFilter+" group by (" + groupByField + ")"; 65 68 } else { 66 69 query = "select " + groupByField + ",count(distinct " + countDistinctField + ") from " + tableName + " where (eventTime between ?" + 67 " and ?) and "+sqlWhere+" group by (" + groupByField + ")";70 " and ?) and resourceIdCategory "+resourceCategoryFilter+" and "+sqlWhere+" group by (" + groupByField + ")"; 68 71 } 69 72 -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/GroupByFrequency.java
r799 r807 67 67 String tableName = statisticParameters.getEventType().getHibernateSimpleClassName(); 68 68 log.debug("Select {}, tableName {}", groupByField, tableName); 69 70 String resourceCategoryFilter = statisticParameters.getResourceCategory().getSql(); 71 log.debug("Resource Category Filter {}",resourceCategoryFilter); 69 72 70 73 String query = ""; 71 74 if (sqlWhere.equals("")) { 72 query = "select "+groupByField+", count(*) from "+tableName+" where (eventTime between ? and ?) group by ("+groupByField+")";75 query = "select "+groupByField+", count(*) from "+tableName+" where (eventTime between ? and ?) and resourceIdCategory "+resourceCategoryFilter+" group by ("+groupByField+")"; 73 76 } else { 74 query = "select "+groupByField+", count(*) from "+tableName+" where (eventTime between ? and ?) and "+sqlWhere+" group by ("+groupByField+")";77 query = "select "+groupByField+", count(*) from "+tableName+" where (eventTime between ? and ?) and resourceIdCategory "+resourceCategoryFilter+" and "+sqlWhere+" group by ("+groupByField+")"; 75 78 } 76 79 -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/helper/ObservationComparator.java
r443 r807 31 31 private boolean asc; 32 32 33 public ObservationComparator(boolean asc){34 this.asc = asc;33 public ObservationComparator(boolean asc){ 34 this.asc = asc; 35 35 } 36 36 37 /* (non-Javadoc)38 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)39 */40 @Override41 37 public int compare(Observation arg0, Observation arg1) { 42 38 if (asc) -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/service/MUAProcess.java
r799 r807 26 26 import uk.ac.cardiff.model.AdministrativeFunction.AdministrativeFunctionType; 27 27 import uk.ac.cardiff.model.report.AggregatorGraphModel; 28 import uk.ac.cardiff.model.resource.ResourceMetadata; 28 29 import uk.ac.cardiff.model.wsmodel.Capabilities; 29 30 import uk.ac.cardiff.model.wsmodel.EventPushMessage; … … 80 81 81 82 public void resourceClassification(); 83 84 public void saveResourceMetadata(List<ResourceMetadata> resourceMetadata); 82 85 } -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/service/impl/MUAProcessImpl.java
r799 r807 32 32 import uk.ac.cardiff.model.AdministrativeFunction; 33 33 import uk.ac.cardiff.model.report.AggregatorGraphModel; 34 import uk.ac.cardiff.model.resource.ResourceMetadata; 34 35 import uk.ac.cardiff.model.wsmodel.Capabilities; 35 36 import uk.ac.cardiff.model.wsmodel.EventPushMessage; … … 38 39 import uk.ac.cardiff.model.wsmodel.StatisticalUnitInformation; 39 40 import uk.ac.cardiff.raptor.store.TransactionInProgressException; 40 import uk.ac.cardiff.raptormua.engine.BackgroundServices;41 41 import uk.ac.cardiff.raptormua.engine.MUAEngine; 42 import uk.ac.cardiff.raptormua.engine.classification.ResourceClassificationBackgroundService; 42 43 import uk.ac.cardiff.raptormua.service.MUAProcess; 43 44 … … 58 59 private MUAEngine engine; 59 60 60 /** Engine to handle background tasks */61 private BackgroundServices backgroundServices;62 61 63 62 /** … … 103 102 } 104 103 105 @Override106 104 public void updateStatisticalUnit(StatisticalUnitInformation statisticalUnitInformation) throws SoapFault { 107 105 boolean success = false; … … 124 122 } 125 123 126 @Override127 124 public boolean performAdministrativeFunction(AdministrativeFunction function) throws SoapFault { 128 125 if (lockR.tryLock()) { … … 146 143 * Because this is perform async, the lock is not useful, its the exceptions that are. 147 144 */ 148 @Override149 145 public void addAuthentications(EventPushMessage pushed) throws SoapFault { 150 146 boolean success = false; … … 171 167 } 172 168 173 @Override174 169 public AggregatorGraphModel updateAndInvokeStatisticalUnit(StatisticalUnitInformation statisticalUnitInformation) throws SoapFault { 175 170 if (lockR.tryLock()) { … … 192 187 * 193 188 */ 194 @Override195 189 public List<LogFileUploadResult> batchUpload(List<LogFileUpload> uploadFiles) throws SoapFault { 196 190 List<LogFileUploadResult> result= new ArrayList<LogFileUploadResult>(); … … 227 221 public void resourceClassification(){ 228 222 log.info("Resource classification background thread called"); 229 backgroundServices.resourceClassification(); 230 } 231 232 /** 233 * @param backgroundServices the backgroundServices to set 234 */ 235 public void setBackgroundServices(BackgroundServices backgroundServices) { 236 this.backgroundServices = backgroundServices; 237 } 238 239 /** 240 * @return the backgroundServices 241 */ 242 public BackgroundServices getBackgroundServices() { 243 return backgroundServices; 244 } 223 //backgroundServices.resourceClassification(); 224 } 225 226 public void saveResourceMetadata(List<ResourceMetadata> resourceMetadata) { 227 log.info("Saving resource metadata (classification) for {} resources",resourceMetadata.size()); 228 engine.saveAndApplyResourceClassification(resourceMetadata); 229 230 } 231 245 232 246 233 public void setEngine(MUAEngine engine) { … … 252 239 } 253 240 241 254 242 } -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/wsinterface/impl/MultiUnitAggregatorImpl.java
r799 r807 29 29 import uk.ac.cardiff.model.AdministrativeFunction.AdministrativeFunctionType; 30 30 import uk.ac.cardiff.model.report.AggregatorGraphModel; 31 import uk.ac.cardiff.model.resource.ResourceMetadata; 31 32 import uk.ac.cardiff.model.wsmodel.Capabilities; 32 33 import uk.ac.cardiff.model.wsmodel.EventPushMessage; … … 70 71 71 72 72 @Override73 73 public void updateStatisticalUnit(StatisticalUnitInformation statisticalUnitInformation) throws SoapFault { 74 74 processService.updateStatisticalUnit(statisticalUnitInformation); … … 77 77 78 78 79 @Override80 79 public boolean performAdministrativeFunction(AdministrativeFunction function) throws SoapFault { 81 80 return processService.performAdministrativeFunction(function); … … 83 82 84 83 85 @Override86 84 public void addAuthentications(EventPushMessage pushed) throws SoapFault{ 87 85 processService.addAuthentications(pushed); … … 89 87 } 90 88 91 @Override92 89 public AggregatorGraphModel updateAndInvokeStatisticalUnit(StatisticalUnitInformation statisticalUnitInformation) throws SoapFault { 93 90 return processService.updateAndInvokeStatisticalUnit(statisticalUnitInformation); … … 98 95 } 99 96 97 public void saveResourceMetadata(List<ResourceMetadata> resourceMetadata) { 98 processService.saveResourceMetadata(resourceMetadata); 99 100 } 101 100 102 101 103 -
raptor-mua/trunk/src/main/resources/package.xml
r760 r807 45 45 </fileSet> 46 46 <fileSet> 47 <directory>target/data</directory> 48 <outputDirectory>data</outputDirectory> 49 <includes> 50 <include>*</include> 51 </includes> 52 </fileSet> 53 <fileSet> 54 <directory>target/keys</directory> 55 <outputDirectory>keys</outputDirectory> 56 <includes> 57 <include>*</include> 58 </includes> 59 </fileSet> 60 <fileSet> 47 61 <directory>target/bin</directory> 48 62 <outputDirectory>bin</outputDirectory>
Note: See TracChangeset
for help on using the changeset viewer.
