You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2009/01/30 02:20:06 UTC
svn commit: r739113 [2/2] - in
/felix/trunk/framework/src/main/java/org/apache/felix: framework/
framework/searchpolicy/ framework/util/ moduleloader/
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4WireModule.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4WireModule.java?rev=739113&r1=739112&r2=739113&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4WireModule.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4WireModule.java Fri Jan 30 01:20:06 2009
@@ -97,32 +97,20 @@
ResolvedPackage rp = (ResolvedPackage) m_pkgMap.get(pkgName);
if (rp != null)
{
- for (int srcIdx = 0; srcIdx < rp.m_sourceList.size(); srcIdx++)
+ try
{
- PackageSource ps = (PackageSource) rp.m_sourceList.get(srcIdx);
-// TODO: REFACTOR - Module's shouldn't depend on themself.
- if ((ps.m_module == m_importer) ||
- ((ps.m_capability instanceof Capability) &&
- ((Capability) ps.m_capability).isIncluded(name)))
+ Class clazz = m_exporter.getClassByDelegation(name);
+ if (clazz != null)
{
-// TODO: REFACTOR - It seems like we should be able to use getClassByDelegation()
-// here once we don't allow modules to require themself above.
- try
- {
- Class clazz = ps.m_module.getClassFromModule(name);
- if (clazz != null)
- {
- return clazz;
- }
- }
- catch (ClassNotFoundException ex)
- {
- // Do not throw the exception here, since we want
- // to continue search other package sources and
- // ultimately the module's own content.
- }
+ return clazz;
}
}
+ catch (ClassNotFoundException ex)
+ {
+ // Do not throw the exception here, since we want
+ // to continue search other package sources and
+ // ultimately the module's own content.
+ }
}
return null;
@@ -139,16 +127,10 @@
ResolvedPackage rp = (ResolvedPackage) m_pkgMap.get(pkgName);
if (rp != null)
{
- for (int srcIdx = 0; srcIdx < rp.m_sourceList.size(); srcIdx++)
+ URL url = m_exporter.getResourceByDelegation(name);
+ if (url != null)
{
- PackageSource ps = (PackageSource) rp.m_sourceList.get(srcIdx);
-// TODO: REFACTOR - It seems like we should be able to use getClassByDelegation()
-// here once we don't allow modules to require themself above.
- URL url = ps.m_module.getResourceFromModule(name);
- if (url != null)
- {
- return url;
- }
+ return url;
}
// Don't throw ResourceNotFoundException because module
@@ -163,9 +145,6 @@
*/
public Enumeration getResources(String name) throws ResourceNotFoundException
{
- // List to hold all enumerations from all package sources.
- List enums = new ArrayList();
-
// Get the package of the target class.
String pkgName = Util.getResourcePackage(name);
@@ -175,27 +154,17 @@
ResolvedPackage rp = (ResolvedPackage) m_pkgMap.get(pkgName);
if (rp != null)
{
- for (int srcIdx = 0; srcIdx < rp.m_sourceList.size(); srcIdx++)
+ Enumeration urls = m_exporter.getResourcesByDelegation(name);
+ if (urls != null)
{
- PackageSource ps = (PackageSource) rp.m_sourceList.get(srcIdx);
-// TODO: REFACTOR - It seems like we should be able to use getClassByDelegation()
-// here once we don't allow modules to require themself above.
- Enumeration urls = ps.m_module.getResourcesFromModule(name);
- if (urls != null)
- {
- enums.add(urls);
- }
+ return urls;
}
// Don't throw ResourceNotFoundException because module
// dependencies support split packages.
}
- return (enums.size() == 0)
- ? null
- : new CompoundEnumeration(
- (Enumeration[]) enums.toArray(new Enumeration[enums.size()]));
-
+ return null;
}
public String toString()
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/util/SecureAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/SecureAction.java?rev=739113&r1=739112&r2=739113&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/util/SecureAction.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/util/SecureAction.java Fri Jan 30 01:20:06 2009
@@ -25,7 +25,6 @@
import java.util.Hashtable;
import java.util.jar.JarFile;
-import org.apache.felix.framework.searchpolicy.ModuleClassLoader;
import org.apache.felix.framework.searchpolicy.ModuleImpl;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@@ -540,7 +539,8 @@
return new JarFileX(file);
}
}
-
+// TODO: REFACTOR - SecureAction fix needed.
+/*
public ModuleClassLoader createModuleClassLoader(ModuleImpl impl)
{
return createModuleClassLoader(impl, null);
@@ -567,7 +567,7 @@
return new ModuleClassLoader(impl, protectionDomain);
}
}
-
+*/
public void startActivator(BundleActivator activator, BundleContext context)
throws Exception
{
@@ -1104,10 +1104,11 @@
{
return ((URLConnection) arg1).getInputStream();
}
- else if (action == CREATE_MODULECLASSLOADER_ACTION)
- {
- return new ModuleClassLoader((ModuleImpl) arg1, (ProtectionDomain) arg2);
- }
+// TODO: REFACTOR - SecureAction fix needed.
+// else if (action == CREATE_MODULECLASSLOADER_ACTION)
+// {
+// return new ModuleClassLoader((ModuleImpl) arg1, (ProtectionDomain) arg2);
+// }
else if (action == START_ACTIVATOR_ACTION)
{
((BundleActivator) arg1).start((BundleContext) arg2);
Modified: felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModule.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModule.java?rev=739113&r1=739112&r2=739113&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModule.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModule.java Fri Jan 30 01:20:06 2009
@@ -28,35 +28,31 @@
public interface IModule
{
- Bundle getBundle();
-
void setURLPolicy(IURLPolicy urlPolicy);
IURLPolicy getURLPolicy();
void setSecurityContext(Object securityContext);
Object getSecurityContext();
- // Metadata access
+ // Metadata access methods.
Map getHeaders();
+ String getSymbolicName();
ICapability[] getCapabilities();
IRequirement[] getRequirements();
IRequirement[] getDynamicRequirements();
R4Library[] getNativeLibraries();
- // Run-time data access.
+ // Run-time data access methods.
+ Bundle getBundle();
String getId();
- String getSymbolicName();
IWire[] getWires();
boolean isResolved();
- // Content access.
+ // Content access methods.
IContent getContent();
Class getClassByDelegation(String name) throws ClassNotFoundException;
URL getResourceByDelegation(String name);
Enumeration getResourcesByDelegation(String name);
- Class getClassFromModule(String name) throws ClassNotFoundException;
- URL getResourceFromModule(String name);
- Enumeration getResourcesFromModule(String name);
- URL getResourceFromContent(String name);
+ URL getEntry(String name);
// TODO: ML - For expediency, the index argument was added to these methods
// but it is not clear that this makes sense in the long run. This needs to