org.mule.module.cxf.config.WsConfig Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mule-module-cxf Show documentation
Show all versions of mule-module-cxf Show documentation
A Mule module for web service connectivity using CXF.
The newest version!
/*
* Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
* The software in this package is published under the terms of the CPAL v1.0
* license, a copy of which has been included with this distribution in the
* LICENSE.txt file.
*/
package org.mule.module.cxf.config;
import org.mule.RequestContext;
import org.mule.api.MuleEvent;
import org.mule.api.MuleMessage;
import org.mule.util.AttributeEvaluator;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
public class WsConfig
{
Map configProperties = new HashMap ();
public WsConfig()
{
}
public WsConfig(Map configProperties)
{
this.configProperties = configProperties;
}
public void setConfigProperties(Map configProperties)
{
this.configProperties = configProperties;
}
public Map getConfigProperties()
{
return new DynamicAttributeEvalutorMap(new HashMap(configProperties));
}
private static class DynamicAttributeEvalutorMap implements Map
{
private Map map;
public DynamicAttributeEvalutorMap(Map map)
{
this.map = map;
}
private Map getEvaluatedMap()
{
MuleEvent event = RequestContext.getEvent();
MuleMessage message = (event != null) ? event.getMessage() : null;
if (map != null && message != null)
{
Map evaluatedMap = new LinkedHashMap(map.size());
for (Entry entry : map.entrySet())
{
if (entry.getValue() instanceof String)
{
AttributeEvaluator evaluator = new AttributeEvaluator((String)entry.getValue());
evaluator.initialize(message.getMuleContext().getExpressionManager());
evaluatedMap.put(entry.getKey(), evaluator.resolveValue(message));
}
else
{
evaluatedMap.put(entry.getKey(), entry.getValue());
}
}
return evaluatedMap;
}
return map;
}
@Override
public void clear()
{
map.clear();
}
@Override
public boolean containsKey(Object key)
{
return map.containsKey(key);
}
@Override
public boolean containsValue(Object value)
{
return map.containsValue(value);
}
@Override
public Set> entrySet()
{
return getEvaluatedMap().entrySet();
}
@Override
public Object get(Object key)
{
return getEvaluatedMap().get(key);
}
@Override
public boolean isEmpty()
{
return map.isEmpty();
}
@Override
public Set keySet()
{
return map.keySet();
}
@Override
public Object put(String key, Object value)
{
return map.put(key, value);
}
@Override
public void putAll(Map extends String, ? extends Object> m)
{
map.putAll(m);
}
@Override
public Object remove(Object key)
{
return map.remove(key);
}
@Override
public int size()
{
return map.size();
}
@Override
public Collection © 2015 - 2025 Weber Informatics LLC | Privacy Policy