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

📄 cmsregistry.java

📁 java 编写的程序
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
 * @return boolean the value for the parameter in the module.
 */
public long getModuleParameterLong(String modulname, String parameter, long defaultValue) {
    return Long.valueOf(getModuleParameter(modulname, parameter, Long.toString(defaultValue))).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.
 * @return boolean the value for the parameter in the module.
 */
public Long getModuleParameterLong(String modulname, String parameter, Long defaultValue) {
    return new Long(getModuleParameterLong(modulname, parameter, defaultValue.longValue()));
}
/**
 * Gets all parameter-names for a module.
 *
 * @param modulename String the name of the module.
 * @return value String[] the names of the parameters for a module.
 */
public String[] getModuleParameterNames(String modulename) {
    String[] retValue = null;
    try {
        Element module = getModuleElement(modulename);
        Element parameters = (Element) (module.getElementsByTagName("parameters").item(0));
        NodeList para = parameters.getElementsByTagName("para");
        retValue = new String[para.getLength()];
        for (int i = 0; i < para.getLength(); i++) {
            retValue[i] = ((Element) para.item(i)).getElementsByTagName("name").item(0).getFirstChild().getNodeValue();
        }
    } 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.
 * @return boolean the value for the parameter in the module.
 */
public String getModuleParameterString(String modulname, String parameter) {
    return 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 String getModuleParameterString(String modulname, String parameter, String defaultValue) {
    return getModuleParameter(modulname, parameter, defaultValue);
}
/**
 * This method returns the type of a parameter in a module.
 *
 * @param modulename the name of the module.
 * @param parameter the name of the parameter.
 * @return the type of the parameter.
 */
public String getModuleParameterType(String modulename, String parameter) {
    String retValue = null;
    try {
        Element param = getModuleParameterElement(modulename, parameter);
        retValue = param.getElementsByTagName("type").item(0).getFirstChild().getNodeValue();
    } catch (Exception exc) {
        // ignore the exception - parameter is not existent
    }
    return retValue;
}
/**
 * Returns all repositories for a module.
 *
 * @parameter String modulname the name of the module.
 * @return java.lang.String[] the reprositories of a module.
 */
public java.lang.String[] getModuleRepositories(String modulename) {
    String[] retValue = null;
    try {
        Element module = getModuleElement(modulename);
        Element repository = (Element) (module.getElementsByTagName("repository").item(0));
        NodeList paths = repository.getElementsByTagName("path");
        retValue = new String[paths.getLength()];
        for (int i = 0; i < paths.getLength(); i++) {
            retValue[i] = paths.item(i).getFirstChild().getNodeValue();
        }
    } catch (Exception exc) {
        // ignore the exception - reg is not welformed
    }
    return retValue;
}
/**
 * Returns the upload-date for the module.
 *
 * @parameter String the name of the module.
 * @return java.lang.String the upload-date for the module.
 */
public long getModuleUploadDate(String modulname) {
    long retValue = -1;
    try {
        String value = getModuleData(modulname, "uploaddate");
        retValue = m_dateFormat.parse(value).getTime();
    } catch (Exception exc) {
        // ignore the exception - reg is not welformed
    }
    return retValue;
}
/**
 * Returns the user-name of the user who had uploaded the module.
 *
 * @parameter String the name of the module.
 * @return java.lang.String the user-name of the user who had uploaded the module.
 */
public String getModuleUploadedBy(String modulename) {
    return getModuleData(modulename, "uploadedby");
}
/**
 * This method returns the version of the module.
 *
 * @parameter String the name of the module.
 * @return java.lang.String the version of the module.
 */
public int getModuleVersion(String modulename) {
    int retValue = -1;
    try {
        retValue = Integer.parseInt(getModuleData(modulename, "version"));
    } catch (Exception exc) {
        // ignore the exception - reg is not welformed
    }
    return retValue;
}
/**
 * Returns the name of the view, that is implemented by the module.
 *
 * @parameter String the name of the module.
 * @return java.lang.String the name of the view, that is implemented by the module.
 */
public String getModuleViewName(String modulename) {
    String retValue = null;
    try {
        Element module = getModuleElement(modulename);
        Element view = (Element) (module.getElementsByTagName("view").item(0));
        retValue = view.getElementsByTagName("name").item(0).getFirstChild().getNodeValue();
    } catch (Exception exc) {
        // ignore the exception - reg is not welformed
    }
    return retValue;
}
/**
 * Returns the url to the view-url for the module within the system.
 *
 * @parameter String the name of the module.
 * @return java.lang.String the view-url to the module.
 */
public String getModuleViewUrl(String modulname) {
    String retValue = null;
    try {
        Element module = getModuleElement(modulname);
        Element view = (Element) (module.getElementsByTagName("view").item(0));
        retValue = view.getElementsByTagName("url").item(0).getFirstChild().getNodeValue();
    } catch (Exception exc) {
        // ignore the exception - reg is not welformed
    }
    return retValue;
}

/**
 * Returns all publishable classes for all modules.
 *
 * @parameter Vector classes in this parameter the classes will be returned.
 * @parameter String requiredMethod The value of the methodTag for the different
 *      methods useable after publish.
 *          null means the standard publish method
 *          "linkpublish" means the method that needs the changed links as parameter (i.e. search)
 * @return int the amount of classes.
 */
public int getModulePublishables(Vector classes, String requiredMethod) {
    if(requiredMethod == null){
        requiredMethod = "";
    }
    try {
        NodeList classList = m_xmlReg.getElementsByTagName("publishclass");
        for (int x = 0; x < classList.getLength(); x++) {
            try {
                String methodValue = ((Element) classList.item(x)).getAttribute("method");
                if(methodValue == null){
                    methodValue = "";
                }
                if(methodValue.equals(requiredMethod)){
                    String name = ((Element) classList.item(x)).getElementsByTagName("name").item(0).getFirstChild().getNodeValue();
                    classes.addElement(name);
                }
            } catch(Exception exc) {
                // ignore the exception and try the next view-pair.
            }
        }
        return classes.size();
    } catch (Exception exc) {
        // no return-values
        return 0;
    }
}

/**
 * Returns all exportable classes for all modules.
 *
 * @parameter Hashtable classes in this parameter the classes will be returned.
 * @return int the amount of classes.
 */
public int getModuleExportables(Hashtable classes) {
    try {
        Enumeration allModules = m_modules.keys();
        while(allModules.hasMoreElements()){
            String nicename = (String)allModules.nextElement();
            NodeList classList = ((Element) m_modules.get(nicename)).getElementsByTagName("publishclass");
            if(classList.getLength() > 0) {
                try {
                    String classname = ((Element) classList.item(0)).getElementsByTagName("name").item(0).getFirstChild().getNodeValue();
                    if(classname != null && !"".equalsIgnoreCase(classname)){
                        classes.put(nicename, classname);
                    }
                } catch(Exception exc) {
                    // ignore the exception and try the next view-pair.
                }
            }
        }
        return classes.size();
    } catch (Exception exc) {
        // no return-values
        return 0;
    }
}

/**
 * Returns all repositories for all modules.
 *
 * @return java.lang.String[] the reprositories of all modules.
 */
public java.lang.String[] getRepositories() {
    NodeList repositories = m_xmlReg.getElementsByTagName("repository");
    Vector retValue = new Vector();
    String[] retValueArray = new String[0];
    for (int x = 0; x < repositories.getLength(); x++) {
        NodeList paths = ((Element) repositories.item(x)).getElementsByTagName("path");
        for (int y = 0; y < paths.getLength(); y++) {
            retValue.addElement(paths.item(y).getFirstChild().getNodeValue());
        }
    }
    retValueArray = new String[retValue.size()];
    retValue.copyInto(retValueArray);
    return retValueArray;
}

/**
 * Returns all Resourcetypes and korresponding parameter for System and all modules.
 *
 * @parameter Vector names in this parameter the names of the Resourcetypes will be returned.
 * @parameter Vector launcherTypes in this parameters the launcherType will be returned(int).
 * @parameter Vector launcherClass in this parameters the launcherClass will be returned.
 * @parameter Vector resourceClass in this parameters the resourceClass will be returned.
 * @return int the amount of resourcetypes.
 */
public int getResourceTypes(Vector names, Vector launcherTypes, Vector launcherClass, Vector resourceClass){
    try{
        NodeList resTypes = m_xmlReg.getElementsByTagName("restype");
        for (int x = 0; x < resTypes.getLength(); x++){
            try{
                String name = ((Element)resTypes.item(x)).getElementsByTagName("name").item(0).getFirstChild().getNodeValue();
                String lType = ((Element)resTypes.item(x)).getElementsByTagName("launcherType").item(0).getFirstChild().getNodeValue();
                String lClass = "";
                try{
                    lClass = ((Element)resTypes.item(x)).getElementsByTagName("launcherClass").item(0).getFirstChild().getNodeValue();
                }catch(Exception ex){
                }
                String resClass = ((Element)resTypes.item(x)).getElementsByTagName("resourceClass").item(0).getFirstChild().getNodeValue();
                names.addElement(name);
                launcherTypes.addElement(lType);
                launcherClass.addElement(lClass);
                resourceClass.addElement(resClass);
            }catch(Exception exc){
                // ignore the exeption
            }
        }
        return names.size();
    }catch(Exception e){
        // no returnvalues
        return 0;
    }
}

/**
 * Returns a value for a system-key.
 * E.g. <code>&lt;system&gt;&lt;mailserver&gt;mail.server.com&lt;/mailserver&gt;&lt;/system&gt;</code>
 * can be requested via <code>getSystemValue("mailserver");</code> and returns "mail.server.com".
 *
 * @parameter String the key of the system-value.
 * @return the value for that system-key.
 */
public String getSystemValue(String key) {
    String retValue = null;
    try {
        Element systemElement = (Element)m_xmlReg.getElementsByTagName("system").item(0);
        retValue = systemElement.getElementsByTagName(key).item(0).getFirstChild().getNodeValue();
    } catch (Exception exc) {
        // ignore the exception - registry is not wellformed
    }
    return retValue;
}

/**
 * Returns a vector of value for a system-key.
 *
 * @parameter String the key of the system-value.
 * @return the values for that system-key.
 */
public Hashtable getSystemValues(String key) {
    Hashtable retValue = new Hashtable();
    try {
        Element systemElement = (Element)m_xmlReg.getElementsByTagName("system").item(0);
        NodeList list = systemElement.getElementsByTagName(key).item(0).getChildNodes();
        for(int i=0; i < list.getLength(); i++) {
            retValue.put(list.item(i).getNodeName(),
                         list.item(i).getFirstChild().getNodeValue());
        }
    } catch (Exception exc) {
        // ignore the exception - registry is not wellformed

⌨️ 快捷键说明

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