Integrated changes for Bundle.getSymbolicName() and Bundle.getLastModified().
git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@368722 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/BundleImpl.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/BundleImpl.java
index c928877..48e8a75 100644
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/BundleImpl.java
+++ b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/BundleImpl.java
@@ -60,6 +60,11 @@
return m_felix.getBundleHeaders(this);
}
+ public long getLastModified()
+ {
+ return m_info.getLastModified();
+ }
+
public String getLocation()
{
return m_felix.getBundleLocation(this);
@@ -96,11 +101,21 @@
return m_info.getState();
}
+ public String getSymbolicName()
+ {
+ return (String) getHeaders().get(Constants.BUNDLE_SYMBOLICNAME);
+ }
+
public boolean hasPermission(Object obj)
{
return m_felix.bundleHasPermission(this, obj);
}
+ public Class loadClass(String name) throws ClassNotFoundException
+ {
+ return m_felix.loadBundleClass(this, name);
+ }
+
public void start() throws BundleException
{
m_felix.startBundle(this, true);
@@ -137,21 +152,11 @@
public Dictionary getHeaders(String locale)
{
- // TODO: Implement Bundle.getHeaders()
+ // TODO: Implement Bundle.getHeaders(String locale)
+ // Should be done after [#FELIX-27] resolution
return null;
}
- public String getSymbolicName()
- {
- // TODO: Implement Bundle.getSymbolicName()
- return null;
- }
-
- public Class loadClass(String name) throws ClassNotFoundException
- {
- return m_felix.loadBundleClass(this, name);
- }
-
public Enumeration getResources(String name) throws IOException
{
// TODO: Implement Bundle.getResources()
@@ -170,12 +175,6 @@
return null;
}
- public long getLastModified()
- {
- // TODO: Implement Bundle.getLastModified()
- return 0;
- }
-
public Enumeration findEntries(String path, String filePattern, boolean recurse)
{
// TODO: Implement Bundle.findEntries()
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/BundleInfo.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/BundleInfo.java
index 1d97508..2ab1823 100644
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/BundleInfo.java
+++ b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/BundleInfo.java
@@ -28,6 +28,7 @@
private BundleArchive m_archive = null;
private Module[] m_modules = null;
private int m_state = 0;
+ private long m_modified = 0;
private BundleActivator m_activator = null;
private BundleContext m_context = null;
// Indicates that the bundle was either updated
@@ -198,6 +199,16 @@
m_state = i;
}
+ public long getLastModified()
+ {
+ return m_modified;
+ }
+
+ public void setLastModified(long l)
+ {
+ m_modified = l;
+ }
+
public int getPersistentState()
{
try
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
index 9056ff0..867c72e 100644
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -1471,6 +1471,7 @@
}
info.setState(Bundle.INSTALLED);
+ info.setLastModified(System.currentTimeMillis());
// Mark as needing a refresh.
info.setRemovalPending();
@@ -1708,6 +1709,7 @@
// Set state to uninstalled.
info.setState(Bundle.UNINSTALLED);
+ info.setLastModified(System.currentTimeMillis());
// Fire bundle event.
fireBundleEvent(BundleEvent.UNINSTALLED, bundle);
@@ -1882,6 +1884,7 @@
{
// This will persistently set the bundle's start level.
bundle.getInfo().setStartLevel(getInitialBundleStartLevel());
+ bundle.getInfo().setLastModified(System.currentTimeMillis());
}
synchronized (m_installedBundleLock_Priority2)