Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id AAB51200D1F for ; Thu, 28 Sep 2017 22:12:25 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A937A160BCB; Thu, 28 Sep 2017 20:12:25 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D7FDF1609ED for ; Thu, 28 Sep 2017 22:12:24 +0200 (CEST) Received: (qmail 62507 invoked by uid 500); 28 Sep 2017 20:12:24 -0000 Mailing-List: contact commits-help@tamaya.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tamaya.incubator.apache.org Delivered-To: mailing list commits@tamaya.incubator.apache.org Received: (qmail 62494 invoked by uid 99); 28 Sep 2017 20:12:24 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Sep 2017 20:12:24 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 09A23C48F2 for ; Thu, 28 Sep 2017 20:12:23 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.222 X-Spam-Level: X-Spam-Status: No, score=-4.222 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id TTYWxXIktRPA for ; Thu, 28 Sep 2017 20:12:21 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 5E6E561070 for ; Thu, 28 Sep 2017 20:12:19 +0000 (UTC) Received: (qmail 61962 invoked by uid 99); 28 Sep 2017 20:12:18 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Sep 2017 20:12:18 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 330A8F5C17; Thu, 28 Sep 2017 20:12:15 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: anatole@apache.org To: commits@tamaya.incubator.apache.org Date: Thu, 28 Sep 2017 20:12:16 -0000 Message-Id: <1db6f1eea0a24f69a4eef5704502ebfe@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [02/45] incubator-tamaya-sandbox git commit: TAMAYA-145: Added meta logging feature. archived-at: Thu, 28 Sep 2017 20:12:25 -0000 TAMAYA-145: Added meta logging feature. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/31b9c0e1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/31b9c0e1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/31b9c0e1 Branch: refs/heads/master Commit: 31b9c0e1db95143e67dc945f25694f676d8cb00c Parents: 1fec344 Author: anatole Authored: Mon Aug 7 17:33:38 2017 +0200 Committer: anatole Committed: Mon Aug 7 17:33:38 2017 +0200 ---------------------------------------------------------------------- .../internal/resolver/LoggingReader.java | 79 ++++++++++++++++++++ ...tamaya.metamodel.spi.MetaConfigurationReader | 19 +++++ 2 files changed, 98 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/31b9c0e1/metamodel/src/test/java/org/apache/tamaya/metamodel/internal/resolver/LoggingReader.java ---------------------------------------------------------------------- diff --git a/metamodel/src/test/java/org/apache/tamaya/metamodel/internal/resolver/LoggingReader.java b/metamodel/src/test/java/org/apache/tamaya/metamodel/internal/resolver/LoggingReader.java new file mode 100644 index 0000000..c0d67bc --- /dev/null +++ b/metamodel/src/test/java/org/apache/tamaya/metamodel/internal/resolver/LoggingReader.java @@ -0,0 +1,79 @@ +/* + * 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.metamodel.internal.resolver; + +import org.apache.tamaya.Configuration; +import org.apache.tamaya.ConfigurationProvider; +import org.apache.tamaya.metamodel.MetaContext; +import org.apache.tamaya.metamodel.spi.MetaConfigurationReader; +import org.apache.tamaya.spi.ConfigurationContext; +import org.apache.tamaya.spi.ConfigurationContextBuilder; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.StringReader; +import java.util.HashMap; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; + +/** + * Created by atsticks on 01.05.17. + */ +public class LoggingReader implements MetaConfigurationReader{ + + private static final JavaResolver resolver = new JavaResolver(); + + @Override + public void read(final Document document, ConfigurationContextBuilder contextBuilder) { + new Timer(true).schedule(new TimerTask() { + @Override + public void run() { + Map meta = new HashMap<>(); + meta.put("context", ConfigurationProvider.getConfiguration().getContext()); + meta.put("config", ConfigurationProvider.getConfiguration()); + NodeList nodeList = document.getDocumentElement().getElementsByTagName("context"); + for(int i=0;i