public Script getScript() throws Exception { if (rc != null) { URL url = rc.getBundle().getEntry(script); if (url == null) { // if not found using bundle entries try using classloader // in a test environment bundle entries may not work url = rc.getResource(script); if (url == null) { throw new Exception("Script Not found: " + script); } } return Script.newScript(url); } else { return Script.newScript(script); } }
public Bundle findHostBundle(Bundle bundle) { String hostId = (String) bundle.getHeaders().get(Constants.FRAGMENT_HOST); log.debug("Looking for host bundle: " + bundle.getSymbolicName() + " host id: " + hostId); if (hostId != null) { int p = hostId.indexOf(';'); if (p > -1) { // remove version or other extra information if any hostId = hostId.substring(0, p); } RuntimeContext ctx = contexts.get(hostId); if (ctx != null) { log.debug("Context was found for host id: " + hostId); return ctx.getBundle(); } else { log.warn("No context found for host id: " + hostId); } } return null; }