01: /*
02: * JBoss, Home of Professional Open Source.
03: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
04: * as indicated by the @author tags. See the copyright.txt file in the
05: * distribution for a full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * published by the Free Software Foundation; either version 2.1 of
10: * the License, or (at your option) any later version.
11: *
12: * This software is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this software; if not, write to the Free
19: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21: */
22: package org.jboss.services.xml;
23:
24: import java.util.Map;
25: import java.util.Iterator;
26: import java.util.Properties;
27:
28: import org.jboss.util.xml.JBossEntityResolver;
29:
30: /**
31: A simple mbean for managing the static JBossEntityResolver class entity
32: mappings.
33:
34: @todo update this to support xml catalog mappings
35:
36: @author Scott.Stark@jboss.org
37: @version $Revision: 57210 $
38: */
39: public class JBossEntityResolverMgr implements
40: JBossEntityResolverMgrMBean {
41:
42: public boolean isWarnOnNonFileURLs() {
43: return JBossEntityResolver.isWarnOnNonFileURLs();
44: }
45:
46: public void setWarnOnNonFileURLs(boolean flag) {
47: JBossEntityResolver.setWarnOnNonFileURLs(flag);
48: }
49:
50: public Properties getEntityMap() {
51: Map map = JBossEntityResolver.getEntityMap();
52: Properties props = new Properties();
53: Iterator entries = map.entrySet().iterator();
54: while (entries.hasNext()) {
55: Map.Entry entry = (Map.Entry) entries.next();
56: String key = (String) entry.getKey();
57: String value = (String) entry.getValue();
58: props.setProperty(key, value);
59: }
60: return props;
61: }
62:
63: public void setEntityMap(Properties map) {
64: Iterator entries = map.entrySet().iterator();
65: while (entries.hasNext()) {
66: Map.Entry entry = (Map.Entry) entries.next();
67: String key = (String) entry.getKey();
68: String value = (String) entry.getValue();
69: JBossEntityResolver.registerEntity(key, value);
70: }
71: }
72:
73: public void registerEntity(String id, String file) {
74: JBossEntityResolver.registerEntity(id, file);
75: }
76: }
|