You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/08/11 15:29:07 UTC

camel git commit: Fixed CS

Repository: camel
Updated Branches:
  refs/heads/master dd8ea2f68 -> 2e42b1c20


Fixed CS


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2e42b1c2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2e42b1c2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2e42b1c2

Branch: refs/heads/master
Commit: 2e42b1c20187f30896d61f6e42275f1172845266
Parents: dd8ea2f
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Aug 11 15:36:55 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Aug 11 15:36:55 2015 +0200

----------------------------------------------------------------------
 .../management/CustomRequiredModelMBean.java    | 76 ----------------
 .../management/MaskRequiredModelMBean.java      | 96 --------------------
 .../component/bean/BeanProxyNoBindingTest.java  |  4 +-
 ...umpModelAsXmlTransformRouteConstantTest.java |  7 +-
 ...umpModelAsXmlTransformRouteLanguageTest.java |  7 +-
 5 files changed, 10 insertions(+), 180 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2e42b1c2/camel-core/src/main/java/org/apache/camel/management/CustomRequiredModelMBean.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/CustomRequiredModelMBean.java b/camel-core/src/main/java/org/apache/camel/management/CustomRequiredModelMBean.java
deleted file mode 100644
index c8efe97..0000000
--- a/camel-core/src/main/java/org/apache/camel/management/CustomRequiredModelMBean.java
+++ /dev/null
@@ -1,76 +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.camel.management;
-
-import javax.management.DynamicMBean;
-import javax.management.MBeanException;
-import javax.management.MBeanOperationInfo;
-import javax.management.ReflectionException;
-import javax.management.RuntimeOperationsException;
-import javax.management.modelmbean.ModelMBeanInfo;
-import javax.management.modelmbean.RequiredModelMBean;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A {@link javax.management.modelmbean.RequiredModelMBean} which allows us to intercept invoking operations on the MBean.
- * <p/>
- * This allows us to intercept calls to custom mbeans where allows us to mix-in the standard set of mbean attributes
- * and operations that Camel provides out of the box.
- */
-@Deprecated
-public class CustomRequiredModelMBean extends RequiredModelMBean {
-
-    private static final Logger LOG = LoggerFactory.getLogger(CustomRequiredModelMBean.class);
-    private ModelMBeanInfo defaultMbi;
-    private DynamicMBean defaultObject;
-
-    public CustomRequiredModelMBean() throws MBeanException, RuntimeOperationsException {
-        // must have default no-arg constructor
-    }
-
-    public CustomRequiredModelMBean(ModelMBeanInfo mbi, ModelMBeanInfo defaultMbi, DynamicMBean defaultObject) throws MBeanException, RuntimeOperationsException {
-        super(mbi);
-        this.defaultMbi = defaultMbi;
-        this.defaultObject = defaultObject;
-    }
-
-    @Override
-    public Object invoke(String opName, Object[] opArgs, String[] sig) throws MBeanException, ReflectionException {
-        Object answer;
-        if (isDefaultOperation(opName)) {
-            answer = defaultObject.invoke(opName, opArgs, sig);
-        } else {
-            answer = super.invoke(opName, opArgs, sig);
-        }
-        return answer;
-    }
-
-    protected boolean isDefaultOperation(String opName) {
-        if (defaultMbi == null || defaultObject == null) {
-            return false;
-        }
-        for (MBeanOperationInfo info : defaultMbi.getOperations()) {
-            if (info.getName().equals(opName)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/2e42b1c2/camel-core/src/main/java/org/apache/camel/management/MaskRequiredModelMBean.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/MaskRequiredModelMBean.java b/camel-core/src/main/java/org/apache/camel/management/MaskRequiredModelMBean.java
deleted file mode 100644
index 50966e3..0000000
--- a/camel-core/src/main/java/org/apache/camel/management/MaskRequiredModelMBean.java
+++ /dev/null
@@ -1,96 +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.camel.management;
-
-import javax.management.Descriptor;
-import javax.management.MBeanException;
-import javax.management.MBeanOperationInfo;
-import javax.management.ReflectionException;
-import javax.management.RuntimeOperationsException;
-import javax.management.modelmbean.ModelMBeanInfo;
-import javax.management.modelmbean.RequiredModelMBean;
-
-import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.URISupport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A {@link RequiredModelMBean} which allows us to intercept invoking operations on the MBean.
- * <p/>
- * For example if mask has been enabled on JMX, then we use this implementation
- * to hide sensitive information from the returned JMX attributes / operations.
- */
-@Deprecated
-public class MaskRequiredModelMBean extends RequiredModelMBean {
-
-    private static final Logger LOG = LoggerFactory.getLogger(MaskRequiredModelMBean.class);
-    private boolean mask;
-
-    public MaskRequiredModelMBean() throws MBeanException, RuntimeOperationsException {
-        // must have default no-arg constructor
-    }
-
-    public MaskRequiredModelMBean(ModelMBeanInfo mbi, boolean mask) throws MBeanException, RuntimeOperationsException {
-        super(mbi);
-        this.mask = mask;
-    }
-
-    public boolean isMask() {
-        return mask;
-    }
-
-    @Override
-    public Object invoke(String opName, Object[] opArgs, String[] sig) throws MBeanException, ReflectionException {
-        Object answer = super.invoke(opName, opArgs, sig);
-        // mask the answer if enabled and it was a String type (we cannot mask other types)
-        if (mask && answer instanceof String && ObjectHelper.isNotEmpty(answer) && isMaskOperation(opName)) {
-            answer = mask(opName, (String) answer);
-        }
-        return answer;
-    }
-
-    protected boolean isMaskOperation(String opName) {
-        for (MBeanOperationInfo info : getMBeanInfo().getOperations()) {
-            if (info.getName().equals(opName)) {
-                Descriptor desc = info.getDescriptor();
-                if (desc != null) {
-                    Object val = desc.getFieldValue("mask");
-                    return val != null && "true".equals(val);
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Masks the returned value from invoking the operation
-     *
-     * @param opName  the operation name invoked
-     * @param value   the current value
-     * @return the masked value
-     */
-    protected String mask(String opName, String value) {
-        // use sanitize uri which will mask sensitive information
-        String answer = URISupport.sanitizeUri(value);
-        if (LOG.isTraceEnabled()) {
-            LOG.trace("Masking JMX operation: {}.{} value: {} -> {}",
-                    new Object[]{getMBeanInfo().getClassName(), opName, value, answer});
-        }
-        return answer;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/2e42b1c2/camel-core/src/test/java/org/apache/camel/component/bean/BeanProxyNoBindingTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanProxyNoBindingTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanProxyNoBindingTest.java
index 0f94a5d..09928d6 100644
--- a/camel-core/src/test/java/org/apache/camel/component/bean/BeanProxyNoBindingTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanProxyNoBindingTest.java
@@ -16,13 +16,13 @@
  */
 package org.apache.camel.component.bean;
 
+import org.w3c.dom.Document;
+
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Endpoint;
 import org.apache.camel.InvalidPayloadException;
 import org.apache.camel.builder.ProxyBuilder;
 import org.apache.camel.builder.RouteBuilder;
-import org.w3c.dom.Document;
-
 
 /**
  * @version 

http://git-wip-us.apache.org/repos/asf/camel/blob/2e42b1c2/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlTransformRouteConstantTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlTransformRouteConstantTest.java b/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlTransformRouteConstantTest.java
index 8147225..cb2d4e8 100644
--- a/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlTransformRouteConstantTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlTransformRouteConstantTest.java
@@ -16,13 +16,14 @@
  */
 package org.apache.camel.util;
 
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.converter.jaxp.XmlConverter;
 import org.apache.camel.model.ModelHelper;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/camel/blob/2e42b1c2/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlTransformRouteLanguageTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlTransformRouteLanguageTest.java b/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlTransformRouteLanguageTest.java
index 40d6aa2..3b72e1f 100644
--- a/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlTransformRouteLanguageTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlTransformRouteLanguageTest.java
@@ -16,13 +16,14 @@
  */
 package org.apache.camel.util;
 
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.converter.jaxp.XmlConverter;
 import org.apache.camel.model.ModelHelper;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
 
 /**
  *