org.osgi.framework.Bundle#update ( )源码实例Demo

下面列出了org.osgi.framework.Bundle#update ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: knopflerfish.org   文件: Util.java
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);
  }
}
 
源代码2 项目: concierge   文件: FrameworkNodeImpl.java
public BundleDTO updateBundle(long id) throws BundleException {
	Bundle b  = context.getBundle(id);
	if(b == null)
		return null;
	
	b.update();
	return b.adapt(BundleDTO.class);
}
 
源代码3 项目: concierge   文件: FrameworkNodeImpl.java
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);
}
 
源代码4 项目: knopflerfish.org   文件: Util.java
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();
  }
}
 
源代码5 项目: knopflerfish.org   文件: Util.java
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();
  }
}
 
源代码6 项目: knopflerfish.org   文件: Util.java
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();
  }
}
 
源代码7 项目: ACDD   文件: OpenAtlas.java
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");
}
 
源代码8 项目: ACDD   文件: OpenAtlas.java
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");
}
 
源代码9 项目: ACDD   文件: Framework.java
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();
}
 
源代码10 项目: AtlasForAndroid   文件: Atlas.java
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");
}
 
源代码11 项目: AtlasForAndroid   文件: Atlas.java
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");
}
 
源代码12 项目: AtlasForAndroid   文件: Framework.java
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();
}