Ignore:
Timestamp:
10/31/12 13:52:06 (12 years ago)
Author:
wojtekp
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/trunk/build/classes/schedframe/scheduling/manager/tasks/AbstractJobRegistry.java

    r477 r539  
    22 
    33 
    4 import java.util.Map; 
    54import java.util.concurrent.ConcurrentHashMap; 
    65 
     
    1413 
    1514 
    16 public abstract class AbstractJobRegistry /*extends ConcurrentHashMap<String, Job> */implements JobRegistry, Cloneable{ 
     15public abstract class AbstractJobRegistry /*extends ConcurrentHashMap<String, Job>*/ implements JobRegistry, Cloneable{ 
    1716         
    1817        private static final long serialVersionUID = 8409060063583755824L; 
     18 
    1919         
    20         private static Log log = LogFactory.getLog(AbstractJobRegistry.class); 
    21          
    22         protected static final ConcurrentHashMap<String, Job> jobs = new ConcurrentHashMap<String, Job>(); 
     20        protected static final ConcurrentHashMap<String, JobInterface<?>> jobs = new ConcurrentHashMap<String, JobInterface<?>>(); 
    2321         
    2422        protected AbstractJobRegistry(){ 
    25                 //log.warn("Methods from JobRegistry interface are not implemented."); 
    2623        } 
    2724         
    2825        public boolean addJob(JobInterface<?> job) { 
    29                 try { 
    30                          jobs.put(job.getId(), (Job) job); 
    31                 } catch (NoSuchFieldException e) { 
    32                         log.error(e.getMessage()); 
    33                         return false; 
    34                 } 
     26                jobs.put(job.getId(),  job); 
    3527                return true; 
    3628        } 
     
    3830        public boolean addTask(TaskInterface<?> task) { 
    3931                if(jobs.containsKey(task.getJobId())){ 
    40                         jobs.get(task.getJobId()).add((Task)task); 
     32                        getJob(task.getJobId()).add((Task)task); 
    4133                        return true; 
    4234                } else { 
     
    4537        } 
    4638 
    47         public Job get(String jobId){ 
     39        public JobInterface<?> getJobInfo(String jobId) { 
    4840                return jobs.get(jobId); 
    4941        } 
    50          
    51         public JobInterface<?> getJobInfo(String jobID) { 
    52                 return jobs.get(jobID); 
    53         } 
    5442 
    55         public TaskInterface<?> getTaskInfo(String jobID, String taskId) { 
     43        public TaskInterface<?> getTaskInfo(String jobId, String taskId) { 
    5644                Task task = null; 
    57                 Job job = jobs.get(jobID); 
     45                Job job = getJob(jobId); 
    5846                 
    5947                if(job == null) 
     
    6351                        task = job.getTask(taskId); 
    6452                } catch (NoSuchFieldException e) { 
    65                         log.error(e.getMessage()); 
    6653                } 
    6754                return task; 
    6855        } 
    6956         
    70         /*public List<JobInterface<?>> getActiveJobs() { 
    71                 log.error("getActiveJobs() not implemented."); 
    72                 return null; 
     57        public Job getJob(String jobId){ 
     58                return (Job)jobs.get(jobId); 
    7359        } 
    7460 
    75         public List<TaskInterface<?>> getActiveTasks() { 
    76                 log.error("getActiveTasks() not implemented."); 
    77                 return null; 
    78         }*/ 
    79  
    80  
    81          
    82  
    8361} 
Note: See TracChangeset for help on using the changeset viewer.