1 /* 2 * This file is a part of CAST project. 3 * (c) Copyright 2007, AGH University of Science & Technology 4 * https://caribou.iisg.agh.edu.pl/trac/cast 5 * 6 * Licensed under the Eclipse Public License, Version 1.0 (the "License"). 7 * You may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * http://www.eclipse.org/legal/epl-v10.html 10 */ 11 /* 12 * File: AbstractLoader.java 13 * Created: 2008-07-14 14 * Author: apohllo 15 * $Id: AbstractLoader.java 2232 2009-01-04 22:59:53Z apohllo $ 16 */ 17 18 package pl.edu.agh.cast.model.mapper.internal; 19 20 import java.util.Map; 21 import java.util.SortedMap; 22 23 import org.apache.log4j.Logger; 24 25 import pl.edu.agh.cast.model.base.BasePlugin; 26 import pl.edu.agh.cast.model.mapper.Loader; 27 import pl.edu.agh.cast.model.mapper.Mappable; 28 import pl.edu.agh.cast.model.mapper.Node; 29 30 /** 31 * Partial implementation of the {@link Loader} interface. 32 * 33 * @author AGH CAST Team 34 */ 35 public abstract class AbstractLoader implements Loader { 36 37 /** 38 * The object cache. 39 */ 40 protected Map<Node, Mappable> objectCache; 41 42 /** 43 * The type map contains mappings between DB type names and java classes, which are used to build objects 44 * corresponding to nodes. 45 */ 46 47 protected Map<String, Class> typeMap; 48 49 /** 50 * The conditions of the query. 51 */ 52 protected SortedMap<String, Object> conditions; 53 54 /** 55 * The class of the objects to be loaded. 56 */ 57 protected Class<Mappable> klass; 58 59 /** 60 * The logger. 61 */ 62 protected static Logger log = BasePlugin.getLogger(); 63 64 /** 65 * Creates new loader. 66 * @param newObjectCache The object cache to use. 67 * @param klass2 The class of the loaded objects. 68 * @param typeMap2 The type map to be used. 69 * @param conditions2 The conditions of the query. 70 */ 71 public AbstractLoader(Map<Node, Mappable> newObjectCache, Class klass2, Map<String, Class> typeMap2, 72 SortedMap<String, Object> conditions2) { 73 objectCache = newObjectCache; 74 klass = klass2; 75 typeMap = typeMap2; 76 conditions = conditions2; 77 } 78 }