diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 149242e9..00000000
--- a/.gitignore
+++ /dev/null
@@ -1,17 +0,0 @@
-/.classpath
-/.project
-.settings/
-.gradle
-build
-target/
-/log.roo
-
-/bin/
-/*.log
-
-/.idea
-/*.iml
-/*.ipr
-/*.iws
-out
-.gradletasknamecache
diff --git a/.springBeans b/.springBeans
deleted file mode 100644
index 7d843d92..00000000
--- a/.springBeans
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- 1
-
-
-
-
-
-
- src/test/resources/META-INF/spring/spring-shell-plugin.xml
-
-
-
-
diff --git a/README.asciidoc b/README.asciidoc
deleted file mode 100644
index 95e9eb3d..00000000
--- a/README.asciidoc
+++ /dev/null
@@ -1,88 +0,0 @@
-:currentReleaseVersion: 1.1.0.RELEASE
-:currentSnapshotVersion: 1.2.0.BUILD-SNAPSHOT
-
-Spring Shell is an shell skeleton that can be easily extended with commands using a Spring based programming model. Spring Shell eases the creation of interactive console applications, featuring ANSI coloring, TAB completion, history browsing, _etc._
-
-To witness possibilities of Spring Shell, have a look at the http://docs.spring.io/spring-xd/docs/current-SNAPSHOT/reference/html/#interactive-shell[Spring XD Shell].
-
-The latest release version is {currentReleaseVersion}, while the development version is {currentSnapshotVersion}.
-
-# Useful links
-
-* http://static.springsource.org/spring-shell/docs/current/reference/[User documentation]
-* https://jira.spring.io/browse/SHL[Issue Tracker]
-
-# Artifacts
-
-[filter=source,language=xml,subs="attributes,specialcharacters"]
-----
-
-
-
- spring-release
- Spring Maven RELEASE Repository
- http://repo.springframework.org/release
-
-
-
-
- libs-release
- Spring Maven libs-release Repository
- http://repo.springframework.org/libs-release
-
-
-
- org.springframework.shell
- spring-shell
- {currentReleaseVersion}
-
-
-
-
-
- spring-snapshot
- Spring Maven SNAPSHOT Repository
- http://repo.springframework.org/libs-snapshot
-
-
-
- org.springframework.shell
- spring-shell
- {currentSnapshotVersion}
-
-----
-
-
-* Gradle:
-
-[subs="attributes,specialcharacters"]
-----
-repositories {
- maven { url "http://repo.springsource.org/lib-release" }
-}
-
-dependencies {
- compile "org.springframework.shell:spring-shell:{currentReleaseVersion}"
-}
-----
-
-# Building
-Spring Shell is built with Gradle. To build Spring Shell, run
-
- ./gradlew
-
-# Running Example
-
- cd samples/helloworld
- ./gradlew installApp
- cd build/install/helloworld/bin
- helloworld
-
-
-# Contributing
-
-Here are some ways for you to get involved in the community:
-
-* Get involved with the Spring community on Stack Overflow. Please help out on the http://stackoverflow.com/questions/tagged/spring-shell[dedicated SO tag] by responding to questions and joining the debate.
-* Create https://jira.spring.io/browse/SHL[JIRA] tickets for bugs and new features and comment and vote on the ones that you are interested in.
-Github is for social coding: if you want to write code, we encourage contributions through pull requests from http://help.github.com/forking/[forks of this repository]. If you want to contribute code this way, please reference a JIRA tracker ticket covering the specific issue you are addressing. Before we accept a non-trivial patch or pull request we will need you to sign the https://support.springsource.com/spring_committer_signup[contributor's agreement]. Signing the contributor's agreement does not grant anyone commit rights to the main repository, but it does mean that we can accept your contributions, and you will get an author credit if we do. Active contributors might be asked to join the core team, and given the ability to merge pull requests.
diff --git a/build.gradle b/build.gradle
deleted file mode 100644
index a2888a36..00000000
--- a/build.gradle
+++ /dev/null
@@ -1,220 +0,0 @@
-buildscript {
- repositories {
- maven { url 'http://repo.springsource.org/plugins-release' }
- }
- dependencies {
- classpath 'io.spring.gradle:docbook-reference-plugin:0.3.1'
- classpath 'org.springframework.build.gradle:spring-io-plugin:0.0.3.RELEASE'
- }
-}
-
-description = 'Spring Shell'
-group = 'org.springframework.shell'
-
-repositories {
- mavenCentral()
- maven { url "http://repo.springsource.org/libs-snapshot" }
- maven { url "http://repo.springsource.org/plugins-release" }
-}
-
-apply plugin: "java"
-apply plugin: 'eclipse'
-apply plugin: 'idea'
-apply from: "$rootDir/maven.gradle"
-apply plugin: 'docbook-reference'
-apply plugin: 'application'
-
-if (project.hasProperty('platformVersion')) {
- apply plugin: 'spring-io'
-
- repositories {
- maven { url "https://repo.spring.io/libs-snapshot" }
- }
-
- dependencies {
- springIoVersions "io.spring.platform:platform-versions:${platformVersion}@properties"
- }
-}
-
-[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:-serial", "-Xlint:unchecked", "-Xlint:rawtypes"]
-
-[compileJava, compileTestJava]*.options*.encoding = "UTF-8"
-
-dependencies {
- compile "org.springframework:spring-core:$springVersion"
- compile "org.springframework:spring-context-support:$springVersion"
- compile "commons-io:commons-io:$commonsioVersion"
- compile "jline:jline:$jlineVersion"
-
-
- // Testing
- testCompile "junit:junit:$junitVersion"
- testCompile "org.mockito:mockito-core:$mockitoVersion"
- testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
-}
-
-sourceCompatibility = 1.6
-targetCompatibility = 1.6
-
-javadoc {
- ext.srcDir = file("${projectDir}/docs/src/api")
- destinationDir = file("${buildDir}/api")
- ext.tmpDir = file("${buildDir}/api-work")
-
- configure(options) {
- encoding = "UTF-8"
- stylesheetFile = file("${srcDir}/spring-javadoc.css")
- overview = "${srcDir}/overview.html"
- docFilesSubDirs = true
- outputLevel = org.gradle.external.javadoc.JavadocOutputLevel.QUIET
- breakIterator = true
- showFromProtected()
- groups = [
- 'Spring Shell' : ['org.springframework.shell*'],
- ]
-
- links = [
- "http://static.springframework.org/spring/docs/3.1.x/javadoc-api",
- "http://download.oracle.com/javase/6/docs/api",
- ]
-
- //exclude "org/springframework/data/redis/config/**"
- if (JavaVersion.current().isJava8Compatible()) {
- options.addStringOption('Xdoclint:none', '-quiet')
- }
- }
-
- title = "${rootProject.description} ${version} API"
-}
-
-
-jar {
- manifest.attributes['Implementation-Title'] = 'spring-shell'
- manifest.attributes['Implementation-Version'] = project.version
-
- from("$rootDir/docs/src/info") {
- include "license.txt"
- include "notice.txt"
- into "META-INF"
- expand(copyright: new Date().format('yyyy'), version: project.version)
- }
-}
-
-task sourcesJar(type: Jar, dependsOn:classes) {
- classifier = 'sources'
- from sourceSets.main.allJava
-}
-
-task javadocJar(type: Jar) {
- classifier = 'javadoc'
- from javadoc
-}
-
-reference {
- sourceDir = file('docs/src/reference/docbook')
-}
-
-
-task docsZip(type: Zip) {
- group = 'Distribution'
- classifier = 'docs'
- description = "Builds -${classifier} archive containing api and reference for deployment"
-
- from('docs/src/info') {
- include 'changelog.txt'
- }
-
- from (javadoc) {
- into 'api'
- }
-
- from (reference) {
- into 'reference'
- }
-}
-
-task schemaZip(type: Zip) {
- group = 'Distribution'
- classifier = 'schema'
- description = "Builds -${classifier} archive containing all XSDs for deployment"
-
- def Properties schemas = new Properties();
-
- sourceSets.main.resources.find {
- it.path.endsWith('META-INF' + File.separator + 'spring.schemas')
- }?.withInputStream { schemas.load(it) }
-
- ext.paths = [] as Set
-
- for (def key : schemas.keySet()) {
- def shortName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1')
- assert shortName != key
- File xsdFile = sourceSets.main.resources.find {
- it.path.replace('\\', '/').endsWith(schemas.get(key))
- }
- assert xsdFile != null
- def input = xsdFile.path
-
- if (!paths.contains(input)) {
- paths.add(input)
- into (shortName) {
- from input
- }
- }
- }
-}
-
-task distroZip(type: Zip, dependsOn: [jar, docsZip, sourcesJar, javadocJar]) {
- group = 'Distribution'
- classifier = 'dist'
- description = "Builds -${classifier} archive, containing all jars and docs, " +
- "suitable for community download page."
-
- ext.zipRootDir = "${project.name}-${project.version}"
-
- into (zipRootDir) {
- from('docs/src/info') {
- include 'readme.txt'
- include 'license.txt'
- include 'notice.txt'
- expand(copyright: new Date().format('yyyy'), version: project.version)
- }
-
- from('samples/') {
- into 'samples'
- exclude '.gradle/'
- exclude 'build/'
- }
-
- from(zipTree(docsZip.archivePath)) {
- into "docs"
- }
-
-// from(zipTree(schemaZip.archivePath)) {
-// into "schema"
-// }
- into ("dist") {
- from rootProject.collect { project -> project.libsDir }
- }
- }
-}
-
-artifacts {
- archives sourcesJar
- archives javadocJar
-
- archives docsZip
-// archives schemaZip
- archives distroZip
-}
-
-task wrapper(type: Wrapper) {
- description = 'Generates gradlew[.bat] scripts'
- gradleVersion = '2.10'
-}
-
-
-mainClassName = "org.springframework.shell.Bootstrap"
-
-assemble.dependsOn = ['jar', 'sourcesJar']
-defaultTasks 'build'
diff --git a/docs/src/api/doc-files/th-background.png b/docs/src/api/doc-files/th-background.png
deleted file mode 100644
index 72d65e77..00000000
Binary files a/docs/src/api/doc-files/th-background.png and /dev/null differ
diff --git a/docs/src/api/overview.html b/docs/src/api/overview.html
deleted file mode 100644
index 6bf9f535..00000000
--- a/docs/src/api/overview.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-This document is the API specification for the Spring Shell project.
-
-
-
-
-
- If you are interested in commercial training, consultancy and
- support for the Spring Shell project,
- SpringSource provides
- such commercial support.
-
-
-
-
\ No newline at end of file
diff --git a/docs/src/api/spring-javadoc.css b/docs/src/api/spring-javadoc.css
deleted file mode 100644
index 1f009c4b..00000000
--- a/docs/src/api/spring-javadoc.css
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Spring-specific Javadoc style sheet rules */
-
-#overviewBody {
-
-}
-
-.code {
- border: 1px solid black;
- background-color: #F4F4F4;
- padding: 5px;
-}
-
-/* Vanilla Javadoc style sheet rules */
-
-body {
- font-family: Helvetica, Arial, sans-serif;
- background-color: white;
- font-size: 10pt;
-}
-
-td { font-size: 10pt; font-family: Helvetica, Arial, sans-serif }/* Javadoc style sheet */
-
-/* Define colors, fonts and other style attributes here to override the defaults */
-
-/* Page background color */
-body { background-color: #FFFFFF }
-
-/* Headings */
-h1 { font-size: 145% }
-
-/* Table colors */
-.TableHeadingColor { background: #CCCCFF } /* Dark mauve */
-.TableSubHeadingColor { background: #EEEEFF } /* Light mauve */
-.TableRowColor { background: #FFFFFF } /* White */
-
-/* Font used in left-hand frame lists */
-.FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif }
-.FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif }
-.FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif }
-
-/* Navigation bar fonts and colors */
-.NavBarCell1 { background-color:#EEEEFF;} /* Light mauve */
-.NavBarCell1Rev { background-color:#00008B;} /* Dark Blue */
-.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;}
-.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;}
-
-.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
-.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
diff --git a/docs/src/info/changelog.txt b/docs/src/info/changelog.txt
deleted file mode 100644
index a05d0bed..00000000
--- a/docs/src/info/changelog.txt
+++ /dev/null
@@ -1,175 +0,0 @@
-SPRING SHELL CHANGELOG
-======================
-http://www.springsource.org/spring-shell
-
-Commit changelog: http://github.com/SpringSource/spring-shell/tree/[version]
-Issues changelog: http://jira.springsource.org/secure/ReleaseNote.jspa?projectId=10361
-
-Changes in version 1.1.0 RELEASE (2014-7-25)
--------------------------------------
-
-No changes
-
-Changes in version 1.1 RC4 (2014-7-8)
--------------------------------------
-** Bug
-* [SHL-138] - Support unquoted doublequotes inside singles, and vice versa
-* [SHL-140] - Fix completions for the "help" builtin command
-* [SHL-153] - Date command should assume user localization.
-
-** Improvement
-* [SHL-136] - Shell should indicate error location with a caret when possible
-* [SHL-155] - Expose number of times the TAB key has been hit in completion
-
-** Task
-* [SHL-154] - Update DateCommand test
-
-
-Changes in version 1.1 RC3 (2014-5-16)
---------------------------------------
-** Bug
-* [SHL-140] - Fix completions for the "help" builtin command
-
-** Improvement
-* [SHL-134] - Grab the entire input line as parameter to CliCommand
-* [SHL-139] - Add support for common escapes
-* [SHL-143] - Upgrade to gradle 1.11
-* [SHL-149] - Upgrad to Spring Framework 4
-
-Changes in version 1.1 RC2 (2014-4-15)
---------------------------------------
-** Bug
-* [SHL-133] - Shell command "! ls /tmp" fails
-* [SHL-135] - Key-less option corner case
-
-Changes in version 1.1 RC1 (2014-4-2)
--------------------------------------
-
-** Bug
-* [SHL-84] - Shell cannot deal with "-" in CliOption keys
-* [SHL-85] - Argument completion broken when default value present
-* [SHL-107] - Prompt not re-evaluated if the user input is just an "enter" command.
-* [SHL-116] - Support quotes escaping
-* [SHL-119] - Remove unused bright color constants
-* [SHL-120] - Add @Inherited and @Documented to the annotations
-* [SHL-122] - --key --foo thinks "--foo" is a value, even if --key has a default
-
-** Improvement
-* [SHL-74] - Switch JLine dependency to an official JLine version
-* [SHL-80] - ability to disable built-in commands
-* [SHL-91] - Applications built with spring-shell are required to inherit comment commands
-* [SHL-125] - Some documentation fixes
-
-** New Feature
-* [SHL-126] - Add utility classes for rendering ascii based tables
-
-** Task
-* [SHL-118] - Rename JLineCompletorAdapter to ParserCompleter
-* [SHL-128] - Change version of spring shell in hello world application to 1.1 RC1
-* [SHL-130] - Release 1.1 RC1
-
-Release Notes - Spring Shell - Version 1.1 M1
-
-
-Changes in version 1.1 M1 (2013-7-26)
--------------------------------------
-
-** Bug
-* [SHL-47] - Invesitgate if SimpleFileConverter should be used or incorporated in FileConverter
-* [SHL-72] - DefaultBannerProvider welcome message mentions non-existent 'hint' command
-* [SHL-87] - sample app not working anymore
-* [SHL-114] - After initial creation, the plugin's ApplicationContext is refreshed one time too often
-
-
-
-** Improvement
-* [SHL-68] - Make help for built-in commands consistent
-* [SHL-69] - Extract "version" command from AbstractShell
-* [SHL-70] - Add a command to clear the console
-* [SHL-71] - Reference docs do not mention PluginProvider interface
-* [SHL-73] - Typo in reference docs: CliOptions iso CliOption
-* [SHL-75] - Change repository used to pull in custom jline dependency in sample application
-* [SHL-77] - Update the build to use later versions of JUnit and SLF4J
-* [SHL-78] - Add an if check in JLineShellComponent's stop method.
-* [SHL-79] - Update gradle wrapper to 1.2
-* [SHL-82] - Improve detection of apple terminal
-* [SHL-86] - Change bootstrapping procedure so JLineShellComponent can resolve its own dependencies.
-* [SHL-92] - Decoupled commands 'date' and 'system properties' from AbstractShell
-* [SHL-93] - Decouple script command from AbstractShell
-* [SHL-100] - Rename PluginProvider to NamedProvider and name() method to getProviderName()
-* [SHL-101] - Add top level ShellException
-* [SHL-102] - Remove parent/child context hierarchy
-* [SHL-104] - Remove compiler warnings
-* [SHL-105] - Add option to run helloworld example as a gradle run task
-
-** New Feature
-* [SHL-66] - Plugins should have access to command line options
-* [SHL-103] - Create simple way to test the execution of shell commands
-
-
-Changes in version 1.0 RELEASE (2012-10-02)
--------------------------------------------
-
-** Bug
-* [SHL-62] - customized prompt doesn't works
-
-
-
-** Improvement
-* [SHL-63] - sample moved from Maven to Gradle
-* [SHL-111] - Change prompt during running application
-
-
-Changes in version 1.0 RC1 (2012-09-20)
----------------------------------------
-
-** Bug
-* [SHL-14] - History from previous session is not loaded into JLine history buffer
-* [SHL-48] - Remove duplicated classes from Spring Framework and old Roo code base in util package
-* [SHL-52] - Missing Maven dependency JLine
-* [SHL-60] - Jansi terminal support not working under cygwin
-* [SHL-61] - Remove unused Hint classes
-
-** Improvement
-* [SHL-53] - Documentation Corrections
-* [SHL-54] - Dynamic prompt
-* [SHL-57] - Miscellaneous documentation cleanup
-
-** New Feature
-* [SHL-55] - ascii art/text should be loaded from a file
-* [SHL-56] - SHL contains a lot of duplicated classes from Spring
-
-** Task
-* [SHL-51] - Correct Maven groupId
-
-
-Changes in version 1.0 M1 (2012-07-18)
---------------------------------------
-
-* Moved Spring Roo code into Spring Shell, removing OSGi dependency
-
-** New Feature
-* [SHL-12] - Allow shell comnand prompt text to be customized by plugins
-* [SHL-13] - Allow name of history file to be customized by plugins
-* [SHL-40] - Provide an interception mechanism for the command class to intercept invocation of command methods
-
-** Improvement
-* [SHL-24] - Should not ignore the optional parameter if no parameter value is set in the command
-* [SHL-31] - Move providers & ApplicationContext to JLineShellComponent from JLineShell.
-* [SHL-32] - Sub-classes of AbstractShell should be able to handle results of execution as required.
-* [SHL-39] - Remove NAPA specific environment option, replace with Spring 3.1 profile support
-* [SHL-41] - Improve error handling for command line options when staring shell
-
-** Bug
-* [SHL-6] - Spring Shell does not support "help"
-* [SHL-19] - When running spring shell in the script mode, the output shout not include the Spring Shell interative information
-* [SHL-35] - Improve the parsing command line options to gracefully handle invalid values.
-
-** Task
-* [SHL-1] - Change build system to use gradle
-* [SHL-4] - Adding a constructor in JlineShell to provide ConsoleReader.
-* [SHL-9] - Create Bamboo build project on CI farm
-* [SHL-10] - Publish CI builds to springsource maven snapshot repository
-* [SHL-23] - Create docbook based reference guide
-* [SHL-25] - Enable unit test on CI build
-* [SHL-50] - Add sample application
diff --git a/docs/src/info/license.txt b/docs/src/info/license.txt
deleted file mode 100644
index 261eeb9e..00000000
--- a/docs/src/info/license.txt
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/docs/src/info/notice.txt b/docs/src/info/notice.txt
deleted file mode 100644
index e3343e92..00000000
--- a/docs/src/info/notice.txt
+++ /dev/null
@@ -1,22 +0,0 @@
- ======================================================================
- == NOTICE file corresponding to section 4 d of the Apache License, ==
- == Version 2.0, for the Spring Framework distribution. ==
- ======================================================================
-
- This product includes software developed by
- the Apache Software Foundation (http://www.apache.org).
-
- The end-user documentation included with a redistribution, if any,
- must include the following acknowledgement:
-
- "This product includes software developed by the Spring Framework
- Project (http://www.springframework.org)."
-
- Alternately, this acknowledgement may appear in the software itself,
- if and wherever such third-party acknowledgements normally appear.
-
- The names "Spring", "Spring Framework", and "Spring Shell" must
- not be used to endorse or promote products derived from this
- software without prior written permission. For written permission,
- please contact enquiries@springsource.com.
-
diff --git a/docs/src/info/readme.txt b/docs/src/info/readme.txt
deleted file mode 100644
index db1f498e..00000000
--- a/docs/src/info/readme.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-SPRING SHELL
-------------
-https://github.com/spring-projects/spring-shell
-
-1. INTRODUCTION
-
-Spring Shell is an interactive shell that can be easily extended with commands using a Spring based programming model.
-
-2. RELEASE NOTES
-
-This release comes with complete reference documentation. For further
-details, consult the provided javadoc for specific packages and classes.
-
-3. DISTRIBUTION JAR FILES
-
-The Spring Shell jar files can be found in the 'dist' directory.
-
-4. GETTING STARTED
-
-Please see the reference documentation.
-Additionally, consult the blog at https://spring.io/blog as well
-as sections of interest in the reference documentation.
-
-5. ADDITIONAL RESOURCES
-
-Spring Shell homepage: http://www.springsource.org/spring-shell
diff --git a/docs/src/reference/docbook/images/logo.png b/docs/src/reference/docbook/images/logo.png
deleted file mode 100644
index a9f6d959..00000000
Binary files a/docs/src/reference/docbook/images/logo.png and /dev/null differ
diff --git a/docs/src/reference/docbook/images/shell-arch-overview.png b/docs/src/reference/docbook/images/shell-arch-overview.png
deleted file mode 100644
index 5b7f791e..00000000
Binary files a/docs/src/reference/docbook/images/shell-arch-overview.png and /dev/null differ
diff --git a/docs/src/reference/docbook/images/shell-example-enum.jpg b/docs/src/reference/docbook/images/shell-example-enum.jpg
deleted file mode 100644
index a12af2d4..00000000
Binary files a/docs/src/reference/docbook/images/shell-example-enum.jpg and /dev/null differ
diff --git a/docs/src/reference/docbook/images/shell-example.jpg b/docs/src/reference/docbook/images/shell-example.jpg
deleted file mode 100644
index 4148897c..00000000
Binary files a/docs/src/reference/docbook/images/shell-example.jpg and /dev/null differ
diff --git a/docs/src/reference/docbook/index.xml b/docs/src/reference/docbook/index.xml
deleted file mode 100644
index ae9352ba..00000000
--- a/docs/src/reference/docbook/index.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-
-
- Spring Shell Documentation
- Spring Shell ${version}
- ${version}
- Spring Shell
-
-
-
- Mark
- Pollack
- SpringSource
-
-
- Costin
- Leau
- SpringSource
-
-
- Jarred
- Li
- VMware
-
-
-
-
-
- Copies of this document may be made for your own use and for distribution
- to others, provided that you do not charge any fee for such copies and
- further provided that each copy contains this Copyright Notice, whether
- distributed in print or electronically.
-
-
-
-
-
-
-
-
-
- Introduction
-
-
-
-
-
- Reference Documentation
-
-
-
-
-
- Developing Spring Shell Applications
-
-
-
-
-
- Spring Shell Sample application
-
-
-
-
-
\ No newline at end of file
diff --git a/docs/src/reference/docbook/introduction/introduction.xml b/docs/src/reference/docbook/introduction/introduction.xml
deleted file mode 100644
index f794e8aa..00000000
--- a/docs/src/reference/docbook/introduction/introduction.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- The Spring Shell provides an interactive shell that lets you
- contribute commands using a simple Spring based programming model.
-
- This document is the reference guide for the Spring Shell and covers
- the key classes that are part of the Shell infrastructure, the plugin model,
- how to create commands for the shell as well as discussion of the sample
- application.
-
diff --git a/docs/src/reference/docbook/introduction/requirements.xml b/docs/src/reference/docbook/introduction/requirements.xml
deleted file mode 100644
index 9cf5c3d7..00000000
--- a/docs/src/reference/docbook/introduction/requirements.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- Requirements
-
- The Spring Shell requires JDK level 6.0 and above as well as the
- Spring Framework 3.0
- (3.1 recommended) and above.
-
diff --git a/docs/src/reference/docbook/preface.xml b/docs/src/reference/docbook/preface.xml
deleted file mode 100644
index d9bc1b89..00000000
--- a/docs/src/reference/docbook/preface.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
- Preface
-
- The Spring Shell provides an interactive shell that allows you to
- plugin your own custom commands using a Spring based programming
- model.
-
- The shell has been extracted from the Spring Roo
- project, giving it a strong foundation and rich feature set. One
- significant change from Spring Roo is that the plugin model is no longer
- based on OSGi but instead uses the Spring IoC container to discover commands
- through classpath scanning. There is currently no classloader isolation
- between plugins, however that maybe added in future versions.
-
- Spring Shell's features include
-
-
-
- A simple, annotation driven, programming model to contribute
- custom commands
-
-
-
- Use of Spring's classpath scanning functionality as the basis for
- a command plugin strategy and command development
-
-
-
- Inheritance of the Roo
- Shell features, most notably tab completion, colorization, and
- script execution.
-
-
-
- Customization of command prompt, banner, shell history file
- name.
-
-
-
- This document assumes that the reader already has a basic familiarity
- with the Spring Framework.
-
- While every effort has been made to ensure that this documentation is
- comprehensive and there are no errors, nevertheless some topics might
- require more explanation and some typos might have crept in. If you do spot
- any mistakes or even more serious errors and you can spare a few cycles
- during lunch, please do bring the error to the attention of the Spring Shell
- team by raising an
- issue.
-
diff --git a/docs/src/reference/docbook/reference/dev-guide/dev-spring-shell.xml b/docs/src/reference/docbook/reference/dev-guide/dev-spring-shell.xml
deleted file mode 100644
index 8fee889b..00000000
--- a/docs/src/reference/docbook/reference/dev-guide/dev-spring-shell.xml
+++ /dev/null
@@ -1,225 +0,0 @@
-
-
- Developing Spring Shell Applications
-
- Contributing commands to the shell is very easy. There are only a few
- annotations you need to learn. The implementation style of the command is
- the same as developing classes for an application that uses dependency
- injection. You can leverage all the features of the Spring container to
- implement your command classes.
-
-
- Marker Interface
-
- The first step to creating a command is to implement the marker
- interface CommandMarker and to annotate
- your class with Spring's @Component annotation.
- (Note there is an open JIRA issue to provide a
- @CliCommand meta-annotation to avoid having to use
- a marker interface). Using the code from the helloworld sample
- application, the code of a HelloWorldCommands class
- is shown below:
-
- @Component
-public class HelloWorldCommands implements CommandMarker {
-
- // use any Spring annotations for Dependency Injection or other Spring interfaces
- // as required.
-
- // methods with @Cli annotations go here
-
-}
-
-
-
- Logging
-
- Logging is currently done using JDK logging. Due to the intricacies
- of console, JLine and Ansi handling, it is generally advised to display
- messages as return values to the method commands. However, when logging is
- required, the typical JDK logger declaration should suffice.
-
- @Component
-public class HelloWorldCommands implements CommandMarker {
-
- protected final Logger LOG = Logger.getLogger(getClass().getName());
-
- // methods with @Cli annotations go here
-
-}
-
-
- Note: it is the responsibility of the packager/developer to handle logging for third-party libraries. Typically one wants to reduce the logging level so the console/shell does not get affected by logging messages.
-
-
-
-
- CLI Annotations
-
- There are three annotations used on methods and method arguments
- that define the main contract for interacting with the shell. These
- are:
-
-
-
- CliAvailabilityIndicator - Placed on a
- method that returns a boolean value and indicates if a particular
- command can be presented in the shell. This decision is usually based
- on the history of commands that have been executed previously. It
- prevents extraneous commands being presented until some preconditions
- are met, for example the execution of a 'configuration'
- command.
-
-
-
- CliCommand - Placed on a method that
- provides a command to the shell. Its value provides one or more
- strings that serve as the start of a particular command name. These
- must be unique within the entire application, across all
- plugins.
-
-
-
- CliOption - Placed on the arguments of a
- command method, allowing it to declare the argument value as mandatory
- or optional with a default value.
-
-
-
- Here is a simple use of these annotations in a command class
-
- @Component
-public class HelloWorldCommands implements CommandMarker {
-
- @CliAvailabilityIndicator({"hw simple"})
- public boolean isCommandAvailable() {
- return true;
- }
-
- @CliCommand(value = "hw simple", help = "Print a simple hello world message")
- public String simple(
- @CliOption(key = { "message" }, mandatory = true, help = "The hello world message")
- final String message,
-
- @CliOption(key = { "location" }, mandatory = false,
- help = "Where you are saying hello", specifiedDefaultValue="At work")
- final String location) {
-
- return "Message = [" + message + "] Location = [" + location + "]";
-
- }
-}
-
- The method annotated with @CliAvailabilityIndicator
- is returning true so that the one and only command in this
- class is exposed to the shell to be invoked. If there were more commands
- in the class, you would list them as comma separated value.
-
- The @CliCommand annotation is creating the
- command 'hw simple' in the shell. The help message is
- what will be printed if you use the build in help
- command. The method name is 'simple' but it could
- just have been any other name.
-
- The @CliOption annotation on each of the
- command arguments is where you will spend most of your time authoring
- commands. You need to decide which arguments are required, which are
- optional, and if they are optional is there a default value. In this case
- there are two arguments or options to the command: message and location.
- The message option is required and a help message is provided to give
- guidance to the user when tabbing to get completion for the
- command.
-
- The implementation of the 'simple' method
- is trivial, just a log statement, but this is where you would typically
- call other collaborating objects that were injected into the class via
- Spring.
-
- The method argument types in this example are
- String, which doesn't present any issue with type
- conversion. You can specify methods with any rich object type as well as
- basic primitive types such as int, float etc. For all types other than
- those handled by the shell by default (basic types,
- Date, File) you will need to
- register your own implementation of the
- org.springframework.shell.core.Converter
- interface with the container in your plugin.
-
- Note that the method return argument can be non-void - in our
- example, it is the actual message we want to display. Whenever an object
- is returned, the shell will display its toString()
- representation.
-
-
-
- Testing shell commands
-
- To perform a test of the shell commands you can instantiate the shell inside a test case,
- execute the command and then perform assertions on the return value CommandResult.
- A simple base class to set this up is shown below.
- public abstract class AbstractShellIntegrationTest {
-
- private static JLineShellComponent shell;
-
- @BeforeClass
- public static void startUp() throws InterruptedException {
- Bootstrap bootstrap = new Bootstrap();
- shell = bootstrap.getJLineShellComponent();
- }
-
- @AfterClass
- public static void shutdown() {
- shell.stop();
- }
-
- public static JLineShellComponent getShell() {
- return shell;
- }
-
-}
- Here is an example testing the Date command
- public class BuiltInCommandTests extends AbstractShellIntegrationTest {
-
- @Test
- public void dateTest() throws ParseException {
-
- //Execute command
- CommandResult cr = getShell().executeCommand("date");
-
- //Get result
- DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL,Locale.US);
- Date result = df.parse(cr.getResult().toString());
-
- //Make assertions - DateMaters is an external dependency not shown here.
- Date now = new Date();
- MatcherAssert.assertThat(now, DateMatchers.within(5, TimeUnit.SECONDS, result));
- }
-}
- The java.lang.Class of CommandResult's getResult method will match that of the return value of
- the method annotated with @CliCommand. You should cast to the appropriate type to help perform your assertions.
-
-
-
- Building and running the shell
-
- In our opinion, the easiest way to build and execute the shell is to
- cut-n-paste the gradle script in the example application. This uses the
- application plugin from gradle to create a bin directory with a startup
- script for windows and Unix and places all dependent jars in a lib
- directory. Maven has a similar plugin - the AppAssembler
- plugin.
-
- The main class of the shell is
- org.springframework.shell.Bootstrap. As long as you
- place other plugins, perhaps developed independently, on the classpath,
- the Bootstrap class will incorporate them into the shell.
-
-
diff --git a/docs/src/reference/docbook/reference/dev-guide/introduction.xml b/docs/src/reference/docbook/reference/dev-guide/introduction.xml
deleted file mode 100644
index a0f0a240..00000000
--- a/docs/src/reference/docbook/reference/dev-guide/introduction.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- This section provides some guidance on how one can create commands for
- the Spring Shell.
-
diff --git a/docs/src/reference/docbook/reference/introduction.xml b/docs/src/reference/docbook/reference/introduction.xml
deleted file mode 100644
index 7bad5ca8..00000000
--- a/docs/src/reference/docbook/reference/introduction.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- This part of the reference documentation explains the core components
- of the Spring Shell.
-
diff --git a/docs/src/reference/docbook/reference/shell.xml b/docs/src/reference/docbook/reference/shell.xml
deleted file mode 100644
index a4d01b18..00000000
--- a/docs/src/reference/docbook/reference/shell.xml
+++ /dev/null
@@ -1,312 +0,0 @@
-
-
- Spring Shell
-
- The core components of the shell are its plugin model, built-in
- commands, and converters.
-
-
- Plugin Model
-
- The plugin model is based on Spring. Each plugin jar is required to
- contain the file
- META-INF/spring/spring-shell-plugin.xml. These files
- will be loaded to bootstrap a Spring
- ApplicationContext when the shell is
- started. The essential boostrapping code that looks for your contributions
- looks like this: new ClassPathXmlApplicationContext("classpath*:/META-INF/spring/spring-shell-plugin.xml");
-
- In the spring-shell-plugin.xml file you should
- define the command classes and any other collaborating objects that
- support the command's actions. The plugin model is depicted in the
- following diagram
-
-
-
-
-
-
-
-
-
-
- Note that the current plugin model loads all plugins under the same
- class loader. An open JIRA issue
- suggests providing a classloader per plugin to provide isolation.
-
-
- Commands
-
- An easy way to declare the commands is to use Spring's component
- scanning functionality. Here is an example
- spring-shell-plugin.xml from the sample
- application:
-
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.1.xsd">
-
- <context:component-scan
- base-package="org.springframework.shell.samples.helloworld.commands" />
-
-</beans>
-
- The commands are Spring components, demarcated as such using the
- @Component annotation. For example, the shell of the
- HelloWorldCommands class from the sample
- application looks like this
-
- @Component
-public class HelloWorldCommands implements CommandMarker {
-
- // use any Spring annotations for Dependency Injection or other Spring
- // interfaces as required.
-
- // methods with @Cli annotations go here
-
-}
-
- Once the commands are registered and instantiated by the Spring
- container, they are registered with the core shell parser so that the
- @Cli annotations can be processed. The way the
- commands are identified is through the use of the
- CommandMarker interface.
-
-
-
- Converters
-
- The
- org.springframework.shell.core.Converter
- interface provides the contract to convert the strings that are entered
- on the command line to rich Java types passed into the arguments of
- @Cli-annotated methods.
-
- By default converters for common types are registered. These cover
- primitive types (boolean, int, float...) as well as Date, Character, and
- File.
-
- If you need to register any additional
- Converter instances, register them with
- the Spring container in the
- spring-shell-plugin.xml file and they will be
- picked up automatically.
-
-
-
-
- Built in commands
-
- There are a few built in commands. Here is a listing of their class
- name and functionality
-
-
-
- ConsoleCommands -
- clr and clear - to clear the console.
-
-
-
- DateCommands -
- date - show the current date and time.
-
-
-
- ExitCommands -
- exit and quit - to exit the
- shell.
-
-
-
- HelpCommands - help -
- list all commands and their usage
-
-
-
- InlineCommentCommands - // and ; shows the valid characters to use for inline comments
-
-
-
- OsCommands - the keyword for this command
- is the exclamation point, !. After the exclamation
- point you can pass in a unix/windows command string to be
- executed.
-
-
-
- SystemPropertyCommands - system properties- shows the shell's system properties
-
-
-
- VersionCommands - version- shows the shell's version
-
-
-
-
- There are two commands in provided by the
- AbstractShell class related to useage of block comments
-
-
-
-
- /* and */- The begin and end characters for block comments
-
-
-
-
-
-
- Customizing the shell
-
- There are a few extension points that allow you to customize the
- shell. The extension points are the interfaces
-
-
-
- BannerProvider - Specifies the
- banner text, welcome message, and version number that will be
- displayed when the shell is started
-
-
-
- PromptProvider - Specifies the
- command prompt text, eg. "shell>" or
- "#" or "$". This will be called
- after every command execution so it does not need to be a static
- string.
-
-
-
- HistoryFileNameProvider -
- Specifies the name of the command history file
-
-
-
- There is a default implementation for these interfaces but you
- should create your own implementations for your own shell application.
- All of these interfaces extend from
- NamedProvider. Use
- Spring's @Order annotation to set the priority of the
- provider. This allows your provider implementations to take precedence
- over any other implementations that maybe present on the classpath from
- other plugins.
-
- To make cool "ASCII art"
- banners the website http://patorjk.com/software/taag
- is quite neat!
-
-
-
- Communicating between plugins
-
- As this is a standard Spring application you can use Spring's
- ApplicationContext event infrastructure to
- communicate across plugins.
-
-
-
- Command method interception
-
- It has shown to be useful to provide a simple form of interception
- around the invocation of a command method. This enables the command class
- to check for updates to state, such as configuration information modified
- by other plugins, before the command method is executed. The interface
- ExecutionProcessor should be implemented
- instead of CommandMarker to access this
- functionality. The ExecutionProcessor
- interface is shown below
-
- public interface ExecutionProcessor extends CommandMarker {
-
- /**
- * Method called before invoking the target command (described by {@link ParseResult}).
- * Additionally, for advanced cases, the parse result itself effectively changing the
- * invocation calling site.
- *
- * @param invocationContext target command context
- * @return the invocation target
- */
- ParseResult beforeInvocation(ParseResult invocationContext);
-
- /**
- * Method called after successfully invoking the target command (described by
- * {@link ParseResult}).
- *
- * @param invocationContext target command context
- * @param result the invocation result
- */
- void afterReturningInvocation(ParseResult invocationContext, Object result);
-
- /**
- * Method called after invoking the target command (described by {@link ParseResult})
- * had thrown an exception .
- *
- * @param invocationContext target command context
- * @param thrown the thrown object
- */
- void afterThrowingInvocation(ParseResult invocationContext, Throwable thrown);
-
-}
-
-
-
- Command line options
-
- There are a few command line options that can be specified when
- starting the shell. They are
-
-
-
- --profiles - Specifies values for the system
- property spring.profiles.active so that Spring 3.1 and greater profile
- support is enabled.
-
-
-
- --cmdfile - Specifies a file to read that
- contains shell commands
-
-
-
- --histsize - Specifies the maximum number of
- lines to store in the command history file. Default value is
- 3000.
-
-
-
- --disableInternalCommands - Flag that disables all commands that would
- be pre-registered with the shell. There is no argument to this option. You can selectively add
- back any internal commands by referencing them in your shell plugin file. Look at the
- Spring Shell javadocs for specific commands located in the
- org.springframework.shell.commands package as well as the section in this documentation
- of Built in commands.
-
-
-
-
-
- Scripts and comments
-
- Scripts can be executed either by passing in the
- --cmdfile argument at startup or by executing the
- script command inside the shell. When using scripts it
- helps to add comments and this can be done using block comments that start
- and end with /* and */ or an inline
- one line comment using the // or ;
- characters.
-
-
diff --git a/docs/src/reference/docbook/samples/introduction.xml b/docs/src/reference/docbook/samples/introduction.xml
deleted file mode 100644
index fba417d0..00000000
--- a/docs/src/reference/docbook/samples/introduction.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
- This part of the reference documentation covers the sample
- applications included with Spring Shell that demonstrate the features in a
- code centric manner.
-
- Describes a simple Spring Shell
- application that echo's the command parameters to the console.
-
diff --git a/docs/src/reference/docbook/samples/simple-application.xml b/docs/src/reference/docbook/samples/simple-application.xml
deleted file mode 100644
index 83533603..00000000
--- a/docs/src/reference/docbook/samples/simple-application.xml
+++ /dev/null
@@ -1,137 +0,0 @@
-
-
- Simple sample application using the Spring Shell
-
-
- Introduction
-
- The sample application named 'helloworld' contains three
- 'hw' commands, they are 'hw simple',
- 'hw complex' and 'hw enum' and
- demonstrate simple to intermediate level usage of the
- @Cli annotation classes for creating commands.
-
- The example code is located in the distribution directory
- <spring-shell-install-dir>/samples/helloworld.
-
- To build the example cd to the helloworld directory and execute
- gradlew installApp (you first need to add the gradlew
- gradle wrapper to your path). To run the application cd to
- build\install\helloworld\bin and execute the helloworld
- script.
-
-
-
- HelloWorldCommands
-
- The HelloWorldCommands class is show
- below
-
- package org.springframework.shell.samples.helloworld.commands;
-
-import org.springframework.shell.core.CommandMarker;
-import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-import org.springframework.stereotype.Component;
-
-@Component
-public class HelloWorldCommands implements CommandMarker {
-
- private boolean simpleCommandExecuted = false;
-
- @CliAvailabilityIndicator({"hw simple"})
- public boolean isSimpleAvailable() {
- //always available
- return true;
- }
-
- @CliAvailabilityIndicator({"hw complex", "hw enum"})
- public boolean isComplexAvailable() {
- if (simpleCommandExecuted) {
- return true;
- } else {
- return false;
- }
- }
-
- @CliCommand(value = "hw simple", help = "Print a simple hello world message")
- public String simple(
- @CliOption(key = { "message" }, mandatory = true, help = "The hello world message") final String message,
- @CliOption(key = { "location" }, mandatory = false, help = "Where you are saying hello", specifiedDefaultValue="At work") final String location) {
- simpleCommandExecuted = true;
- return "Message = [" + message + "] Location = [" + location + "]";
- }
-
- @CliCommand(value = "hw complex", help = "Print a complex hello world message")
- public String hello(
- @CliOption(key = { "message" }, mandatory = true, help = "The hello world message") final String message,
- @CliOption(key = { "name1"}, mandatory = true, help = "Say hello to the first name") final String name1,
- @CliOption(key = { "name2" }, mandatory = true, help = "Say hello to a second name") final String name2,
- @CliOption(key = { "time" }, mandatory = false, specifiedDefaultValue="now", help = "When you are saying hello") final String time,
- @CliOption(key = { "location" }, mandatory = false, help = "Where you are saying hello") final String location) {
- return "Hello " + name1 + " and " + name2 + ". Your special message is " + message + ". time=[" + time + "] location=[" + location + "]";
- }
-
- @CliCommand(value = "hw enum", help = "Print a simple hello world message from an enumerated value")
- public String eenum(
- @CliOption(key = { "message" }, mandatory = true, help = "The hello world message") final MessageType message){
- return "Hello. Your special enumerated message is " + message;
- }
-
- enum MessageType {
- Type1("type1"),
- Type2("type2"),
- Type3("type3");
-
- private String type;
-
- private MessageType(String type){
- this.type = type;
- }
-
- public String getType(){
- return type;
- }
- }
-}
-
-
- The use of the @CliAvailabilityIndicator
- annotation on two methods, isSimpleAvailable and
- isComplexAvailable shows how you can enable the
- presence of the 'hw complex' and 'hw
- enum' commands only if the 'hw simple'
- command was executed.
-
- Here is an example session showing the behavior.
-
-
-
-
-
-
-
-
-
-
- The 'hw enum' command shows how the shell
- supports the use of an enumeration as command method arguments.
-
-
-
-
-
-
-
-
-
-
-
diff --git a/gradle.properties b/gradle.properties
deleted file mode 100644
index 3c3dbb67..00000000
--- a/gradle.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-slf4jVersion=1.7.13
-jlineVersion=2.12
-junitVersion=4.12
-springVersion=4.2.4.RELEASE
-commonsioVersion=2.4
-hamcrestVersion=1.3
-version=1.2.1.BUILD-SNAPSHOT
-mockitoVersion=1.10.19
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index b7612167..00000000
Binary files a/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index b25698f5..00000000
--- a/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Thu Jun 29 11:35:25 CEST 2017
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-bin.zip
diff --git a/gradlew b/gradlew
deleted file mode 100755
index 91a7e269..00000000
--- a/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/gradlew.bat b/gradlew.bat
deleted file mode 100644
index aec99730..00000000
--- a/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/maven.gradle b/maven.gradle
deleted file mode 100644
index 40ea7c76..00000000
--- a/maven.gradle
+++ /dev/null
@@ -1,60 +0,0 @@
-apply plugin: 'maven'
-
-ext.optionalDeps = []
-ext.providedDeps = []
-
-ext.optional = { optionalDeps << it }
-ext.provided = { providedDeps << it }
-
-install {
- repositories.mavenInstaller {
- customizePom(pom, project)
- }
-}
-
-def customizePom(pom, gradleProject) {
- pom.whenConfigured { generatedPom ->
- // respect 'optional' and 'provided' dependencies
- gradleProject.optionalDeps.each { dep ->
- generatedPom.dependencies.find { it.artifactId == dep.name }?.optional = true
- }
- gradleProject.providedDeps.each { dep ->
- generatedPom.dependencies.find { it.artifactId == dep.name }?.scope = 'provided'
- }
-
- // eliminate test-scoped dependencies (no need in maven central poms)
- generatedPom.dependencies.removeAll { dep ->
- dep.scope == 'test'
- }
-
- // add all items necessary for maven central publication
- generatedPom.project {
- name = gradleProject.description
- description = gradleProject.description
- url = 'http://github.com/SpringSource/spring-shell'
- organization {
- name = 'SpringSource'
- url = 'http://www.springsource.org/spring-shell'
- }
- licenses {
- license {
- name 'The Apache Software License, Version 2.0'
- url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
- distribution 'repo'
- }
- }
- scm {
- url = 'http://github.com/SpringSource/spring-shell'
- connection = 'scm:git:git://github.com/SpringSource/spring-shell'
- developerConnection = 'scm:git:git://github.com/SpringSource/spring-shell'
- }
- developers {
- developer {
- id = 'markpollack'
- name = 'Mark Pollack'
- email = 'mpollack@vmware.com'
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/readme.dev b/readme.dev
deleted file mode 100644
index 0c5797cb..00000000
--- a/readme.dev
+++ /dev/null
@@ -1,32 +0,0 @@
-======================================================================
-DEBUGGING VIA ECLIPSE
-======================================================================
-
-Most of the time we just use the spring-shell line tool directly
-from the command line. This we have found is the fastest approach and
-also lets us see exactly what a user would see, including the TAB
-completion features. Still, sometimes you have a tricky issue you'd
-prefer to work through via the STS/Eclipse debugger. When you do this
-you need to be aware that you lose the full capabilities of the shell,
-as the JLine library (used for command line parsing) is unable to
-fully hook into your operating system's keyboard and ANSI services.
-Anyhow, for some issues a debugger is worth the minor price of losing
-your full keyboard and colour services! :-)
-
-To setup debugging, open org.springframework.shell.Bootstrap.
-Note it has a Java "main" method. Execute the class using Run As >
-Java Application. Note the "Console" tab in Eclipse/STS will open.
-Type "quit" then hit enter. Now select Run > Debug Configurations.
-Select the Java Application > Bootstrap entry. Click on Arguments
-and then add the following VM Arguments:
-
-*nix machines:
- -Djline.terminal=org.springframework.shell.core.IdeTerminal
-
-Windows machines:
- -Djline.WindowsTerminal.directConsole=false
- -Djline.terminal=jline.UnsupportedTerminal
-
-Finally, set the working directory to "Other" and a location on your
-disk where you'd like the spring-shell to be loaded. This is usually a
-project you're intending to test with.
\ No newline at end of file
diff --git a/samples/helloworld/.gitignore b/samples/helloworld/.gitignore
deleted file mode 100644
index 5d1172ac..00000000
--- a/samples/helloworld/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-/.classpath
-/.project
-.settings/
-target/
-/log.roo
-*.log
-
-/bin/
diff --git a/samples/helloworld/.project b/samples/helloworld/.project
deleted file mode 100644
index cdac73f2..00000000
--- a/samples/helloworld/.project
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
- helloworld
- Spring Shell Example
-
-
- org.eclipse.jdt.core.javanature
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
diff --git a/samples/helloworld/build.gradle b/samples/helloworld/build.gradle
deleted file mode 100644
index 8e19f117..00000000
--- a/samples/helloworld/build.gradle
+++ /dev/null
@@ -1,32 +0,0 @@
-description = 'Spring Shell Example'
-apply plugin: 'base'
-apply plugin: 'java'
-apply plugin: 'eclipse'
-apply plugin: 'application'
-
-repositories {
- maven { url "http://repo.springsource.org/libs-milestone" }
- maven { url "http://repo.springsource.org/libs-release" }
- mavenLocal()
- mavenCentral()
-}
-
-dependencies {
- compile "org.springframework.shell:spring-shell:$springShellVersion"
- testCompile "junit:junit:$junitVersion"
- runtime "log4j:log4j:$log4jVersion"
-}
-
-mainClassName = "org.springframework.shell.Bootstrap"
-
-defaultTasks 'installApp'
-
-run {
- standardInput = System.in
-}
-
-task wrapper(type: Wrapper) {
- description = 'Generates gradlew[.bat] scripts'
- gradleVersion = '1.2'
-}
-
diff --git a/samples/helloworld/gradle.properties b/samples/helloworld/gradle.properties
deleted file mode 100644
index 72634061..00000000
--- a/samples/helloworld/gradle.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-springShellVersion = 1.2.0.RELEASE
-junitVersion = 4.10
-log4jVersion = 1.2.17
-version = 1.0.0.RELEASE
-
-
-
diff --git a/samples/helloworld/gradle/wrapper/gradle-wrapper.jar b/samples/helloworld/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 42d9b0e9..00000000
Binary files a/samples/helloworld/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/samples/helloworld/gradle/wrapper/gradle-wrapper.properties b/samples/helloworld/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 0b5aba0e..00000000
--- a/samples/helloworld/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Thu Jul 25 19:49:28 EDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.2-bin.zip
diff --git a/samples/helloworld/gradlew b/samples/helloworld/gradlew
deleted file mode 100755
index 91a7e269..00000000
--- a/samples/helloworld/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/helloworld/gradlew.bat b/samples/helloworld/gradlew.bat
deleted file mode 100644
index aec99730..00000000
--- a/samples/helloworld/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/helloworld/pom.xml b/samples/helloworld/pom.xml
deleted file mode 100644
index 5e8a03d0..00000000
--- a/samples/helloworld/pom.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-
- 4.0.0
-
- org.springframework.shell.samples
- helloworld
- 1.1.0.RELEASE
- jar
-
- helloworld
- http://maven.apache.org
-
-
- 1.2.0.RELEASE
- org.springframework.shell.Bootstrap
- 1.2.17
- 4.10
-
-
-
-
-
- org.springframework.shell
- spring-shell
- ${spring.shell.version}
-
-
- log4j
- log4j
- ${log4j.version}
-
-
- junit
- junit-dep
- ${junit.version}
- test
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.5
- 1.5
-
-
-
- org.apache.maven.plugins
- maven-dependency-plugin
-
-
- copy-dependencies
- prepare-package
-
- copy-dependencies
-
-
- ${project.build.directory}/lib
- true
- true
- true
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
-
-
-
- true
- false
- lib/
- ${jar.mainclass}
-
-
- ${project.version}
-
-
-
-
-
-
-
-
-
-
-
- libs-milestone
- http://repo.spring.io/libs-milestone/
-
-
- libs-release
- http://repo.spring.io/libs-release/
-
-
-
diff --git a/samples/helloworld/readme.txt b/samples/helloworld/readme.txt
deleted file mode 100644
index 110843b2..00000000
--- a/samples/helloworld/readme.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-Maven 3:
-
-1.Build the project
- $>mvn package
-
-2.run spring shell
- $>java -jar target/helloworld-1.1.0.RELEASE.jar
-
-
-
-Gradle:
-
-1.Build and install the project
- $>./gradlew installApp
-
-2.run spring shell
- $>./build/install/helloworld/bin/helloworld
-
-or
- $>./gradlew -q run
-
diff --git a/samples/helloworld/src/main/java/org/springframework/shell/samples/helloworld/Main.java b/samples/helloworld/src/main/java/org/springframework/shell/samples/helloworld/Main.java
deleted file mode 100644
index 1ce398e3..00000000
--- a/samples/helloworld/src/main/java/org/springframework/shell/samples/helloworld/Main.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.shell.samples.helloworld;
-
-import java.io.IOException;
-
-import org.springframework.shell.Bootstrap;
-
-/**
- * Driver class to run the helloworld example.
- *
- * @author Mark Pollack
- *
- */
-public class Main {
-
- /**
- * Main class that delegates to Spring Shell's Bootstrap class in order to simplify debugging inside an IDE
- * @param args
- * @throws IOException
- */
- public static void main(String[] args) throws IOException {
- Bootstrap.main(args);
-
- }
-
-}
diff --git a/samples/helloworld/src/main/java/org/springframework/shell/samples/helloworld/commands/HelloWorldCommands.java b/samples/helloworld/src/main/java/org/springframework/shell/samples/helloworld/commands/HelloWorldCommands.java
deleted file mode 100644
index 1ef7ac56..00000000
--- a/samples/helloworld/src/main/java/org/springframework/shell/samples/helloworld/commands/HelloWorldCommands.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.springframework.shell.samples.helloworld.commands;
-
-import org.springframework.shell.core.CommandMarker;
-import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-import org.springframework.stereotype.Component;
-
-@Component
-public class HelloWorldCommands implements CommandMarker {
-
- private boolean simpleCommandExecuted = false;
-
- @CliAvailabilityIndicator({"hw simple"})
- public boolean isSimpleAvailable() {
- //always available
- return true;
- }
-
- @CliAvailabilityIndicator({"hw complex", "hw enum"})
- public boolean isComplexAvailable() {
- if (simpleCommandExecuted) {
- return true;
- } else {
- return false;
- }
- }
-
- @CliCommand(value = "hw simple", help = "Print a simple hello world message")
- public String simple(
- @CliOption(key = { "message" }, mandatory = true, help = "The hello world message") final String message,
- @CliOption(key = { "location" }, mandatory = false, help = "Where you are saying hello", specifiedDefaultValue="At work") final String location) {
- simpleCommandExecuted = true;
- return "Message = [" + message + "] Location = [" + location + "]";
- }
-
- @CliCommand(value = "hw complex", help = "Print a complex hello world message (run 'hw simple' once first)")
- public String hello(
- @CliOption(key = { "message" }, mandatory = true, help = "The hello world message") final String message,
- @CliOption(key = { "name1"}, mandatory = true, help = "Say hello to the first name") final String name1,
- @CliOption(key = { "name2" }, mandatory = true, help = "Say hello to a second name") final String name2,
- @CliOption(key = { "time" }, mandatory = false, specifiedDefaultValue="now", help = "When you are saying hello") final String time,
- @CliOption(key = { "location" }, mandatory = false, help = "Where you are saying hello") final String location) {
- return "Hello " + name1 + " and " + name2 + ". Your special message is " + message + ". time=[" + time + "] location=[" + location + "]";
- }
-
- @CliCommand(value = "hw enum", help = "Print a simple hello world message from an enumerated value (run 'hw simple' once first)")
- public String eenum(
- @CliOption(key = { "message" }, mandatory = true, help = "The hello world message") final MessageType message){
- return "Hello. Your special enumerated message is " + message;
- }
-
- enum MessageType {
- Type1("type1"),
- Type2("type2"),
- Type3("type3");
-
- private String type;
-
- private MessageType(String type){
- this.type = type;
- }
-
- public String getType(){
- return type;
- }
- }
-}
diff --git a/samples/helloworld/src/main/java/org/springframework/shell/samples/helloworld/commands/MyBannerProvider.java b/samples/helloworld/src/main/java/org/springframework/shell/samples/helloworld/commands/MyBannerProvider.java
deleted file mode 100644
index 62579c92..00000000
--- a/samples/helloworld/src/main/java/org/springframework/shell/samples/helloworld/commands/MyBannerProvider.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.shell.samples.helloworld.commands;
-
-import org.springframework.core.Ordered;
-import org.springframework.core.annotation.Order;
-import org.springframework.shell.plugin.support.DefaultBannerProvider;
-import org.springframework.shell.support.util.OsUtils;
-import org.springframework.stereotype.Component;
-
-/**
- * @author Jarred Li
- *
- */
-@Component
-@Order(Ordered.HIGHEST_PRECEDENCE)
-public class MyBannerProvider extends DefaultBannerProvider {
-
- public String getBanner() {
- StringBuffer buf = new StringBuffer();
- buf.append("=======================================" + OsUtils.LINE_SEPARATOR);
- buf.append("* *"+ OsUtils.LINE_SEPARATOR);
- buf.append("* HelloWorld *" +OsUtils.LINE_SEPARATOR);
- buf.append("* *"+ OsUtils.LINE_SEPARATOR);
- buf.append("=======================================" + OsUtils.LINE_SEPARATOR);
- buf.append("Version:" + this.getVersion());
- return buf.toString();
- }
-
- public String getVersion() {
- return "1.2.3";
- }
-
- public String getWelcomeMessage() {
- return "Welcome to HelloWorld CLI";
- }
-
- @Override
- public String getProviderName() {
- return "Hello World Banner";
- }
-}
\ No newline at end of file
diff --git a/samples/helloworld/src/main/java/org/springframework/shell/samples/helloworld/commands/MyHistoryFileNameProvider.java b/samples/helloworld/src/main/java/org/springframework/shell/samples/helloworld/commands/MyHistoryFileNameProvider.java
deleted file mode 100644
index 77c745c4..00000000
--- a/samples/helloworld/src/main/java/org/springframework/shell/samples/helloworld/commands/MyHistoryFileNameProvider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.shell.samples.helloworld.commands;
-
-import org.springframework.core.Ordered;
-import org.springframework.core.annotation.Order;
-import org.springframework.shell.plugin.support.DefaultHistoryFileNameProvider;
-import org.springframework.stereotype.Component;
-
-/**
- *
- * @author Jarred Li
- *
- */
-@Component
-@Order(Ordered.HIGHEST_PRECEDENCE)
-public class MyHistoryFileNameProvider extends DefaultHistoryFileNameProvider {
-
- public String getHistoryFileName() {
- return "my.log";
- }
-
- @Override
- public String getProviderName() {
- return "My history file name provider";
- }
-
-}
diff --git a/samples/helloworld/src/main/java/org/springframework/shell/samples/helloworld/commands/MyPromptProvider.java b/samples/helloworld/src/main/java/org/springframework/shell/samples/helloworld/commands/MyPromptProvider.java
deleted file mode 100644
index ba875c27..00000000
--- a/samples/helloworld/src/main/java/org/springframework/shell/samples/helloworld/commands/MyPromptProvider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.shell.samples.helloworld.commands;
-
-import org.springframework.core.Ordered;
-import org.springframework.core.annotation.Order;
-import org.springframework.shell.plugin.support.DefaultPromptProvider;
-import org.springframework.stereotype.Component;
-
-/**
- * @author Jarred Li
- *
- */
-@Component
-@Order(Ordered.HIGHEST_PRECEDENCE)
-public class MyPromptProvider extends DefaultPromptProvider {
-
- @Override
- public String getPrompt() {
- return "hw-shell>";
- }
-
-
- @Override
- public String getProviderName() {
- return "My prompt provider";
- }
-
-}
diff --git a/samples/helloworld/src/main/resources/META-INF/spring/spring-shell-plugin.xml b/samples/helloworld/src/main/resources/META-INF/spring/spring-shell-plugin.xml
deleted file mode 100644
index 9c76b239..00000000
--- a/samples/helloworld/src/main/resources/META-INF/spring/spring-shell-plugin.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/samples/helloworld/src/main/resources/log4j.properties b/samples/helloworld/src/main/resources/log4j.properties
deleted file mode 100644
index d43a9859..00000000
--- a/samples/helloworld/src/main/resources/log4j.properties
+++ /dev/null
@@ -1 +0,0 @@
-log4j.rootCategory=OFF
\ No newline at end of file
diff --git a/samples/helloworld/src/test/java/org/springframework/shell/samples/hellworld/commands/HelloWorldCommandTests.java b/samples/helloworld/src/test/java/org/springframework/shell/samples/hellworld/commands/HelloWorldCommandTests.java
deleted file mode 100644
index e80f9654..00000000
--- a/samples/helloworld/src/test/java/org/springframework/shell/samples/hellworld/commands/HelloWorldCommandTests.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2013 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.shell.samples.hellworld.commands;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.springframework.shell.Bootstrap;
-import org.springframework.shell.core.CommandResult;
-import org.springframework.shell.core.JLineShellComponent;
-
-public class HelloWorldCommandTests {
-
- @Test
- public void testSimple() {
- Bootstrap bootstrap = new Bootstrap();
-
- JLineShellComponent shell = bootstrap.getJLineShellComponent();
-
- CommandResult cr = shell.executeCommand("hw simple --message hello");
- assertEquals(true, cr.isSuccess());
- assertEquals("Message = [hello] Location = [null]", cr.getResult());
- }
-}
diff --git a/settings.gradle b/settings.gradle
deleted file mode 100644
index e3da39c3..00000000
--- a/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-rootProject.name = 'spring-shell'
diff --git a/src/main/java/org/springframework/shell/Bootstrap.java b/src/main/java/org/springframework/shell/Bootstrap.java
deleted file mode 100644
index f948d6cb..00000000
--- a/src/main/java/org/springframework/shell/Bootstrap.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.shell;
-
-import java.io.IOException;
-import java.util.logging.Logger;
-
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
-import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.shell.core.ExitShellRequest;
-import org.springframework.shell.core.JLineShellComponent;
-import org.springframework.shell.core.Shell;
-import org.springframework.shell.support.logging.HandlerUtils;
-import org.springframework.util.StopWatch;
-
-/**
- * Loads a {@link Shell} using Spring IoC container.
- *
- * @author Ben Alex (original Roo code)
- * @author Mark Pollack
- * @author David Winterfeldt
- *
- */
-public class Bootstrap {
-
- private final static String[] CONTEXT_PATH = { "classpath*:/META-INF/spring/spring-shell-plugin.xml" };
-
- private CommandLine commandLine;
-
- private GenericApplicationContext ctx;
-
- public static void main(String[] args) throws IOException {
- ExitShellRequest exitShellRequest;
- try {
- Bootstrap bootstrap = new Bootstrap(args);
- exitShellRequest = bootstrap.run();
- }
- catch (RuntimeException t) {
- throw t;
- }
- finally {
- HandlerUtils.flushAllHandlers(Logger.getLogger(""));
- }
-
- System.exit(exitShellRequest.getExitCode());
- }
-
- public Bootstrap() {
- this(null, CONTEXT_PATH);
- }
-
- public Bootstrap(String[] args) throws IOException {
- this(args, CONTEXT_PATH);
- }
-
- public Bootstrap(String[] args, String[] contextPath) {
- try {
- commandLine = SimpleShellCommandLineOptions.parseCommandLine(args);
- }
- catch (IOException e) {
- throw new ShellException(e.getMessage(), e);
- }
-
- ctx = new GenericApplicationContext();
- ctx.registerShutdownHook();
- configureApplicationContext(ctx);
- // built-in commands and converters
- ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(ctx);
- if (commandLine.getDisableInternalCommands()) {
- scanner.scan("org.springframework.shell.converters", "org.springframework.shell.plugin.support");
- }
- else {
- scanner.scan("org.springframework.shell.commands", "org.springframework.shell.converters",
- "org.springframework.shell.plugin.support");
- }
- // user contributed commands
- XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(ctx);
- reader.loadBeanDefinitions(contextPath);
- ctx.refresh();
- }
-
- public ApplicationContext getApplicationContext() {
- return ctx;
- }
-
- private void configureApplicationContext(GenericApplicationContext annctx) {
- createAndRegisterBeanDefinition(annctx, org.springframework.shell.core.JLineShellComponent.class, "shell");
- annctx.getBeanFactory().registerSingleton("commandLine", commandLine);
- }
-
- protected void createAndRegisterBeanDefinition(GenericApplicationContext annctx, Class> clazz, String name) {
- RootBeanDefinition rbd = new RootBeanDefinition();
- rbd.setBeanClass(clazz);
- DefaultListableBeanFactory bf = (DefaultListableBeanFactory) annctx.getBeanFactory();
- if (name != null) {
- bf.registerBeanDefinition(name, rbd);
- }
- else {
- bf.registerBeanDefinition(clazz.getSimpleName(), rbd);
- }
- }
-
- public ExitShellRequest run() {
- StopWatch sw = new StopWatch("Spring Shell");
- sw.start();
- String[] commandsToExecuteAndThenQuit = commandLine.getShellCommandsToExecute();
- // The shell is used
- JLineShellComponent shell = ctx.getBean("shell", JLineShellComponent.class);
- ExitShellRequest exitShellRequest;
-
- if (null != commandsToExecuteAndThenQuit) {
- boolean successful = false;
- exitShellRequest = ExitShellRequest.FATAL_EXIT;
-
- for (String cmd : commandsToExecuteAndThenQuit) {
- successful = shell.executeCommand(cmd).isSuccess();
- if (!successful)
- break;
- }
-
- // if all commands were successful, set the normal exit status
- if (successful) {
- exitShellRequest = ExitShellRequest.NORMAL_EXIT;
- }
- }
- else {
- shell.start();
- exitShellRequest = shell.getExitShellRequest();
- if (exitShellRequest == null) {
- // shouldn't really happen, but we'll fallback to this anyway
- exitShellRequest = ExitShellRequest.NORMAL_EXIT;
- }
- shell.waitForComplete();
- }
-
- ctx.close();
- sw.stop();
- if (shell.isDevelopmentMode()) {
- System.out.println("Total execution time: " + sw.getLastTaskTimeMillis() + " ms");
- }
- return exitShellRequest;
- }
-
- public JLineShellComponent getJLineShellComponent() {
- return ctx.getBean("shell", JLineShellComponent.class);
- }
-}
diff --git a/src/main/java/org/springframework/shell/CommandLine.java b/src/main/java/org/springframework/shell/CommandLine.java
deleted file mode 100644
index 1481f37d..00000000
--- a/src/main/java/org/springframework/shell/CommandLine.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.shell;
-
-
-/**
- * Encapsulates the list of argument passed to the shell.
- *
- * @author Mark Pollack
- */
-public class CommandLine {
-
- private String[] args;
- private int historySize;
- private String[] shellCommandsToExecute;
- private boolean disableInternalCommands;
-
- /**
- * Construct a new CommandLine
- * @param args an array of strings from main(String[] args)
- * @param historySize the size of this history buffer
- * @param shellCommandsToExecute semi-colon delimited list of commands for the shell to execute
- */
- public CommandLine(String[] args, int historySize, String[] shellCommandsToExecute) {
- this(args,historySize,shellCommandsToExecute, false);
- }
-
-
- /**
- * Construct a new CommandLine
- * @param args an array of strings from main(String[] args)
- * @param historySize the size of this history buffer
- * @param shellCommandsToExecute semi-colon delimited list of commands for the shell to execute
- * @param disableInternalCommands if true, do not load the built-in shell commands
- */
- public CommandLine(String[] args, int historySize, String[] shellCommandsToExecute, boolean disableInternalCommands) {
- this.args = args;
- this.historySize = historySize;
- this.shellCommandsToExecute = shellCommandsToExecute;
- this.disableInternalCommands = disableInternalCommands;
- }
-
- /**
- * Return the command line arguments
- * @return the command line arguments
- */
- public String[] getArgs() {
- return args;
- }
-
- /**
- * @return the historySize
- */
- public int getHistorySize() {
- return historySize;
- }
-
- /**
- * @return the shellCommandsToExecute
- */
- public String[] getShellCommandsToExecute() {
- return shellCommandsToExecute;
- }
-
- /**
- *
- * @return the disableInternalCommands value
- */
- public boolean getDisableInternalCommands() {
- return disableInternalCommands;
- }
-
-}
diff --git a/src/main/java/org/springframework/shell/ShellException.java b/src/main/java/org/springframework/shell/ShellException.java
deleted file mode 100644
index 3caa04d9..00000000
--- a/src/main/java/org/springframework/shell/ShellException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2011-2013 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.shell;
-
-
-/**
- * Shell exception.
- *
- * @author David Wintefeldt
- */
-public class ShellException extends RuntimeException {
-
- private static final long serialVersionUID = 1123895874463364743L;
-
- public ShellException() {}
-
- public ShellException(String message) {
- super(message);
- }
-
- public ShellException(Throwable t) {
- super(t);
- }
-
- public ShellException(String message, Throwable t) {
- super(message, t);
- }
-
-}
diff --git a/src/main/java/org/springframework/shell/SimpleShellCommandLineOptions.java b/src/main/java/org/springframework/shell/SimpleShellCommandLineOptions.java
deleted file mode 100644
index 6890b0a1..00000000
--- a/src/main/java/org/springframework/shell/SimpleShellCommandLineOptions.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.shell;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Logger;
-
-import org.apache.commons.io.FileUtils;
-import org.springframework.shell.support.logging.HandlerUtils;
-
-/**
- * Used to pass in command line options to customize the shell on launch
- *
- * @author vnagaraja
- */
-public class SimpleShellCommandLineOptions {
-
- private static final Logger LOGGER = HandlerUtils.getLogger(SimpleShellCommandLineOptions.class);
- public static final int DEFAULT_HISTORY_SIZE = 3000;
- String[] executeThenQuit = null;
- Map extraSystemProperties = new HashMap();
- int historySize = DEFAULT_HISTORY_SIZE;
- boolean disableCommands;
-
- public static CommandLine parseCommandLine(String[] args)
- throws IOException {
- if (args == null) {
- args = new String[] {};
- }
- SimpleShellCommandLineOptions options = new SimpleShellCommandLineOptions();
- List commands = new ArrayList();
- int i = 0;
- while (i < args.length) {
- String arg = args[i++];
- if (arg.equals("--profiles")) {
- try {
- String profiles = args[i++];
- options.extraSystemProperties.put("spring.profiles.active", profiles);
- } catch (ArrayIndexOutOfBoundsException e) {
- LOGGER.warning("No value specified for --profiles option");
- }
- } else if (arg.equals("--cmdfile")) {
- try {
- File f = new File(args[i++]);
- commands.addAll(FileUtils.readLines(f));
- } catch (IOException e) {
- LOGGER.warning("Could not read lines from command file: " + e.getMessage());
- } catch (ArrayIndexOutOfBoundsException e) {
- LOGGER.warning("No value specified for --cmdfile option");
- }
- } else if (arg.equals("--histsize")) {
- try {
- String histSizeArg = args[i++];
- int histSize = Integer.parseInt(histSizeArg);
- if (histSize <= 0) {
- LOGGER.warning("histsize option must be > 0, using default value of " + DEFAULT_HISTORY_SIZE);
- } else {
- options.historySize = histSize;
- }
- } catch (NumberFormatException e) {
- LOGGER.warning("Unable to parse histsize value to an integer ");
- } catch (ArrayIndexOutOfBoundsException ae) {
- LOGGER.warning("No value specified for --histsize option");
- }
- } else if (arg.equals("--disableInternalCommands")) {
- options.disableCommands = true;
- } else if (arg.equals("--help")) {
- printUsage();
- System.exit(0);
- } else {
- i--;
- break;
- }
- }
-
- StringBuilder sb = new StringBuilder();
- for (; i < args.length; i++) {
- if (sb.length() > 0) {
- sb.append(" ");
- }
- sb.append(args[i]);
- }
-
- if (sb.length() > 0) {
- String[] cmdLineCommands = sb.toString().split(";");
- for (String s : cmdLineCommands) {
- // add any command line commands after the commands loaded from the file
- commands.add(s.trim());
- }
- }
-
- if (commands.size() > 0) {
- options.executeThenQuit = commands.toArray(new String[commands.size()]);
- }
-
- for (Map.Entry entry : options.extraSystemProperties.entrySet()) {
- System.setProperty(entry.getKey(), entry.getValue());
- }
-
- return new CommandLine(args, options.historySize, options.executeThenQuit, options.disableCommands);
- }
-
- private static void printUsage() {
- System.out.println("Usage: --help --histsize [size] --cmdfile [file name] --profiles [comma-separated list of profile names]");
- }
-}
diff --git a/src/main/java/org/springframework/shell/TerminalSizeAware.java b/src/main/java/org/springframework/shell/TerminalSizeAware.java
deleted file mode 100644
index a9fa6d77..00000000
--- a/src/main/java/org/springframework/shell/TerminalSizeAware.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.springframework.shell;
-
-/**
- * To be implemented by command result objects that can adapt to the terminal size when they are being rendered.
- *
- *
An object which does not implement this interface will simply be rendered by invoking its {@link #toString()}
- * method.
- *
- * @author Eric Bottard
- */
-public interface TerminalSizeAware {
-
- CharSequence render(int terminalWidth);
-}
diff --git a/src/main/java/org/springframework/shell/commands/ConsoleCommands.java b/src/main/java/org/springframework/shell/commands/ConsoleCommands.java
deleted file mode 100644
index d9d2caac..00000000
--- a/src/main/java/org/springframework/shell/commands/ConsoleCommands.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.shell.commands;
-
-import static org.fusesource.jansi.Ansi.ansi;
-
-import org.fusesource.jansi.AnsiConsole;
-import org.springframework.shell.core.CommandMarker;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.stereotype.Component;
-
-/**
- * Commands related to the manipulation of the jline console.
- *
- * @author Mark Pollack
- *
- */
-@Component
-public class ConsoleCommands implements CommandMarker {
-
- @CliCommand(value = { "cls", "clear" }, help = "Clears the console")
- public void clear() {
- AnsiConsole.out().print(ansi().eraseScreen().cursor(0, 0));
- }
-
-}
diff --git a/src/main/java/org/springframework/shell/commands/DateCommands.java b/src/main/java/org/springframework/shell/commands/DateCommands.java
deleted file mode 100644
index bc3d11cd..00000000
--- a/src/main/java/org/springframework/shell/commands/DateCommands.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.shell.commands;
-
-import java.text.DateFormat;
-import java.util.Date;
-import java.util.Locale;
-
-import org.springframework.shell.core.CommandMarker;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.stereotype.Component;
-
-/**
- * Commands related to the dates
- *
- */
-@Component
-public class DateCommands implements CommandMarker {
-
- @CliCommand(value = { "date" }, help = "Displays the local date and time")
- public String date() {
- return DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, Locale.getDefault()).format(new Date());
- }
-
-}
diff --git a/src/main/java/org/springframework/shell/commands/ExitCommands.java b/src/main/java/org/springframework/shell/commands/ExitCommands.java
deleted file mode 100644
index d0c6dd69..00000000
--- a/src/main/java/org/springframework/shell/commands/ExitCommands.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.shell.commands;
-
-import org.springframework.shell.core.CommandMarker;
-import org.springframework.shell.core.ExitShellRequest;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.stereotype.Component;
-
-/**
- * Commands related to exiting the shell
- *
- */
-@Component
-public class ExitCommands implements CommandMarker {
-
- @CliCommand(value={"exit", "quit"}, help="Exits the shell")
- public ExitShellRequest quit() {
- return ExitShellRequest.NORMAL_EXIT;
- }
-
-}
diff --git a/src/main/java/org/springframework/shell/commands/HelpCommands.java b/src/main/java/org/springframework/shell/commands/HelpCommands.java
deleted file mode 100644
index af0f947b..00000000
--- a/src/main/java/org/springframework/shell/commands/HelpCommands.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.shell.commands;
-
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.shell.core.CommandMarker;
-import org.springframework.shell.core.JLineShellComponent;
-import org.springframework.shell.core.SimpleParser;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-import org.springframework.stereotype.Component;
-
-/**
- * Provides a listing of commands known to the shell.
- *
- * @author Ben Alex
- * @author Mark Pollack
- * @author Jarred Li
- *
- */
-@Component
-public class HelpCommands implements CommandMarker, ApplicationContextAware {
-
- private ApplicationContext ctx;
-
- @CliCommand(value = "help", help = "List all commands usage")
- public void obtainHelp(
- @CliOption(key = { "", "command" }, optionContext = "disable-string-converter availableCommands", help = "Command name to provide help for")
- String buffer) {
- JLineShellComponent shell = ctx.getBean("shell", JLineShellComponent.class);
- SimpleParser parser = shell.getSimpleParser();
- parser.obtainHelp(buffer);
- }
-
- @Override
- public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
- this.ctx = applicationContext;
- }
-}
diff --git a/src/main/java/org/springframework/shell/commands/InlineCommentCommands.java b/src/main/java/org/springframework/shell/commands/InlineCommentCommands.java
deleted file mode 100644
index ca870626..00000000
--- a/src/main/java/org/springframework/shell/commands/InlineCommentCommands.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.shell.commands;
-
-import org.springframework.shell.core.CommandMarker;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.stereotype.Component;
-
-/**
- * Commands relating to inline comments
- *
- */
-@Component
-public class InlineCommentCommands implements CommandMarker {
-
- @CliCommand(value = { "//", ";" }, help = "Inline comment markers (start of line only)")
- public void inlineComment() {}
-
-}
diff --git a/src/main/java/org/springframework/shell/commands/OsCommands.java b/src/main/java/org/springframework/shell/commands/OsCommands.java
deleted file mode 100644
index 67fcb5a7..00000000
--- a/src/main/java/org/springframework/shell/commands/OsCommands.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.shell.commands;
-
-import java.io.IOException;
-import java.util.logging.Logger;
-
-import org.springframework.shell.core.CommandMarker;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-import org.springframework.shell.support.logging.HandlerUtils;
-import org.springframework.stereotype.Component;
-
-/**
- * Command type to allow execution of native OS commands from the Spring Shell.
- *
- * @author Stefan Schmidt
- * @since 1.2.0
- */
-@Component
-public class OsCommands implements CommandMarker {
-
- private static final Logger LOGGER = HandlerUtils
- .getLogger(OsCommands.class);
-
- private OsOperations osOperations = new OsOperationsImpl();
-
- @CliCommand(value = "!", help = "Allows execution of operating system (OS) commands")
- public void command(
- @CliOption(key = { "", "command" }, mandatory = false, specifiedDefaultValue = "", unspecifiedDefaultValue = "", help = "The command to execute") final String command) {
-
- System.out.println("command is:" + command);
- if (command != null && command.length() > 0) {
- try {
- osOperations.executeCommand(command);
- }
- catch (final IOException e) {
- LOGGER.severe("Unable to execute command " + command + " ["
- + e.getMessage() + "]");
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/springframework/shell/commands/OsOperations.java b/src/main/java/org/springframework/shell/commands/OsOperations.java
deleted file mode 100644
index bba29236..00000000
--- a/src/main/java/org/springframework/shell/commands/OsOperations.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.shell.commands;
-
-import java.io.IOException;
-
-/**
- * Operations type to allow execution of native OS commands from the Spring Roo
- * shell.
- *
- * @author Stefan Schmidt
- * @since 1.2.0
- */
-public interface OsOperations {
-
- /**
- * Attempts the execution of a commands and delegates the output to the
- * standard logger.
- *
- * @param command the command to execute
- * @throws IOException if an error occurs
- */
- void executeCommand(String command) throws IOException;
-}
\ No newline at end of file
diff --git a/src/main/java/org/springframework/shell/commands/OsOperationsImpl.java b/src/main/java/org/springframework/shell/commands/OsOperationsImpl.java
deleted file mode 100644
index d0ae9515..00000000
--- a/src/main/java/org/springframework/shell/commands/OsOperationsImpl.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.shell.commands;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.util.logging.Logger;
-
-import org.apache.commons.io.IOUtils;
-import org.springframework.shell.support.logging.HandlerUtils;
-import org.springframework.stereotype.Component;
-
-/**
- * Implementation of {@link OsOperations} interface.
- *
- * @author Stefan Schmidt
- * @since 1.2.0
- */
-@Component
-public class OsOperationsImpl implements OsOperations {
- private static final Logger LOGGER = HandlerUtils.getLogger(OsOperationsImpl.class);
-
- public void executeCommand(final String command) throws IOException {
- final File root = new File(".");
- final Process p = Runtime.getRuntime().exec(command, null, root);
- Reader input = new InputStreamReader(p.getInputStream());
- Reader errors = new InputStreamReader(p.getErrorStream());
-
- for (String line : IOUtils.readLines(input)) {
- if (line.startsWith("[ERROR]")) {
- LOGGER.severe(line);
- }
- else if (line.startsWith("[WARNING]")) {
- LOGGER.warning(line);
- }
- else {
- LOGGER.info(line);
- }
- }
-
-
- for (String line : IOUtils.readLines(errors)) {
- if (line.startsWith("[ERROR]")) {
- LOGGER.severe(line);
- }
- else if (line.startsWith("[WARNING]")) {
- LOGGER.warning(line);
- }
- else {
- LOGGER.info(line);
- }
- }
-
-
- p.getOutputStream().close();
-
-
- try {
- if (p.waitFor() != 0) {
- LOGGER.warning("The command '" + command + "' did not complete successfully");
- }
- } catch (final InterruptedException e) {
- throw new IllegalStateException(e);
- }
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/org/springframework/shell/commands/ScriptCommands.java b/src/main/java/org/springframework/shell/commands/ScriptCommands.java
deleted file mode 100644
index 439ae4ac..00000000
--- a/src/main/java/org/springframework/shell/commands/ScriptCommands.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.shell.commands;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.logging.Logger;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-import org.springframework.core.io.Resource;
-import org.springframework.shell.core.CommandMarker;
-import org.springframework.shell.core.JLineShellComponent;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-import org.springframework.shell.support.logging.HandlerUtils;
-import org.springframework.shell.support.util.IOUtils;
-import org.springframework.shell.support.util.MathUtils;
-import org.springframework.stereotype.Component;
-import org.springframework.util.Assert;
-
-@Component
-public class ScriptCommands implements CommandMarker {
- protected final Logger logger = HandlerUtils.getLogger(getClass());
-
- @Autowired
- private ApplicationContext applicationContext;
-
- @Autowired
- private JLineShellComponent shell;
- @CliCommand(value = { "script" }, help = "Parses the specified resource file and executes its commands")
- public void script(
- @CliOption(key = { "", "file" }, help = "The file to locate and execute", mandatory = true) final File script,
- @CliOption(key = "lineNumbers", mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "Display line numbers when executing the script") final boolean lineNumbers) {
-
- Assert.notNull(script, "Script file to parse is required");
- double startedNanoseconds = System.nanoTime();
- final InputStream inputStream = openScript(script);
-
- BufferedReader in = null;
- try {
- in = new BufferedReader(new InputStreamReader(inputStream));
- String line;
- int i = 0;
- while ((line = in.readLine()) != null) {
- i++;
- if (lineNumbers) {
- logger.fine("Line " + i + ": " + line);
- } else {
- logger.fine(line);
- }
- if (!"".equals(line.trim())) {
- boolean success = shell.executeScriptLine(line);
- if (success && ((line.trim().startsWith("q") || line.trim().startsWith("ex")))) {
- break;
- } else if (!success) {
- // Abort script processing, given something went wrong
- throw new IllegalStateException("Script execution aborted");
- }
- }
- }
- } catch (IOException e) {
- throw new IllegalStateException(e);
- } finally {
- IOUtils.closeQuietly(inputStream, in);
- double executionDurationInSeconds = (System.nanoTime() - startedNanoseconds) / 1000000000D;
- logger.fine("Script required " + MathUtils.round(executionDurationInSeconds, 3) + " seconds to execute");
- }
- }
-
- /**
- * Opens the given script for reading
- *
- * @param script the script to read (required)
- * @return a non-null input stream
- */
- private InputStream openScript(final File script) {
- try {
- return new BufferedInputStream(new FileInputStream(script));
- } catch (final FileNotFoundException fnfe) {
- // Try to find the script via the classloader
- final Collection urls = findResources(script.getName());
-
- // Handle search failure
- Assert.notNull(urls, "Unexpected error looking for '" + script.getName() + "'");
-
- // Handle the search being OK but the file simply not being present
- Assert.notEmpty(urls, "Script '" + script + "' not found on disk or in classpath");
- Assert.isTrue(urls.size() == 1, "More than one '" + script + "' was found in the classpath; unable to continue");
- try {
- return urls.iterator().next().openStream();
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
- }
- }
-
- protected Collection findResources(final String path) {
- try {
- Resource[] resources = applicationContext.getResources(path);
- Collection list = new ArrayList(resources.length);
- for (Resource resource : resources) {
- list.add(resource.getURL());
- }
- return list;
- } catch (IOException ex) {
- logger.fine("Cannot find path " + path);
- // return Collections.emptyList();
- throw new RuntimeException(ex);
- }
- }
-
-}
diff --git a/src/main/java/org/springframework/shell/commands/SystemPropertyCommands.java b/src/main/java/org/springframework/shell/commands/SystemPropertyCommands.java
deleted file mode 100644
index 3279ba3a..00000000
--- a/src/main/java/org/springframework/shell/commands/SystemPropertyCommands.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.shell.commands;
-
-import static org.springframework.shell.support.util.OsUtils.LINE_SEPARATOR;
-
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.springframework.shell.core.CommandMarker;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.stereotype.Component;
-import org.springframework.util.StringUtils;
-
-/**
- * Commands related to system properties
- *
- */
-@Component
-public class SystemPropertyCommands implements CommandMarker {
-
- @CliCommand(value = { "system properties" }, help = "Shows the shell's properties")
- public String props() {
- final Set data = new TreeSet(); // For repeatability
- for (final Entry