收藏 分销(赏)

新生代数字媒体技术羿魔方数据可视化系统_源代码_java.docx

上传人:xrp****65 文档编号:8944910 上传时间:2025-03-08 格式:DOCX 页数:60 大小:55.79KB
下载 相关 举报
新生代数字媒体技术羿魔方数据可视化系统_源代码_java.docx_第1页
第1页 / 共60页
新生代数字媒体技术羿魔方数据可视化系统_源代码_java.docx_第2页
第2页 / 共60页
点击查看更多>>
资源描述
package org.jfree.base.config; import java.util.Enumeration; import java.util.Iterator; import org.jfree.util.Configuration; public abstract interface ModifiableConfiguration extends Configuration { public abstract void setConfigProperty(String paramString1, String paramString2); public abstract Enumeration getConfigProperties(); public abstract Iterator findPropertyKeys(String paramString); } package org.jfree.base.config; import java.util.Enumeration; import java.util.Properties;© import java.util.Vector; public class SystemPropertyConfiguration extends HierarchicalConfiguration { public void setConfigProperty(String key, String value) { throw new UnsupportedOperationException("The SystemPropertyConfiguration is readOnly"); } public String getConfigProperty(String key, String defaultValue) { try { String value = System.getProperty(key); if (value != null) { return value; } } catch (SecurityException se) { } return super.getConfigProperty(key, defaultValue); } public boolean isLocallyDefined(String key) { try { return System.getProperties().containsKey(key); } catch (SecurityException se) { } return false; } public Enumeration getConfigProperties() { try { return System.getProperties().keys(); } catch (SecurityException se) { } return new Vector().elements(); } }package org.jfree.base.config; import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import org.jfree.util.Log; import org.jfree.util.ObjectUtilities; public class PropertyFileConfiguration extends HierarchicalConfiguration { public void load(String resourceName) { load(resourceName, PropertyFileConfiguration.class); } public void load(String resourceName, Class resourceSource) { InputStream in = ObjectUtilities.getResourceRelativeAsStream(resourceName, resourceSource); if (in != null) { try { load(in); } finally { try { in.close(); } catch (IOException e) { } } } else { Log.debug("Configuration file not found in the classpath: " + resourceName); } } public void load(InputStream in) { if (in == null) { throw new NullPointerException(); } try { BufferedInputStream bin = new BufferedInputStream(in); Properties p = new Properties(); p.load(bin); getConfiguration().putAll(p); bin.close(); } catch (IOException ioe) { Log.warn("Unable to read configuration", ioe); } } }package org.jfree.base.log; import org.jfree.util.Log; import org.jfree.util.LogTarget; import org.jfree.util.PrintStreamLogTarget; public class DefaultLog extends Log { private static final PrintStreamLogTarget DEFAULT_LOG_TARGET = new PrintStreamLogTarget(); private static final DefaultLog defaultLogInstance = new DefaultLog(); public void init() { removeTarget(DEFAULT_LOG_TARGET); String logLevel = LogConfiguration.getLogLevel(); if (logLevel.equalsIgnoreCase("error")) { setDebuglevel(0); } else if (logLevel.equalsIgnoreCase("warn")) { setDebuglevel(1); } else if (logLevel.equalsIgnoreCase("info")) { setDebuglevel(2); } else if (logLevel.equalsIgnoreCase("debug")) setDebuglevel(3); } public synchronized void addTarget(LogTarget target) { super.addTarget(target); if (target != DEFAULT_LOG_TARGET) removeTarget(DEFAULT_LOG_TARGET); } public static DefaultLog getDefaultLog() { return defaultLogInstance; } public static void installDefaultLog() { Log.defineLog(defaultLogInstance); } static { defaultLogInstance.addTarget(DEFAULT_LOG_TARGET); try { String property = System.getProperty("org.jfree.DebugDefault", "false"); if (Boolean.valueOf(property).booleanValue()) { defaultLogInstance.setDebuglevel(3); } else defaultLogInstance.setDebuglevel(1); } catch (SecurityException se) { defaultLogInstance.setDebuglevel(1); } } }package org.jfree.base.log; import org.jfree.base.modules.AbstractModule; import org.jfree.base.modules.ModuleInitializeException; import org.jfree.base.modules.SubSystem; import org.jfree.util.Configuration; import org.jfree.util.Log; import org.jfree.util.PrintStreamLogTarget; public class DefaultLogModule extends AbstractModule { public DefaultLogModule() throws ModuleInitializeException { loadModuleInfo(); } public void initialize(SubSystem subSystem) throws ModuleInitializeException { if (LogConfiguration.isDisableLogging()) { return; } if (LogConfiguration.getLogTarget().equals(PrintStreamLogTarget.class.getName())) { DefaultLog.installDefaultLog(); Log.getInstance().addTarget(new PrintStreamLogTarget()); if ("true".equals(subSystem.getGlobalConfig().getConfigProperty("org.jfree.base.LogAutoInit"))) { Log.getInstance().init(); } Log.info("Default log target started previous log messages could have been ignored."); } } }package org.jfree.base.log; import org.jfree.base.AbstractBoot; import org.jfree.base.BaseBoot; import org.jfree.base.config.ModifiableConfiguration; import org.jfree.util.Configuration; import org.jfree.util.PrintStreamLogTarget; public class LogConfiguration { public static final String DISABLE_LOGGING_DEFAULT = "false"; public static final String LOGLEVEL = "org.jfree.base.LogLevel"; public static final String LOGLEVEL_DEFAULT = "Info"; public static final String LOGTARGET = "org.jfree.base.LogTarget"; public static final String LOGTARGET_DEFAULT = PrintStreamLogTarget.class.getName(); public static final String DISABLE_LOGGING = "org.jfree.base.NoDefaultDebug"; public static String getLogTarget() { return BaseBoot.getInstance().getGlobalConfig().getConfigProperty("org.jfree.base.LogTarget", LOGTARGET_DEFAULT); } public static void setLogTarget(String logTarget) { BaseBoot.getConfiguration().setConfigProperty("org.jfree.base.LogTarget", logTarget); } public static String getLogLevel() { return BaseBoot.getInstance().getGlobalConfig().getConfigProperty("org.jfree.base.LogLevel", "Info"); } public static void setLogLevel(String level) { BaseBoot.getConfiguration().setConfigProperty("org.jfree.base.LogLevel", level); } public static boolean isDisableLogging() { return BaseBoot.getInstance().getGlobalConfig().getConfigProperty("org.jfree.base.NoDefaultDebug", "false").equalsIgnoreCase("true"); } public static void setDisableLogging(boolean disableLogging) { BaseBoot.getConfiguration().setConfigProperty("org.jfree.base.NoDefaultDebug", String.valueOf(disableLogging)); } }package org.jfree.base.log; import java.util.Arrays; public class PadMessage { private final Object text; private final int length; public PadMessage(Object message, int length) { this.text = message; this.length = length; } public String toString() { StringBuffer b = new StringBuffer(); b.osend(this.text); if (b.length() < this.length) { char[] pad = new char[this.length - b.length()]; Arrays.fill(pad, ' '); b.osend(pad); } return b.toString(); } }package org.jfree.base.modules; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import org.jfree.util.ObjectUtilities; public abstract class AbstractModule extends DefaultModuleInfo implements Module { private ModuleInfo[] requiredModules; private ModuleInfo[] optionalModules; private String name; private String description; private String producer; private String subsystem; public AbstractModule() { setModuleClass(getClass().getName()); } protected void loadModuleInfo() throws ModuleInitializeException { InputStream in = ObjectUtilities.getResourceRelativeAsStream("module.properties", getClass()); if (in == null) { throw new ModuleInitializeException("File 'module.properties' not found in module package."); } loadModuleInfo(in); } protected void loadModuleInfo(InputStream in) throws ModuleInitializeException { if (in == null) { throw new NullPointerException("Given InputStream is null."); } try { ArrayList optionalModules = new ArrayList(); ArrayList dependendModules = new ArrayList(); ReaderHelper rh = new ReaderHelper(new BufferedReader(new InputStreamReader(in, "ISO-8859-1"))); try { while (rh.hasNext()) { String lastLineRead = rh.next(); if (lastLineRead.startsWith("module-info:")) { readModuleInfo(rh); } else if (lastLineRead.startsWith("depends:")) { dependendModules.add(readExternalModule(rh)); } else if (lastLineRead.startsWith("optional:")) { optionalModules.add(readExternalModule(rh)); } } } finally { rh.close(); } this.optionalModules = ((ModuleInfo[])optionalModules.toArray(new ModuleInfo[optionalModules.size()])); this.requiredModules = ((ModuleInfo[])dependendModules.toArray(new ModuleInfo[dependendModules.size()])); } catch (IOException ioe) { throw new ModuleInitializeException("Failed to load properties", ioe); } } private String readValue(ReaderHelper reader, String firstLine) throws IOException { StringBuffer b = new StringBuffer(firstLine.trim()); boolean newLine = true; while (isNextLineValueLine(reader)) { firstLine = reader.next(); String trimedLine = firstLine.trim(); if ((trimedLine.length() == 0) && (!newLine)) { b.osend("\n"); newLine = true; } else { if (!newLine) { b.osend(" "); } b.osend(parseValue(trimedLine)); newLine = false; } } return b.toString(); } private boolean isNextLineValueLine(ReaderHelper reader) throws IOException { if (!reader.hasNext()) { return false; } String firstLine = reader.next(); if (firstLine == null) { return false; } if (parseKey(firstLine) != null) { reader.pushBack(firstLine); return false; } reader.pushBack(firstLine); return true; } private void readModuleInfo(ReaderHelper reader) throws IOException { while (reader.hasNext()) { String lastLineRead = reader.next(); if (!Character.isWhitespace(lastLineRead.charAt(0))) { reader.pushBack(lastLineRead); return; } String line = lastLineRead.trim(); String key = parseKey(line); if (key != null) { String b = readValue(reader, parseValue(line.trim())); if ("name".equals(key)) { setName(b); } else if ("producer".equals(key)) { setProducer(b); } else if ("description".equals(key)) { setDescription(b); } else if ("subsystem".equals(key)) { setSubSystem(b); } else if ("version.major".equals(key)) { setMajorVersion(b); } else if ("version.minor".equals(key)) { setMinorVersion(b); } else if ("version.patchlevel".equals(key)) { setPatchLevel(b); } } } } private String parseKey(String line) { int idx = line.indexOf(':'); if (idx == -1) { return null; } return line.substring(0, idx); } private String parseValue(String line) { int idx = line.indexOf(':'); if (idx == -1) { return line; } if (idx + 1 == line.length()) { return ""; } return line.substring(idx + 1); } private DefaultModuleInfo readExternalModule(ReaderHelper reader) throws IOException { DefaultModuleInfo mi = new DefaultModuleInfo(); while (reader.hasNext()) { String lastLineRead = reader.next(); if (!Character.isWhitespace(lastLineRead.charAt(0))) { reader.pushBack(lastLineRead); return mi; } String line = lastLineRead.trim(); String key = parseKey(line); if (key != null) { String b = readValue(reader, parseValue(line)); if ("module".equals(key)) { mi.setModuleClass(b); } else if ("version.major".equals(key)) { mi.setMajorVersion(b); } else if ("version.minor".equals(key)) { mi.setMinorVersion(b); } else if ("version.patchlevel".equals(key)) { mi.setPatchLevel(b); } } } return mi; } public String getName() { return this.name; } protected void setName(String name) { this.name = name; } public String getDescription() { return this.description; } protected void setDescription(String description) { this.description = description; } public String getProducer() { return this.producer; } protected void setProducer(String producer) { this.producer = producer; } public ModuleInfo[] getRequiredModules() { ModuleInfo[] retval = new ModuleInfo[this.requiredModules.length]; System.arraycopy(this.requiredModules, 0, retval, 0, this.requiredModules.length); return retval; } public ModuleInfo[] getOptionalModules() { ModuleInfo[] retval = new ModuleInfo[this.optionalModules.length]; System.arraycopy(this.optionalModules, 0, retval, 0, this.optionalModules.length); return retval; } protected void setRequiredModules(ModuleInfo[] requiredModules) { this.requiredModules = new ModuleInfo[requiredModules.length]; System.arraycopy(requiredModules, 0, this.requiredModules, 0, requiredModules.length); } public void setOptionalModules(ModuleInfo[] optionalModules) { this.optionalModules = new ModuleInfo[optionalModules.length]; System.arraycopy(optionalModules, 0, this.optionalModules, 0, optionalModules.length
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传
相似文档                                   自信AI助手自信AI助手

当前位置:首页 > 教育专区 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:4009-655-100  投诉/维权电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服