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