Java Code Examples for org.osgi.framework.Bundle#update()
The following examples show how to use
org.osgi.framework.Bundle#update() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Util.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 6 votes |
public static void updateBundle(BundleContext bc, Bundle bu, String resource) throws BundleException { try { System.out.println("updateBundle(" +bu.getSymbolicName() +", " + resource + ")"); URL url = bc.getBundle().getResource(resource); if(url == null) { throw new BundleException("No resource " + resource); } InputStream in = url.openStream(); if(in == null) { throw new BundleException("No resource " + resource); } bu.update(in); } catch (IOException e) { throw new BundleException ("Failed to get input stream for " + resource + ": " + e); } }
Example 2
Source File: FrameworkNodeImpl.java From concierge with Eclipse Public License 1.0 | 5 votes |
public BundleDTO updateBundle(long id) throws BundleException { Bundle b = context.getBundle(id); if(b == null) return null; b.update(); return b.adapt(BundleDTO.class); }
Example 3
Source File: FrameworkNodeImpl.java From concierge with Eclipse Public License 1.0 | 5 votes |
public BundleDTO updateBundle(long id, String url) throws BundleException, MalformedURLException, IOException { Bundle b = context.getBundle(id); if(b == null) return null; URL u = new URL(url); b.update(u.openStream()); return b.adapt(BundleDTO.class); }
Example 4
Source File: Util.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static void updateBundle(BundleContext context, Bundle bundle) { try{ if (bundle.getLocation().startsWith(LOC_PROT)) { String resource = bundle.getLocation().substring(LOC_PROT.length()); URL url = context.getBundle().getResource(resource); bundle.update(url.openStream()); } else { bundle.update(); } } catch(Exception e) { /* print the error */ System.out.println("ERROR in Util installBundle()" + e); e.printStackTrace(); } }
Example 5
Source File: Util.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static void updateBundle(BundleContext context, Bundle bundle) { try{ if (bundle.getLocation().startsWith(LOC_PROT)) { String resource = bundle.getLocation().substring(LOC_PROT.length()); URL url = context.getBundle().getResource(resource); bundle.update(url.openStream()); } else { bundle.update(); } }catch(Exception e){ /* print the error */ System.out.println("ERROR in Util installBundle()" + e); e.printStackTrace(); } }
Example 6
Source File: Util.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static void updateBundle(BundleContext context, Bundle bundle) { try{ if (bundle.getLocation().startsWith(LOC_PROT)) { String resource = bundle.getLocation().substring(LOC_PROT.length()); URL url = context.getBundle().getResource(resource); bundle.update(url.openStream()); } else { bundle.update(); } } catch(Exception e) { /* print the error */ System.out.println("ERROR in Util installBundle()" + e); e.printStackTrace(); } }
Example 7
Source File: OpenAtlas.java From ACDD with MIT License | 5 votes |
public void updateBundle(String pkgName, InputStream inputStream) throws BundleException { Bundle bundle = Framework.getBundle(pkgName); if (bundle != null) { bundle.update(inputStream); return; } throw new BundleException("Could not update bundle " + pkgName + ", because could not find it"); }
Example 8
Source File: OpenAtlas.java From ACDD with MIT License | 5 votes |
public void updateBundle(String pkgName, File mBundleFile) throws BundleException { if (!mBundleFile.exists()) { throw new BundleException("file not found" + mBundleFile.getAbsolutePath()); } Bundle bundle = Framework.getBundle(pkgName); if (bundle != null) { bundle.update(mBundleFile); return; } throw new BundleException("Could not update bundle " + pkgName + ", because could not find it"); }
Example 9
Source File: Framework.java From ACDD with MIT License | 5 votes |
static void installOrUpdate(String[] locations, File[] archiveFiles) throws BundleException { if (locations == null || archiveFiles == null || locations.length != archiveFiles.length) { throw new IllegalArgumentException("locations and files must not be null and must be same length"); } String valueOf = String.valueOf(System.currentTimeMillis()); File file = new File(new File(STORAGE_LOCATION, "wal"), valueOf); file.mkdirs(); int i = 0; while (i < locations.length) { if (!(locations[i] == null || archiveFiles[i] == null)) { try { BundleLock.WriteLock(locations[i]); Bundle bundle = getBundle(locations[i]); if (bundle != null) { bundle.update(archiveFiles[i]); } else { BundleImpl bundleImpl = new BundleImpl(new File(file, locations[i]), locations[i], null, archiveFiles[i], false); } BundleLock.WriteUnLock(locations[i]); } catch (Throwable th) { BundleLock.WriteUnLock(locations[i]); } } i++; } writeAheads.add(valueOf); storeMetadata(); }
Example 10
Source File: Atlas.java From AtlasForAndroid with MIT License | 5 votes |
public void updateBundle(String str, InputStream inputStream) throws BundleException { Bundle bundle = Framework.getBundle(str); if (bundle != null) { bundle.update(inputStream); return; } throw new BundleException("Could not update bundle " + str + ", because could not find it"); }
Example 11
Source File: Atlas.java From AtlasForAndroid with MIT License | 5 votes |
public void updateBundle(String str, File file) throws BundleException { Bundle bundle = Framework.getBundle(str); if (bundle != null) { bundle.update(file); return; } throw new BundleException("Could not update bundle " + str + ", because could not find it"); }
Example 12
Source File: Framework.java From AtlasForAndroid with MIT License | 5 votes |
static void installOrUpdate(String[] strArr, File[] fileArr) throws BundleException { if (strArr == null || fileArr == null || strArr.length != fileArr.length) { throw new IllegalArgumentException("locations and files must not be null and must be same length"); } String valueOf = String.valueOf(System.currentTimeMillis()); File file = new File(new File(STORAGE_LOCATION, "wal"), valueOf); file.mkdirs(); int i = 0; while (i < strArr.length) { if (!(strArr[i] == null || fileArr[i] == null)) { try { BundleLock.WriteLock(strArr[i]); Bundle bundle = getBundle(strArr[i]); if (bundle != null) { bundle.update(fileArr[i]); } else { BundleImpl bundleImpl = new BundleImpl(new File(file, strArr[i]), strArr[i], new BundleContextImpl(), null, fileArr[i], false); } BundleLock.WriteUnLock(strArr[i]); } catch (Throwable th) { BundleLock.WriteUnLock(strArr[i]); } } i++; } writeAheads.add(valueOf); storeMetadata(); }