1 19 20 package org.netbeans.modules.j2ee.persistence.wizard.fromdb; 21 22 import java.util.Map ; 23 import java.util.WeakHashMap ; 24 import org.netbeans.api.project.Project; 25 26 38 public class TableSource { 39 40 public enum Type { DATA_SOURCE, CONNECTION, SCHEMA_FILE }; 41 42 private final static Map <Project, TableSource> PROJECT_TO_SOURCE = new WeakHashMap <Project, TableSource>(); 43 44 private final Type type; 45 private final String name; 46 47 public static TableSource get(Project project) { 48 synchronized (TableSource.class) { 49 return PROJECT_TO_SOURCE.get(project); 50 } 51 } 52 53 public static void put(Project project, TableSource tableSource) { 54 synchronized (TableSource.class) { 55 PROJECT_TO_SOURCE.put(project, tableSource); 56 } 57 } 58 59 public TableSource(String name, Type type) { 60 assert name != null; 61 assert type != null; 62 63 this.name = name; 64 this.type = type; 65 } 66 67 public String getName() { 68 return name; 69 } 70 71 public Type getType() { 72 return type; 73 } 74 } 75 | Popular Tags |