org.codehaus.enunciate.modules.gwt.gwt-endpoint-impl.fmt Maven / Gradle / Ivy
[#ftl]
[#-- @ftlvariable name="endpointInterface" type="org.codehaus.enunciate.contract.jaxws.EndpointInterface" --]
[#--template for the client-side endpoint interface.--]
[@file name=("GWT" + endpointInterface.simpleName + "Impl.java") package=(endpointInterface.package.qualifiedName + ".gwt") charset="utf-8"]
/**
* ${(generatedCodeLicense!"")?replace("\n", "\n * ")}
*
* Generated by Enunciate.
*/
package ${endpointInterface.package.qualifiedName}.gwt;
/**
* ${endpointInterface.docComment?default("(no documentation provided)")?chop_linebreak?replace("\n", "\n * ")}
*/
@java.lang.SuppressWarnings( {"all"} )
[#if useWrappedServices!false]
public class GWT${endpointInterface.simpleName}Impl extends org.codehaus.enunciate.modules.gwt.GWTEndpointImpl implements ${packageFor(endpointInterface)}.GWT${endpointInterface.simpleName} {
[#else]
public class GWT${endpointInterface.simpleName}Impl extends org.codehaus.enunciate.modules.gwt.GWTEndpointImpl implements ${packageFor(endpointInterface)}.${endpointInterface.simpleName} {
[/#if]
public GWT${endpointInterface.simpleName}Impl() throws Exception {
super(new ${endpointInterface.endpointImplementations[0].qualifiedName}());
}
[@forEachWebMethod endpointInterface=endpointInterface]
[#if !webMethod.annotations["org.codehaus.enunciate.modules.gwt.GWTTransient"]?exists]
/**
* ${webMethod.docComment?default("(no documentation provided)")?chop_linebreak?replace("\n", "\n * ")}
*/
public ${classnameFor(webMethod.webResult)} ${webMethod.simpleName}([#list webMethod.webParameters as param]${classnameFor(param)} ${param.simpleName}[#if param_has_next], [/#if][/#list]) [#if webMethod.webFaults?size > 0]throws [#list webMethod.webFaults as fault]${classnameFor(fault)}[#if fault_has_next], [/#if][/#list][/#if] {
try {
[#if !webMethod.returnType.void]
[#if !webMethod.returnType.primitive]
return (${classnameFor(webMethod.webResult)}) invokeOperation("${webMethod.operationName}"[#list webMethod.webParameters as param], [#if param.type.array](Object) [/#if]${param.simpleName}[/#list]);
[#else]
return [@unwrapIfPrimitive type=webMethod.returnType](([@primitiveWrapper type=webMethod.returnType/]) invokeOperation("${webMethod.operationName}"[#list webMethod.webParameters as param], [#if param.type.array](Object) [/#if]${param.simpleName}[/#list]))[/@unwrapIfPrimitive];
[/#if]
[#else]
invokeOperation("${webMethod.operationName}"[#list webMethod.webParameters as param], [#if param.type.array](Object) [/#if]${param.simpleName}[/#list]);
[/#if]
}
[#list webMethod.webFaults as fault]
catch (${classnameFor(fault)} e) {
throw e;
}
[/#list]
catch (Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
}
else {
throw new RuntimeException(e);
}
}
}
[/#if]
[/@forEachWebMethod]
// Inherited.
protected Class getServiceInterface() {
return ${endpointInterface.qualifiedName}.class;
}
[#if useSpringDI!false]
@org.springframework.beans.factory.annotation.Autowired( required = false )
[/#if]
public void setServiceBean([#if useSpringDI!false]@org.springframework.beans.factory.annotation.Qualifier("${endpointInterface.endpointImplementations[0].serviceEndpointId}") [/#if]${endpointInterface.qualifiedName} serviceBean) {
this.serviceBean = serviceBean;
}
[#if useSpringDI!false]
//just used for autowiring.
@org.springframework.beans.factory.annotation.Autowired( required = false )
public void setSecurityChecker(org.codehaus.enunciate.service.SecurityExceptionChecker securityChecker) {
super.setSecurityChecker(securityChecker);
}
[/#if]
}
[/@file]