1 24 package org.riotfamily.riot.job.persistence; 25 26 import java.util.ArrayList ; 27 import java.util.Collection ; 28 import java.util.HashMap ; 29 30 34 public class InMemoryJobDao implements JobDao { 35 36 private HashMap jobDetails = new HashMap (); 37 38 private HashMap jobLogEntries = new HashMap (); 39 40 public int getAverageStepTime(String type) { 41 return 0; 42 } 43 44 public JobDetail getJobDetail(Long jobId) { 45 return (JobDetail) jobDetails.get(jobId); 46 } 47 48 public Collection getJobDetails() { 49 return jobDetails.values(); 50 } 51 52 public Collection getLogEntries(Long jobId) { 53 return (Collection ) jobLogEntries.get(jobId); 54 } 55 56 public JobDetail getPendingJobDetail(String type, String objectId) { 57 return null; 58 } 59 60 public JobDetail getLastCompletedJobDetail(String type, String objectId) { 61 return null; 62 } 63 64 public Collection getPendingJobDetails() { 65 return null; 66 } 67 68 public synchronized void log(JobLogEntry entry) { 69 ArrayList entries = (ArrayList ) jobLogEntries.get(entry.getJobId()); 70 if (entries == null) { 71 entries = new ArrayList (); 72 jobLogEntries.put(entry.getJobId(), entries); 73 } 74 entries.add(entry); 75 } 76 77 public synchronized void saveJobDetail(JobDetail detail) { 78 detail.setId(new Long (jobDetails.size() + 1)); 79 jobDetails.put(detail.getId(), detail); 80 } 81 82 public void updateJobDetail(JobDetail detail) { 83 } 84 85 } 86 | Popular Tags |