Skip to content

Commit

Permalink
Merge branch 'master' of /home/jcagarcia/projects/git/spring-roo
Browse files Browse the repository at this point in the history
Conflicts:
	README.adoc
  • Loading branch information
jcagarcia committed Feb 13, 2015
2 parents e3e3fcc + 9ebd4a3 commit 9b14bd6
Show file tree
Hide file tree
Showing 1,545 changed files with 185,860 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.settings
.classpath
.project
target
annotations/src/main/java/org
*/bin
*.ipr
*.iml
*.iws
.idea
*.aj
21 changes: 21 additions & 0 deletions LICENSE.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
======================================================================
LEGAL NOTICES
======================================================================

Roo is copyright (C) 2008-2011 SpringSource Inc. All Rights Reserved.

Roo is licensed under the Apache License, Version 2.0:

http://www.apache.org/licenses/LICENSE-2.0.html.

In connection with the annotations, we further note:

1. The annotations are source level retention only. As such there is
no requirement for the roo-annotations-*.jar file to be present
in your classpath at runtime. The annotations are not even
referred to in your compiled .class files.

2. Roo itself is a development time only tool. No Roo JARs whatsoever
are required by your project at runtime.

[end]
386 changes: 386 additions & 0 deletions README.adoc

Large diffs are not rendered by default.

67 changes: 67 additions & 0 deletions addon-backup/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.osgi.roo.bundle</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
<relativePath>../osgi-roo-bundle</relativePath>
</parent>
<artifactId>org.springframework.roo.addon.backup</artifactId>
<packaging>bundle</packaging>
<name>Spring Roo - Addon - Backup</name>
<description>Provides project backup facilities.</description>
<dependencies>
<!-- OSGi -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
</dependency>
<!-- Apache Felix -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
</dependency>
<!-- Roo -->
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.classpath</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.file.monitor</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.file.undo</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.metadata</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.model</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.process.manager</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.project</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.shell</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.support</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.springframework.roo.addon.backup;

import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.springframework.roo.shell.CliAvailabilityIndicator;
import org.springframework.roo.shell.CliCommand;
import org.springframework.roo.shell.CommandMarker;

/**
* Commands for the 'backup' add-on to be used by the ROO shell.
*
* @author Stefan Schmidt
* @since 1.0
*/
@Component
@Service
public class BackupCommands implements CommandMarker {

@Reference private BackupOperations backupOperations;

@CliCommand(value = "backup", help = "Backup your project to a zip file")
public String backup() {
return backupOperations.backup();
}

@CliAvailabilityIndicator("backup")
public boolean isBackupCommandAvailable() {
return backupOperations.isBackupPossible();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.springframework.roo.addon.backup;

/**
* Interface to {@link BackupOperationsImpl}.
*
* @author Ben Alex
* @since 1.0
*/
public interface BackupOperations {

String backup();

boolean isBackupPossible();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
package org.springframework.roo.addon.backup;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Logger;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.Validate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.springframework.roo.process.manager.FileManager;
import org.springframework.roo.process.manager.MutableFile;
import org.springframework.roo.project.Path;
import org.springframework.roo.project.ProjectOperations;
import org.springframework.roo.support.logging.HandlerUtils;
import org.springframework.roo.support.util.FileUtils;

/**
* Operations for the 'backup' add-on.
*
* @author Stefan Schmidt
* @author Ben Alex
* @author Alan Stewart
* @since 1.0
*/
@Component
@Service
public class BackupOperationsImpl implements BackupOperations {

private static final Logger LOGGER = HandlerUtils
.getLogger(BackupOperationsImpl.class);

@Reference private FileManager fileManager;
@Reference private ProjectOperations projectOperations;

public String backup() {
Validate.isTrue(isBackupPossible(), "Project metadata unavailable");

// For Windows, make a date format that can legally form part of a
// filename (ROO-277)
final String pattern = File.separatorChar == '\\' ? "yyyy-MM-dd_HH.mm.ss"
: "yyyy-MM-dd_HH:mm:ss";
final DateFormat df = new SimpleDateFormat(pattern);
final long start = System.nanoTime();

ZipOutputStream zos = null;
try {
final File projectDirectory = new File(projectOperations
.getPathResolver().getFocusedIdentifier(Path.ROOT, "."));
final MutableFile file = fileManager.createFile(FileUtils
.getCanonicalPath(new File(projectDirectory,
projectOperations.getFocusedProjectName() + "_"
+ df.format(new Date()) + ".zip")));
zos = new ZipOutputStream(file.getOutputStream());
zip(projectDirectory, projectDirectory, zos);
}
catch (final FileNotFoundException e) {
LOGGER.fine("Could not determine project directory");
}
catch (final IOException e) {
LOGGER.fine("Could not create backup archive");
}
finally {
IOUtils.closeQuietly(zos);
}

final long milliseconds = (System.nanoTime() - start) / 1000000;
return "Backup completed in " + milliseconds + " ms";
}

public boolean isBackupPossible() {
return projectOperations.isFocusedProjectAvailable();
}

private void zip(final File directory, final File base,
final ZipOutputStream zos) throws IOException {
final File[] files = directory.listFiles(new FilenameFilter() {
public boolean accept(final File dir, final String name) {
// Don't use this directory if it's "target" under base
if (dir.equals(base) && name.equals("target")) {
return false;
}

// Skip existing backup files
if (dir.equals(base) && name.endsWith(".zip")) {
return false;
}

// Skip files that start with "."
return !name.startsWith(".");
}
});

for (final File file : files) {
if (file.isDirectory()) {
if (file.listFiles().length == 0) {
final ZipEntry dirEntry = new ZipEntry(file.getPath()
.substring(base.getPath().length() + 1)
+ File.separatorChar);
zos.putNextEntry(dirEntry);
}
zip(file, base, zos);
}
else {
InputStream inputStream = null;
try {
final ZipEntry entry = new ZipEntry(file.getPath()
.substring(base.getPath().length() + 1));
zos.putNextEntry(entry);

inputStream = new FileInputStream(file);
IOUtils.write(IOUtils.toByteArray(inputStream), zos);
}
finally {
IOUtils.closeQuietly(inputStream);
}
}
}
}
}
79 changes: 79 additions & 0 deletions addon-cloud/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.osgi.roo.bundle</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
<relativePath>../osgi-roo-bundle</relativePath>
</parent>
<artifactId>org.springframework.roo.addon.cloud</artifactId>
<packaging>bundle</packaging>
<name>Spring Roo - Addon - Cloud</name>
<description>Provides some different Cloud Providers to deploy Spring Roo applications on cloud servers</description>
<dependencies>
<!-- OSGi -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
</dependency>
<!-- Apache Felix -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
</dependency>
<!-- Roo -->
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.addon.configurable</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.addon.jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.addon.plural</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.classpath</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.file.monitor</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.file.undo</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.metadata</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.model</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.process.manager</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.project</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.shell</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.support</artifactId>
</dependency>
</dependencies>
</project>
Loading

0 comments on commit 9b14bd6

Please sign in to comment.