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 2019/06/03 12:45:41 UTC
[camel] branch master updated: Removed unused stuff
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 6430c63 Removed unused stuff
6430c63 is described below
commit 6430c63d8b25d83961981c89094ae66f4e1ab053
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jun 3 12:19:09 2019 +0200
Removed unused stuff
---
.../spring/boot/util/CamelPropertiesHelper.java | 54 +---------------------
1 file changed, 2 insertions(+), 52 deletions(-)
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/CamelPropertiesHelper.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/CamelPropertiesHelper.java
index 911bb15..e5627db 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/CamelPropertiesHelper.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/CamelPropertiesHelper.java
@@ -16,16 +16,12 @@
*/
package org.apache.camel.spring.boot.util;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.apache.camel.CamelContext;
-import org.apache.camel.support.CamelContextHelper;
import org.apache.camel.support.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import static org.apache.camel.support.EndpointHelper.isReferenceParameter;
@@ -34,8 +30,6 @@ import static org.apache.camel.support.EndpointHelper.isReferenceParameter;
*/
public final class CamelPropertiesHelper {
- private static final Logger LOG = LoggerFactory.getLogger(CamelContextHelper.class);
-
private CamelPropertiesHelper() {
}
@@ -64,6 +58,8 @@ public final class CamelPropertiesHelper {
ObjectHelper.notNull(properties, "properties");
boolean rc = false;
+ // TODO: Use BindingPropertySupport instead of IntrospectionSupport
+
Iterator<Map.Entry<String, Object>> it = properties.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
@@ -99,50 +95,4 @@ public final class CamelPropertiesHelper {
return rc;
}
- /**
- * Inspects the given object and resolves any property placeholders from its properties.
- * <p/>
- * This implementation will check all the getter/setter pairs on this instance and for all the values
- * (which is a String type) will be property placeholder resolved.
- *
- * @param camelContext the Camel context
- * @param target the object that should have the properties (eg getter/setter) resolved
- * @throws Exception is thrown if property placeholders was used and there was an error resolving them
- * @see CamelContext#resolvePropertyPlaceholders(String)
- * @see org.apache.camel.component.properties.PropertiesComponent
- */
- public static void resolvePropertyPlaceholders(CamelContext camelContext, Object target) throws Exception {
- LOG.trace("Resolving property placeholders for: {}", target);
-
- // find all getter/setter which we can use for property placeholders
- Map<String, Object> properties = new HashMap<>();
- IntrospectionSupport.getProperties(target, properties, null);
-
- Map<String, Object> changedProperties = new HashMap<>();
- if (!properties.isEmpty()) {
- LOG.trace("There are {} properties on: {}", properties.size(), target);
- // lookup and resolve properties for String based properties
- for (Map.Entry<String, Object> entry : properties.entrySet()) {
- // the name is always a String
- String name = entry.getKey();
- Object value = entry.getValue();
- if (value instanceof String) {
- // value must be a String, as a String is the key for a property placeholder
- String text = (String) value;
- text = camelContext.resolvePropertyPlaceholders(text);
- if (text != value) {
- // invoke setter as the text has changed
- boolean changed = IntrospectionSupport.setProperty(camelContext.getTypeConverter(), target, name, text);
- if (!changed) {
- throw new IllegalArgumentException("No setter to set property: " + name + " to: " + text + " on: " + target);
- }
- changedProperties.put(name, value);
- if (LOG.isDebugEnabled()) {
- LOG.debug("Changed property [{}] from: {} to: {}", name, value, text);
- }
- }
- }
- }
- }
- }
}