/* * gvNIX is an open source tool for rapid application development (RAD). * Copyright (C) 2010 Generalitat Valenciana * * 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 3 of the License, or (at your option) any later * version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ package org.gvnix.service.roo.addon.addon.ws.export; import java.util.List; import org.gvnix.service.roo.addon.addon.ws.WSCompilationUnit; import org.gvnix.service.roo.addon.annotations.GvNIXWebFault; import org.springframework.roo.classpath.details.ConstructorMetadata; import org.springframework.roo.classpath.details.FieldMetadata; import org.springframework.roo.classpath.details.MethodMetadata; import org.springframework.roo.classpath.details.annotations.AnnotationAttributeValue; import org.springframework.roo.classpath.details.annotations.AnnotationMetadata; import org.springframework.roo.model.JavaType; import com.github.antlrjavaparser.api.body.BodyDeclaration; import com.github.antlrjavaparser.api.body.ClassOrInterfaceDeclaration; import com.github.antlrjavaparser.api.body.MethodDeclaration; import com.github.antlrjavaparser.api.body.TypeDeclaration; import com.github.antlrjavaparser.api.expr.MemberValuePair; /** * @author <a href="http://www.disid.com">DISID Corporation S.L.</a> made for <a * href="http://www.dgti.gva.es">General Directorate for Information * Technologies (DGTI)</a> */ public interface WsExportWsdl { /** Sources directory generated by wsdl2java maven plugin into target folder */ public static final String GENERATED_CXF_SOURCES_DIR = "target/generated-sources/cxf/server/"; /** * Utility to get {@link #genSourcesDir}. * <p> * Use this method to ensure it is initialized. * </p> * * @return Generated sources directory. */ public String getGenSourcesDir(); /** * Loads fault field declaration into field list to generate fault web * service class * * @param declaredByMetadataId * @param compilationUnitServices * @param fieldMetadataList * @param bodyDeclaration */ public void loadFaultFieldDeclaration(String declaredByMetadataId, WSCompilationUnit compilationUnitServices, List<FieldMetadata> fieldMetadataList, BodyDeclaration bodyDeclaration); /** * Loads fault constructor declaration into contructor list to generate * fault web service class * * @param declaredByMetadataId * @param compilationUnitServices * @param constructorMetadataList * @param bodyDeclaration */ public void loadFaultConstructorDeclaration(String declaredByMetadataId, WSCompilationUnit compilationUnitServices, List<ConstructorMetadata> constructorMetadataList, BodyDeclaration bodyDeclaration); /** * Loads fault method declaration into method list to generate fault web * service class * * @param declaredByMetadataId * @param compilationUnitServices * @param methodMetadataList * @param bodyDeclaration */ public void loadFaultMethodDeclaration(String declaredByMetadataId, WSCompilationUnit compilationUnitServices, List<MethodMetadata> methodMetadataList, MethodDeclaration methodDeclaration); /** * Convert annotation @WebFault values from * {@link ClassOrInterfaceDeclaration} to {@link GvNIXWebFault}. TODO to be * removed from interface?. This method could be useless outside this * service. * * @param classOrInterfaceDeclaration to retrieve values from @WebFault * annotations and convert to {@link GvNIXWebFault} values. * @param exceptionType to retrieve faultBean attribute value * {@link GvNIXWebFault}. * @return {@link GvNIXWebFault} to define in class. */ public AnnotationMetadata getGvNIXWebFaultAnnotation( ClassOrInterfaceDeclaration classOrInterfaceDeclaration, JavaType exceptionType); /** * Load WebService Field declaration and complete with gvNIX annotations * * @param declaredByMetadataId * @param compilationUnitServices * @param fieldMetadataList * @param bodyDeclaration */ public void loadWebServiceFieldDeclaration(String declaredByMetadataId, WSCompilationUnit compilationUnitServices, List<FieldMetadata> fieldMetadataList, BodyDeclaration bodyDeclaration); /** * Load WebService method declaration and complete with gvNIX annotations * * @param declaredByMetadataId * @param compilationUnitServices * @param implementedInterface * @param methodMetadataList * @param defaultNamespace * @param bodyDeclaration */ public void loadWebServiceMethodDeclaration(String declaredByMetadataId, WSCompilationUnit compilationUnitServices, ClassOrInterfaceDeclaration implementedInterface, List<MethodMetadata> methodMetadataList, String defaultNamespace, BodyDeclaration bodyDeclaration); /** * Load field declaration from a type * * @param id * @param compUnit * @param fields * @param body */ public void loadFieldFromType(String id, WSCompilationUnit compUnit, List<FieldMetadata> fields, BodyDeclaration body); /** * Extract the filename from the given path, e.g. "mypath/myfile.txt" -> * "myfile.txt". * * @param path the file path (may be <code>null</code>) * @return the extracted filename, or <code>null</code> if none */ public String getFilename(String path); /** * Search name attributes on pairs and add it as name attrs. * * @param attrs Annotation attributes to add names * @param pairs Pairs to search in name attributes */ public void addNameAttr(List<AnnotationAttributeValue<?>> attrs, List<MemberValuePair> pairs); /** * If pair has text, add it as xml type name attr. * * @param attrs Annotation attributes to add xml type name * @param pair Pair to test has text */ public void addXmlTypeNameAttr(List<AnnotationAttributeValue<?>> attrs, MemberValuePair pair); /** * Add empty ignored attribute to list. * * @param annotAttrs Attributes list * @param pair Pair */ public void addElementListAttr(List<AnnotationAttributeValue<?>> annotAttrs); /** * Add pair value with namespace name into attributes list. * * @param attrs Attributes list * @param pair Pair */ public void addNamespaceAttr(List<AnnotationAttributeValue<?>> attrs, MemberValuePair pair); /** * Get all pair values and add it as ignored attrs. * * @param annotAttrs Annotation attributes to add ignored attrs * @param pairs Pair to get values */ public void addElementListAttr( List<AnnotationAttributeValue<?>> annotAttrs, MemberValuePair pair); /** * Add true exported attribute to list. * * @param annotAttrs Attributes list * @param pair Pair */ public void addExportedAttr(List<AnnotationAttributeValue<?>> attrs); /** * Add true/false enum element attribute to list when if is/isnot enum. * * @param typeDecl Type declaration * @param annotAttrs Attributes list */ public void addEnumElementAttr(TypeDeclaration typeDecl, List<AnnotationAttributeValue<?>> annotAttrs); }