📄 cmsregistry.java
字号:
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.
*
* @param 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.
*
* @param 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");
Element moduleElement = getModuleElement(modulname);
NodeList allUploadDates = moduleElement.getElementsByTagName("uploaddate");
String value = allUploadDates.item((allUploadDates.getLength() - 1)).getFirstChild().getNodeValue();
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.
*
* @param 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) {
String retValue = "";
try {
Element moduleElement = getModuleElement(modulename);
NodeList allUploadDates = moduleElement.getElementsByTagName("uploadedby");
retValue = allUploadDates.item((allUploadDates.getLength() - 1)).getFirstChild().getNodeValue();
} catch (Exception e) {}
return retValue;
}
/**
* This method returns the version of the module.
*
* @param String the name of the module.
* @return java.lang.String the version of the module.
*/
public float getModuleVersion(String modulename) {
float retValue = -1;
try {
retValue = Float.parseFloat(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.
*
* @param 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.
*
* @param 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 lifecycle classes for all modules.
*
* @param Vector classes in this parameter the classes will be returned.
* @return int the amount of classes.
*/
public int getModuleLifeCycle(Vector classes) {
try {
NodeList classList = m_xmlReg.getElementsByTagName("lifecycleclass");
for (int x = 0; x < classList.getLength(); x++) {
try {
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 the name of the class, that contains the publish method of the module.
*
* @param String the name of the module.
* @return java.lang.Class that contains the publish method of the module.
*/
public String getModulePublishClass(String modulname) {
String retValue = null;
try {
Element module = getModuleElement(modulname);
Element publishClass = (Element) (module.getElementsByTagName("publishclass").item(0));
retValue = publishClass.getElementsByTagName("name").item(0).getFirstChild().getNodeValue();
} catch (Exception exc) {
// ignore the exception - reg is not welformed
}
return retValue;
}
/**
* Returns all publishable classes for all modules.
*
* @param Vector classes in this parameter the classes will be returned.
* @param 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();
if ((name != null) && (!"".equals(name)))
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.
*
* @param 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 exportpoints and paths.
*
*
* @return Hashtable The exportpoints and the paths.
*/
public Hashtable getExportpoints() {
if((m_exportpoints == null) || (m_exportpoints.size() == 0)){
m_exportpoints = new Hashtable();
try {
NodeList exportpointsList = m_xmlReg.getElementsByTagName("exportpoint");
for (int x = 0; x < exportpointsList.getLength(); x++) {
try {
String curExportpoint = ((Element) exportpointsList.item(x)).getElementsByTagName("source").item(0).getFirstChild().getNodeValue();
String curPath = ((Element) exportpointsList.item(x)).getElementsByTagName("destination").item(0).getFirstChild().getNodeValue();
m_exportpoints.put(curExportpoint, com.opencms.boot.CmsBase.getAbsoluteWebPath(curPath));
} catch(Exception exc) {
exc.printStackTrace();
// ignore the exception and try the next view-pair.
}
}
} catch (Exception exc) {
exc.printStackTrace();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -