Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libCq CMS for java.old / src / org / cresques / io / DataSource.java @ 6

History | View | Annotate | Download (863 Bytes)

1
/*
2
 * Created on 12-may-2004
3
 */
4

    
5
package org.cresques.io;
6

    
7
import java.util.Hashtable;
8

    
9
/**
10
 * Origen de datos. Unidad, volumen de red, etc.
11
 * 
12
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
13
 */
14

    
15
public class DataSource {
16
        private static int counter = 0;
17
        private static Hashtable units = new Hashtable();
18
        String path = null;
19
        String name = null;
20

    
21
        public DataSource(String path, String name) {
22
                this.path = path;
23
                this.name = name;
24
                units.put(name, this);
25
        }
26
        
27
        public String getName() { return name; }
28
        public String getPath() { return path; }
29
        
30
        public static DataSource getDSFromName(String name) {
31
                if (name.startsWith("[")) name = name.substring(1);
32
                if (name.indexOf("]") >= 0) name = name.substring(name.indexOf("]"));
33
                DataSource ds = (DataSource) units.get(name);
34
                return ds;
35
        }
36
        
37
        public String toString() {
38
                return "["+counter+"]";
39
        }
40
}