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 2010/03/03 16:04:42 UTC
svn commit: r918500 [4/4] - in
/felix/trunk/framework/src/main/java/org/apache/felix: framework/
framework/capabilityset/ framework/resolver/ framework/searchpolicy/
moduleloader/
Copied: felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResourceNotFoundException.java (from r915677, felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ResourceNotFoundException.java)
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResourceNotFoundException.java?p2=felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResourceNotFoundException.java&p1=felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ResourceNotFoundException.java&r1=915677&r2=918500&rev=918500&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ResourceNotFoundException.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResourceNotFoundException.java Wed Mar 3 15:04:41 2010
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.moduleloader;
+package org.apache.felix.framework.resolver;
public class ResourceNotFoundException extends Exception
{
Copied: felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Wire.java (from r915677, felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IWire.java)
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Wire.java?p2=felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Wire.java&p1=felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IWire.java&r1=915677&r2=918500&rev=918500&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IWire.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Wire.java Wed Mar 3 15:04:41 2010
@@ -1,57 +1,53 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.apache.felix.moduleloader;
+package org.apache.felix.framework.resolver;
+import org.apache.felix.framework.resolver.Module;
import java.net.URL;
import java.util.Enumeration;
+import org.apache.felix.framework.capabilityset.Capability;
+import org.apache.felix.framework.capabilityset.Requirement;
-/**
- * This interface represents a directed class/resource loading dependency
- * between two modules, which result when the framework resolves
- * <tt>Import-Package</tt> or <tt>Require-Bundle</tt> declarations. A wire is
- * the means by which a dependent module makes a class/resource request on
- * the providing module.
-**/
-public interface IWire
+public interface Wire
{
/**
* Returns the importing module.
* @return The importing module.
**/
- public IModule getImporter();
+ public Module getImporter();
/**
* Returns the associated requirement from the importing module that
* resulted in the creation of this wire.
* @return
**/
- public IRequirement getRequirement();
+ public Requirement getRequirement();
/**
* Returns the exporting module.
* @return The exporting module.
**/
- public IModule getExporter();
+ public Module getExporter();
/**
* Returns the associated capability from the exporting module that
* satisfies the requirement of the importing module.
* @return
**/
- public ICapability getCapability();
+ public Capability getCapability();
/**
* Returns whether or not the wire has a given package name. For some
* wires, such as ones for Require-Bundle, there may be many packages.
Copied: felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WireImpl.java (from r915677, felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Wire.java)
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WireImpl.java?p2=felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WireImpl.java&p1=felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Wire.java&r1=915677&r2=918500&rev=918500&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Wire.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WireImpl.java Wed Mar 3 15:04:41 2010
@@ -1,76 +1,68 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.apache.felix.framework.searchpolicy;
+package org.apache.felix.framework.resolver;
import java.net.URL;
import java.util.Enumeration;
-
+import org.apache.felix.framework.capabilityset.Capability;
+import org.apache.felix.framework.capabilityset.Requirement;
import org.apache.felix.framework.util.Util;
-import org.apache.felix.framework.util.manifestparser.Capability;
-import org.apache.felix.moduleloader.*;
+import org.apache.felix.framework.util.manifestparser.CapabilityImpl;
-public class R4Wire implements IWire
+public class WireImpl implements Wire
{
- private final IModule m_importer;
- private final IRequirement m_requirement;
- private final IModule m_exporter;
- private final ICapability m_capability;
+ private final Module m_importer;
+ private final Requirement m_req;
+ private final Module m_exporter;
+ private final Capability m_cap;
- public R4Wire(IModule importer, IRequirement requirement,
- IModule exporter, ICapability capability)
+ public WireImpl(Module importer, Requirement ip, Module exporter, Capability ep)
{
m_importer = importer;
- m_requirement = requirement;
+ m_req = ip;
m_exporter = exporter;
- m_capability = capability;
+ m_cap = ep;
}
- /* (non-Javadoc)
- * @see org.apache.felix.framework.searchpolicy.IWire#getImporter()
- */
- public IModule getImporter()
+ public Module getImporter()
{
return m_importer;
}
- /* (non-Javadoc)
- * @see org.apache.felix.framework.searchpolicy.IWire#getRequirement()
- */
- public IRequirement getRequirement()
+ public Requirement getRequirement()
{
- return m_requirement;
+ return m_req;
}
- /* (non-Javadoc)
- * @see org.apache.felix.framework.searchpolicy.IWire#getExporter()
- */
- public IModule getExporter()
+ public Module getExporter()
{
return m_exporter;
}
- /* (non-Javadoc)
- * @see org.apache.felix.framework.searchpolicy.IWire#getCapability()
- */
- public ICapability getCapability()
+ public Capability getCapability()
{
- return m_capability;
+ return m_cap;
+ }
+
+ public String toString()
+ {
+ return m_req + " (" + m_importer + ") -> " + m_cap + " (" + m_exporter + ")";
}
/* (non-Javadoc)
@@ -78,8 +70,8 @@
*/
public boolean hasPackage(String pkgName)
{
- return (m_capability.getNamespace().equals(ICapability.PACKAGE_NAMESPACE) &&
- m_capability.getProperties().get(ICapability.PACKAGE_PROPERTY).equals(pkgName));
+ return (m_cap.getNamespace().equals(Capability.PACKAGE_NAMESPACE) &&
+ m_cap.getAttribute(Capability.PACKAGE_ATTR).getValue().equals(pkgName));
}
/* (non-Javadoc)
@@ -94,16 +86,16 @@
// Only check when the package of the target class is
// the same as the package for the wire.
- if (m_capability.getNamespace().equals(ICapability.PACKAGE_NAMESPACE) &&
- m_capability.getProperties().get(ICapability.PACKAGE_PROPERTY).equals(pkgName))
+ if (m_cap.getNamespace().equals(Capability.PACKAGE_NAMESPACE) &&
+ m_cap.getAttribute(Capability.PACKAGE_ATTR).getValue().equals(pkgName))
{
// Check the include/exclude filters from the target package
// to make sure that the class is actually visible. We delegate
// to the exporting module, rather than its content, so it can
// it can follow any internal wires it may have (e.g., if the
// package has multiple sources).
- if (m_capability.getNamespace().equals(ICapability.PACKAGE_NAMESPACE)
- && ((Capability) m_capability).isIncluded(name))
+// TODO: FELIX3 - Should isIncluded() be part of Capability?
+ if (((CapabilityImpl) m_cap).isIncluded(name))
{
clazz = m_exporter.getClassByDelegation(name);
}
@@ -132,8 +124,8 @@
// Only check when the package of the target resource is
// the same as the package for the wire.
- if (m_capability.getNamespace().equals(ICapability.PACKAGE_NAMESPACE) &&
- m_capability.getProperties().get(ICapability.PACKAGE_PROPERTY).equals(pkgName))
+ if (m_cap.getNamespace().equals(Capability.PACKAGE_NAMESPACE) &&
+ m_cap.getAttribute(Capability.PACKAGE_ATTR).getValue().equals(pkgName))
{
// Delegate to the exporting module, rather than its
// content, so that it can follow any internal wires it may have
@@ -164,8 +156,8 @@
// Only check when the package of the target resource is
// the same as the package for the wire.
- if (m_capability.getNamespace().equals(ICapability.PACKAGE_NAMESPACE) &&
- m_capability.getProperties().get(ICapability.PACKAGE_PROPERTY).equals(pkgName))
+ if (m_cap.getNamespace().equals(Capability.PACKAGE_NAMESPACE) &&
+ m_cap.getAttribute(Capability.PACKAGE_ATTR).getValue().equals(pkgName))
{
urls = m_exporter.getResourcesByDelegation(name);
@@ -180,15 +172,4 @@
return urls;
}
-
- public String toString()
- {
- if (m_capability.getNamespace().equals(ICapability.PACKAGE_NAMESPACE))
- {
- return m_importer + " -> "
- + m_capability.getProperties().get(ICapability.PACKAGE_PROPERTY)
- + " -> " + m_exporter;
- }
- return m_importer + " -> " + m_capability + " -> " + m_exporter;
- }
}
\ No newline at end of file
Copied: felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WireModuleImpl.java (from r915677, 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/resolver/WireModuleImpl.java?p2=felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WireModuleImpl.java&p1=felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4WireModule.java&r1=915677&r2=918500&rev=918500&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/resolver/WireModuleImpl.java Wed Mar 3 15:04:41 2010
@@ -16,36 +16,37 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.framework.searchpolicy;
+package org.apache.felix.framework.resolver;
import java.net.URL;
-import java.util.*;
-
+import java.util.Enumeration;
+import java.util.List;
+import org.apache.felix.framework.capabilityset.Capability;
+import org.apache.felix.framework.capabilityset.Requirement;
import org.apache.felix.framework.util.Util;
-import org.apache.felix.moduleloader.*;
-public class R4WireModule implements IWire
+public class WireModuleImpl implements Wire
{
- private final IModule m_importer;
- private final IRequirement m_requirement;
- private final IModule m_exporter;
- private final ICapability m_capability;
- private final Map m_pkgMap;
+ private final Module m_importer;
+ private final Requirement m_requirement;
+ private final Module m_exporter;
+ private final Capability m_capability;
+ private final List<String> m_packages;
- public R4WireModule(IModule importer, IRequirement requirement,
- IModule exporter, ICapability capability, Map pkgMap)
+ public WireModuleImpl(Module importer, Requirement requirement,
+ Module exporter, Capability capability, List<String> packages)
{
m_importer = importer;
m_requirement = requirement;
m_exporter = exporter;
m_capability = capability;
- m_pkgMap = pkgMap;
+ m_packages = packages;
}
/* (non-Javadoc)
* @see org.apache.felix.framework.searchpolicy.IWire#getImporter()
*/
- public IModule getImporter()
+ public Module getImporter()
{
return m_importer;
}
@@ -53,7 +54,7 @@
/* (non-Javadoc)
* @see org.apache.felix.framework.searchpolicy.IWire#getRequirement()
*/
- public IRequirement getRequirement()
+ public Requirement getRequirement()
{
return m_requirement;
}
@@ -61,7 +62,7 @@
/* (non-Javadoc)
* @see org.apache.felix.framework.searchpolicy.IWire#getExporter()
*/
- public IModule getExporter()
+ public Module getExporter()
{
return m_exporter;
}
@@ -69,7 +70,7 @@
/* (non-Javadoc)
* @see org.apache.felix.framework.searchpolicy.IWire#getCapability()
*/
- public ICapability getCapability()
+ public Capability getCapability()
{
return m_capability;
}
@@ -79,7 +80,7 @@
*/
public boolean hasPackage(String pkgName)
{
- return (m_pkgMap.get(pkgName) != null);
+ return m_packages.contains(pkgName);
}
/* (non-Javadoc)
@@ -89,9 +90,7 @@
{
// Get the package of the target class.
String pkgName = Util.getClassPackage(name);
-
- ResolvedPackage rp = (ResolvedPackage) m_pkgMap.get(pkgName);
- if (rp != null)
+ if (m_packages.contains(pkgName))
{
try
{
@@ -119,9 +118,7 @@
{
// Get the package of the target class.
String pkgName = Util.getResourcePackage(name);
-
- ResolvedPackage rp = (ResolvedPackage) m_pkgMap.get(pkgName);
- if (rp != null)
+ if (m_packages.contains(pkgName))
{
URL url = m_exporter.getResourceByDelegation(name);
if (url != null)
@@ -145,10 +142,7 @@
String pkgName = Util.getResourcePackage(name);
// See if we have a resolved package for the resource's package.
- // If so, loop through all package sources and aggregate any
- // matching resource enumerations.
- ResolvedPackage rp = (ResolvedPackage) m_pkgMap.get(pkgName);
- if (rp != null)
+ if (m_packages.contains(pkgName))
{
Enumeration urls = m_exporter.getResourcesByDelegation(name);
if (urls != null)