Lines 101-119
Link Here
|
101 |
/** look up appropriate provider according to clazz */ |
101 |
/** look up appropriate provider according to clazz */ |
102 |
public static FileObject findProvider(Class clazz) throws IOException { |
102 |
public static FileObject findProvider(Class clazz) throws IOException { |
103 |
String prefix = "xml/memory/"; //NOI18N |
103 |
String prefix = "xml/memory/"; //NOI18N |
104 |
String name = clazz.getName().replace('.', '/'); |
|
|
105 |
FileSystem sfs = Repository.getDefault().getDefaultFileSystem(); |
104 |
FileSystem sfs = Repository.getDefault().getDefaultFileSystem(); |
106 |
FileObject memContext = sfs.findResource(prefix); |
105 |
FileObject memContext = sfs.findResource(prefix); |
107 |
if (memContext == null) throw new java.io.FileNotFoundException("SFS/xml/memory/"); //NOI18N |
106 |
if (memContext == null) throw new java.io.FileNotFoundException("SFS/xml/memory/"); //NOI18N |
108 |
|
107 |
|
109 |
String convertorPath = new StringBuffer(200).append(prefix). |
108 |
while (clazz != null) { |
110 |
append(name).toString(); // NOI18N |
109 |
String name = clazz.getName().replace('.', '/'); |
111 |
FileObject fo = sfs.findResource(convertorPath); |
110 |
String convertorPath = new StringBuffer(200).append(prefix). |
112 |
if (fo != null) { |
111 |
append(name).toString(); // NOI18N |
113 |
String providerPath = (String) fo.getAttribute(EA_PROVIDER_PATH); |
112 |
FileObject fo = sfs.findResource(convertorPath); |
114 |
if (providerPath != null) { |
113 |
if (fo != null) { |
115 |
return sfs.findResource(providerPath); |
114 |
String providerPath = (String) fo.getAttribute(EA_PROVIDER_PATH); |
|
|
115 |
if (providerPath != null) { |
116 |
return sfs.findResource(providerPath); |
117 |
} |
116 |
} |
118 |
} |
|
|
119 |
clazz = clazz.getSuperclass(); |
117 |
} |
120 |
} |
118 |
return null; |
121 |
return null; |
119 |
} |
122 |
} |