⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmsregistry.java

📁 java 编写的程序
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
 */
public int getModuleFiles(String modulename, Vector retNames, Vector retCodes) {
    try {
        Element module = getModuleElement(modulename);
        Element files = (Element) (module.getElementsByTagName("files").item(0));
        NodeList file = files.getElementsByTagName("file");
        for (int i = 0; i < file.getLength(); i++) {
            retNames.addElement(((Element) file.item(i)).getElementsByTagName("name").item(0).getFirstChild().getNodeValue());
            retCodes.addElement(((Element) file.item(i)).getElementsByTagName("checksum").item(0).getFirstChild().getNodeValue());
        }
    } catch (Exception exc) {
        // ignore the exception - reg is not welformed
    }
    return retNames.size();
}
/**
 * Returns the class, that receives all maintenance-events for the module.
 *
 * @parameter String the name of the module.
 * @return java.lang.Class that receives all maintenance-events for the module.
 */
public Class getModuleMaintenanceEventClass(String modulname) {
    try {

        Vector repositories = new Vector();
        String[] reposNoVector = getRepositories();
        for (int i=0; i<reposNoVector.length; i++){
            repositories.addElement(reposNoVector[i]);
        }
        ClassLoader loader = this.getClass().getClassLoader();

        return loader.loadClass(getModuleData(modulname, "maintenance_class"));

    } catch(Exception exc) {
        return null;
    }
}
/**
 * Returns the name of the class, that receives all maintenance-events for the module.
 *
 * @parameter String the name of the module.
 * @return java.lang.Class that receives all maintenance-events for the module.
 */
 public String getModuleMaintenanceEventName(String modulname) {
    return getModuleData(modulname, "maintenance_class");
}
/**
 * Returns the names of all available modules.
 *
 * @return Enumeration the names of all available modules.
 */
public Enumeration getModuleNames() {
    return m_modules.keys();
}
/**
 * Returns the nice name of the module.
 *
 * @parameter String the name of the module.
 * @return java.lang.String the description of the module.
 */
public String getModuleNiceName(String module) {
    return getModuleData(module, "nicename");
}
/**
 * Gets a parameter for a module.
 *
 * @param modulename java.lang.String the name of the module.
 * @param parameter java.lang.String the name of the parameter to set.
 * @return value java.lang.String the value to set for the parameter.
 */
public String getModuleParameter(String modulename, String parameter) {
    String retValue = null;
    try {
        Element param = getModuleParameterElement(modulename, parameter);
        retValue = param.getElementsByTagName("value").item(0).getFirstChild().getNodeValue();
    } catch (Exception exc) {
        // ignore the exception - parameter is not existent
    }
    return retValue;
}

/**
 * Gets a parameter for a module.
 *
 * @param modulename java.lang.String the name of the module.
 * @param parameter java.lang.String the name of the parameter to set.
 * @param defaultValue the default value.
 * @return value java.lang.String the value to set for the parameter.
 */
public String getModuleParameter(String modulename, String parameter, String defaultValue) {
    String retValue = null;
    try {
        Element param = getModuleParameterElement(modulename, parameter);
        retValue = param.getElementsByTagName("value").item(0).getFirstChild().getNodeValue();
    } catch (Exception exc) {
        retValue = defaultValue;
        // ignore the exception - parameter is not existent
    }
    return retValue;
}

/**
 * Returns a parameter for a module.
 *
 * @param modulname String the name of the module.
 * @param parameter String the name of the parameter.
 * @return boolean the value for the parameter in the module.
 */
public boolean getModuleParameterBoolean(String modulname, String parameter) {
    if ("true".equals(getModuleParameter(modulname, parameter).toLowerCase())) {
        return true;
    } else {
        return false;
    }
}
/**
 * Returns a parameter for a module.
 *
 * @param modulname String the name of the module.
 * @param parameter String the name of the parameter.
 * @param default the default value.
 * @return boolean the value for the parameter in the module.
 */
public Boolean getModuleParameterBoolean(String modulname, String parameter, Boolean defaultValue) {
    return new Boolean(getModuleParameterBoolean(modulname, parameter, defaultValue.booleanValue()));
}
/**
 * Returns a parameter for a module.
 *
 * @param modulname String the name of the module.
 * @param parameter String the name of the parameter.
 * @param default the default value.
 * @return boolean the value for the parameter in the module.
 */
public boolean getModuleParameterBoolean(String modulname, String parameter, boolean defaultValue) {
    if (getModuleParameterBoolean(modulname, parameter)) {
        return true;
    } else {
        return defaultValue;
    }
}
/**
 * Returns a parameter for a module.
 *
 * @param modulname String the name of the module.
 * @param parameter String the name of the parameter.
 * @param default the default value.
 * @return boolean the value for the parameter in the module.
 */
public byte getModuleParameterByte(String modulname, String parameter) {
    return Byte.parseByte(getModuleParameter(modulname, parameter));
}
/**
 * Returns a parameter for a module.
 *
 * @param modulname String the name of the module.
 * @param parameter String the name of the parameter.
 * @param default the default value.
 * @return boolean the value for the parameter in the module.
 */
public byte getModuleParameterByte(String modulname, String parameter, byte defaultValue) {
    return Byte.parseByte(getModuleParameter(modulname, parameter, Byte.toString(defaultValue)));
}
/**
 * Returns a parameter for a module.
 *
 * @param modulname String the name of the module.
 * @param parameter String the name of the parameter.
 * @param default the default value.
 * @return boolean the value for the parameter in the module.
 */
public Byte getModuleParameterByte(String modulname, String parameter, Byte defaultValue) {
    return new Byte(getModuleParameterByte(modulname, parameter, defaultValue.byteValue()));
}
/**
 * Returns a description for parameter in a module.
 *
 * @param modulname String the name of the module.
 * @param parameter String the name of the parameter.
 * @return String the description for the parameter in the module.
 */
public String getModuleParameterDescription(String modulname, String parameter) {
    String retValue = null;
    try {
        Element param = getModuleParameterElement(modulname, parameter);
        retValue = param.getElementsByTagName("description").item(0).getFirstChild().getNodeValue();
    } catch (Exception exc) {
        // ignore the exception - parameter is not existent
    }
    return retValue;
}
/**
 * Returns a parameter for a module.
 *
 * @param modulname String the name of the module.
 * @param parameter String the name of the parameter.
 * @return boolean the value for the parameter in the module.
 */
public double getModuleParameterDouble(String modulname, String parameter) {
    return Double.valueOf(getModuleParameter(modulname, parameter)).doubleValue();
}
/**
 * Returns a parameter for a module.
 *
 * @param modulname String the name of the module.
 * @param parameter String the name of the parameter.
 * @param default the default value.
 * @return boolean the value for the parameter in the module.
 */
public double getModuleParameterDouble(String modulname, String parameter, double defaultValue) {
    return Double.valueOf(getModuleParameter(modulname, parameter, Double.toString(defaultValue))).doubleValue();
}
/**
 * Returns a parameter for a module.
 *
 * @param modulname String the name of the module.
 * @param parameter String the name of the parameter.
 * @param default the default value.
 * @return boolean the value for the parameter in the module.
 */
public Double getModuleParameterDouble(String modulname, String parameter, Double defaultValue) {
    return new Double(getModuleParameterDouble(modulname, parameter, defaultValue.doubleValue()));
}
/**
 * Private method to get them XML-Element for a parameter in a module.
 *
 * @param modulename String the name of the module.
 * @param parameter String the name of the parameter.
 * @return Element the XML-Element corresponding to the parameter.
 */
private Element getModuleParameterElement(String modulename, String parameter) {
    Element retValue = null;
    try {
        Element module = getModuleElement(modulename);
        Element parameters = (Element) (module.getElementsByTagName("parameters").item(0));
        NodeList para = parameters.getElementsByTagName("para");
        for (int i = 0; i < para.getLength(); i++) {
            if (((Element) para.item(i)).getElementsByTagName("name").item(0).getFirstChild().getNodeValue().equals(parameter)) {
                // this is the element for the parameter.
                retValue = (Element) para.item(i);
                // stop searching - parameter was found
                break;
            }
        }
    } catch (Exception exc) {
        // ignore the exception - reg is not welformed
    }
    return retValue;
}
/**
 * Returns a parameter for a module.
 *
 * @param modulname String the name of the module.
 * @param parameter String the name of the parameter.
 * @param default the default value.
 * @return boolean the value for the parameter in the module.
 */
public float getModuleParameterFloat(String modulname, String parameter) {
    return Float.valueOf(getModuleParameter(modulname, parameter)).floatValue();
}
/**
 * Returns a parameter for a module.
 *
 * @param modulname String the name of the module.
 * @param parameter String the name of the parameter.
 * @param default the default value.
 * @return boolean the value for the parameter in the module.
 */
public float getModuleParameterFloat(String modulname, String parameter, float defaultValue) {
    return Float.valueOf(getModuleParameter(modulname, parameter, Float.toString(defaultValue))).floatValue();
}
/**
 * Returns a parameter for a module.
 *
 * @param modulname String the name of the module.
 * @param parameter String the name of the parameter.
 * @param default the default value.
 * @return boolean the value for the parameter in the module.
 */
public Float getModuleParameterFloat(String modulname, String parameter, Float defaultValue) {
    return new Float(getModuleParameterFloat(modulname, parameter, defaultValue.floatValue()));
}
/**
 * Returns a parameter for a module.
 *
 * @param modulname String the name of the module.
 * @param parameter String the name of the parameter.
 * @return boolean the value for the parameter in the module.
 */
public int getModuleParameterInteger(String modulname, String parameter) {
    return Integer.parseInt(getModuleParameter(modulname, parameter));
}
/**
 * Returns a parameter for a module.
 *
 * @param modulname String the name of the module.
 * @param parameter String the name of the parameter.
 * @param default the default value.
 * @return boolean the value for the parameter in the module.
 */
public int getModuleParameterInteger(String modulname, String parameter, int defaultValue) {
    return Integer.parseInt(getModuleParameter(modulname, parameter, Integer.toString(defaultValue)));
}
/**
 * Returns a parameter for a module.
 *
 * @param modulname String the name of the module.
 * @param parameter String the name of the parameter.
 * @param default the default value.
 * @return boolean the value for the parameter in the module.
 */
public Integer getModuleParameterInteger(String modulname, String parameter, Integer defaultValue) {
    return new Integer(getModuleParameterInteger(modulname, parameter, defaultValue.intValue()));
}
/**
 * Returns a parameter for a module.
 *
 * @param modulname String the name of the module.
 * @param parameter String the name of the parameter.
 * @param default the default value.
 * @return boolean the value for the parameter in the module.
 */
public long getModuleParameterLong(String modulname, String parameter) {
    return Long.valueOf(getModuleParameter(modulname, parameter)).longValue();
}
/**
 * Returns a parameter for a module.
 *
 * @param modulname String the name of the module.
 * @param parameter String the name of the parameter.
 * @param default the default value.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -