Author: rickhall
Date: Fri Sep 12 13:51:49 2008
New Revision: 694804
URL: http://svn.apache.org/viewvc?rev=694804&view=rev
Log:
Added a configuration property to determine whether installing a fragment
that uses unimplemented features throws an exception or logs a warnging.
(FELIX-725)
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/util/FelixConstants.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
felix/trunk/main/src/main/resources/config.properties
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/util/FelixConstants.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/FelixConstants.java?rev=694804&r1=694803&r2=694804&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/util/FelixConstants.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/util/FelixConstants.java
Fri Sep 12 13:51:49 2008
@@ -51,6 +51,11 @@
= "felix.startlevel.bundle";
public static final String SERVICE_URLHANDLERS_PROP =
"felix.service.urlhandlers";
+ // THESE CAN BE DELETED ONCE WE HAVE COMPLETE FRAGMENT SUPPORT.
+ public static final String FRAGMENT_VALIDATION_PROP =
"felix.fragment.validation";
+ public static final String FRAGMENT_VALIDATION_EXCEPTION_VALUE =
"exception";
+ public static final String FRAGMENT_VALIDATION_WARNING_VALUE = "warning";
+
// Start level-related constants.
public static final int FRAMEWORK_INACTIVE_STARTLEVEL = 0;
public static final int FRAMEWORK_DEFAULT_STARTLEVEL = 1;
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java?rev=694804&r1=694803&r2=694804&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
Fri Sep 12 13:51:49 2008
@@ -255,8 +255,18 @@
|| (headerMap.get(Constants.EXPORT_PACKAGE) != null)
|| (headerMap.get(Constants.BUNDLE_NATIVECODE) != null))
{
- throw new BundleException(
- "Fragments with exports, imports, or native code are not
currently supported.");
+ String s = (String)
m_configMap.get(FelixConstants.FRAGMENT_VALIDATION_PROP);
+ s = (s == null) ?
FelixConstants.FRAGMENT_VALIDATION_EXCEPTION_VALUE : s;
+ if
(s.equalsIgnoreCase(FelixConstants.FRAGMENT_VALIDATION_WARNING_VALUE))
+ {
+ m_logger.log(Logger.LOG_WARNING,
+ "Fragments with exports, imports, or native code are
not currently supported.");
+ }
+ else
+ {
+ throw new BundleException(
+ "Fragments with exports, imports, or native code are
not currently supported.");
+ }
}
}
}
Modified: felix/trunk/main/src/main/resources/config.properties
URL:
http://svn.apache.org/viewvc/felix/trunk/main/src/main/resources/config.properties?rev=694804&r1=694803&r2=694804&view=diff
==============================================================================
--- felix/trunk/main/src/main/resources/config.properties (original)
+++ felix/trunk/main/src/main/resources/config.properties Fri Sep 12 13:51:49
2008
@@ -34,6 +34,13 @@
felix.log.level=4
felix.startlevel.framework=1
felix.startlevel.bundle=1
+
+# Invalid fragment bundles throw an 'exception' by default, but
+# uncomment the follow line to have them log a 'warning' instead.
+#felix.fragment.validation=warning
+
+# Felix installs a stream and content handler factories by default,
+# uncomment the following line to not install them.
#felix.service.urlhandlers=false
#