1
2
3
4
5
6
7
8
9
10 package org.astrogrid.store.delegate.myspaceItn05;
11
12 import java.util.Hashtable;
13 import org.astrogrid.util.TypeSafeEnumerator;
14
15 /***
16 * File Types for MySpace. Enumerated, indexed by the string returned
17 * by the getDataHolding methods
18 *
19 * @author mch. Could/Should probably be replaced by new templaty stuff.
20 */
21
22
23 public class MySpaceFileType extends TypeSafeEnumerator
24 {
25 private int managerRef = 0;
26 private String mimeType = null;
27
28 private static Hashtable holdingIdx = new Hashtable();
29
30 public static final MySpaceFileType UNKNOWN = new MySpaceFileType(EntryCodes.UNKNOWN, "Unknown", null);
31 public static final MySpaceFileType FOLDER = new MySpaceFileType(EntryCodes.CON, "Folder", null);
32 public static final MySpaceFileType VOTABLE = new MySpaceFileType(EntryCodes.VOT, "VOTable", "text/votable");
33 public static final MySpaceFileType QUERY = new MySpaceFileType(EntryCodes.QUERY, "Query", "text/xml");
34 public static final MySpaceFileType WORKFLOW = new MySpaceFileType(EntryCodes.WORKFLOW, "Workflow", "text/xml");
35 public static final MySpaceFileType XML = new MySpaceFileType(EntryCodes.XML, "Xml", "text/xml");
36
37
38 private MySpaceFileType(int givenRef, String userDesc, String givenMimeType)
39 {
40 super(userDesc);
41 holdingIdx.put(new Integer(managerRef), this);
42 managerRef = givenRef;
43 mimeType = givenMimeType;
44 }
45
46 public static MySpaceFileType getForManagerRef(int managerRef)
47 {
48 return (MySpaceFileType) holdingIdx.get(new Integer(managerRef));
49 }
50
51 public static MySpaceFileType getForHoldingRef(String holdingRef)
52 {
53 return (MySpaceFileType) holdingIdx.get(holdingRef);
54 }
55
56 public final int getManagerRef() {
57 return managerRef;
58 }
59
60 public final String getMimeType() {
61 return mimeType;
62 }
63 }
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109