org.osgi.framework.Bundle.getLastModified()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中org.osgi.framework.Bundle.getLastModified()方法的一些代码示例,展示了Bundle.getLastModified()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bundle.getLastModified()方法的具体详情如下:
包路径:org.osgi.framework.Bundle
类名称:Bundle
方法名:getLastModified

Bundle.getLastModified介绍

[英]Returns the time when this bundle was last modified. A bundle is considered to be modified when it is installed, updated or uninstalled.

The time value is the number of milliseconds since January 1, 1970, 00:00:00 UTC.
[中]返回上次修改此捆绑包的时间。捆绑包在安装、更新或卸载时被视为已被修改。
时间值是自1970年1月1日00:00:00 UTC以来的毫秒数。

代码示例

代码示例来源:origin: org.opendaylight.controller/blueprint

@Override
  public int compare(Bundle b1, Bundle b2) {
    return (int) (b2.getLastModified() - b1.getLastModified());
  }
});

代码示例来源:origin: org.eclipse/org.eclipse.osgi

public long getLastModified() {
  Bundle current = systemBundle;
  if (current == null)
    return System.currentTimeMillis();
  return current.getLastModified();
}

代码示例来源:origin: org.apache.felix/org.apache.felix.metatype

private BundleResources( Bundle bundle )
{
  this.bundle = bundle;
  this.bundleLastModified = bundle.getLastModified();
  this.resourcesByLocale = new HashMap();
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.osgi

public long getLastModified() {
  Bundle current = systemBundle;
  if (current == null)
    return System.currentTimeMillis();
  return current.getLastModified();
}

代码示例来源:origin: apache/felix

private BundleResources( Bundle bundle )
{
  this.bundle = bundle;
  this.bundleLastModified = bundle.getLastModified();
  this.resourcesByLocale = new HashMap();
}

代码示例来源:origin: org.eclipse/osgi

public static BundleDTO newBundleDTO(Bundle bundle) {
  if (bundle == null) {
    return null;
  }
  BundleDTO dto = new BundleDTO();
  dto.id = bundle.getBundleId();
  dto.lastModified = bundle.getLastModified();
  dto.state = bundle.getState();
  dto.symbolicName = bundle.getSymbolicName();
  dto.version = bundle.getVersion().toString();
  return dto;
}

代码示例来源:origin: org.eclipse.gemini.blueprint/gemini-blueprint-io

public long lastModified() throws IOException {
  URLConnection con = getURL().openConnection();
  con.setUseCaches(false);
  long time = con.getLastModified();
  // the implementation doesn't return the proper time stamp
  if (time == 0) {
    if (OsgiResourceUtils.PREFIX_TYPE_BUNDLE_JAR == searchType)
      return bundle.getLastModified();
  }
  // there is nothing else we can do
  return time;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.osgi

public static BundleDTO newBundleDTO(Bundle bundle) {
  if (bundle == null) {
    return null;
  }
  BundleDTO dto = new BundleDTO();
  dto.id = bundle.getBundleId();
  dto.lastModified = bundle.getLastModified();
  dto.state = bundle.getState();
  dto.symbolicName = bundle.getSymbolicName();
  dto.version = bundle.getVersion().toString();
  return dto;
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.osgi

public static BundleDTO newBundleDTO(Bundle bundle) {
  if (bundle == null) {
    return null;
  }
  BundleDTO dto = new BundleDTO();
  dto.id = bundle.getBundleId();
  dto.lastModified = bundle.getLastModified();
  dto.state = bundle.getState();
  dto.symbolicName = bundle.getSymbolicName();
  dto.version = bundle.getVersion().toString();
  return dto;
}

代码示例来源:origin: apache/felix

private static BundleDTO createBundleDTO(Bundle bundle)
{
  BundleDTO dto = new BundleDTO();
  dto.id = bundle.getBundleId();
  dto.lastModified = bundle.getLastModified();
  dto.state = bundle.getState();
  dto.symbolicName = bundle.getSymbolicName();
  dto.version = "" + bundle.getVersion();
  return dto;
}

代码示例来源:origin: com.github.veithen.cosmos/cosmos-equinox

public static BundleDTO newBundleDTO(Bundle bundle) {
  if (bundle == null) {
    return null;
  }
  BundleDTO dto = new BundleDTO();
  dto.id = bundle.getBundleId();
  dto.lastModified = bundle.getLastModified();
  dto.state = bundle.getState();
  dto.symbolicName = bundle.getSymbolicName();
  dto.version = bundle.getVersion().toString();
  return dto;
}

代码示例来源:origin: org.eclipse.gemini.blueprint/gemini-blueprint-extender

public static String createNamespaceFilter(BundleContext ctx) {
    Bundle bnd = getDMCoreBundle(ctx);
    if (bnd != null) {
      return "(|(" + DM_CORE_ID + "=" + bnd.getBundleId() + ")(" + DM_CORE_TS + "=" + bnd.getLastModified()
          + "))";
    }
    return "";
  }
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.osgi

public static BundleDTO newBundleDTO(Bundle bundle) {
  if (bundle == null) {
    return null;
  }
  BundleDTO dto = new BundleDTO();
  dto.id = bundle.getBundleId();
  dto.lastModified = bundle.getLastModified();
  dto.state = bundle.getState();
  dto.symbolicName = bundle.getSymbolicName();
  dto.version = bundle.getVersion().toString();
  return dto;
}

代码示例来源:origin: org.springframework.osgi/spring-osgi-io

public long lastModified() throws IOException {
  URLConnection con = getURL().openConnection();
  con.setUseCaches(false);
  long time = con.getLastModified();
  // the implementation doesn't return the proper time stamp
  if (time == 0) {
    if (OsgiResourceUtils.PREFIX_TYPE_BUNDLE_JAR == searchType)
      return bundle.getLastModified();
  }
  // there is nothing else we can do
  return time;
}

代码示例来源:origin: org.eclipse.gemini.blueprint/gemini-blueprint-core

public static String createNamespaceFilter(BundleContext ctx) {
    Bundle bnd = getDMCoreBundle(ctx);
    if (bnd != null) {
      return "(|(" + DM_CORE_ID + "=" + bnd.getBundleId() + ")(" + DM_CORE_TS + "=" + bnd.getLastModified()
          + "))";
    }
    return "";
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.osgi

public static BundleDTO newBundleDTO(Bundle bundle) {
  if (bundle == null) {
    return null;
  }
  BundleDTO dto = new BundleDTO();
  dto.id = bundle.getBundleId();
  dto.lastModified = bundle.getLastModified();
  dto.state = bundle.getState();
  dto.symbolicName = bundle.getSymbolicName();
  dto.version = bundle.getVersion().toString();
  return dto;
}

代码示例来源:origin: de.mhus.osgi/mhu-osgi-vaadinosgibridge

public long getLastModified(String name) {
  ResourceBundle resource = getResourceInfo(name);
  if (resource == null) return -1;
  Bundle bundle = resource.getBundle();
  if (bundle == null) return -1;
  return bundle.getLastModified();
}

代码示例来源:origin: org.glassfish.hk2/osgi-adapter

public void refresh() {
  URI location = md.getLocations()[0];
  File f = new File(location);
  if (f.lastModified() > bundle.getLastModified()) {
    try {
      bundle.update();
      registry.getPackageAdmin().refreshPackages(new Bundle[]{bundle});
    } catch (BundleException e) {
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: org.apache.servicemix.jbi/org.apache.servicemix.jbi.deployer

protected void postInstall() throws Exception {
  Storage prefs = getStorage();
  prefs.put(LAST_INSTALL, Long.toString(getBundle().getLastModified()));
  prefs.save();
}

代码示例来源:origin: com.atlassian.labs/speakeasy-plugin

@Override
  public String getModulesWebResourceCompleteKey()
  {
    return getStatefulKey(super.getModulesWebResourceCompleteKey(), getPluginBundle().getLastModified());
  }
}

相关文章