01: /*
02: * $Id: ProvideDefaultNameFromElement.java 10901 2008-02-20 13:11:46Z acooke $
03: * --------------------------------------------------------------------------------------
04: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
05: *
06: * The software in this package is published under the terms of the CPAL v1.0
07: * license, a copy of which has been included with this distribution in the
08: * LICENSE.txt file.
09: */
10:
11: package org.mule.config.spring.parsers.processors;
12:
13: import org.mule.config.spring.parsers.PreProcessor;
14: import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser;
15: import org.mule.config.spring.parsers.generic.AutoIdUtils;
16: import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration;
17: import org.mule.util.XMLUtils;
18:
19: import org.w3c.dom.Element;
20:
21: public class ProvideDefaultNameFromElement implements PreProcessor {
22:
23: public void preProcess(PropertyConfiguration config, Element element) {
24: if (AutoIdUtils.blankAttribute(element,
25: AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME)) {
26: element.setAttribute(
27: AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME,
28: element.getLocalName());
29: }
30: }
31:
32: }
|