You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by pl...@apache.org on 2016/09/15 17:26:26 UTC
[09/24] incubator-tamaya git commit: Removed all modules from the
main repository. They will be reborn in separate ASF repository.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/json/src/test/resources/arquillian.xml
----------------------------------------------------------------------
diff --git a/modules/json/src/test/resources/arquillian.xml b/modules/json/src/test/resources/arquillian.xml
deleted file mode 100644
index 1eeb58b..0000000
--- a/modules/json/src/test/resources/arquillian.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<arquillian xmlns="http://jboss.org/schema/arquillian"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
- <container qualifier="daemon" default="true">
- <configuration>
- <property name="host">localhost</property>
- <property name="port">12346</property>
- <property name="serverJarFile">target/arquillian-daemon-main.jar</property>
- </configuration>
- </container>
-</arquillian>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/json/src/test/resources/configs/invalid/array.json
----------------------------------------------------------------------
diff --git a/modules/json/src/test/resources/configs/invalid/array.json b/modules/json/src/test/resources/configs/invalid/array.json
deleted file mode 100644
index 0c2058a..0000000
--- a/modules/json/src/test/resources/configs/invalid/array.json
+++ /dev/null
@@ -1,21 +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.
-*/
-[
-
-]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/json/src/test/resources/configs/invalid/empty-file.json
----------------------------------------------------------------------
diff --git a/modules/json/src/test/resources/configs/invalid/empty-file.json b/modules/json/src/test/resources/configs/invalid/empty-file.json
deleted file mode 100644
index f396085..0000000
--- a/modules/json/src/test/resources/configs/invalid/empty-file.json
+++ /dev/null
@@ -1,18 +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.
-*/
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/json/src/test/resources/configs/invalid/only-opening-bracket.json
----------------------------------------------------------------------
diff --git a/modules/json/src/test/resources/configs/invalid/only-opening-bracket.json b/modules/json/src/test/resources/configs/invalid/only-opening-bracket.json
deleted file mode 100644
index b936f69..0000000
--- a/modules/json/src/test/resources/configs/invalid/only-opening-bracket.json
+++ /dev/null
@@ -1,19 +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.
-*/
-{
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/json/src/test/resources/configs/invalid/with-array.json
----------------------------------------------------------------------
diff --git a/modules/json/src/test/resources/configs/invalid/with-array.json b/modules/json/src/test/resources/configs/invalid/with-array.json
deleted file mode 100644
index e623e49..0000000
--- a/modules/json/src/test/resources/configs/invalid/with-array.json
+++ /dev/null
@@ -1,27 +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.
-*/
-{
- "a" : "A",
- "b" : {
- "c" : "C",
- "d" : [
- "1", "2"
- ]
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/json/src/test/resources/configs/valid/cyrillic.json
----------------------------------------------------------------------
diff --git a/modules/json/src/test/resources/configs/valid/cyrillic.json b/modules/json/src/test/resources/configs/valid/cyrillic.json
deleted file mode 100644
index b9f07b8..0000000
--- a/modules/json/src/test/resources/configs/valid/cyrillic.json
+++ /dev/null
@@ -1,22 +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.
-*/
-{
- "name" : "\u041e\u043b\u0438\u0432\u0435\u0440",
- "\u0444\u0430\u043c\u0438\u043b\u0438\u044f" : "Fischer"
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/json/src/test/resources/configs/valid/empty-object-config.json
----------------------------------------------------------------------
diff --git a/modules/json/src/test/resources/configs/valid/empty-object-config.json b/modules/json/src/test/resources/configs/valid/empty-object-config.json
deleted file mode 100644
index 103c28d..0000000
--- a/modules/json/src/test/resources/configs/valid/empty-object-config.json
+++ /dev/null
@@ -1,20 +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.
-*/
-{
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/json/src/test/resources/configs/valid/simple-flat-string-only-config.json
----------------------------------------------------------------------
diff --git a/modules/json/src/test/resources/configs/valid/simple-flat-string-only-config.json b/modules/json/src/test/resources/configs/valid/simple-flat-string-only-config.json
deleted file mode 100644
index 02e2cd8..0000000
--- a/modules/json/src/test/resources/configs/valid/simple-flat-string-only-config.json
+++ /dev/null
@@ -1,23 +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.
-*/
-{
- "a" : "A",
- "b" : "B",
- "c" : "C"
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/json/src/test/resources/configs/valid/simple-nested-string-only-config-1.json
----------------------------------------------------------------------
diff --git a/modules/json/src/test/resources/configs/valid/simple-nested-string-only-config-1.json b/modules/json/src/test/resources/configs/valid/simple-nested-string-only-config-1.json
deleted file mode 100644
index fb2c4fe..0000000
--- a/modules/json/src/test/resources/configs/valid/simple-nested-string-only-config-1.json
+++ /dev/null
@@ -1,27 +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.
-*/
-{
- "a": "A",
- "b": "B",
- "c": "C",
- "d": {
- "o": "O",
- "p": "P"
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/json/src/test/resources/configs/valid/simple-nested-string-only-config-2.json
----------------------------------------------------------------------
diff --git a/modules/json/src/test/resources/configs/valid/simple-nested-string-only-config-2.json b/modules/json/src/test/resources/configs/valid/simple-nested-string-only-config-2.json
deleted file mode 100644
index b037174..0000000
--- a/modules/json/src/test/resources/configs/valid/simple-nested-string-only-config-2.json
+++ /dev/null
@@ -1,26 +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.
-*/
-{
- "a" : "A",
- "b" : {
- "o" : "O",
- "p" : "P"
- },
- "c" : "C"
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/json/src/test/resources/configs/valid/with-explicit-priority.json
----------------------------------------------------------------------
diff --git a/modules/json/src/test/resources/configs/valid/with-explicit-priority.json b/modules/json/src/test/resources/configs/valid/with-explicit-priority.json
deleted file mode 100644
index ed7acc2..0000000
--- a/modules/json/src/test/resources/configs/valid/with-explicit-priority.json
+++ /dev/null
@@ -1,25 +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.
-*/
-{
- /*
- some useful comment here
- */
- "tamaya.ordinal" : 16784,
- "a" : "A" // another comment
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/management/pom.xml
----------------------------------------------------------------------
diff --git a/modules/management/pom.xml b/modules/management/pom.xml
deleted file mode 100644
index 8603cf9..0000000
--- a/modules/management/pom.xml
+++ /dev/null
@@ -1,81 +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 current 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-extensions</artifactId>
- <version>0.3-incubating-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
-
- <artifactId>tamaya-management</artifactId>
- <name>Apache Tamaya Modules - Java Management Extensions</name>
- <packaging>bundle</packaging>
-
- <properties>
- <jdkVersion>1.7</jdkVersion>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-functions</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-core</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>java-hamcrest</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>
- org.apache.tamaya.management
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/management/src/main/java/org/apache/tamaya/management/ConfigManagementSupport.java
----------------------------------------------------------------------
diff --git a/modules/management/src/main/java/org/apache/tamaya/management/ConfigManagementSupport.java b/modules/management/src/main/java/org/apache/tamaya/management/ConfigManagementSupport.java
deleted file mode 100644
index 64fa062..0000000
--- a/modules/management/src/main/java/org/apache/tamaya/management/ConfigManagementSupport.java
+++ /dev/null
@@ -1,128 +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.tamaya.management;
-
-
-import org.apache.tamaya.spi.ServiceContextManager;
-
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import java.lang.management.ManagementFactory;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Accessor singleton for the JMX configuration support module.
- */
-public class ConfigManagementSupport {
-
- /** The logger used. */
- private final static Logger LOG = Logger.getLogger(ConfigManagementSupport.class.getName());
-
- /**
- * Private singleton constructor.
- */
- private ConfigManagementSupport(){}
-
- /**
- * Creates a new instance of a {@link ManagedConfigMBean} instance. This method uses the
- * current {@link ServiceContextManager} to resolve the implementation to be used.
- * @return a new ManagedConfigMBean instance, or null
- * @throws org.apache.tamaya.ConfigException if there are multiple service implementations with the
- * maximum priority.
- */
- private static ManagedConfigMBean createMBean(){
- return ServiceContextManager.getServiceContext()
- .getService(ManagedConfigMBean.class);
- }
-
- /**
- * Registers a new instance of {@link ManagedConfigMBean} mbean for accessing config documentation into the local platform
- * mbean server.
- * @return the registered ObjectName, or null, if no bean could be created.
- */
- public static ObjectName registerMBean() {
- return registerMBean(null);
- }
-
- /**
- * Registers the {@link ManagedConfigMBean} mbean for accessing config documentation into the local platform
- * mbean server.
- * @param context An optional context parameter to be added to the object name.
- * @return the registered ObjectName, or null, if no bean could be created.
- */
- public static ObjectName registerMBean(String context) {
- try{
- ManagedConfigMBean configMbean = createMBean();
- if(configMbean==null){
- return null;
- }
- MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
- ObjectName on = context==null?new ObjectName("org.apache.tamaya.managemet:type=ManagedConfigMBean"):
- new ObjectName("org.apache.tamaya.management:type=ManagedConfigMBean,context="+context);
- try{
- mbs.getMBeanInfo(on);
- LOG.info("Cannot register mbean " + on + ": already existing.");
- return on;
- } catch(InstanceNotFoundException e) {
- LOG.info("Registering mbean " + on + "...");
- mbs.registerMBean(configMbean, on);
- return on;
- }
- } catch(Exception e){
- LOG.log(Level.WARNING, "Failed to register ManagedConfigMBean.", e);
- }
- return null;
- }
-
- /**
- * Unregisters a new instance of {@link ManagedConfigMBean} mbean for accessing config documentation
- * into the local platform mbean server.
- * @return the unregistered ObjectName, or null, if no bean could be found.
- */
- public static ObjectName unregisterMBean() {
- return unregisterMBean(null);
- }
-
- /**
- * Unegisters the {@link ManagedConfigMBean} mbean for accessing config documentation into the local
- * platform mbean server.
- * @param context An optional context parameter to be added to the object name.
- * @return the unregistered ObjectName, or null, if no bean could be created.
- */
- public static ObjectName unregisterMBean(String context) {
- try{
- MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
- ObjectName on = context==null?new ObjectName("org.apache.tamaya.managemet:type=ManagedConfigMBean"):
- new ObjectName("org.apache.tamaya.management:type=ManagedConfigMBean,context="+context);
- try{
- mbs.unregisterMBean(on);
- LOG.info("Unregistered mbean " + on + ".");
- return on;
- } catch(InstanceNotFoundException e) {
- LOG.log(Level.INFO, "Unregistering mbean " + on + " failed.", e);
- }
- } catch(Exception e){
- LOG.log(Level.WARNING, "Failed to unregister ManagedConfigMBean.", e);
- }
- return null;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/management/src/main/java/org/apache/tamaya/management/ManagedConfig.java
----------------------------------------------------------------------
diff --git a/modules/management/src/main/java/org/apache/tamaya/management/ManagedConfig.java b/modules/management/src/main/java/org/apache/tamaya/management/ManagedConfig.java
deleted file mode 100644
index dab3457..0000000
--- a/modules/management/src/main/java/org/apache/tamaya/management/ManagedConfig.java
+++ /dev/null
@@ -1,110 +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.tamaya.management;
-
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.functions.ConfigurationFunctions;
-
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Default implementation of the {@link ManagedConfigMBean} interface. Each bean binds to the
- * current Configuration instance on creation.
- */
-public class ManagedConfig implements ManagedConfigMBean {
-
- /**
- * Classloader that was active when this instance was created.
- */
- private ClassLoader classLoader;
-
- /**
- * Constructor, which binds this instance to the current TCCL. In the rare cases where
- * the TCCL is null, this class's classloader is used.
- */
- public ManagedConfig() {
- this.classLoader = Thread.currentThread().getContextClassLoader();
- if (this.classLoader == null) {
- this.classLoader = ManagedConfigMBean.class.getClassLoader();
- }
- }
-
- @Override
- public String getJsonConfigurationInfo() {
- return getConfigurationInternal().query(ConfigurationFunctions.jsonInfo());
- }
-
- @Override
- public String getXmlConfigurationInfo() {
- return getConfigurationInternal().query(ConfigurationFunctions.xmlInfo());
- }
-
- @Override
- public Map<String, String> getConfiguration() {
- return getConfigurationInternal().getProperties();
- }
-
- @Override
- public Map<String, String> getSection(String area, boolean recursive) {
- return getConfigurationInternal().with(ConfigurationFunctions.section(area, recursive)).getProperties();
- }
-
- @Override
- public Set<String> getSections() {
- return getConfigurationInternal().query(ConfigurationFunctions.sections());
- }
-
- @Override
- public Set<String> getTransitiveSections() {
- return getConfigurationInternal().query(ConfigurationFunctions.transitiveSections());
- }
-
- @Override
- public boolean isAreaExisting(String area) {
- return !getConfigurationInternal().with(
- ConfigurationFunctions.section(area)).getProperties().isEmpty();
- }
-
- @Override
- public boolean isAreaEmpty(String area) {
- return getSection(area, true).isEmpty();
- }
-
-
- /**
- * Evaluate the current configuration. By default this class is temporarely setting the
- * TCCL to the instance active on bean creation and then calls {@link ConfigurationProvider#getConfiguration()}.
- *
- * @return the configuration instance to be used.
- */
- protected Configuration getConfigurationInternal() {
- ClassLoader currentCL = Thread.currentThread().getContextClassLoader();
- try{
- Thread.currentThread().setContextClassLoader(this.classLoader);
- return ConfigurationProvider.getConfiguration();
- } finally{
- Thread.currentThread().setContextClassLoader(currentCL);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/management/src/main/java/org/apache/tamaya/management/ManagedConfigMBean.java
----------------------------------------------------------------------
diff --git a/modules/management/src/main/java/org/apache/tamaya/management/ManagedConfigMBean.java b/modules/management/src/main/java/org/apache/tamaya/management/ManagedConfigMBean.java
deleted file mode 100644
index 7fa1eef..0000000
--- a/modules/management/src/main/java/org/apache/tamaya/management/ManagedConfigMBean.java
+++ /dev/null
@@ -1,119 +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.tamaya.management;
-
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Managed bean interface for accessing environment data.
- */
-public interface ManagedConfigMBean {
-
- /**
- * Get a general description of the configuration (context) in place, in JSON format:
- * <pre>
- * Configuration: {
- * "class": "org.apache.tamaya.core.internal.DefaultConfiguration",
- * "timestamp": 1440426409388,
- * "data": {
- * "ALLUSERSPROFILE": "C:\ProgramData",
- * "APPDATA": "C:\Users\Anatole\AppData\Roaming",
- * "COMPUTERNAME": "DEVBOX-WIN",
- * "ComSpec": "C:\Windows\system32\cmd.exe",
- * "CommonProgramFiles": "C:\Program Files\Common Files",
- * "CommonProgramFiles(x86)": "C:\Program Files (x86)\Common Files",
- * "CommonProgramW6432": "C:\Program Files\Common Files",
- * "FP_NO_HOST_CHECK": "NO",
- * "HOMEDRIVE": "C:",
- * // ...
- * }
- * }
- * </pre>
- *
- * @return a JSON formatted meta-information.
- */
- String getJsonConfigurationInfo();
-
- /**
- * Get a general description of the configuration (context) in place, in JSON format:
- * <pre>
- * ConfigurationContext[gqContextClassName] {
- * version = 2345-34334-2333-3434,
- * config {
- * key = "value",
- * key2 = "value2"
- * ...
- * },
- * filters = [...],
- * converters{...},
- * property-sources{...}
- * }
- * </pre>
- *
- * @return a JSON formatted meta-information.
- */
- String getXmlConfigurationInfo();
-
- /**
- * Accesses a configuration current a given type as Map.
- *
- * @return the current configuration map.
- * @throws org.apache.tamaya.ConfigException If the configuration is not available.
- */
- Map<String, String> getConfiguration();
-
- /**
- * Accesses a configuration values for current a given config section as Map.
- * @param area the target section key, not null.
- * @param recursive if set to false only direct child keys of the given section are returned.
- * @return the key/values found, including the recursive child values.
- * @throws org.apache.tamaya.ConfigException If the configuration is not yet loaded.
- */
- Map<String, String> getSection(String area, boolean recursive);
-
- /**
- * Access the defined sections for a given configuration.
- * @return the sections defined (only returning the sections that contain properties).
- * @throws org.apache.tamaya.ConfigException If the configuration is not yet loaded
- */
- Set<String> getSections();
-
- /**
- * Access the transitive sections for the current configuration.
- * @return the transitive sections defined.
- * @throws org.apache.tamaya.ConfigException If the configuration is not yet loaded
- */
- Set<String> getTransitiveSections();
-
- /**
- * Allows to determine if an section is existing.
- * @param area the target section key, not null.
- * @return true, if such an section exists (the section may be empty).
- */
- boolean isAreaExisting(String area);
-
- /**
- * Allows to determine if an section is empty.
- * @param area the target section key, not null.
- * @return true, if such an section exists and is not empty.
- */
- boolean isAreaEmpty(String area);
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/management/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/modules/management/src/main/resources/META-INF/beans.xml b/modules/management/src/main/resources/META-INF/beans.xml
deleted file mode 100644
index adee378..0000000
--- a/modules/management/src/main/resources/META-INF/beans.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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 current 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.
--->
-<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd">
-
-</beans>
-
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/management/src/main/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/modules/management/src/main/resources/META-INF/javaconfiguration.properties b/modules/management/src/main/resources/META-INF/javaconfiguration.properties
deleted file mode 100644
index 333ba9c..0000000
--- a/modules/management/src/main/resources/META-INF/javaconfiguration.properties
+++ /dev/null
@@ -1,19 +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 current 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.
-#
-a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z=alphabet
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/management/src/main/resources/META-INF/services/org.apache.tamaya.management.ManagedConfigMBean
----------------------------------------------------------------------
diff --git a/modules/management/src/main/resources/META-INF/services/org.apache.tamaya.management.ManagedConfigMBean b/modules/management/src/main/resources/META-INF/services/org.apache.tamaya.management.ManagedConfigMBean
deleted file mode 100644
index 4ba72b6..0000000
--- a/modules/management/src/main/resources/META-INF/services/org.apache.tamaya.management.ManagedConfigMBean
+++ /dev/null
@@ -1,19 +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 current 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.
-#
-org.apache.tamaya.management.ManagedConfig
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/management/src/test/java/org/apache/tamaya/management/internal/ManagedConfigTest.java
----------------------------------------------------------------------
diff --git a/modules/management/src/test/java/org/apache/tamaya/management/internal/ManagedConfigTest.java b/modules/management/src/test/java/org/apache/tamaya/management/internal/ManagedConfigTest.java
deleted file mode 100644
index 90ad0bf..0000000
--- a/modules/management/src/test/java/org/apache/tamaya/management/internal/ManagedConfigTest.java
+++ /dev/null
@@ -1,118 +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.tamaya.management.internal;
-
-import org.apache.tamaya.management.ConfigManagementSupport;
-import org.apache.tamaya.management.ManagedConfig;
-import org.apache.tamaya.management.ManagedConfigMBean;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import java.lang.management.ManagementFactory;
-import java.util.Map;
-import java.util.Set;
-
-import static org.junit.Assert.*;
-
-/**
- * Created by Anatole on 20.08.2015.
- */
-public class ManagedConfigTest {
-
- private final ManagedConfigMBean bean = new ManagedConfig();
-
- @org.junit.Test
- public void testGetJsonConfigurationInfo() throws Exception {
- String info = bean.getJsonConfigurationInfo();
- assertNotNull(info);
- assertTrue(info.contains("java.version"));
- System.out.println(bean.getJsonConfigurationInfo());
- }
-
- @org.junit.Test
- public void testGetXmlConfigurationInfo() throws Exception {
- String info = bean.getXmlConfigurationInfo();
- assertNotNull(info);
- assertTrue(info.contains("java.version"));
- assertTrue(info.contains("<configuration>"));
- System.out.println(bean.getXmlConfigurationInfo());
- }
-
- @org.junit.Test
- public void testGetConfiguration() throws Exception {
- Map<String,String> config = bean.getConfiguration();
- assertNotNull(config);
- for(Map.Entry<Object, Object> en:System.getProperties().entrySet()){
- assertEquals(config.get(en.getKey()),en.getValue());
- }
- }
-
- @org.junit.Test
- public void testGetConfigurationArea() throws Exception {
- Map<String,String> cfg = bean.getSection("java", false);
- for(Map.Entry<String,String> en:cfg.entrySet()){
- assertEquals(System.getProperty(en.getKey()), en.getValue());
- }
- }
-
- @org.junit.Test
- public void testGetAreas() throws Exception {
- Set<String> sections = (bean.getSections());
- assertNotNull(sections);
- assertTrue(sections.contains("java"));
- assertTrue(sections.contains("file"));
- }
-
- @org.junit.Test
- public void testGetTransitiveAreas() throws Exception {
- Set<String> sections = (bean.getTransitiveSections());
- Set<String> sectionsNT = (bean.getSections());
- assertNotNull(sections);
- assertTrue(sections.contains("java"));
- assertTrue(sections.contains("sun"));
- assertTrue(sections.contains("sun.os"));
- assertTrue(sectionsNT.size()<sections.size());
- }
-
- @org.junit.Test
- public void testIsAreaExisting() throws Exception {
- assertTrue(bean.isAreaExisting("java"));
- assertFalse(bean.isAreaExisting("sd.fldsfl.erlwsf"));
- }
-
- @org.junit.Test
- public void testRegisterMBean() throws Exception {
- ObjectName on = ConfigManagementSupport.registerMBean();
- ConfigManagementSupport.registerMBean();
- // Lookup object name
- MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
- assertTrue(mbs.getMBeanInfo(on)!=null);
- }
-
- @org.junit.Test
- public void testRegisterMBean1() throws Exception {
- ObjectName on1 = ConfigManagementSupport.registerMBean("SubContext1");
- ConfigManagementSupport.registerMBean("SubContext1");
- ObjectName on2 = ConfigManagementSupport.registerMBean("SubContext2");
- // Lookup object name
- MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
- assertTrue(mbs.getMBeanInfo(on1)!=null);
- assertTrue(mbs.getMBeanInfo(on2)!=null);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/management/src/test/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/modules/management/src/test/resources/META-INF/beans.xml b/modules/management/src/test/resources/META-INF/beans.xml
deleted file mode 100644
index adee378..0000000
--- a/modules/management/src/test/resources/META-INF/beans.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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 current 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.
--->
-<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd">
-
-</beans>
-
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/model/pom.xml
----------------------------------------------------------------------
diff --git a/modules/model/pom.xml b/modules/model/pom.xml
deleted file mode 100644
index b121c24..0000000
--- a/modules/model/pom.xml
+++ /dev/null
@@ -1,120 +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 current 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-extensions</artifactId>
- <version>0.3-incubating-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
-
- <artifactId>tamaya-model</artifactId>
- <name>Apache Tamaya Modules - Configuration Model Infrastructure</name>
- <description>This extension module provides functionality to describe, document and
- validate configuration during runtime.
- </description>
- <packaging>bundle</packaging>
-
- <properties>
- <jdkVersion>1.7</jdkVersion>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-core</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-injection-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-formats</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-events</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-json</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.apache.johnzon</groupId>
- <artifactId>johnzon-core</artifactId>
- <version>0.9-incubating</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-json_1.0_spec</artifactId>
- <version>1.0-alpha-1</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>java-hamcrest</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>
- org.apache.tamaya.model,
- org.apache.tamaya.model.spi
- </Export-Package>
- <Private-Package>
- org.apache.tamaya.model.internal
- </Private-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/model/src/main/java/org/apache/tamaya/model/ConfigModel.java
----------------------------------------------------------------------
diff --git a/modules/model/src/main/java/org/apache/tamaya/model/ConfigModel.java b/modules/model/src/main/java/org/apache/tamaya/model/ConfigModel.java
deleted file mode 100644
index 88403d1..0000000
--- a/modules/model/src/main/java/org/apache/tamaya/model/ConfigModel.java
+++ /dev/null
@@ -1,78 +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.tamaya.model;
-
-import org.apache.tamaya.Configuration;
-
-import java.util.Collection;
-
-/**
- * Base structure describing a validated item, by default a parameter or a section.
- */
-public interface ConfigModel {
-
- /**
- * Access the owner.
- * @return the owner of this model, never null.
- */
- String getOwner();
-
- /**
- * Get the type of item that is modelled.
- * @return the modelled type, never null.
- */
- ModelTarget getType();
-
- /**
- * Get the item's name, it should minimally describe the validation. Examples are:
- * <pre>
- * Sections: a.b.c
- * Params: a.b.c.paramName
- * Filter: a.b.c.FilterImplClass
- * Dependency: mydepClassname
- * CombinationPolicy: a.b.c.MyCombinationPolicyClass
- * </pre>
- * @return the item's name.
- */
- String getName();
-
- /**
- * Check if this validation is a required one.
- * @return true, if this validation is required.
- */
- boolean isRequired();
-
- /**
- * Get an description of the item, using the default locale. The description is basically optional
- * though it is higly recommended to provide a description, so the validation issues is well
- * resolvable.
- *
- * @return the description required, or null.
- */
- String getDescription();
-
- /**
- * Validates the item and all its children against the given configuration.
- *
- * @param config the configuration to be validated against, not null.
- * @return the validation result, or null, if not applicable.
- */
- Collection<Validation> validate(Configuration config);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/model/src/main/java/org/apache/tamaya/model/ConfigModelManager.java
----------------------------------------------------------------------
diff --git a/modules/model/src/main/java/org/apache/tamaya/model/ConfigModelManager.java b/modules/model/src/main/java/org/apache/tamaya/model/ConfigModelManager.java
deleted file mode 100644
index 078b0dc..0000000
--- a/modules/model/src/main/java/org/apache/tamaya/model/ConfigModelManager.java
+++ /dev/null
@@ -1,289 +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.tamaya.model;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.model.spi.ConfigDocumentationMBean;
-import org.apache.tamaya.model.spi.ModelProviderSpi;
-import org.apache.tamaya.spi.ServiceContextManager;
-
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import java.lang.management.ManagementFactory;
-import java.util.*;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Validator accessor to validate the current configuration.
- */
-public final class ConfigModelManager {
-
- /** The logger used. */
- private static final Logger LOG = Logger.getLogger(ConfigModelManager.class.getName());
-
- /**
- * Singleton constructor.
- */
- private ConfigModelManager() {
- }
-
- /**
- * Access the usage statistics for the recorded uses of configuration.
- * @return usage statistics
- */
- public static String getConfigInfoText(){
- StringBuilder b = new StringBuilder();
- List<ConfigModel> models = new ArrayList<>(getModels());
- Collections.sort(models, new Comparator<ConfigModel>() {
- @Override
- public int compare(ConfigModel k1, ConfigModel k2) {
- return k2.getName().compareTo(k2.getName());
- }
- });
- b.append("TYPE OWNER NAME MANDATORY DESCRIPTION\n");
- b.append("-----------------------------------------------------------------------------------------------------\n");
- for(ConfigModel model:models){
- switch(model.getType()){
- case Parameter:
- b.append("PARAM ");
- break;
- case Section:
- b.append("SECTION ");
- break;
- case Group:
- b.append("GROUP ");
- break;
- default:
- break;
- }
- b.append(formatWithFixedLength(model.getOwner(), 10)).append(' ');
- b.append(formatWithFixedLength(model.getName(), 50));
- if(model.isRequired()){
- b.append(formatWithFixedLength("yes", 12));
- }else{
- b.append(formatWithFixedLength("no", 12));
- }
- if(model.getDescription()!=null){
- b.append(model.getDescription().replace("\n", "\\\n").replace("\"", "'")).append("\"");
- }
- b.append("\n");
- }
- return b.toString();
- }
-
- private static String formatWithFixedLength(String name, int targetLength) {
- targetLength = targetLength-1;
- StringBuilder b = new StringBuilder();
- if(name.length() > targetLength){
- name = name.substring(0, targetLength);
- }
- b.append(name);
- for(int i=0;i<(targetLength-name.length());i++){
- b.append(' ');
- }
- b.append(' ');
- return b.toString();
- }
-
- /**
- * Get the validations defined.
- *
- * @return the sections defined, never null.
- */
- public static Collection<ConfigModel> getModels() {
- List<ConfigModel> result = new ArrayList<>();
- for (ModelProviderSpi model : ServiceContextManager.getServiceContext().getServices(ModelProviderSpi.class)) {
- result.addAll(model.getConfigModels());
- }
- return result;
- }
-
-
- /**
- * Find the validations by matching the validation's name against the given model type.
- *
- * @param name the name to use, not null.
- * @param modelType classname of the target model type.
- * @param <T> type of the model to filter for.
- * @return the sections defined, never null.
- */
- public static <T extends ConfigModel> T getModel(String name, Class<T> modelType) {
- for (ModelProviderSpi model : ServiceContextManager.getServiceContext().getServices(ModelProviderSpi.class)) {
- for(ConfigModel configModel : model.getConfigModels()) {
- if(configModel.getName().equals(name) && configModel.getClass().equals(modelType)) {
- return modelType.cast(configModel);
- }
- }
- }
- return null;
- }
-
- /**
- * Find the validations by checking the validation's name using the given regular expression.
- * @param namePattern the regular expression to use, not null.
- * @param targets the target types only to be returned (optional).
- * @return the sections defined, never null.
- */
- public static Collection<ConfigModel> findModels(String namePattern, ModelTarget... targets) {
- List<ConfigModel> result = new ArrayList<>();
- for (ModelProviderSpi model : ServiceContextManager.getServiceContext().getServices(ModelProviderSpi.class)) {
- for(ConfigModel configModel : model.getConfigModels()) {
- if(configModel.getName().matches(namePattern)) {
- if(targets.length>0){
- for(ModelTarget tgt:targets){
- if(configModel.getType().equals(tgt)){
- result.add(configModel);
- break;
- }
- }
- }else {
- result.add(configModel);
- }
- }
- }
- }
- return result;
- }
-
- /**
- * Validates the current configuration.
- *
- * @return the validation results, never null.
- */
- public static Collection<Validation> validate() {
- return validate(false);
- }
-
- /**
- * Validates the current configuration.
- * @param showUndefined show any unknown parameters.
- * @return the validation results, never null.
- */
- public static Collection<Validation> validate(boolean showUndefined) {
- return validate(ConfigurationProvider.getConfiguration(), showUndefined);
- }
-
- /**
- * Validates the given configuration.
- *
- * @param config the configuration to be validated against, not null.
- * @return the validation results, never null.
- */
- public static Collection<Validation> validate(Configuration config) {
- return validate(config, false);
- }
-
- /**
- * Validates the given configuration.
- *
- * @param config the configuration to be validated against, not null.
- * @param showUndefined allows filtering for undefined configuration elements.
- * @return the validation results, never null.
- */
- public static Collection<Validation> validate(Configuration config, boolean showUndefined) {
- List<Validation> result = new ArrayList<>();
- for (ConfigModel defConf : getModels()) {
- result.addAll(defConf.validate(config));
- }
- if(showUndefined){
- Map<String,String> map = new HashMap<>(config.getProperties());
- Set<String> areas = extractTransitiveAreas(map.keySet());
- for (ConfigModel defConf : getModels()) {
- if(ModelTarget.Section.equals(defConf.getType())){
- for (Iterator<String> iter = areas.iterator();iter.hasNext();){
- String area = iter.next();
- if(area.matches(defConf.getName())){
- iter.remove();
- }
- }
- }
- if(ModelTarget.Parameter.equals(defConf.getType())){
- map.remove(defConf.getName());
- }
- }
- outer:for(Map.Entry<String,String> entry:map.entrySet()){
- for (ConfigModel defConf : getModels()) {
- if(ModelTarget.Section.equals(defConf.getType())){
- if(defConf.getName().endsWith(".*") && entry.getKey().matches(defConf.getName())){
- // Ignore parameters that are part of transitive section.
- continue outer;
- }
- }
- }
- result.add(Validation.ofUndefined("<auto>", entry.getKey(), ModelTarget.Parameter));
- }
- for(String area:areas){
- result.add(Validation.ofUndefined("<auto>", area, ModelTarget.Section));
- }
- }
- return result;
- }
-
- private static java.util.Set<java.lang.String> extractTransitiveAreas(Set<String> keys) {
- Set<String> transitiveClosure = new HashSet<>();
- for(String key:keys){
- int index = key.lastIndexOf('.');
- while(index>0){
- String areaKey = key.substring(0,index);
- transitiveClosure.add(areaKey);
- index = areaKey.lastIndexOf('.');
- }
- }
- return transitiveClosure;
- }
-
-
- /**
- * Registers the {@link ConfigDocumentationMBean} mbean for accessing config documentation into the local platform
- * mbean server.
- */
- public static void registerMBean() {
- registerMBean(null);
- }
-
- /**
- * Registers the {@link ConfigDocumentationMBean} mbean for accessing config documentation into the local platform
- * mbean server.
- *
- * @param context allows to specify an additional MBean context, maybe {@code null}.
- */
- public static void registerMBean(String context) {
- try{
- ConfigDocumentationMBean configMbean = ServiceContextManager.getServiceContext()
- .getService(ConfigDocumentationMBean.class);
- MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
- ObjectName on = context==null?new ObjectName("org.apache.tamaya.model:type=ConfigDocumentationMBean"):
- new ObjectName("org.apache.tamaya.model:type=ConfigDocumentationMBean,context="+context);
- try{
- mbs.getMBeanInfo(on);
- LOG.warning("Cannot register mbean " + on + ": already existing.");
- } catch(InstanceNotFoundException e) {
- LOG.info("Registering mbean " + on + "...");
- mbs.registerMBean(configMbean, on);
- }
- } catch(Exception e){
- LOG.log(Level.WARNING,
- "Failed to register ConfigDocumentationMBean.", e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/model/src/main/java/org/apache/tamaya/model/ConfigUsageStats.java
----------------------------------------------------------------------
diff --git a/modules/model/src/main/java/org/apache/tamaya/model/ConfigUsageStats.java b/modules/model/src/main/java/org/apache/tamaya/model/ConfigUsageStats.java
deleted file mode 100644
index b502242..0000000
--- a/modules/model/src/main/java/org/apache/tamaya/model/ConfigUsageStats.java
+++ /dev/null
@@ -1,129 +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.tamaya.model;
-
-import org.apache.tamaya.model.spi.ConfigUsageStatsSpi;
-import org.apache.tamaya.spi.ServiceContextManager;
-
-import java.util.Collection;
-import java.util.Objects;
-import java.util.Set;
-import java.util.logging.Logger;
-
-/**
- * Validator accessor to validate the current configuration.
- */
-public final class ConfigUsageStats {
-
- /** The logger used. */
- private static final Logger LOG = Logger.getLogger(ConfigUsageStats.class.getName());
- private static final String NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE = "No UsageTrackerSpi component available.";
-
- /** The loaded usage tracking SPI. */
- private static ConfigUsageStatsSpi usageTracker = ServiceContextManager
- .getServiceContext().getService(ConfigUsageStatsSpi.class);
-
- /**
- * Singleton constructor.
- */
- private ConfigUsageStats() {
- }
-
- /**
- * Returns a set of package names that are to be ignored when collecting usage data.
- * @return the ignored package names, not null.
- */
- public static Set<String> getIgnoredUsagePackages(){
- return Objects.requireNonNull(usageTracker, NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE)
- .getIgnoredPackages();
- }
-
- /**
- * Adds the given packageNames to the list of packages to be ignored when collecting usage data.
- * @param packageName the package names to be added, not null.
- */
- public static void addIgnoredUsagePackages(String... packageName){
- Objects.requireNonNull(usageTracker, NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE)
- .addIgnoredUsagePackages(packageName);
- }
-
- /**
- * Enables/disables usage tracking.
- * @param enabled set to true to enable usage tracking.
- */
- public static void enableUsageTracking(boolean enabled){
- Objects.requireNonNull(usageTracker, NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE)
- .enableUsageTracking(enabled);
- }
-
- /**
- * Access the usage statistics for a given key. If usage stats collection is not
- * activated (default), this method returns null.
- * @param key the fully qualified configuration key, not null.
- * @return the stats collected, or null.
- */
- public static Usage getUsage(String key){
- return Objects.requireNonNull(usageTracker, NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE)
- .getUsage(key);
- }
-
- /**
- * Get the recorded usage references of configuration.
- * @return the recorded usge references, never null.
- */
- public static Collection<Usage> getUsages() {
- return Objects.requireNonNull(usageTracker, NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE).getUsages();
- }
-
- /**
- * Clears all collected usage statistics.
- */
- public static void clearUsageStats() {
- Objects.requireNonNull(usageTracker, NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE)
- .clearUsageStats();
- }
-
- /**
- * Access the usage statistics for accessing {@link org.apache.tamaya.Configuration#getProperties()}.
- * If usage stats collection is not activated (default), this method returns null.
- * @return the stats collected, or null.
- */
- public static Usage getUsageAllProperties(){
- return Objects.requireNonNull(usageTracker, NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE)
- .getUsageAllProperties();
- }
-
- /**
- * Allows to check if usage tracking is enabled (should be disbled by default).
- * @return true, if usage tracking is enabled.
- */
- public static boolean isUsageTrackingEnabled(){
- return Objects.requireNonNull(usageTracker, NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE)
- .isUsageTrackingEnabled();
- }
-
- /**
- * Access the usage statistics for the recorded uses of configuration.
- * @return usage info or default message.
- */
- public static String getUsageInfo(){
- return Objects.requireNonNull(usageTracker, NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE).getUsageInfo();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/model/src/main/java/org/apache/tamaya/model/ModelTarget.java
----------------------------------------------------------------------
diff --git a/modules/model/src/main/java/org/apache/tamaya/model/ModelTarget.java b/modules/model/src/main/java/org/apache/tamaya/model/ModelTarget.java
deleted file mode 100644
index a8b687b..0000000
--- a/modules/model/src/main/java/org/apache/tamaya/model/ModelTarget.java
+++ /dev/null
@@ -1,37 +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.tamaya.model;
-
-/**
- * This enumeration defines the types of supported validations.
- */
-public enum ModelTarget {
- /**
- * A configuration section.
- */
- Section,
- /**
- * A configuration paramter.
- */
- Parameter,
- /**
- * ConfigModel that is a container of other validations.
- */
- Group,
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/model/src/main/java/org/apache/tamaya/model/Usage.java
----------------------------------------------------------------------
diff --git a/modules/model/src/main/java/org/apache/tamaya/model/Usage.java b/modules/model/src/main/java/org/apache/tamaya/model/Usage.java
deleted file mode 100644
index 2d84915..0000000
--- a/modules/model/src/main/java/org/apache/tamaya/model/Usage.java
+++ /dev/null
@@ -1,312 +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.tamaya.model;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.logging.Logger;
-
-/**
- * Metrics container containing access statistics for a given configuration key.
- */
-public final class Usage {
- private static final Logger LOG = Logger.getLogger(Usage.class.getName());
- private static final String[] EMPTY_TRACE = new String[0];
- /**
- * the config section.
- */
- private final String key;
-
- /**
- * Maps with usage references, key is the fully qualified package name.
- */
- private final Map<String,AccessDetail> accessDetails = new ConcurrentHashMap<>();
- /**
- * The maximal length of the stacktrace stored.
- */
- private static int maxTrace = 10;
-
- /**
- * Creates a usage metric container for a given key.
- * @param key the parameter (fully qualified).
- */
- public Usage(String key) {
- this.key = Objects.requireNonNull(key);
- }
-
- /**
- * Get the maximal length of the stack traces recorded, default is 10.
- * @return the maximal length of the stack traces recorded
- */
- public static int getMaxTraceLength(){
- return Usage.maxTrace;
- }
-
- /**
- * Sets the maximal length of the stacktraces stored when tracking configuration
- * usage. Setting it to a negative value, disabled stacktrace logging.
- * @param maxTrace the maximal recorded stack length.
- */
- public static void setMaxTraceLength(int maxTrace){
- Usage.maxTrace =maxTrace;
- }
-
- /**
- * Get the configModel section.
- *
- * @return the section, never null.
- */
- public String getKey() {
- return key;
- }
-
- /**
- * Clears all collected usage metrics for this key.
- */
- public void clearMetrics(){
- this.accessDetails.clear();
- }
-
- /**
- * Get the detail message.
- *
- * @return the detail message, or null.
- */
- public int getReferenceCount() {
- return accessDetails.size();
- }
-
- /**
- * Get the detail message.
- *
- * @return the detail message, or null.
- */
- public int getUsageCount() {
- int count = 0;
- for(AccessDetail ref: accessDetails.values()){
- count += ref.getAccessCount();
- }
- return count;
- }
-
- /**
- * Access a usage reference for a given class.
- * @param type class to get usage references for, not null.
- * @return the usage ref, if present, or null.
- */
- public Collection<AccessDetail> getAccessDetails(Class type){
- return getAccessDetails(type.getName() +"\\..*");
- }
-
- /**
- * Access a usage reference for a given package.
- * @param pack package to get usage references for, not null.
- * @return the usage ref, if present, or null.
- */
- public Collection<AccessDetail> getAccessDetails(Package pack){
- return getAccessDetails(pack.getName() +"\\..*");
- }
-
- /**
- * Find usages of this key for the given expression (regex). Hereby the expression is
- * matched with the tracked reference identifier, which has the form
- * {@code f.q.n.ClassName#methodName(line: 123)}.
- * @param lookupExpression the target lookup expression, not null.
- * @return the matching references, not null.
- */
- public Collection<AccessDetail> getAccessDetails(String lookupExpression){
- List<AccessDetail> result = new ArrayList<>();
- for(AccessDetail ref:this.accessDetails.values()){
- if(ref.getAccessPoint().matches(lookupExpression)){
- result.add(ref);
- }
- }
- return result;
- }
-
- @Override
- public String toString() {
- return "Usage Count: " + key + " -> " + getUsageCount() + '\n';
- }
-
- /**
- * Get the access details (stacktrace etc) for this reference.
- * @return return the access details, not null.
- */
- public Collection<AccessDetail> getAccessDetails(){
- return Collections.unmodifiableCollection(accessDetails.values());
- }
-
- /**
- * Evaluates the current access point from the current stacktrace and adds an according
- * usage reference object (or updates any existing one) for the given key. The
- * stacktrace is shortened to a maximal size of 20 items.
- * @param value the value returned, not null.
- */
- public void trackUsage(String value){
- trackUsage(value, maxTrace);
- }
-
- /**
- * Evaluates the current access point from the current stacktrace and adds an according
- * usage reference object (or updates any existing one) for the given key.
- * @param value the value returned, not null.
- * @param maxTraceLength the maximal length of the stored stacktrace.
- */
- public void trackUsage(String value, int maxTraceLength){
- String accessPoint = null;
- if(maxTraceLength>0) {
- Exception e = new Exception();
- List<String> trace = new ArrayList<>();
- stack:
- for (StackTraceElement ste : e.getStackTrace()) {
- for (String ignored : ConfigUsageStats.getIgnoredUsagePackages()) {
- if (ste.getClassName().startsWith(ignored)) {
- continue stack;
- }
- }
- String ref = ste.getClassName() + '#' + ste.getMethodName() + "(line:" + ste.getLineNumber() + ')';
- trace.add(ref);
- if (accessPoint == null) {
- accessPoint = ref;
- }
- if (trace.size() >= maxTraceLength) {
- break;
- }
- }
- if (accessPoint == null) {
- // all ignored, take first one, with different package
- accessPoint = "<unknown/filtered/internal>";
- }
- AccessDetail details = getAccessDetails(accessPoint, trace.toArray(new String[trace.size()]));
- details.trackAccess(value);
- }else{
- accessPoint = "<disabled>";
- AccessDetail details = getAccessDetails(accessPoint, EMPTY_TRACE);
- details.trackAccess(value);
- }
- }
-
- private AccessDetail getAccessDetails(String accessPoint, String[] trace) {
- AccessDetail details = accessDetails.get(accessPoint);
- if(details==null){
- details = new AccessDetail(key, accessPoint, trace);
- accessDetails.put(accessPoint, details);
- }
- return details;
- }
-
- /**
- * Class modelling the access details tracked per detailed item, e.g. per class in the owning package.
- */
- public static final class AccessDetail {
- private String key;
- private AtomicLong accessCount = new AtomicLong();
- private long lastAccessTS;
- private long firstAccessTS;
- private String[] stackTrace;
- private String accessPoint;
- private Map<Long, String> trackedValues;
-
- public AccessDetail(String key, String accessPoint, String[] stackTrace){
- this.key = Objects.requireNonNull(key);
- this.accessPoint = Objects.requireNonNull(accessPoint);
- this.stackTrace = stackTrace.clone();
- }
-
- public void clearStats(){
- lastAccessTS = 0;
- firstAccessTS = 0;
- accessCount.set(0);
- }
-
- public long trackAccess(String value){
- long count = accessCount.incrementAndGet();
- lastAccessTS = System.currentTimeMillis();
- if(firstAccessTS==0){
- firstAccessTS = lastAccessTS;
- }
- if(value!=null){
- synchronized (this) {
- if(trackedValues==null){
- trackedValues = new HashMap<>();
- }
- trackedValues.put(lastAccessTS, value);
- }
- }
- return count;
- }
-
- public String getKey(){
- return key;
- }
-
- public long getAccessCount() {
- return accessCount.get();
- }
-
- public String getAccessPoint() {
- return accessPoint;
- }
-
- public long getFirstAccessTS() {
- return firstAccessTS;
- }
-
- public long getLastAccessTS() {
- return lastAccessTS;
- }
-
- public String[] getStackTrace() {
- return stackTrace.clone();
- }
-
- public Map<Long, String> getTrackedValues(){
- synchronized (this) {
- if (trackedValues == null) {
- return Collections.emptyMap();
- } else {
- return new HashMap<>(trackedValues);
- }
- }
- }
-
- @Override
- public String toString() {
- return "AccessDetails{" +
- "key=" + key +
- ", accessCount=" + accessCount +
- ", lastAccessTS=" + lastAccessTS +
- ", firstAccessTS=" + firstAccessTS +
- ", stackTrace=" + Arrays.toString(stackTrace) +
- ", accessPoint='" + accessPoint + '\'' +
- ", trackedValues=" + trackedValues +
- '}';
- }
- }
-
-}