|
Lines 26-31
Link Here
|
| 26 |
public class DevClassLoadingHook implements ClassLoadingHook, HookConfigurator, KeyedElement { |
26 |
public class DevClassLoadingHook implements ClassLoadingHook, HookConfigurator, KeyedElement { |
| 27 |
public static final String KEY = DevClassLoadingHook.class.getName(); |
27 |
public static final String KEY = DevClassLoadingHook.class.getName(); |
| 28 |
public static final int HASHCODE = KEY.hashCode(); |
28 |
public static final int HASHCODE = KEY.hashCode(); |
|
|
29 |
private static final String FRAGMENT = "@fragment@"; //$NON-NLS-1$ |
| 29 |
|
30 |
|
| 30 |
public byte[] processClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager) { |
31 |
public byte[] processClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager) { |
| 31 |
// Do nothing |
32 |
// Do nothing |
|
Lines 47-57
Link Here
|
| 47 |
else { |
48 |
else { |
| 48 |
// if in dev mode, try using the cp as an absolute path |
49 |
// if in dev mode, try using the cp as an absolute path |
| 49 |
// we assume absolute entries come from fragments. Find the source |
50 |
// we assume absolute entries come from fragments. Find the source |
| 50 |
BaseData fragData = findFragmentSource(sourcedata, devClassPath[i], hostmanager); |
51 |
String devCP = devClassPath[i]; |
| 51 |
ClasspathEntry entry = hostmanager.getExternalClassPath(devClassPath[i], fragData, sourcedomain); |
52 |
boolean fromFragment = devCP.endsWith(FRAGMENT); |
| 52 |
if (entry != null) { |
53 |
if (fromFragment) |
| 53 |
cpEntries.add(entry); |
54 |
devCP = devCP.substring(0, devCP.length() - FRAGMENT.length()); |
| 54 |
result = true; |
55 |
BaseData fragData = findFragmentSource(sourcedata, devCP, hostmanager, fromFragment); |
|
|
56 |
if (fragData != null) { |
| 57 |
ClasspathEntry entry = hostmanager.getExternalClassPath(devCP, fragData, sourcedomain); |
| 58 |
if (entry != null) { |
| 59 |
cpEntries.add(entry); |
| 60 |
result = true; |
| 61 |
} |
| 55 |
} |
62 |
} |
| 56 |
} |
63 |
} |
| 57 |
} |
64 |
} |
|
Lines 62-70
Link Here
|
| 62 |
return result; |
69 |
return result; |
| 63 |
} |
70 |
} |
| 64 |
|
71 |
|
| 65 |
private BaseData findFragmentSource(BaseData hostData, String cp, ClasspathManager manager) { |
72 |
private BaseData findFragmentSource(BaseData hostData, String cp, ClasspathManager manager, boolean fromFragment) { |
| 66 |
if (hostData != manager.getBaseData()) |
73 |
if (hostData != manager.getBaseData()) |
| 67 |
return hostData; |
74 |
return hostData; |
|
|
75 |
|
| 68 |
File file = new File(cp); |
76 |
File file = new File(cp); |
| 69 |
if (!file.isAbsolute()) |
77 |
if (!file.isAbsolute()) |
| 70 |
return hostData; |
78 |
return hostData; |
|
Lines 75-81
Link Here
|
| 75 |
if (fragFile != null && file.getPath().startsWith(fragFile.getPath())) |
83 |
if (fragFile != null && file.getPath().startsWith(fragFile.getPath())) |
| 76 |
return fragCP[i].getBundleData(); |
84 |
return fragCP[i].getBundleData(); |
| 77 |
} |
85 |
} |
| 78 |
return hostData; |
86 |
return fromFragment ? null : hostData; |
| 79 |
} |
87 |
} |
| 80 |
|
88 |
|
| 81 |
public String findLibrary(BaseData data, String libName) { |
89 |
public String findLibrary(BaseData data, String libName) { |