/**********************************************************************************
* nWordPress is an automated migration of WordPress 2.5.1 performed by Numiton.
*
* copyright : (C) 2008 Numiton - www.numiton.com
* email : numiton@users.sourceforge.net
*
* $Id: IXR_Error.java,v 1.2 2008/10/03 18:45:30 numiton Exp $
*
**********************************************************************************/
/**********************************************************************************
*
* 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 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.
*
***************************************************************************/
package org.numiton.nwp.wp_includes;
import static com.numiton.VarHandling.strval;
import java.io.Serializable;
import org.apache.log4j.Logger;
import org.numiton.nwp.GlobalConsts;
import org.numiton.nwp.GlobalVars;
import com.numiton.generic.ContextCarrierInterface;
import com.numiton.generic.GlobalConstantsInterface;
import com.numiton.generic.GlobalVariablesContainer;
import com.numiton.string.Strings;
public class IXR_Error implements ContextCarrierInterface, Serializable, Cloneable {
protected static final Logger LOG = Logger.getLogger(IXR_Error.class.getName());
public GlobalConsts gConsts;
public GlobalVars gVars;
public int code;
public String message;
public IXR_Error(GlobalVars javaGlobalVariables, GlobalConsts javaGlobalConstants, int code, String message) {
setContext(javaGlobalVariables, javaGlobalConstants);
this.code = code;
this.message = Strings.htmlspecialchars(message);
}
public String getXml() {
String xml = null;
xml = "<methodResponse>\n <fault>\n <value>\n <struct>\n <member>\n <name>faultCode</name>\n <value><int>" + strval(this.code) +
"</int></value>\n </member>\n <member>\n <name>faultString</name>\n <value><string>" + this.message +
"</string></value>\n </member>\n </struct>\n </value>\n </fault>\n</methodResponse>\n\n";
return xml;
}
public void setContext(GlobalVariablesContainer javaGlobalVariables, GlobalConstantsInterface javaGlobalConstants) {
gConsts = (GlobalConsts) javaGlobalConstants;
gVars = (GlobalVars) javaGlobalVariables;
gVars.gConsts = gConsts;
}
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
public GlobalVariablesContainer getGlobalVars() {
return gVars;
}
}