bug fixes for MARMOTTA-388
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/4ba0d1bf Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/4ba0d1bf Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/4ba0d1bf Branch: refs/heads/develop Commit: 4ba0d1bf4cd34b571f9729217dd6cf16fcc1fa91 Parents: 61c14a1 Author: Sebastian Schaffert <[email protected]> Authored: Tue Dec 17 14:44:54 2013 +0100 Committer: Sebastian Schaffert <[email protected]> Committed: Tue Dec 17 14:44:54 2013 +0100 ---------------------------------------------------------------------- .../marmotta/kiwi/caching/KiWiCacheManager.java | 2 + .../src/main/resources/jgroups-kiwi.xml | 17 +++ .../kiwi/test/LDCachePersistenceTest.java | 8 +- .../test/rdf/TestLinkedDataProvider.java | 1 + platform/marmotta-core/pom.xml | 2 + .../core/services/cache/CachingServiceImpl.java | 2 + .../ehcache/EHCacheStatisticsModule.java | 140 ------------------- .../marmotta/platform/core/util/CDIContext.java | 5 +- 8 files changed, 28 insertions(+), 149 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/marmotta/blob/4ba0d1bf/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/KiWiCacheManager.java ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/KiWiCacheManager.java b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/KiWiCacheManager.java index f22a6ad..6c25504 100644 --- a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/KiWiCacheManager.java +++ b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/KiWiCacheManager.java @@ -72,6 +72,7 @@ public class KiWiCacheManager { .machineId("instance-" + config.getDatacenterId()) .addProperty("configurationFile", "jgroups-kiwi.xml") .globalJmxStatistics() + .jmxDomain("org.apache.marmotta.kiwi") .build(); @@ -95,6 +96,7 @@ public class KiWiCacheManager { } else { globalConfiguration = new GlobalConfigurationBuilder() .globalJmxStatistics() + .jmxDomain("org.apache.marmotta.kiwi") .build(); defaultConfiguration = new ConfigurationBuilder() http://git-wip-us.apache.org/repos/asf/marmotta/blob/4ba0d1bf/libraries/kiwi/kiwi-triplestore/src/main/resources/jgroups-kiwi.xml ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-triplestore/src/main/resources/jgroups-kiwi.xml b/libraries/kiwi/kiwi-triplestore/src/main/resources/jgroups-kiwi.xml index aa5ce8c..fb9b7d3 100644 --- a/libraries/kiwi/kiwi-triplestore/src/main/resources/jgroups-kiwi.xml +++ b/libraries/kiwi/kiwi-triplestore/src/main/resources/jgroups-kiwi.xml @@ -1,3 +1,20 @@ +<!-- + ~ 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. + --> + <config xmlns="urn:org:jgroups" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.4.xsd"> http://git-wip-us.apache.org/repos/asf/marmotta/blob/4ba0d1bf/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/backend/kiwi/test/LDCachePersistenceTest.java ---------------------------------------------------------------------- diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/backend/kiwi/test/LDCachePersistenceTest.java b/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/backend/kiwi/test/LDCachePersistenceTest.java index d066405..35f11b4 100644 --- a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/backend/kiwi/test/LDCachePersistenceTest.java +++ b/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/backend/kiwi/test/LDCachePersistenceTest.java @@ -28,11 +28,7 @@ import org.apache.marmotta.kiwi.persistence.pgsql.PostgreSQLDialect; import org.apache.marmotta.ldcache.backend.kiwi.model.KiWiCacheEntry; import org.apache.marmotta.ldcache.backend.kiwi.persistence.LDCachingKiWiPersistence; import org.apache.marmotta.ldcache.backend.kiwi.persistence.LDCachingKiWiPersistenceConnection; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; +import org.junit.*; import org.junit.rules.TestWatcher; import org.junit.runner.Description; import org.junit.runner.RunWith; @@ -171,7 +167,7 @@ public class LDCachePersistenceTest { LDCachingKiWiPersistenceConnection connection = vpersistence.getConnection(); try { Assert.assertThat(connection.getDatabaseTables(), hasItems("ldcache_entries")); - Assert.assertEquals(2, connection.getDatabaseVersion()); + Assert.assertEquals(3, connection.getDatabaseVersion()); connection.commit(); } finally { http://git-wip-us.apache.org/repos/asf/marmotta/blob/4ba0d1bf/libraries/ldclient/ldclient-provider-rdf/src/test/java/org/apache/marmotta/ldclient/test/rdf/TestLinkedDataProvider.java ---------------------------------------------------------------------- diff --git a/libraries/ldclient/ldclient-provider-rdf/src/test/java/org/apache/marmotta/ldclient/test/rdf/TestLinkedDataProvider.java b/libraries/ldclient/ldclient-provider-rdf/src/test/java/org/apache/marmotta/ldclient/test/rdf/TestLinkedDataProvider.java index f6fa7cf..bc9277b 100644 --- a/libraries/ldclient/ldclient-provider-rdf/src/test/java/org/apache/marmotta/ldclient/test/rdf/TestLinkedDataProvider.java +++ b/libraries/ldclient/ldclient-provider-rdf/src/test/java/org/apache/marmotta/ldclient/test/rdf/TestLinkedDataProvider.java @@ -117,6 +117,7 @@ public class TestLinkedDataProvider { * */ @Test + @Ignore("test failing for the moment because the data returned by the service is wrong") public void testRDFOhloh() throws Exception { Assume.assumeTrue(ldclient.ping(MARMOTTA)); ClientResponse response = ldclient.retrieveResource(MARMOTTA); http://git-wip-us.apache.org/repos/asf/marmotta/blob/4ba0d1bf/platform/marmotta-core/pom.xml ---------------------------------------------------------------------- diff --git a/platform/marmotta-core/pom.xml b/platform/marmotta-core/pom.xml index d38d15e..3cad061 100644 --- a/platform/marmotta-core/pom.xml +++ b/platform/marmotta-core/pom.xml @@ -341,10 +341,12 @@ <groupId>org.infinispan</groupId> <artifactId>infinispan-core</artifactId> </dependency> + <!-- TODO: we still use our own CDI implementation here... <dependency> <groupId>org.infinispan</groupId> <artifactId>infinispan-cdi</artifactId> </dependency> + --> <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> http://git-wip-us.apache.org/repos/asf/marmotta/blob/4ba0d1bf/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/cache/CachingServiceImpl.java ---------------------------------------------------------------------- diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/cache/CachingServiceImpl.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/cache/CachingServiceImpl.java index 729a563..459d63c 100644 --- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/cache/CachingServiceImpl.java +++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/cache/CachingServiceImpl.java @@ -86,6 +86,7 @@ public class CachingServiceImpl implements CachingService { .machineId(configurationService.getServerName()) .addProperty("configurationFile", "jgroups-marmotta.xml") .globalJmxStatistics() + .jmxDomain("org.apache.marmotta.platform") .build(); @@ -109,6 +110,7 @@ public class CachingServiceImpl implements CachingService { } else { globalConfiguration = new GlobalConfigurationBuilder() .globalJmxStatistics() + .jmxDomain("org.apache.marmotta.platform") .build(); defaultConfiguration = new ConfigurationBuilder() http://git-wip-us.apache.org/repos/asf/marmotta/blob/4ba0d1bf/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/statistics/ehcache/EHCacheStatisticsModule.java ---------------------------------------------------------------------- diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/statistics/ehcache/EHCacheStatisticsModule.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/statistics/ehcache/EHCacheStatisticsModule.java deleted file mode 100644 index a4f4f8e..0000000 --- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/statistics/ehcache/EHCacheStatisticsModule.java +++ /dev/null @@ -1,140 +0,0 @@ -/** - * 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.marmotta.platform.core.services.statistics.ehcache; - -import org.apache.marmotta.platform.core.api.cache.CachingService; -import org.apache.marmotta.platform.core.api.statistics.StatisticsModule; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Statistics; -import org.slf4j.Logger; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -/** - * Offer statistical information about the EHCache caches used in the KiWi System - * <p/> - * User: sschaffe - */ -public class EHCacheStatisticsModule implements StatisticsModule { - - @Inject - private Logger log; - - @Inject - private CachingService cachingService; - - @PostConstruct - public void initialize() { - - - } - - /** - * Enable this module. Depending on the type of information, this may involve additional runtime overhead. - */ - @Override - public void enable() { - for(String cacheName : cachingService.getCacheNames()) { - Ehcache cache = cachingService.getCacheByName(cacheName); - if(cache != null) { - cache.setStatisticsEnabled(true); - cache.setStatisticsAccuracy(Statistics.STATISTICS_ACCURACY_GUARANTEED); - } - } - } - - /** - * Disable this module. - */ - @Override - public void disable() { - for(String cacheName : cachingService.getCacheNames()) { - Ehcache cache = cachingService.getCacheByName(cacheName); - if(cache != null) { - cache.setStatisticsEnabled(false); - cache.setStatisticsAccuracy(Statistics.STATISTICS_ACCURACY_NONE); - } - } - } - - /** - * Return true if the module is enabled. - * - * @return - */ - @Override - public boolean isEnabled() { - return true; - } - - /** - * Return all names of properties supported by this module. - * - * @return - */ - @Override - public List<String> getPropertyNames() { - - List<String> propertyNames = new LinkedList<String>(); - for(String cacheName : cachingService.getCacheNames()) { - propertyNames.add(cacheName + " hits"); - propertyNames.add(cacheName + " misses"); - propertyNames.add(cacheName + " size"); - } - return propertyNames; - } - - /** - * Return the statistics as a map from key to value - * - * @return - */ - @Override - public Map<String, String> getStatistics() { - - LinkedHashMap<String,String> result = new LinkedHashMap<String, String>(); - for(String cacheName : cachingService.getCacheNames()) { - Ehcache cache = cachingService.getCacheByName(cacheName); - if(cache != null) { - Statistics stat = cache.getStatistics(); - - result.put(cacheName + " hits",""+stat.getCacheHits()); - result.put(cacheName + " misses",""+stat.getCacheMisses()); - result.put(cacheName + " size",""+stat.getObjectCount()); - } else { - log.warn("cache with name {} does not exist",cacheName); - } - } - return result; - } - - /** - * Return the display name of the statistics module. - * - * @return - */ - @Override - public String getName() { - return "Cache Statistics"; - } -} http://git-wip-us.apache.org/repos/asf/marmotta/blob/4ba0d1bf/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/util/CDIContext.java ---------------------------------------------------------------------- diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/util/CDIContext.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/util/CDIContext.java index 76a5ed4..c35e570 100644 --- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/util/CDIContext.java +++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/util/CDIContext.java @@ -65,9 +65,8 @@ public class CDIContext { try { return (BeanManager) new InitialContext().lookup(location); } catch (NameNotFoundException e) { - log.error( - "NameNotFoundException for path {}", - location, e); + // do nothing: it is ok to throw an exception here because we will look anyways in other locations and + // throw an exception at the end of the method } catch (NamingException e) { log.error( "naming exception for path {}; this probably means that JNDI is not set up properly (see e.g. http://code.google.com/p/lmf/wiki/InstallationSetup#Specific_Settings_for_Tomcat )",
