Author: rwesten
Date: Thu Apr 17 09:23:52 2014
New Revision: 1588186
URL: http://svn.apache.org/r1588186
Log:
fixes STANBOL-1322 in trunk. Much less changes as for the 0.12 branch as a lot
of adaptions where already done wile working on 1.0.0
Modified:
stanbol/trunk/commons/stanboltools/datafileprovider/src/main/java/org/apache/stanbol/commons/stanboltools/datafileprovider/impl/MainDataFileProvider.java
stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/it/OsgiConsoleTest.java
stanbol/trunk/launchers/bundlelists/osgiframework/src/main/bundles/list.xml
stanbol/trunk/launchers/bundlelists/stanbolcommons/src/main/bundles/list.xml
stanbol/trunk/parent/pom.xml
Modified:
stanbol/trunk/commons/stanboltools/datafileprovider/src/main/java/org/apache/stanbol/commons/stanboltools/datafileprovider/impl/MainDataFileProvider.java
URL:
http://svn.apache.org/viewvc/stanbol/trunk/commons/stanboltools/datafileprovider/src/main/java/org/apache/stanbol/commons/stanboltools/datafileprovider/impl/MainDataFileProvider.java?rev=1588186&r1=1588185&r2=1588186&view=diff
==============================================================================
---
stanbol/trunk/commons/stanboltools/datafileprovider/src/main/java/org/apache/stanbol/commons/stanboltools/datafileprovider/impl/MainDataFileProvider.java
(original)
+++
stanbol/trunk/commons/stanboltools/datafileprovider/src/main/java/org/apache/stanbol/commons/stanboltools/datafileprovider/impl/MainDataFileProvider.java
Thu Apr 17 09:23:52 2014
@@ -79,8 +79,23 @@ public class MainDataFileProvider implem
/** List of past events, up to maxEvents in size */
private final List<DataFileProviderEvent> events = new
LinkedList<DataFileProviderEvent>();
- /** Tracks providers to which we can delegate */
+ /**
+ * Tracks providers to which we can delegate. <i>NOTE:</i> this tracker is
+ * lazily opened by {@link #getSortedServiceRefs()} as this can not be
+ * done during {@link #activate(ComponentContext) activation} as it would
+ * result in <code>org.osgi.framework.ServiceException:
+ * ServiceFactory.getService() resulted in a cycle.</code>
+ * @see #providersTrackerOpen
+ * @see #getSortedServiceRefs()
+ */
private ServiceTracker providersTracker;
+ /**
+ * Used to track if {@link ServiceTracker#open()} was already called on
+ * {@link #providersTracker}
+ * @see #providersTracker
+ * @see #getSortedServiceRefs()
+ */
+ private boolean providersTrackerOpen = false; //used for lazily open the
tracker
@Activate
protected void activate(ComponentContext ctx) throws
ConfigurationException {
@@ -99,9 +114,11 @@ public class MainDataFileProvider implem
throw new ConfigurationException(DATA_FILES_FOLDER_PROP, "The
configured DataFile directory "+dataFilesFolder+" does already exists but is
not a directory!");
} //else exists and is a directory!
maxEvents = requireProperty(ctx.getProperties(), MAX_EVENTS_PROP,
Integer.class).intValue();
-
providersTracker = new ServiceTracker(ctx.getBundleContext(),
DataFileProvider.class.getName(), null);
- providersTracker.open();
+ providersTrackerOpen = false;
+ //NOTE: do not call apen in activate as this do cause a
+ //org.osgi.framework.ServiceException: ServiceFactory.getService()
resulted in a cycle.
+ //providersTracker.open();
log.info("Activated, max.events {}, data files folder {}",
maxEvents, dataFilesFolder.getAbsolutePath());
}
@@ -109,7 +126,10 @@ public class MainDataFileProvider implem
@Deactivate
protected void deactivate(ComponentContext ctx) {
if(providersTracker != null) {
- providersTracker.close();
+ synchronized (providersTracker) {
+ providersTrackerOpen = false;
+ providersTracker.close();
+ }
providersTracker = null;
}
}
@@ -162,8 +182,7 @@ public class MainDataFileProvider implem
// ordered by service ranking
if(dataFile == null) {
// Sort providers by service ranking
- final List<ServiceReference> refs =
Arrays.asList(providersTracker.getServiceReferences());
- Collections.sort(refs);
+ final List<ServiceReference> refs = getSortedServiceRefs();
for(ServiceReference ref: refs) {
final Object o = providersTracker.getService(ref);
if(o == this) {
@@ -224,6 +243,28 @@ public class MainDataFileProvider implem
return result;
}
+ /**
+ * Getter for the sorted list of service References. THis also lazily
+ * opens the {@link ServiceTracker} on the first call.
+ * @return the sorted list of service references
+ */
+ private List<ServiceReference> getSortedServiceRefs() {
+ ServiceTracker providersTracker = this.providersTracker;
+ if(providersTracker == null){ //already deactivated
+ return Collections.emptyList();
+ }
+ if(!providersTrackerOpen){ //check if we need to open the service
tracker
+ synchronized (providersTracker) { //sync
+ if(!providersTrackerOpen){ //and check again
+ providersTracker.open(); //we need to open it
+ }
+ }
+ }
+ final List<ServiceReference> refs =
Arrays.asList(providersTracker.getServiceReferences());
+ Collections.sort(refs);
+ return refs;
+ }
+
@SuppressWarnings("unchecked")
@Override
public boolean isAvailable(String bundleSymbolicName, String filename,
Map<String,String> comments) {
@@ -233,7 +274,7 @@ public class MainDataFileProvider implem
// ordered by service ranking
if(dataFile == null) {
// Sort providers by service ranking
- final List<ServiceReference> refs =
Arrays.asList(providersTracker.getServiceReferences());
+ final List<ServiceReference> refs = getSortedServiceRefs();
Collections.sort(refs);
for(ServiceReference ref: refs) {
final Object o = providersTracker.getService(ref);
Modified:
stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/it/OsgiConsoleTest.java
URL:
http://svn.apache.org/viewvc/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/it/OsgiConsoleTest.java?rev=1588186&r1=1588185&r2=1588186&view=diff
==============================================================================
---
stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/it/OsgiConsoleTest.java
(original)
+++
stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/it/OsgiConsoleTest.java
Thu Apr 17 09:23:52 2014
@@ -28,7 +28,7 @@ public class OsgiConsoleTest extends Sta
"bundles",
"components",
"configMgr",
- "config",
+ //"config", No longer available with Felix Webconsole 4.2.2
"licenses",
"logs",
"memoryusage",
Modified:
stanbol/trunk/launchers/bundlelists/osgiframework/src/main/bundles/list.xml
URL:
http://svn.apache.org/viewvc/stanbol/trunk/launchers/bundlelists/osgiframework/src/main/bundles/list.xml?rev=1588186&r1=1588185&r2=1588186&view=diff
==============================================================================
--- stanbol/trunk/launchers/bundlelists/osgiframework/src/main/bundles/list.xml
(original)
+++ stanbol/trunk/launchers/bundlelists/osgiframework/src/main/bundles/list.xml
Thu Apr 17 09:23:52 2014
@@ -32,37 +32,37 @@
<bundle>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr</artifactId>
- <version>1.6.2</version>
+ <version>1.8.2</version>
</bundle>
<bundle>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.configadmin</artifactId>
- <version>1.2.8</version>
+ <version>1.8.0</version>
</bundle>
<bundle>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.metatype</artifactId>
- <version>1.0.4</version>
+ <version>1.0.10</version>
</bundle>
<bundle>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.eventadmin</artifactId>
- <version>1.2.14</version>
+ <version>1.3.2</version>
</bundle>
<bundle>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.dependencymanager</artifactId>
- <version>3.0.0</version>
+ <version>3.1.0</version>
</bundle>
<bundle>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.dependencymanager.runtime</artifactId>
- <version>3.0.0</version>
+ <version>3.1.0</version>
</bundle>
<!-- bundle>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.deploymentadmin</artifactId>
- <version>0.9.0</version>
+ <version>0.9.6</version>
</bundle -->
<bundle>
<groupId>org.apache.felix</groupId>
@@ -72,12 +72,12 @@
<!-- bundle> OSGi Command Line Shell support (replaced by
org.apache.felix.shell)
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.gogo.runtime</artifactId>
- <version>0.10.0</version>
+ <version>0.12.0</version>
</bundle -->
<!-- <bundle>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.commons.osgi</artifactId>
- <version>2.1.0</version>
+ <version>2.2.0</version>
</bundle> -->
</startLevel>
@@ -121,7 +121,7 @@
<bundle>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.http.whiteboard</artifactId>
- <version>2.2.1</version>
+ <version>2.2.2</version>
</bundle>
</startLevel>
@@ -135,7 +135,7 @@
<bundle>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.webconsole</artifactId>
- <version>4.0.0</version>
+ <version>4.2.2</version>
</bundle>
<bundle>
<groupId>org.apache.felix</groupId>
@@ -165,7 +165,7 @@
<bundle>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.webconsole.plugins.event</artifactId>
- <version>1.0.2</version>
+ <version>1.1.0</version>
</bundle>
<bundle>
<groupId>org.apache.felix</groupId>
Modified:
stanbol/trunk/launchers/bundlelists/stanbolcommons/src/main/bundles/list.xml
URL:
http://svn.apache.org/viewvc/stanbol/trunk/launchers/bundlelists/stanbolcommons/src/main/bundles/list.xml?rev=1588186&r1=1588185&r2=1588186&view=diff
==============================================================================
---
stanbol/trunk/launchers/bundlelists/stanbolcommons/src/main/bundles/list.xml
(original)
+++
stanbol/trunk/launchers/bundlelists/stanbolcommons/src/main/bundles/list.xml
Thu Apr 17 09:23:52 2014
@@ -45,12 +45,12 @@
<bundle>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.installer.core</artifactId>
- <version>3.4.4</version>
+ <version>3.5.0</version>
</bundle>
<bundle>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.installer.factory.configuration</artifactId>
- <version>1.0.8</version>
+ <version>1.0.12</version>
</bundle>
<bundle>
<groupId>org.apache.stanbol</groupId>
@@ -79,7 +79,7 @@
<bundle>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.settings</artifactId>
- <version>1.2.2</version>
+ <version>1.3.0</version>
</bundle>
<bundle>
<groupId>org.apache.sling</groupId>
Modified: stanbol/trunk/parent/pom.xml
URL:
http://svn.apache.org/viewvc/stanbol/trunk/parent/pom.xml?rev=1588186&r1=1588185&r2=1588186&view=diff
==============================================================================
--- stanbol/trunk/parent/pom.xml (original)
+++ stanbol/trunk/parent/pom.xml Thu Apr 17 09:23:52 2014
@@ -184,7 +184,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
- <version>1.12.0</version>
+ <version>1.16.0</version>
<!-- slf4j impl is needed when QDox inspects/loads classes that use a
static field for the logger, so that those classes can be loaded.
-->
<dependencies>
@@ -296,7 +296,7 @@
<plugin>
<groupId>org.apache.sling</groupId>
<artifactId>maven-launchpad-plugin</artifactId>
- <version>2.2.0</version>
+ <version>2.3.0</version>
<extensions>true</extensions>
</plugin>
<!-- generates version number of dependencies suitable for
introspection
@@ -563,7 +563,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
- <version>1.9.2</version>
+ <version>1.9.8</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
@@ -579,7 +579,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.http.jetty</artifactId>
- <version>2.2.1</version>
+ <version>2.2.2</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -1447,13 +1447,13 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.launchpad.base</artifactId>
- <version>2.4.0</version>
+ <version>2.5.0</version>
<classifier>app</classifier>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.launchpad.base</artifactId>
- <version>2.4.0</version>
+ <version>2.5.0</version>
<classifier>webapp</classifier>
<type>war</type>
</dependency>