01: /*
02: * $Id: AddAttribute.java 10494 2008-01-23 21:09:56Z 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.PostProcessor;
14: import org.mule.config.spring.parsers.PreProcessor;
15: import org.mule.config.spring.parsers.assembly.BeanAssembler;
16: import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration;
17:
18: import org.w3c.dom.Element;
19: import org.springframework.beans.factory.xml.ParserContext;
20:
21: public class AddAttribute implements PreProcessor, PostProcessor {
22:
23: private String name;
24: private String value;
25:
26: public AddAttribute(String name, String value) {
27: this .name = name;
28: this .value = value;
29: }
30:
31: public void postProcess(ParserContext unused,
32: BeanAssembler assembler, Element element) {
33: element.setAttribute(name, value);
34: }
35:
36: public void preProcess(PropertyConfiguration config, Element element) {
37: element.setAttribute(name, value);
38: }
39:
40: }
|