Search in sources :

Example 51 with Pom

use of org.springframework.roo.project.maven.Pom in project spring-roo by spring-projects.

the class DatabaseDotComOperationsImpl method isInstalledInModule.

public boolean isInstalledInModule(final String moduleName) {
    if (projectOperations == null) {
        projectOperations = getProjectOperations();
    }
    Validate.notNull(projectOperations, "ProjectOperations is required");
    final Pom pom = projectOperations.getPomFromModuleName(moduleName);
    if (pom == null) {
        return false;
    }
    for (final Plugin buildPlugin : pom.getBuildPlugins()) {
        if ("com.force.sdk".equals(buildPlugin.getArtifactId())) {
            return true;
        }
    }
    return false;
}
Also used : Pom(org.springframework.roo.project.maven.Pom) Plugin(org.springframework.roo.project.Plugin)

Example 52 with Pom

use of org.springframework.roo.project.maven.Pom in project spring-roo by spring-projects.

the class JmsOperationsImpl method addJmsReceiver.

@Override
public void addJmsReceiver(String destinationName, JavaType endpointService, String jndiConnectionFactory, String profile, boolean force) {
    boolean isApplicationModule = false;
    // Check that the module of the service is type application
    Collection<Pom> modules = getTypeLocationService().getModules(ModuleFeatureName.APPLICATION);
    for (Pom pom : modules) {
        if (pom.getModuleName().equals(endpointService.getModule())) {
            isApplicationModule = true;
        }
    }
    if (!isApplicationModule) {
        LOGGER.log(Level.SEVERE, String.format("The module selected where JMS service will be configured must be of type application"));
        return;
    }
    // Check if Service already exists and --force is included
    final String serviceFilePathIdentifier = getPathResolver().getCanonicalPath(endpointService.getModule(), Path.SRC_MAIN_JAVA, endpointService);
    if (getFileManager().exists(serviceFilePathIdentifier) && force) {
        getFileManager().delete(serviceFilePathIdentifier);
    } else if (getFileManager().exists(serviceFilePathIdentifier)) {
        throw new IllegalArgumentException(String.format("Endpoint '%s' already exists and cannot be created. Try to use a " + "different name on --endpoint parameter or use this command with '--force' " + "to overwrite the current service.", endpointService));
    }
    // Set destionation property name
    StringBuffer destinationNamePropertyName = new StringBuffer(JMS_PROPERTY_DESTINATION_NAME_PREFIX);
    destinationNamePropertyName.append(destinationName.replaceAll("/", "."));
    destinationNamePropertyName.append(JMS_PROPERTY_DESTINATION_NAME_SUFIX);
    // Set properties
    setProperties(destinationName, destinationNamePropertyName.toString(), jndiConnectionFactory, endpointService.getModule(), profile, force);
    // Create service
    createReceiverJmsService(endpointService, destinationNamePropertyName.toString());
    // Add jms dependecy in module
    getProjectOperations().addDependency(endpointService.getModule(), DEPENDENCY_JMS);
    // Add annotation @EnableJms to application class of the module
    Set<ClassOrInterfaceTypeDetails> applicationClasses = getTypeLocationService().findClassesOrInterfaceDetailsWithAnnotation(SpringJavaType.SPRING_BOOT_APPLICATION);
    for (ClassOrInterfaceTypeDetails applicationClass : applicationClasses) {
        if (applicationClass.getType().getModule().equals(endpointService.getModule())) {
            // Check if annotation exists
            boolean annotationNotExists = true;
            for (AnnotationMetadata annotation : applicationClass.getAnnotations()) {
                if (annotation.getAnnotationType().equals(SpringJavaType.ENABLE_JMS)) {
                    annotationNotExists = false;
                    break;
                }
            }
            if (annotationNotExists) {
                ClassOrInterfaceTypeDetailsBuilder builder = new ClassOrInterfaceTypeDetailsBuilder(applicationClass);
                builder.addAnnotation(new AnnotationMetadataBuilder(SpringJavaType.ENABLE_JMS));
                getTypeManagementService().createOrUpdateTypeOnDisk(builder.build());
            }
            break;
        }
    }
}
Also used : ClassOrInterfaceTypeDetailsBuilder(org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder) ClassOrInterfaceTypeDetails(org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails) AnnotationMetadata(org.springframework.roo.classpath.details.annotations.AnnotationMetadata) AnnotationMetadataBuilder(org.springframework.roo.classpath.details.annotations.AnnotationMetadataBuilder) Pom(org.springframework.roo.project.maven.Pom)

Example 53 with Pom

use of org.springframework.roo.project.maven.Pom in project spring-roo by spring-projects.

the class JmsOperationsImpl method addJmsSender.

@Override
public void addJmsSender(String destinationName, JavaType classSelected, String jndiConnectionFactory, String profile, boolean force) {
    // Check that module included in destionationName is an application module
    String module = "";
    String destination = "";
    if (getProjectOperations().isMultimoduleProject()) {
        Collection<String> moduleNames = getTypeLocationService().getModuleNames(ModuleFeatureName.APPLICATION);
        // if only have one module, select this, else check the parameter
        if (moduleNames.size() > 1) {
            // user select a module
            if (destinationName.contains(":")) {
                int charSeparation = destinationName.indexOf(":");
                if (charSeparation > 0 && destinationName.length() > charSeparation) {
                    module = destinationName.substring(0, charSeparation);
                    destination = destinationName.substring(charSeparation + 1, destinationName.length());
                    if (!moduleNames.contains(module)) {
                        // error, is necessary select an application module
                        throw new IllegalArgumentException(String.format("Module '%s' must be of application type. Select one in --destinationName parameter", module));
                    }
                } else {
                    // error, is necessary select an application module and destination
                    throw new IllegalArgumentException(String.format("--destinationName parameter must be composed by [application type module]:[destination] or focus module must be application type module and only write the destination name"));
                }
            } else {
                // module not selected, check if focus module is application type
                Pom focusedModule = getProjectOperations().getFocusedModule();
                if (getTypeLocationService().hasModuleFeature(focusedModule, ModuleFeatureName.APPLICATION)) {
                    module = focusedModule.getModuleName();
                    destination = destinationName;
                } else {
                    throw new IllegalArgumentException(String.format("--destinationName parameter must be composed by [application type module]:[destination] or focus module must be application type module and only write the destination name"));
                }
            }
        } else {
            if (moduleNames.isEmpty()) {
                // error, is necessary select an application module
                throw new IllegalArgumentException(String.format("Is necessary to have at least an application type module."));
            } else {
                module = moduleNames.iterator().next();
                destination = destinationName;
            }
        }
    } else {
        destination = destinationName;
    }
    // Add jms springlets dependecies
    getProjectOperations().addDependency(classSelected.getModule(), DEPENDENCY_SPRINGLETS_JMS);
    // Include springlets-boot-starter-mail in module
    getProjectOperations().addDependency(module, DEPENDENCY_SPRINGLETS_STARTER_JMS);
    // Include property version
    getProjectOperations().addProperty("", PROPERTY_SPRINGLETS_VERSION);
    // Add instance of springlets service to service defined by parameter
    // Add JavaMailSender to service
    final ClassOrInterfaceTypeDetails serviceTypeDetails = getTypeLocationService().getTypeDetails(classSelected);
    Validate.isTrue(serviceTypeDetails != null, "Cannot locate source for '%s'", classSelected.getFullyQualifiedTypeName());
    final String declaredByMetadataId = serviceTypeDetails.getDeclaredByMetadataId();
    final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(serviceTypeDetails);
    // Create service field
    cidBuilder.addField(new FieldMetadataBuilder(declaredByMetadataId, PRIVATE, Arrays.asList(new AnnotationMetadataBuilder(AUTOWIRED)), new JavaSymbolName("jmsSendingService"), SpringletsJavaType.SPRINGLETS_JMS_SENDING_SERVICE));
    // Set destionation property name
    StringBuffer destinationNamePropertyName = new StringBuffer(JMS_PROPERTY_DESTINATION_NAME_PREFIX);
    destinationNamePropertyName.append(destination.replaceAll("/", "."));
    destinationNamePropertyName.append(JMS_PROPERTY_DESTINATION_NAME_SUFIX);
    StringBuffer destionationNameVar = new StringBuffer(JMS_VAR_DESTINATION_NAME_PREFIX);
    if (destination.contains("/")) {
        // Delete char '/' and each word
        String[] destinationNameArray = destination.split("/");
        for (String destinationFragment : destinationNameArray) {
            destionationNameVar.append(StringUtils.capitalize(destinationFragment));
        }
    } else {
        destionationNameVar.append(StringUtils.capitalize(destination));
    }
    destionationNameVar.append(JMS_VAR_DESTINATION_NAME_SUFIX);
    // Adding @Value annotation
    AnnotationMetadataBuilder valueAnnotation = new AnnotationMetadataBuilder(SpringJavaType.VALUE);
    valueAnnotation.addStringAttribute("value", "${".concat(destinationNamePropertyName.toString()).concat("}"));
    // Add instance of destination name
    cidBuilder.addField(new FieldMetadataBuilder(declaredByMetadataId, PRIVATE, Arrays.asList(valueAnnotation), new JavaSymbolName(destionationNameVar.toString()), JavaType.STRING));
    // Write both, springlets service and destination instance
    getTypeManagementService().createOrUpdateTypeOnDisk(cidBuilder.build());
    // Set properties
    setProperties(destination, destinationNamePropertyName.toString(), jndiConnectionFactory, module, profile, force);
}
Also used : JavaSymbolName(org.springframework.roo.model.JavaSymbolName) ClassOrInterfaceTypeDetailsBuilder(org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder) ClassOrInterfaceTypeDetails(org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails) AnnotationMetadataBuilder(org.springframework.roo.classpath.details.annotations.AnnotationMetadataBuilder) Pom(org.springframework.roo.project.maven.Pom) FieldMetadataBuilder(org.springframework.roo.classpath.details.FieldMetadataBuilder)

Example 54 with Pom

use of org.springframework.roo.project.maven.Pom in project spring-roo by spring-projects.

the class RepositoryJpaCommands method repository.

@CliCommand(value = "repository jpa", help = "Generates new Spring Data repository for specified entity or for all entities in generated " + "project.")
public void repository(@CliOption(key = "all", mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "Indicates if developer wants to generate repositories for every entity of current " + "project. " + "This option is mandatory if `--entity` is not specified. Otherwise, using `--entity` " + "will cause the parameter `--all` won't be available. " + "Default if option present: `true`; default if option not present: `false`.") boolean all, @CliOption(key = "entity", mandatory = false, optionContext = PROJECT, help = "The domain entity this repository should manage. When working on a single module " + "project, simply specify the name of the entity. If you consider it necessary, you can " + "also specify the package. Ex.: `--class ~.domain.MyEntity` (where `~` is the base package). " + "When working with multiple modules, you should specify the name of the entity and the " + "module where it is. Ex.: `--class model:~.domain.MyEntity`. If the module is not specified, " + "it is assumed that the entity is in the module which has the focus. " + "Possible values are: any of the entities in the project. " + "This option is mandatory if `--all` is not specified. Otherwise, using `--all` " + "will cause the parameter `--entity` won't be available.") final JavaType domainType, @CliOption(key = "interface", mandatory = true, help = "The java Spring Data repository to generate. When working on a single module " + "project, simply specify the name of the class. If you consider it necessary, you can " + "also specify the package. Ex.: `--class ~.domain.MyClass` (where `~` is the base package). " + "When working with multiple modules, you should specify the name of the class and the " + "module where it is. Ex.: `--class model:~.domain.MyClass`. If the module is not specified, " + "it is assumed that the class is in the module which has the focus. " + "This option is mandatory if `--entity` has been already specified and the project is " + "multi-module. " + "This option is available only when `--entity` has been specified.") final JavaType interfaceType, @CliOption(key = "defaultReturnType", mandatory = false, help = "The default return type which this repository will have for all finders, including those" + "created by default. The default return type should be a Projection class associated to " + "the entity specified in `--entity` parameter. " + "Possible values are: any of the projections associated to the entity in `--entity` option. " + "This option is not available if domain entity specified in `--entity` parameter has no " + "associated Projections. " + "Default: the entity specified in the `entity` option.") JavaType defaultReturnType, @CliOption(key = "package", mandatory = false, help = "The package where repositories will be generated. In multi-module project you should " + "specify the module name before the package name. " + "Ex.: `--package model:org.springframework.roo` but, if module name is not present, " + "the Roo Shell focused module will be used. " + "This option is not available if `--all` option has not been specified. " + "Default value if not present: `~.repository` package, or 'repository:~.' if multi-module " + "project.") JavaPackage repositoriesPackage) {
    if (all) {
        // If user didn't specified some JavaPackage, use default repository package
        if (repositoriesPackage == null) {
            if (projectOperations.isMultimoduleProject()) {
                // Build default JavaPackage with module
                for (String moduleName : projectOperations.getModuleNames()) {
                    if (moduleName.equals("repository")) {
                        Pom module = projectOperations.getPomFromModuleName(moduleName);
                        repositoriesPackage = new JavaPackage(typeLocationService.getTopLevelPackageForModule(module), moduleName);
                        break;
                    }
                }
                // Check if repository found
                Validate.notNull(repositoriesPackage, "Couldn't find in project a default 'repository' " + "module. Please, use 'package' option to specify module and package.");
            } else {
                // Build default JavaPackage for single module
                repositoriesPackage = new JavaPackage(projectOperations.getFocusedTopLevelPackage().getFullyQualifiedPackageName().concat(".repository"), projectOperations.getFocusedModuleName());
            }
        }
        repositoryJpaOperations.generateAllRepositories(repositoriesPackage);
    } else {
        repositoryJpaOperations.addRepository(interfaceType, domainType, defaultReturnType, true);
    }
}
Also used : JavaPackage(org.springframework.roo.model.JavaPackage) Pom(org.springframework.roo.project.maven.Pom) CliCommand(org.springframework.roo.shell.CliCommand)

Example 55 with Pom

use of org.springframework.roo.project.maven.Pom in project spring-roo by spring-projects.

the class WsOperationsImpl method addWsClient.

@Override
public void addWsClient(String wsdlLocation, String endPoint, JavaType configClass, SoapBindingType bindingType, String serviceUrl, String profile) {
    Validate.notEmpty(wsdlLocation, "ERROR: Provide a valid wsdlLocation");
    Validate.notEmpty(endPoint, "ERROR: Provide a valid endPoint");
    Validate.notNull(configClass, "ERROR: Provide a valid configClass");
    // Check if the configClass is located in an application module
    if (!isLocatedInApplicationModule(configClass)) {
        LOGGER.log(Level.INFO, "ERROR: The provided config class is not located in an application module.");
        return;
    }
    // Getting module from the .wsdl file
    final Pom wsdlModule = getModuleFromWsdlLocation(wsdlLocation);
    final String wsdlModuleName = wsdlModule.getModuleName();
    // Getting the wsdlName without the module
    final String wsdlName = getWsdlNameWithoutModule(wsdlLocation);
    // Getting wsdl absolute path from the provided wsdlLocation
    final String wsdlPath = getWsdlAbsolutePathFromWsdlName(wsdlLocation);
    // Check if provided .wsdl exists
    Validate.isTrue(getFileManager().exists(wsdlPath), "ERROR: You must provide an existing .wsdl file.");
    // the configClass module and the .wsdl module
    if (wsdlModuleName != configClass.getModule()) {
        getProjectOperations().addDependency(configClass.getModule(), new Dependency(wsdlModule.getGroupId(), wsdlModule.getArtifactId(), null));
    }
    // Check if provided configClass exists or should be generated
    boolean isNewConfigClass = false;
    ClassOrInterfaceTypeDetails configClassDetails = getTypeLocationService().getTypeDetails(configClass);
    if (configClassDetails == null) {
        isNewConfigClass = true;
    }
    // If it have it, it should match with the provided one the provided one
    if (!isNewConfigClass) {
        MemberDetails configClassMemberDetails = getMemberDetailsScanner().getMemberDetails(getClass().getName(), configClassDetails);
        AnnotationMetadata configurationAnnotation = configClassMemberDetails.getAnnotation(SpringJavaType.CONFIGURATION);
        if (configurationAnnotation == null) {
            LOGGER.log(Level.INFO, "ERROR: The provided class is not annotated with @Configuration so is not possible to include Web Service client configuration on it." + "Specify other configuration class that contains @Configuration annotation or specify a not existing class to generate it.");
            return;
        }
        if (StringUtils.isNotEmpty(profile)) {
            AnnotationMetadata profileAnnotation = configClassMemberDetails.getAnnotation(SpringJavaType.PROFILE);
            if (profileAnnotation != null) {
                String profiles = (String) profileAnnotation.getAttribute("value").getValue();
                String[] definedProfiles = profiles.split(",");
                boolean profileExists = false;
                for (String definedProfile : definedProfiles) {
                    if (definedProfile.equals(profile)) {
                        profileExists = true;
                    }
                }
                if (!profileExists) {
                    LOGGER.log(Level.INFO, "ERROR: The provided configuration class doesn't work in the provided profile. " + "Use a different configuration class or use a different profile.");
                    return;
                }
            }
        }
    }
    // Obtain the service URL from the provided .wsdl file if empty
    if (StringUtils.isEmpty(serviceUrl)) {
        serviceUrl = getServiceUrlForEndpointFromWsdlFile(endPoint, wsdlPath);
        Validate.notEmpty(serviceUrl, "ERROR: It has not been possible to obtain the URL of the service from the provided .wsdl file. Indicate some serviceUrl using --serviceUrl parameter");
    }
    // Obtain the binding type from the provided .wsdl file if empty
    if (bindingType == null) {
        bindingType = getBindingTypeFromWsdlFile(wsdlPath);
        Validate.notNull(bindingType, "ERROR: It has not been possible to obtain the BindingType of the service from the provided .wsdl file. Indicate an specific BindingType using --binding parameter");
    }
    // Always is necessary to obtain the targetNameSpace from the provided .wsdl file
    String targetNameSpace = getTargetNameSpaceFromWsdlFile(wsdlPath);
    Validate.notEmpty(targetNameSpace, "ERROR: It has not been possible to obtain the targetNamespace of the service from the provided .wsdl file. Check if your .wsdl file has the correct format.");
    // Include necessary dependencies and plugins
    includeDependenciesAndPluginsForWsClient(wsdlName, wsdlModuleName);
    // Include the necessary properties using the provided profile
    getApplicationConfigService().addProperty(configClass.getModule(), "url/".concat(endPoint), serviceUrl, profile, true);
    // Generating the new configuration class if not exists
    // If provided class already exists, update it
    ClassOrInterfaceTypeDetailsBuilder cidBuilder = null;
    if (!isNewConfigClass) {
        // Obtain builder from the existing class
        cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(configClassDetails);
        // Check if already have @RooWsClients annotation
        AnnotationMetadataBuilder wsClientsAnnotation = cidBuilder.getDeclaredTypeAnnotation(RooJavaType.ROO_WS_CLIENTS);
        if (wsClientsAnnotation != null) {
            // Update the existing one
            AnnotationAttributeValue<?> existingEndPoints = wsClientsAnnotation.build().getAttribute("endpoints");
            List<?> values = (List<?>) existingEndPoints.getValue();
            if (values != null) {
                // Check if the provided endpoint exists yet in this config class
                Iterator<?> it = values.iterator();
                boolean alreadyManaged = false;
                while (it.hasNext()) {
                    NestedAnnotationAttributeValue existingEndPoint = (NestedAnnotationAttributeValue) it.next();
                    String existingEndpointName = (String) existingEndPoint.getValue().getAttribute("endpoint").getValue();
                    if (existingEndpointName.equals(endPoint)) {
                        alreadyManaged = true;
                    }
                }
                // If endpoint already exists, show an error indicating that this endpoint is already managed
                if (alreadyManaged) {
                    LOGGER.log(Level.INFO, "ERROR: The provided endpoint is already defined in the provided configuration class. " + "Specify some different configuration class.");
                    return;
                } else {
                    // Update existing annotation with the new endPoint
                    Iterator<?> iterator = values.iterator();
                    List<AnnotationAttributeValue<?>> endpoints = new ArrayList<AnnotationAttributeValue<?>>();
                    while (iterator.hasNext()) {
                        NestedAnnotationAttributeValue existingEndPoint = (NestedAnnotationAttributeValue) iterator.next();
                        String existingEndpointName = (String) existingEndPoint.getValue().getAttribute("endpoint").getValue();
                        String existingEndpointNameSpace = (String) existingEndPoint.getValue().getAttribute("targetNamespace").getValue();
                        EnumDetails existingType = (EnumDetails) existingEndPoint.getValue().getAttribute("binding").getValue();
                        // Create @RooWsClient annotation
                        NestedAnnotationAttributeValue existingEndpoint = new NestedAnnotationAttributeValue(new JavaSymbolName("value"), getWsClientAnnotation(existingEndpointName, existingEndpointNameSpace, existingType).build());
                        endpoints.add(existingEndpoint);
                    }
                    // Create @RooWsClient annotation
                    NestedAnnotationAttributeValue newEndpoint = new NestedAnnotationAttributeValue(new JavaSymbolName("value"), getWsClientAnnotation(endPoint, targetNameSpace, bindingType).build());
                    endpoints.add(newEndpoint);
                    ArrayAttributeValue<AnnotationAttributeValue<?>> newEndpoints = new ArrayAttributeValue<AnnotationAttributeValue<?>>(new JavaSymbolName("endpoints"), endpoints);
                    wsClientsAnnotation.addAttribute(newEndpoints);
                }
            }
        } else {
            // If not exists, add it with the new elements
            wsClientsAnnotation = new AnnotationMetadataBuilder(new JavaType(RooWsClients.class));
            // Create @RooWsClient annotation
            List<AnnotationAttributeValue<?>> endpoints = new ArrayList<AnnotationAttributeValue<?>>();
            NestedAnnotationAttributeValue newEndpoint = new NestedAnnotationAttributeValue(new JavaSymbolName("value"), getWsClientAnnotation(endPoint, targetNameSpace, bindingType).build());
            endpoints.add(newEndpoint);
            ArrayAttributeValue<AnnotationAttributeValue<?>> newEndpoints = new ArrayAttributeValue<AnnotationAttributeValue<?>>(new JavaSymbolName("endpoints"), endpoints);
            wsClientsAnnotation.addAttribute(newEndpoints);
            if (StringUtils.isNotEmpty(profile)) {
                wsClientsAnnotation.addStringAttribute("profile", profile);
            }
            // Include new @RooWsClients annotation
            cidBuilder.addAnnotation(wsClientsAnnotation);
        }
    } else {
        // Create new configuration class
        final String configClassIdentifier = getPathResolver().getCanonicalPath(configClass.getModule(), Path.SRC_MAIN_JAVA, configClass);
        final String mid = PhysicalTypeIdentifier.createIdentifier(configClass, getPathResolver().getPath(configClassIdentifier));
        cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(mid, Modifier.PUBLIC, configClass, PhysicalTypeCategory.CLASS);
        // Create new @RooWsClients annotation
        AnnotationMetadataBuilder wsClientsAnnotation = new AnnotationMetadataBuilder(new JavaType(RooWsClients.class));
        // Create @RooWsClient annotation
        List<AnnotationAttributeValue<?>> endpoints = new ArrayList<AnnotationAttributeValue<?>>();
        NestedAnnotationAttributeValue newEndpoint = new NestedAnnotationAttributeValue(new JavaSymbolName("value"), getWsClientAnnotation(endPoint, targetNameSpace, bindingType).build());
        endpoints.add(newEndpoint);
        ArrayAttributeValue<AnnotationAttributeValue<?>> newEndpoints = new ArrayAttributeValue<AnnotationAttributeValue<?>>(new JavaSymbolName("endpoints"), endpoints);
        wsClientsAnnotation.addAttribute(newEndpoints);
        if (StringUtils.isNotEmpty(profile)) {
            wsClientsAnnotation.addStringAttribute("profile", profile);
        }
        // Include new @RooWsClients annotation
        cidBuilder.addAnnotation(wsClientsAnnotation);
    }
    getTypeManagementService().createOrUpdateTypeOnDisk(cidBuilder.build());
    // Compile project to be able to generate necessary resources.
    // Is necessary to create new thread and wat for it.
    Thread generateSourcesThread = new Thread() {

        public void run() {
            try {
                Thread.sleep(1000);
                final StringBuilder sb = new StringBuilder();
                sb.append(LINE_SEPARATOR);
                sb.append(LINE_SEPARATOR);
                sb.append("##########################################################").append(LINE_SEPARATOR);
                sb.append("##########################################################").append(LINE_SEPARATOR);
                sb.append("################# Generating client sources ##############").append(LINE_SEPARATOR);
                sb.append("##########################################################").append(LINE_SEPARATOR);
                sb.append("##########################################################").append(LINE_SEPARATOR);
                sb.append("#").append(LINE_SEPARATOR);
                sb.append("# Please wait...").append(LINE_SEPARATOR);
                sb.append("# Don't execute any command until this operation finishes.").append(LINE_SEPARATOR);
                sb.append("#").append(LINE_SEPARATOR);
                sb.append(LINE_SEPARATOR);
                sb.append(LINE_SEPARATOR);
                LOGGER.log(Level.INFO, sb.toString());
                // Changing focus to the module where the .wsdl file is located
                getProjectOperations().setModule(wsdlModule);
                // executing mvn generate-sources command
                getMavenOperations().executeMvnCommand("generate-sources");
            } catch (InterruptedException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    };
    generateSourcesThread.start();
}
Also used : ArrayList(java.util.ArrayList) EnumDetails(org.springframework.roo.model.EnumDetails) AnnotationMetadata(org.springframework.roo.classpath.details.annotations.AnnotationMetadata) JavaSymbolName(org.springframework.roo.model.JavaSymbolName) ClassOrInterfaceTypeDetailsBuilder(org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder) List(java.util.List) ArrayList(java.util.ArrayList) NodeList(org.w3c.dom.NodeList) NestedAnnotationAttributeValue(org.springframework.roo.classpath.details.annotations.NestedAnnotationAttributeValue) ArrayAttributeValue(org.springframework.roo.classpath.details.annotations.ArrayAttributeValue) AnnotationAttributeValue(org.springframework.roo.classpath.details.annotations.AnnotationAttributeValue) NestedAnnotationAttributeValue(org.springframework.roo.classpath.details.annotations.NestedAnnotationAttributeValue) Dependency(org.springframework.roo.project.Dependency) IOException(java.io.IOException) Pom(org.springframework.roo.project.maven.Pom) RooWsClients(org.springframework.roo.addon.ws.annotations.RooWsClients) RooJavaType(org.springframework.roo.model.RooJavaType) SpringJavaType(org.springframework.roo.model.SpringJavaType) JpaJavaType(org.springframework.roo.model.JpaJavaType) JavaType(org.springframework.roo.model.JavaType) ClassOrInterfaceTypeDetails(org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails) MemberDetails(org.springframework.roo.classpath.scanner.MemberDetails) AnnotationMetadataBuilder(org.springframework.roo.classpath.details.annotations.AnnotationMetadataBuilder)

Aggregations

Pom (org.springframework.roo.project.maven.Pom)86 Element (org.w3c.dom.Element)19 JavaType (org.springframework.roo.model.JavaType)16 Document (org.w3c.dom.Document)16 Test (org.junit.Test)14 ArrayList (java.util.ArrayList)10 ClassOrInterfaceTypeDetails (org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails)9 ClassOrInterfaceTypeDetailsBuilder (org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder)9 AnnotationMetadataBuilder (org.springframework.roo.classpath.details.annotations.AnnotationMetadataBuilder)9 Dependency (org.springframework.roo.project.Dependency)9 RooJavaType (org.springframework.roo.model.RooJavaType)7 InvalidSyntaxException (org.osgi.framework.InvalidSyntaxException)5 ServiceReference (org.osgi.framework.ServiceReference)5 ControllerMVCResponseService (org.springframework.roo.addon.web.mvc.controller.addon.responses.ControllerMVCResponseService)5 JavaPackage (org.springframework.roo.model.JavaPackage)5 List (java.util.List)4 Plugin (org.springframework.roo.project.Plugin)4 Completion (org.springframework.roo.shell.Completion)4 HashMap (java.util.HashMap)3 DataOnDemandCreatorProvider (org.springframework.roo.addon.test.providers.DataOnDemandCreatorProvider)3