1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
| package main.actions.save;
import java.util.Vector;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.uddi4j.UDDIException;
import org.uddi4j.client.UDDIProxy;
import org.uddi4j.datatype.OverviewDoc;
import org.uddi4j.datatype.tmodel.TModel;
import org.uddi4j.response.AuthToken;
import org.uddi4j.response.TModelDetail;
import org.uddi4j.transport.TransportException;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ValidationAware;
public class SaveTModelAction extends ActionSupport implements ServletRequestAware, ValidationAware{
/** Serial Version UID */
private static final long serialVersionUID = 1L;
private HttpServletRequest servletRequest;
private String tModelName;
private String tModelDescription;
private String wsdlURL;
private String overViewDescription;
private String bouton;
private UDDIProxy proxy;
private AuthToken token;
/**
* This action will save the TModel...
**/
public String execute() throws Exception {
if(getBouton()!=null && !getBouton().equals("Annuler")){
TModelDetail tModelDetail = null;
try{
// Get proxy/token from Session
setProxy((UDDIProxy)(getServletRequest().getSession().getAttribute("proxy")));
setToken((AuthToken)(getServletRequest().getSession().getAttribute("token")));
System.out.println("\nSave '" + getTModelName() + "'");
Vector<TModel> tModels = new Vector<TModel>();
TModel tModel = new TModel("", getTModelName());
tModel.setDefaultDescriptionString(getTModelDescription());
OverviewDoc overviewDoc = new OverviewDoc();
overviewDoc.setOverviewURL(getWsdlURL());
overviewDoc.setDefaultDescriptionString(getOverViewDescription());
tModel.setOverviewDoc(overviewDoc);
tModels.add(tModel);
// **** Save a TModel
tModelDetail = getProxy().save_tModel(getToken().getAuthInfoString(), tModels);
// Processing return type
Vector tModelVector = tModelDetail.getTModelVector();
TModel tModelReturned = (TModel)(tModelVector.elementAt(0));
System.out.println("TModel Saved: " + tModelReturned.getNameString());
System.out.println("TModel Key : " + tModelReturned.getTModelKey());
}catch(UDDIException e){
System.err.println("\n ##### Error: exception is reported by: "+e.getClass().getName()+" at: "+
this.getClass().getName()+":: SaveTModel() failed ");
} catch (TransportException e) {
System.err.println("\n ##### Error: exception is reported by: "+e.getClass().getName()+" at: "+
this.getClass().getName()+":: SaveTModel() filed ");
}
}
return SUCCESS;
}
public String getTModelDescription() {
return tModelDescription;
}
public void setTModelDescription(String modelDescription) {
tModelDescription = modelDescription;
}
public String getTModelName() {
return tModelName;
}
public void setTModelName(String modelName) {
tModelName = modelName;
}
public String getWsdlURL() {
return wsdlURL;
}
public void setWsdlURL(String wsdlURL) {
this.wsdlURL = wsdlURL;
}
public AuthToken getToken() {
return token;
}
public void setToken(AuthToken token) {
this.token = token;
}
public UDDIProxy getProxy() {
return proxy;
}
public void setProxy(UDDIProxy proxy) {
this.proxy = proxy;
}
public HttpServletRequest getServletRequest() {
return servletRequest;
}
public void setServletRequest(HttpServletRequest servletRequest) {
this.servletRequest = servletRequest;
}
public String getBouton() {
return bouton;
}
public void setBouton(String bouton) {
this.bouton = bouton;
}
public String getOverViewDescription() {
return overViewDescription;
}
public void setOverViewDescription(String overViewDescription) {
this.overViewDescription = overViewDescription;
}
} |