📄 xmlpropertydefinitionlist.java
字号:
/*
* SSL-Explorer
*
* Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package com.sslexplorer.boot;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Iterator;
import java.util.TreeMap;
import java.util.Vector;
/**
* Loads a list of {@link com.sslexplorer.boot.PropertyDefinition} from
* an XML file.
*
* TODO need to either validating XML parser or manually validate attributes
*
* @author Brett Smith <a href="mailto: brett@3sp.com"><brett@3sp.com></a>
* @version $Revision: 1.1 $
*/
public class XMLPropertyDefinitionList extends TreeMap {
/**
* Constructor and load the XML property definitions from the specfied
* location.
*
* @param location location to load property definitions from
* @throws IOException on any error
*/
public XMLPropertyDefinitionList(URL location) throws IOException {
super();
XMLElement el = new XMLElement();
InputStream in = location.openStream();
try {
el.parseFromReader(new InputStreamReader(in));
Vector c = el.getChildren();
for(Iterator i = c.iterator(); i.hasNext(); ) {
XMLPropertyDefinition def = new XMLPropertyDefinition((XMLElement)i.next());
put(def.getName(), def);
}
} finally {
in.close();
}
}
class XMLPropertyDefinition extends DefaultPropertyDefinition {
XMLPropertyDefinition(XMLElement el) {
super(el.getIntAttribute("type"), el.getStringAttribute("name"),
el.getStringAttribute("typeMeta"), el.getIntAttribute("category"),
el.getStringAttribute("defaultValue"), el.getIntAttribute("visibility"),
el.getIntAttribute("sortOrder"), el.getStringAttribute("bundle"),
el.getBooleanAttribute("hidden", "true", "false", false));
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -