001: /*
002: * $Id: ReusablePropertyConfiguration.java 10256 2008-01-08 15:20:25Z dfeist $
003: * --------------------------------------------------------------------------------------
004: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
005: *
006: * The software in this package is published under the terms of the CPAL v1.0
007: * license, a copy of which has been included with this distribution in the
008: * LICENSE.txt file.
009: */
010:
011: package org.mule.config.spring.parsers.assembly.configuration;
012:
013: import java.util.Map;
014:
015: /**
016: * Allow initial mutation; first call of reset stores values as reference and allows
017: * further temporary mutation; further calls to reset return to reference.
018: */
019: public class ReusablePropertyConfiguration implements
020: PropertyConfiguration {
021:
022: private PropertyConfiguration reference;
023: private PropertyConfiguration delegate;
024:
025: public ReusablePropertyConfiguration() {
026: this (new SimplePropertyConfiguration());
027: }
028:
029: public ReusablePropertyConfiguration(PropertyConfiguration delegate) {
030: this .delegate = delegate;
031: }
032:
033: public void reset() {
034: if (null == reference) {
035: reference = delegate;
036: }
037: delegate = new TempWrapperPropertyConfiguration(reference);
038: }
039:
040: public void addReference(String propertyName) {
041: delegate.addReference(propertyName);
042: }
043:
044: public void addMapping(String propertyName, Map mappings) {
045: delegate.addMapping(propertyName, mappings);
046: }
047:
048: public void addMapping(String propertyName, String mappings) {
049: delegate.addMapping(propertyName, mappings);
050: }
051:
052: public void addMapping(String propertyName, ValueMap mappings) {
053: delegate.addMapping(propertyName, mappings);
054: }
055:
056: public void addAlias(String alias, String propertyName) {
057: delegate.addAlias(alias, propertyName);
058: }
059:
060: public void addCollection(String propertyName) {
061: delegate.addCollection(propertyName);
062: }
063:
064: public void addIgnored(String propertyName) {
065: delegate.addIgnored(propertyName);
066: }
067:
068: public void removeIgnored(String propertyName) {
069: delegate.removeIgnored(propertyName);
070: }
071:
072: public void setIgnoredDefault(boolean ignoreAll) {
073: delegate.setIgnoredDefault(ignoreAll);
074: }
075:
076: public String getAttributeMapping(String alias) {
077: return delegate.getAttributeMapping(alias);
078: }
079:
080: public boolean isCollection(String propertyName) {
081: return delegate.isCollection(propertyName);
082: }
083:
084: public boolean isIgnored(String propertyName) {
085: return delegate.isIgnored(propertyName);
086: }
087:
088: public boolean isReference(String attributeName) {
089: return delegate.isReference(attributeName);
090: }
091:
092: public SingleProperty getSingleProperty(String propertyName) {
093: return new SinglePropertyWrapper(propertyName, this );
094: }
095:
096: public String translateName(String oldName) {
097: return delegate.translateName(oldName);
098: }
099:
100: public Object translateValue(String name, String value) {
101: return delegate.translateValue(name, value);
102: }
103:
104: }
|