View Javadoc

1   /*
2    * $Id: NamespaceManager.java 20321 2010-11-24 15:21:24Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  package org.mule.module.xml.util;
11  
12  import org.mule.api.lifecycle.Initialisable;
13  import org.mule.api.lifecycle.InitialisationException;
14  
15  import java.util.HashMap;
16  import java.util.Map;
17  
18  /**
19   * A simple manager that holds a registry of global namespaces that will be recognised by all xml queries and transforms
20   */
21  public class NamespaceManager implements Initialisable
22  {
23  
24      private Map namespaces = new HashMap(2);
25      private Map configNamespaces = new HashMap(8);
26  
27      private boolean includeConfigNamespaces = false;
28  
29  
30      public void initialise() throws InitialisationException
31      {
32          if (isIncludeConfigNamespaces())
33          {
34              namespaces.putAll(configNamespaces);
35          }
36      }
37  
38      public boolean isIncludeConfigNamespaces()
39      {
40          return includeConfigNamespaces;
41      }
42  
43      public void setIncludeConfigNamespaces(boolean includeConfigNamespaces)
44      {
45          this.includeConfigNamespaces = includeConfigNamespaces;
46      }
47  
48      public Map getNamespaces()
49      {
50          return namespaces;
51      }
52  
53      public void setNamespaces(Map namespaces)
54      {
55          this.namespaces = namespaces;
56      }
57  
58      public Map getConfigNamespaces()
59      {
60          return configNamespaces;
61      }
62  
63      public void setConfigNamespaces(Map configNamespaces)
64      {
65          this.configNamespaces = configNamespaces;
66      }
67  }