├── .drone.yml
├── .gitignore
├── .travis.yml
├── LICENSE
├── README.adoc
├── crest-maven-plugin
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── org
│ │ └── tomitribe
│ │ └── crest
│ │ └── maven
│ │ └── CrestCommandLoaderDescriptorGeneratorMojo.java
│ └── test
│ └── java
│ └── org
│ └── tomitribe
│ └── crest
│ └── maven
│ └── CrestCommandLoaderDescriptorGeneratorMojoTest.java
├── pom.xml
├── tomitribe-crest-api
├── pom.xml
└── src
│ └── main
│ └── java
│ └── org
│ └── tomitribe
│ └── crest
│ └── api
│ ├── Command.java
│ ├── CrestAnnotation.java
│ ├── Default.java
│ ├── Defaults.java
│ ├── Editor.java
│ ├── Err.java
│ ├── Exit.java
│ ├── In.java
│ ├── Loader.java
│ ├── NotAService.java
│ ├── Option.java
│ ├── Options.java
│ ├── Out.java
│ ├── PrintOutput.java
│ ├── Required.java
│ ├── StreamingOutput.java
│ ├── interceptor
│ ├── CrestContext.java
│ ├── CrestInterceptor.java
│ └── ParameterMetadata.java
│ ├── table
│ ├── Border.java
│ ├── Table.java
│ └── TableOptions.java
│ └── validation
│ └── Validation.java
├── tomitribe-crest-archetype
├── pom.xml
└── src
│ └── main
│ └── resources
│ ├── META-INF
│ ├── LICENSE
│ ├── NOTICE
│ ├── archetype-post-generate.groovy
│ └── maven
│ │ └── archetype-metadata.xml
│ └── archetype-resources
│ ├── README.adoc
│ ├── pom.xml
│ └── src
│ ├── main
│ └── java
│ │ ├── App.java
│ │ ├── FileEditor.java
│ │ └── IsFile.java
│ └── test
│ └── java
│ └── AppTest.java
├── tomitribe-crest-arthur-extension
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── tomitribe
│ │ │ └── crest
│ │ │ └── arthur
│ │ │ ├── CrestExtension.java
│ │ │ └── feature
│ │ │ └── CrestFeature.java
│ └── resources
│ │ └── META-INF
│ │ └── services
│ │ ├── org.apache.geronimo.arthur.spi.ArthurExtension
│ │ └── org.graalvm.compiler.options.OptionDescriptors
│ └── test
│ └── java
│ └── org
│ └── tomitribe
│ └── crest
│ └── arthur
│ └── CrestExtensionTest.java
├── tomitribe-crest-cli
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── org
│ │ └── tomitribe
│ │ └── crest
│ │ └── cli
│ │ ├── api
│ │ ├── CliEnvironment.java
│ │ ├── CrestCli.java
│ │ ├── InputReader.java
│ │ ├── format
│ │ │ └── Table.java
│ │ └── interceptor
│ │ │ ├── base
│ │ │ └── ParameterVisitor.java
│ │ │ └── interactive
│ │ │ ├── Interactivable.java
│ │ │ └── InteractiveMissingParameters.java
│ │ └── impl
│ │ ├── CliEnv.java
│ │ ├── CommandParser.java
│ │ └── command
│ │ ├── JSonP.java
│ │ └── Streams.java
│ └── test
│ └── java
│ └── org
│ └── tomitribe
│ └── crest
│ └── cli
│ ├── api
│ ├── CrestCliTest.java
│ └── format
│ │ └── TableTest.java
│ └── impl
│ └── CommandParserTest.java
├── tomitribe-crest-generator
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── tomitribe
│ │ │ └── crest
│ │ │ └── generator
│ │ │ └── CrestBindingGeneratorProcessor.java
│ └── resources
│ │ └── META-INF
│ │ └── services
│ │ └── javax.annotation.processing.Processor
│ └── test
│ └── java
│ └── org
│ └── tomitribe
│ └── crest
│ └── generator
│ └── CrestBindingGeneratorProcessorTest.java
├── tomitribe-crest-test
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── org
│ │ └── tomitribe
│ │ └── crest
│ │ └── test
│ │ ├── Jar.java
│ │ ├── Jars.java
│ │ └── Java.java
│ └── test
│ └── java
│ └── org
│ └── tomitribe
│ └── crest
│ └── test
│ ├── Hello.java
│ └── JarTest.java
├── tomitribe-crest-xbean
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── tomitribe
│ │ │ └── crest
│ │ │ └── xbean
│ │ │ ├── ClasspathScanner.java
│ │ │ ├── UberJarScanner.java
│ │ │ └── XbeanScanningLoader.java
│ └── resources
│ │ └── META-INF
│ │ ├── LICENSE
│ │ ├── NOTICE
│ │ └── services
│ │ └── org.tomitribe.crest.cmds.processors.Commands$Loader
│ └── test
│ └── java
│ └── org
│ └── tomitribe
│ └── crest
│ └── xbean
│ └── XbeanScanningLoaderTest.java
├── tomitribe-crest
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── tomitribe
│ │ │ └── crest
│ │ │ ├── BashCompletion.java
│ │ │ ├── EditorLoader.java
│ │ │ ├── Exec.java
│ │ │ ├── Main.java
│ │ │ ├── Manifest.java
│ │ │ ├── cmds
│ │ │ ├── Cmd.java
│ │ │ ├── CmdGroup.java
│ │ │ ├── CmdMethod.java
│ │ │ ├── CommandFailedException.java
│ │ │ ├── Completer.java
│ │ │ ├── HelpPrintedException.java
│ │ │ ├── MissingArgumentException.java
│ │ │ ├── OverloadedCmdMethod.java
│ │ │ ├── processors
│ │ │ │ ├── Commands.java
│ │ │ │ ├── Help.java
│ │ │ │ ├── Item.java
│ │ │ │ ├── OptionParam.java
│ │ │ │ ├── Param.java
│ │ │ │ └── types
│ │ │ │ │ └── PrimitiveTypes.java
│ │ │ ├── targets
│ │ │ │ ├── SimpleBean.java
│ │ │ │ ├── Substitution.java
│ │ │ │ └── Target.java
│ │ │ └── utils
│ │ │ │ └── CommandLine.java
│ │ │ ├── contexts
│ │ │ ├── DefaultsContext.java
│ │ │ ├── EnvDefaultsContext.java
│ │ │ └── SystemPropertiesDefaultsContext.java
│ │ │ ├── environments
│ │ │ ├── Environment.java
│ │ │ └── SystemEnvironment.java
│ │ │ ├── help
│ │ │ ├── Bullet.java
│ │ │ ├── CommandJavadoc.java
│ │ │ ├── Document.java
│ │ │ ├── DocumentFormatter.java
│ │ │ ├── DocumentParser.java
│ │ │ ├── Element.java
│ │ │ ├── Heading.java
│ │ │ ├── HelpProcessor.java
│ │ │ ├── Highlight.java
│ │ │ ├── HtmlDocumentParser.java
│ │ │ ├── IllegalElementException.java
│ │ │ ├── InvalidJavadocFileException.java
│ │ │ ├── Justify.java
│ │ │ ├── Option.java
│ │ │ ├── Paragraph.java
│ │ │ ├── Preformatted.java
│ │ │ └── Wrap.java
│ │ │ ├── interceptor
│ │ │ ├── InterceptorAnnotationNotFoundException.java
│ │ │ ├── UnresolvedInterceptorAnnotationException.java
│ │ │ ├── internal
│ │ │ │ ├── InternalInterceptor.java
│ │ │ │ └── InternalInterceptorInvocationContext.java
│ │ │ └── security
│ │ │ │ ├── RoleProvider.java
│ │ │ │ └── SecurityInterceptor.java
│ │ │ ├── javadoc
│ │ │ ├── Javadoc.java
│ │ │ └── JavadocParser.java
│ │ │ ├── lang
│ │ │ └── Substitutor.java
│ │ │ ├── table
│ │ │ ├── Border.java
│ │ │ ├── Data.java
│ │ │ ├── Formatting.java
│ │ │ ├── Line.java
│ │ │ ├── Lines.java
│ │ │ ├── Options.java
│ │ │ ├── Parts.java
│ │ │ ├── Resize.java
│ │ │ ├── Table.java
│ │ │ ├── TableInterceptor.java
│ │ │ ├── TableOutput.java
│ │ │ ├── Tables.java
│ │ │ └── Width.java
│ │ │ ├── term
│ │ │ └── Screen.java
│ │ │ └── val
│ │ │ ├── BVal05.java
│ │ │ ├── BeanValidation.java
│ │ │ ├── BeanValidation11.java
│ │ │ ├── BeanValidationImpl.java
│ │ │ ├── BeanValidationMessages.java
│ │ │ ├── BuiltInValidation.java
│ │ │ ├── ConstraintAdapter.java
│ │ │ ├── Directory.java
│ │ │ ├── Executable.java
│ │ │ ├── Exists.java
│ │ │ ├── Readable.java
│ │ │ └── Writable.java
│ └── resources
│ │ ├── META-INF
│ │ ├── LICENSE
│ │ └── NOTICE
│ │ ├── ValidationMessages.properties
│ │ ├── ValidationMessages_en.properties
│ │ └── ValidationMessages_pt_BR.properties
│ └── test
│ ├── java
│ └── org
│ │ └── tomitribe
│ │ └── crest
│ │ ├── AdvancedArrayArgTest.java
│ │ ├── Archives.java
│ │ ├── ArgArraysTest.java
│ │ ├── ArgListsTest.java
│ │ ├── BashCompletionTest.java
│ │ ├── BeanValidationTest.java
│ │ ├── BenInjectionPrefixTest.java
│ │ ├── BooleanOptionsTest.java
│ │ ├── Cli.java
│ │ ├── CmdMethodTest.java
│ │ ├── CommandNameAndVersionTest.java
│ │ ├── CompleterTest.java
│ │ ├── Crest.java
│ │ ├── DefaultInterpolationTest.java
│ │ ├── DefaultListOptionSplittingTest.java
│ │ ├── DefaultOptionListsAndOptionsTest.java
│ │ ├── DefaultOptionListsTest.java
│ │ ├── DefaultOptionsAndSuppliedArgsTest.java
│ │ ├── DefaultSubstitutionTest.java
│ │ ├── EditorInLoaderTest.java
│ │ ├── EnumOptionListTest.java
│ │ ├── ExceptionHandlingTest.java
│ │ ├── ExplicitPrimitiveOptionDefaultsTest.java
│ │ ├── Foo.java
│ │ ├── HelpTest.java
│ │ ├── HelpWithInnerOptionsTest.java
│ │ ├── ImplicitPrimitiveOptionDefaultsTest.java
│ │ ├── InterceptorTest.java
│ │ ├── Java.java
│ │ ├── MainBuilderTest.java
│ │ ├── MainTest.java
│ │ ├── ManifestTest.java
│ │ ├── ManyOptionTest.java
│ │ ├── MissingArgumentTest.java
│ │ ├── NullableOptionsTest.java
│ │ ├── OptionArraysTest.java
│ │ ├── OptionListsTest.java
│ │ ├── OptionsObjectAdvancedArrayArgTest.java
│ │ ├── OptionsObjectTest.java
│ │ ├── OptionsObjectValidationTest.java
│ │ ├── OverloadedCmdHelpTest.java
│ │ ├── OverloadedCmdMethodTest.java
│ │ ├── PluggableDefaultParsingTest.java
│ │ ├── PrimitiveTypesTest.java
│ │ ├── ServiceInjectionTest.java
│ │ ├── SomeOptionsAndSuppliedArgsTest.java
│ │ ├── StreamInjectionTest.java
│ │ ├── SubCommandsTest.java
│ │ ├── SubstitutionTest.java
│ │ ├── SupportedCollectionTypesTest.java
│ │ ├── SystemPropertiesTest.java
│ │ ├── ValidationTest.java
│ │ ├── VarargStreamTest.java
│ │ ├── cmds
│ │ └── utils
│ │ │ └── CommandLineTest.java
│ │ ├── help
│ │ ├── AuthorTest.java
│ │ ├── DefaultsShownTest.java
│ │ ├── DocumentFormatterTest.java
│ │ ├── DocumentParserTest.java
│ │ ├── GenericsInMethodSignatureTest.java
│ │ ├── HighlightTest.java
│ │ ├── JavadocHelpComplexTest.java
│ │ ├── JustifyTest.java
│ │ ├── ManualTest.java
│ │ ├── ParamWithPreformattedTextTest.java
│ │ ├── RsyncManPage.java
│ │ ├── SeeAlsoTest.java
│ │ ├── SubcommandTest.java
│ │ ├── TestEnvironment.java
│ │ └── WrapTest.java
│ │ ├── interceptor
│ │ ├── CustomInterceptorAnnotationTest.java
│ │ └── security
│ │ │ └── SecurityInterceptorTest.java
│ │ ├── javadoc
│ │ └── JavadocParserTest.java
│ │ ├── returns
│ │ └── ReturnStringArrayArrayTest.java
│ │ ├── table
│ │ ├── DataTest.java
│ │ ├── FormattingItemTest.java
│ │ ├── FormattingTest.java
│ │ ├── PartsTest.java
│ │ ├── TableBorderNoHeaderTest.java
│ │ ├── TableBorderTest.java
│ │ ├── TableFieldsTest.java
│ │ ├── TableHeaderTest.java
│ │ ├── TableOptionsTest.java
│ │ ├── TableSortTest.java
│ │ ├── TableTest.java
│ │ ├── TableWrappingTest.java
│ │ └── WidthTest.java
│ │ └── util
│ │ ├── ConverterTest.java
│ │ ├── DurationTest.java
│ │ ├── SizeTest.java
│ │ ├── SizeUnitTest.java
│ │ └── TimeUtilsTest.java
│ └── resources
│ ├── TableBorderNoHeaderTest
│ ├── asciiCompact.txt
│ ├── asciiDots.txt
│ ├── asciiSeparated.txt
│ ├── githubMarkdown.txt
│ ├── mysqlStyle.txt
│ ├── reStructuredTextGrid.txt
│ ├── reStructuredTextSimple.txt
│ ├── redditMarkdown.txt
│ ├── unicodeDouble.txt
│ ├── unicodeSingle.txt
│ ├── unicodeSingleSeparated.txt
│ ├── whitespaceCompact.txt
│ └── whitespaceSeparated.txt
│ ├── TableBorderTest
│ ├── asciiCompact.txt
│ ├── asciiDots.txt
│ ├── asciiSeparated.txt
│ ├── githubMarkdown.txt
│ ├── mysqlStyle.txt
│ ├── reStructuredTextGrid.txt
│ ├── reStructuredTextSimple.txt
│ ├── redditMarkdown.txt
│ ├── unicodeDouble.txt
│ ├── unicodeSingle.txt
│ ├── unicodeSingleSeparated.txt
│ ├── whitespaceCompact.txt
│ └── whitespaceSeparated.txt
│ ├── completion
│ ├── booleanoption.sh
│ ├── defaults.sh
│ ├── enums.sh
│ ├── foo.sh
│ ├── groups.sh
│ └── overloaded.sh
│ ├── help
│ ├── org.tomitribe.crest.AdvancedArrayArgTest$OneExtra_copy.txt
│ ├── org.tomitribe.crest.AdvancedArrayArgTest$RequiredList_copy.txt
│ ├── org.tomitribe.crest.AdvancedArrayArgTest$TwoExtra_copy.txt
│ ├── org.tomitribe.crest.ArgArraysTest$Commands_doBoolean.txt
│ ├── org.tomitribe.crest.ArgArraysTest$Commands_doByte.txt
│ ├── org.tomitribe.crest.ArgArraysTest$Commands_doChar.txt
│ ├── org.tomitribe.crest.ArgArraysTest$Commands_doDouble.txt
│ ├── org.tomitribe.crest.ArgArraysTest$Commands_doFloat.txt
│ ├── org.tomitribe.crest.ArgArraysTest$Commands_doInt.txt
│ ├── org.tomitribe.crest.ArgArraysTest$Commands_doLong.txt
│ ├── org.tomitribe.crest.ArgArraysTest$Commands_doShort.txt
│ ├── org.tomitribe.crest.ArgArraysTest$Commands_doString.txt
│ ├── org.tomitribe.crest.ArgArraysTest$Commands_doURI.txt
│ ├── org.tomitribe.crest.ArgListsTest$Commands_doBoolean.txt
│ ├── org.tomitribe.crest.ArgListsTest$Commands_doByte.txt
│ ├── org.tomitribe.crest.ArgListsTest$Commands_doCharacter.txt
│ ├── org.tomitribe.crest.ArgListsTest$Commands_doDouble.txt
│ ├── org.tomitribe.crest.ArgListsTest$Commands_doFloat.txt
│ ├── org.tomitribe.crest.ArgListsTest$Commands_doInt.txt
│ ├── org.tomitribe.crest.ArgListsTest$Commands_doLong.txt
│ ├── org.tomitribe.crest.ArgListsTest$Commands_doShort.txt
│ ├── org.tomitribe.crest.ArgListsTest$Commands_doString.txt
│ ├── org.tomitribe.crest.ArgListsTest$Commands_doURI.txt
│ ├── org.tomitribe.crest.BeanValidationTest$Duplicates_check.txt
│ ├── org.tomitribe.crest.BeanValidationTest$Duplicates_empty.txt
│ ├── org.tomitribe.crest.BooleanOptionsTest$Commands_object.txt
│ ├── org.tomitribe.crest.BooleanOptionsTest$Commands_object2.txt
│ ├── org.tomitribe.crest.BooleanOptionsTest$Commands_object3.txt
│ ├── org.tomitribe.crest.BooleanOptionsTest$Commands_primitive.txt
│ ├── org.tomitribe.crest.BooleanOptionsTest$Commands_primitive2.txt
│ ├── org.tomitribe.crest.BooleanOptionsTest$Commands_primitive3.txt
│ ├── org.tomitribe.crest.CmdMethodTest$Commands_booleanOption.txt
│ ├── org.tomitribe.crest.CmdMethodTest$Commands_cat.txt
│ ├── org.tomitribe.crest.CmdMethodTest$Commands_ls.txt
│ ├── org.tomitribe.crest.CmdMethodTest$Commands_prefixed.txt
│ ├── org.tomitribe.crest.CmdMethodTest$Commands_required.txt
│ ├── org.tomitribe.crest.CmdMethodTest$Commands_set.txt
│ ├── org.tomitribe.crest.CmdMethodTest$Commands_tail.txt
│ ├── org.tomitribe.crest.CmdMethodTest$Commands_tar.txt
│ ├── org.tomitribe.crest.CmdMethodTest$Commands_touch.txt
│ ├── org.tomitribe.crest.CompleterTest$Copy_copy.txt
│ ├── org.tomitribe.crest.CompleterTest$Foo_blue.txt
│ ├── org.tomitribe.crest.CompleterTest$Foo_green.txt
│ ├── org.tomitribe.crest.CompleterTest$Foo_red.txt
│ ├── org.tomitribe.crest.CompleterTest$Git_git.txt
│ ├── org.tomitribe.crest.CompleterTest$Git_git_push.txt
│ ├── org.tomitribe.crest.CompleterTest$Svn_svn.txt
│ ├── org.tomitribe.crest.CompleterTest$Svn_svn_checkout.txt
│ ├── org.tomitribe.crest.CompleterTest$Svn_svn_commit.txt
│ ├── org.tomitribe.crest.DefaultListOptionSplittingTest$Commands_onComma.txt
│ ├── org.tomitribe.crest.DefaultListOptionSplittingTest$Commands_onTab.txt
│ ├── org.tomitribe.crest.DefaultListOptionSplittingTest$Commands_onUnicode.txt
│ ├── org.tomitribe.crest.DefaultListOptionSplittingTest$Commands_onlyBeforeSubstition.txt
│ ├── org.tomitribe.crest.DefaultOptionListsAndOptionsTest$Commands_doBoolean.txt
│ ├── org.tomitribe.crest.DefaultOptionListsAndOptionsTest$Commands_doByte.txt
│ ├── org.tomitribe.crest.DefaultOptionListsAndOptionsTest$Commands_doCharacter.txt
│ ├── org.tomitribe.crest.DefaultOptionListsAndOptionsTest$Commands_doDouble.txt
│ ├── org.tomitribe.crest.DefaultOptionListsAndOptionsTest$Commands_doFloat.txt
│ ├── org.tomitribe.crest.DefaultOptionListsAndOptionsTest$Commands_doInt.txt
│ ├── org.tomitribe.crest.DefaultOptionListsAndOptionsTest$Commands_doLong.txt
│ ├── org.tomitribe.crest.DefaultOptionListsAndOptionsTest$Commands_doShort.txt
│ ├── org.tomitribe.crest.DefaultOptionListsAndOptionsTest$Commands_doString.txt
│ ├── org.tomitribe.crest.DefaultOptionListsAndOptionsTest$Commands_doURI.txt
│ ├── org.tomitribe.crest.DefaultOptionListsTest$Commands_doBoolean.txt
│ ├── org.tomitribe.crest.DefaultOptionListsTest$Commands_doByte.txt
│ ├── org.tomitribe.crest.DefaultOptionListsTest$Commands_doCharacter.txt
│ ├── org.tomitribe.crest.DefaultOptionListsTest$Commands_doDouble.txt
│ ├── org.tomitribe.crest.DefaultOptionListsTest$Commands_doFloat.txt
│ ├── org.tomitribe.crest.DefaultOptionListsTest$Commands_doInt.txt
│ ├── org.tomitribe.crest.DefaultOptionListsTest$Commands_doLong.txt
│ ├── org.tomitribe.crest.DefaultOptionListsTest$Commands_doShort.txt
│ ├── org.tomitribe.crest.DefaultOptionListsTest$Commands_doString.txt
│ ├── org.tomitribe.crest.DefaultOptionListsTest$Commands_doURI.txt
│ ├── org.tomitribe.crest.DefaultOptionsAndSuppliedArgsTest$Commands_doBoolean.txt
│ ├── org.tomitribe.crest.DefaultOptionsAndSuppliedArgsTest$Commands_doByte.txt
│ ├── org.tomitribe.crest.DefaultOptionsAndSuppliedArgsTest$Commands_doChar.txt
│ ├── org.tomitribe.crest.DefaultOptionsAndSuppliedArgsTest$Commands_doDouble.txt
│ ├── org.tomitribe.crest.DefaultOptionsAndSuppliedArgsTest$Commands_doFloat.txt
│ ├── org.tomitribe.crest.DefaultOptionsAndSuppliedArgsTest$Commands_doInt.txt
│ ├── org.tomitribe.crest.DefaultOptionsAndSuppliedArgsTest$Commands_doLong.txt
│ ├── org.tomitribe.crest.DefaultOptionsAndSuppliedArgsTest$Commands_doMixed.txt
│ ├── org.tomitribe.crest.DefaultOptionsAndSuppliedArgsTest$Commands_doShort.txt
│ ├── org.tomitribe.crest.DefaultOptionsAndSuppliedArgsTest$Commands_doString.txt
│ ├── org.tomitribe.crest.DefaultOptionsAndSuppliedArgsTest$Commands_doURI.txt
│ ├── org.tomitribe.crest.DefaultSubstitutionTest$Commands_doAllExplicit.txt
│ ├── org.tomitribe.crest.DefaultSubstitutionTest$Commands_doRelyOnDefaults.txt
│ ├── org.tomitribe.crest.EnumOptionListTest$Commands_array.txt
│ ├── org.tomitribe.crest.EnumOptionListTest$Commands_list.txt
│ ├── org.tomitribe.crest.ExplicitPrimitiveOptionDefaultsTest$Commands_doAll.txt
│ ├── org.tomitribe.crest.ExplicitPrimitiveOptionDefaultsTest$Commands_doBoolean.txt
│ ├── org.tomitribe.crest.ExplicitPrimitiveOptionDefaultsTest$Commands_doByte.txt
│ ├── org.tomitribe.crest.ExplicitPrimitiveOptionDefaultsTest$Commands_doChar.txt
│ ├── org.tomitribe.crest.ExplicitPrimitiveOptionDefaultsTest$Commands_doDouble.txt
│ ├── org.tomitribe.crest.ExplicitPrimitiveOptionDefaultsTest$Commands_doFloat.txt
│ ├── org.tomitribe.crest.ExplicitPrimitiveOptionDefaultsTest$Commands_doInt.txt
│ ├── org.tomitribe.crest.ExplicitPrimitiveOptionDefaultsTest$Commands_doLong.txt
│ ├── org.tomitribe.crest.ExplicitPrimitiveOptionDefaultsTest$Commands_doShort.txt
│ ├── org.tomitribe.crest.HelpTest$DefaultsAndEnums_test.txt
│ ├── org.tomitribe.crest.HelpTest$Git_git.txt
│ ├── org.tomitribe.crest.HelpTest$Git_git_pull.txt
│ ├── org.tomitribe.crest.HelpTest$Git_git_push.txt
│ ├── org.tomitribe.crest.HelpTest$OptionLists_test.txt
│ ├── org.tomitribe.crest.HelpTest$Rsync_rsync.txt
│ ├── org.tomitribe.crest.HelpWithInnerOptionsTest$DefaultsAndEnums_test.txt
│ ├── org.tomitribe.crest.HelpWithInnerOptionsTest$OptionLists_test.txt
│ ├── org.tomitribe.crest.HelpWithInnerOptionsTest$Rsync_rsync.txt
│ ├── org.tomitribe.crest.ImplicitPrimitiveOptionDefaultsTest$Commands_doAll.txt
│ ├── org.tomitribe.crest.ImplicitPrimitiveOptionDefaultsTest$Commands_doBoolean.txt
│ ├── org.tomitribe.crest.ImplicitPrimitiveOptionDefaultsTest$Commands_doByte.txt
│ ├── org.tomitribe.crest.ImplicitPrimitiveOptionDefaultsTest$Commands_doChar.txt
│ ├── org.tomitribe.crest.ImplicitPrimitiveOptionDefaultsTest$Commands_doDouble.txt
│ ├── org.tomitribe.crest.ImplicitPrimitiveOptionDefaultsTest$Commands_doFloat.txt
│ ├── org.tomitribe.crest.ImplicitPrimitiveOptionDefaultsTest$Commands_doInt.txt
│ ├── org.tomitribe.crest.ImplicitPrimitiveOptionDefaultsTest$Commands_doLong.txt
│ ├── org.tomitribe.crest.ImplicitPrimitiveOptionDefaultsTest$Commands_doShort.txt
│ ├── org.tomitribe.crest.MainTest$Foo_blue.txt
│ ├── org.tomitribe.crest.MainTest$Foo_green.txt
│ ├── org.tomitribe.crest.MainTest$Foo_red.txt
│ ├── org.tomitribe.crest.ManyOptionTest$Commands_doString.txt
│ ├── org.tomitribe.crest.ManyOptionTest$Commands_rsync.txt
│ ├── org.tomitribe.crest.OptionArraysTest$Commands_doBoolean.txt
│ ├── org.tomitribe.crest.OptionArraysTest$Commands_doByte.txt
│ ├── org.tomitribe.crest.OptionArraysTest$Commands_doChar.txt
│ ├── org.tomitribe.crest.OptionArraysTest$Commands_doDouble.txt
│ ├── org.tomitribe.crest.OptionArraysTest$Commands_doFloat.txt
│ ├── org.tomitribe.crest.OptionArraysTest$Commands_doInt.txt
│ ├── org.tomitribe.crest.OptionArraysTest$Commands_doLong.txt
│ ├── org.tomitribe.crest.OptionArraysTest$Commands_doShort.txt
│ ├── org.tomitribe.crest.OptionArraysTest$Commands_doString.txt
│ ├── org.tomitribe.crest.OptionArraysTest$Commands_doURI.txt
│ ├── org.tomitribe.crest.OptionListsTest$Commands_doBoolean.txt
│ ├── org.tomitribe.crest.OptionListsTest$Commands_doByte.txt
│ ├── org.tomitribe.crest.OptionListsTest$Commands_doCharacter.txt
│ ├── org.tomitribe.crest.OptionListsTest$Commands_doDouble.txt
│ ├── org.tomitribe.crest.OptionListsTest$Commands_doFloat.txt
│ ├── org.tomitribe.crest.OptionListsTest$Commands_doInt.txt
│ ├── org.tomitribe.crest.OptionListsTest$Commands_doLong.txt
│ ├── org.tomitribe.crest.OptionListsTest$Commands_doShort.txt
│ ├── org.tomitribe.crest.OptionListsTest$Commands_doString.txt
│ ├── org.tomitribe.crest.OptionListsTest$Commands_doURI.txt
│ ├── org.tomitribe.crest.OptionsObjectAdvancedArrayArgTest$Commands_args.txt
│ ├── org.tomitribe.crest.OptionsObjectAdvancedArrayArgTest$Commands_complex.txt
│ ├── org.tomitribe.crest.OptionsObjectAdvancedArrayArgTest$Commands_complex2.txt
│ ├── org.tomitribe.crest.OptionsObjectAdvancedArrayArgTest$Commands_complex3.txt
│ ├── org.tomitribe.crest.OptionsObjectAdvancedArrayArgTest$Commands_complex4.txt
│ ├── org.tomitribe.crest.OptionsObjectAdvancedArrayArgTest$Commands_complex5.txt
│ ├── org.tomitribe.crest.OptionsObjectAdvancedArrayArgTest$Commands_mixed.txt
│ ├── org.tomitribe.crest.OptionsObjectAdvancedArrayArgTest$Commands_options.txt
│ ├── org.tomitribe.crest.OptionsObjectAdvancedArrayArgTest$Commands_optionsAndArgs.txt
│ ├── org.tomitribe.crest.OptionsObjectAdvancedArrayArgTest$Commands_simple.txt
│ ├── org.tomitribe.crest.OptionsObjectAdvancedArrayArgTest$Commands_twoBeans.txt
│ ├── org.tomitribe.crest.OptionsObjectTest$Commands_args.txt
│ ├── org.tomitribe.crest.OptionsObjectTest$Commands_mixed.txt
│ ├── org.tomitribe.crest.OptionsObjectTest$Commands_options.txt
│ ├── org.tomitribe.crest.OptionsObjectTest$Commands_optionsAndArgs.txt
│ ├── org.tomitribe.crest.OptionsObjectTest$Commands_twoBeans.txt
│ ├── org.tomitribe.crest.OptionsObjectValidationTest$Commands_validation.txt
│ ├── org.tomitribe.crest.OverloadedCmdMethodTest$TestCommands_help.txt
│ ├── org.tomitribe.crest.PluggableDefaultParsingTest$Orange_defaults.txt
│ ├── org.tomitribe.crest.PluggableDefaultParsingTest$Orange_property.txt
│ ├── org.tomitribe.crest.SomeOptionsAndSuppliedArgsTest$Commands_doBoolean.txt
│ ├── org.tomitribe.crest.SomeOptionsAndSuppliedArgsTest$Commands_doByte.txt
│ ├── org.tomitribe.crest.SomeOptionsAndSuppliedArgsTest$Commands_doChar.txt
│ ├── org.tomitribe.crest.SomeOptionsAndSuppliedArgsTest$Commands_doDouble.txt
│ ├── org.tomitribe.crest.SomeOptionsAndSuppliedArgsTest$Commands_doFloat.txt
│ ├── org.tomitribe.crest.SomeOptionsAndSuppliedArgsTest$Commands_doInt.txt
│ ├── org.tomitribe.crest.SomeOptionsAndSuppliedArgsTest$Commands_doLong.txt
│ ├── org.tomitribe.crest.SomeOptionsAndSuppliedArgsTest$Commands_doMixed.txt
│ ├── org.tomitribe.crest.SomeOptionsAndSuppliedArgsTest$Commands_doShort.txt
│ ├── org.tomitribe.crest.SomeOptionsAndSuppliedArgsTest$Commands_doString.txt
│ ├── org.tomitribe.crest.SomeOptionsAndSuppliedArgsTest$Commands_doURI.txt
│ ├── org.tomitribe.crest.SubCommandsTest$Git_git.txt
│ ├── org.tomitribe.crest.SubCommandsTest$Git_git_pull.txt
│ ├── org.tomitribe.crest.SubCommandsTest$Git_git_push.txt
│ ├── org.tomitribe.crest.SystemPropertiesTest$Orange_defaults.txt
│ └── org.tomitribe.crest.SystemPropertiesTest$Orange_property.txt
│ ├── man
│ ├── expected-106.txt
│ ├── expected-178.txt
│ ├── expected-86.txt
│ └── input-markdown.txt
│ └── org
│ └── tomitribe
│ └── crest
│ ├── OptionDescriptions.properties
│ └── OptionDescriptions_en.properties
└── toolz
├── pom.xml
└── src
├── main
├── java
│ └── org
│ │ └── example
│ │ └── toolz
│ │ ├── AnyName.java
│ │ ├── App.java
│ │ └── IsFile.java
└── resources
│ ├── META-INF
│ ├── LICENSE
│ └── NOTICE
│ └── org
│ └── example
│ └── toolz
│ └── OptionDescriptions.properties
└── test
└── java
└── org
└── example
└── toolz
└── AppTest.java
/.drone.yml:
--------------------------------------------------------------------------------
1 | build:
2 | image: teaci/cygwin32
3 | shell: cygwin32
4 | pull: true
5 | commands:
6 | - cmd /c c:/cygwin-installer.exe --site http://mirrors.tea-ci.org/cygwin --local-package-dir Z:/tmp/cygwin -W -P cabextract,unzip -q
7 | - echo '' > run.bat
8 | - wget http://repo.apache.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip
9 | - unzip apache-maven-3.3.9-bin.zip
10 | - wget '--header' 'Cookie:oraclelicense=accept-securebackup-cookie' '--no-cookies' '--no-check-certificate' "http://download.oracle.com/otn-pub/java/jdk/8u91-b15/jdk-8u91-windows-i586.exe"
11 | - chmod ogu+rwx jdk-8u91-windows-i586.exe
12 | - cabextract jdk-8u91-windows-i586.exe || echo "ignoring errors"
13 | - mkdir jdk && mv tools.zip jdk && cd jdk && unzip tools.zip && for i in jre/lib/charsets jre/lib/deploy jre/lib/ext/localedata jre/lib/javaws jre/lib/jsse jre/lib/plugin jre/lib/rt lib/tools; do ./bin/unpack200 -r -v -l "" $i.pack $i.jar; done && cd -
14 | - echo set JAVA_HOME=$(cygpath.exe --windows $PWD/jdk) > run.bat
15 | - echo set M2_HOME=$(cygpath.exe --windows $PWD/apache-maven-3.3.9) >> run.bat
16 | - echo 'set Path=%JAVA_HOME%\bin;%M2_HOME%\bin;%Path%' >> run.bat
17 | - echo '%JAVA_HOME%\bin\java -cp %M2_HOME%\boot\plexus-classworlds-2.5.2.jar -Dclassworlds.conf=%M2_HOME%/bin/m2.conf -Dmaven.home=%M2_HOME% -Dmaven.multiModuleProjectDirectory=. org.codehaus.plexus.classworlds.launcher.Launcher clean install' >> run.bat
18 | - cmd /c run.bat
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Java #
2 | *.class
3 |
4 |
5 | # Package Files #
6 | *.jar
7 | *.war
8 | *.ear
9 |
10 | # IDEA #
11 | *.iml
12 | .idea
13 | *~
14 |
15 | # eclipse specific git ignore
16 | .project
17 | .metadata
18 | .classpath
19 | .settings/
20 |
21 |
22 | # Maven files #
23 | target/
24 | pom.xml.tag
25 | pom.xml.releaseBackup
26 | pom.xml.next
27 | release.properties
28 | dependency-reduced-pom.xml
29 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 | before_script:
3 | - export MAVEN_SKIP_RC=true
4 | jdk:
5 | - openjdk7
6 | - oraclejdk8
7 |
--------------------------------------------------------------------------------
/tomitribe-crest-api/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
20 |
21 |
22 |
23 | 4.0.0
24 |
25 |
26 | org.tomitribe
27 | tomitribe-crest-parent
28 | 0.36-SNAPSHOT
29 |
30 |
31 | tomitribe-crest-api
32 | jar
33 | Tomitribe :: Crest :: API
34 |
35 |
36 | ${project.groupId}.crest.api
37 |
38 |
39 |
--------------------------------------------------------------------------------
/tomitribe-crest-api/src/main/java/org/tomitribe/crest/api/Command.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.api;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * @version $Revision$ $Date$
26 | */
27 | @Retention(value = RetentionPolicy.RUNTIME)
28 | @Target({ElementType.METHOD, ElementType.TYPE})
29 | public @interface Command {
30 | String value() default "";
31 |
32 | String usage() default "";
33 |
34 | Class>[] interceptedBy() default {};
35 | }
36 |
--------------------------------------------------------------------------------
/tomitribe-crest-api/src/main/java/org/tomitribe/crest/api/CrestAnnotation.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.api;
18 |
19 | import java.lang.annotation.Retention;
20 |
21 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
22 |
23 | @Retention(RUNTIME)
24 | public @interface CrestAnnotation {
25 | boolean skipUsage() default false;
26 | }
27 |
--------------------------------------------------------------------------------
/tomitribe-crest-api/src/main/java/org/tomitribe/crest/api/Default.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.api;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * @version $Revision$ $Date$
26 | */
27 | @Retention(value = RetentionPolicy.RUNTIME)
28 | @Target(value = ElementType.PARAMETER)
29 | public @interface Default {
30 | String value();
31 | }
32 |
--------------------------------------------------------------------------------
/tomitribe-crest-api/src/main/java/org/tomitribe/crest/api/Defaults.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.api;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Repeatable;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * override defaults for a parameter bean.
27 | */
28 | @Retention(value = RetentionPolicy.RUNTIME)
29 | @Target(value = ElementType.PARAMETER)
30 | public @interface Defaults {
31 | DefaultMapping[] value();
32 |
33 | @Repeatable(Defaults.class)
34 | @Retention(value = RetentionPolicy.RUNTIME)
35 | @Target(value = ElementType.PARAMETER)
36 | @interface DefaultMapping {
37 | /**
38 | * @return short name (without prefix) of the parameter.
39 | */
40 | String name();
41 |
42 | /**
43 | * @return parameter default value.
44 | */
45 | String value();
46 |
47 | /**
48 | * @return overriden description for the parameter.
49 | */
50 | String description() default "";
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/tomitribe-crest-api/src/main/java/org/tomitribe/crest/api/Editor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.tomitribe.crest.api;
19 |
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | @Retention(value = RetentionPolicy.RUNTIME)
26 | @Target({ ElementType.TYPE})
27 | public @interface Editor {
28 | Class> value();
29 | }
30 |
--------------------------------------------------------------------------------
/tomitribe-crest-api/src/main/java/org/tomitribe/crest/api/Err.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.api;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | @CrestAnnotation(skipUsage = true)
25 | @Retention(RetentionPolicy.RUNTIME)
26 | @Target(ElementType.PARAMETER)
27 | public @interface Err {
28 | }
29 |
--------------------------------------------------------------------------------
/tomitribe-crest-api/src/main/java/org/tomitribe/crest/api/Exit.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.api;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * Usable on an exception type to indicate the
26 | * status code that should be returned
27 | *
28 | * The message of the exception will be printed
29 | *
30 | * @version $Revision$ $Date$
31 | */
32 | @Retention(value = RetentionPolicy.RUNTIME)
33 | @Target(ElementType.TYPE)
34 | public @interface Exit {
35 | int value();
36 |
37 | boolean help() default false;
38 | }
39 |
--------------------------------------------------------------------------------
/tomitribe-crest-api/src/main/java/org/tomitribe/crest/api/In.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.api;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | @CrestAnnotation(skipUsage = true)
25 | @Retention(RetentionPolicy.RUNTIME)
26 | @Target(ElementType.PARAMETER)
27 | public @interface In {
28 | }
29 |
--------------------------------------------------------------------------------
/tomitribe-crest-api/src/main/java/org/tomitribe/crest/api/Loader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.api;
18 |
19 | import java.util.ArrayList;
20 | import java.util.Arrays;
21 | import java.util.Iterator;
22 | import java.util.List;
23 |
24 | /**
25 | * Interface whose only purpose is to be used in conjunction
26 | * with the java.util.ServiceLoader API as one potential
27 | * way to load the list of classes that have commands.
28 | *
29 | * This interface intentionally has zero methods and never will
30 | * so that the simplest implementation is a plain java.util.ArrayList
31 | * (or pick your favorite collection)
32 | *
33 | * This interface is intentionally not used in any method or constructor of crest.
34 | */
35 | public interface Loader extends Iterable> {
36 |
37 | static Iterator> of(final Class> commandClass, final Class>... commandClasses) {
38 | final List> list = new ArrayList<>();
39 | list.add(commandClass);
40 | list.addAll(Arrays.asList(commandClasses));
41 | return list.iterator();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/tomitribe-crest-api/src/main/java/org/tomitribe/crest/api/NotAService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.api;
18 |
19 | import java.lang.annotation.Retention;
20 | import java.lang.annotation.Target;
21 |
22 | import static java.lang.annotation.ElementType.PARAMETER;
23 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
24 |
25 | /**
26 | * intended to skip service injection tentative for this parameter if other tries failed.
27 | */
28 | @Retention(RUNTIME)
29 | @Target(PARAMETER)
30 | public @interface NotAService {
31 | }
32 |
--------------------------------------------------------------------------------
/tomitribe-crest-api/src/main/java/org/tomitribe/crest/api/Option.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.api;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * @version $Revision$ $Date$
26 | */
27 | @Retention(value = RetentionPolicy.RUNTIME)
28 | @Target(value = ElementType.PARAMETER)
29 | public @interface Option {
30 | String[] value();
31 | String description() default "";
32 | }
33 |
--------------------------------------------------------------------------------
/tomitribe-crest-api/src/main/java/org/tomitribe/crest/api/Options.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.api;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * @version $Revision$ $Date$
26 | */
27 | @Retention(value = RetentionPolicy.RUNTIME)
28 | @Target(value = ElementType.TYPE)
29 | public @interface Options {
30 | /**
31 | * Allow to get null instead of a wrapper instance initialized from defaults.
32 | *
33 | * @return true if the parameter can be null if no value is set from the command line, false otherwise.
34 | */
35 | boolean nillable() default false;
36 | }
37 |
--------------------------------------------------------------------------------
/tomitribe-crest-api/src/main/java/org/tomitribe/crest/api/Out.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.api;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | @CrestAnnotation(skipUsage = true)
25 | @Retention(RetentionPolicy.RUNTIME)
26 | @Target(ElementType.PARAMETER)
27 | public @interface Out {
28 | }
29 |
--------------------------------------------------------------------------------
/tomitribe-crest-api/src/main/java/org/tomitribe/crest/api/PrintOutput.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.api;
18 |
19 | import java.io.IOException;
20 | import java.io.PrintStream;
21 |
22 | public interface PrintOutput {
23 | public void write(final PrintStream os) throws IOException;
24 | }
25 |
--------------------------------------------------------------------------------
/tomitribe-crest-api/src/main/java/org/tomitribe/crest/api/Required.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.api;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * @version $Revision$ $Date$
26 | */
27 | @Retention(value = RetentionPolicy.RUNTIME)
28 | @Target(value = ElementType.PARAMETER)
29 | public @interface Required {
30 | }
31 |
--------------------------------------------------------------------------------
/tomitribe-crest-api/src/main/java/org/tomitribe/crest/api/StreamingOutput.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.api;
18 |
19 | import java.io.IOException;
20 | import java.io.OutputStream;
21 |
22 | public interface StreamingOutput {
23 | public void write(OutputStream os) throws IOException;
24 | }
25 |
--------------------------------------------------------------------------------
/tomitribe-crest-api/src/main/java/org/tomitribe/crest/api/interceptor/CrestContext.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.api.interceptor;
18 |
19 | import java.lang.reflect.Method;
20 | import java.util.List;
21 |
22 | public interface CrestContext {
23 | /**
24 | * @return continue the execution of the command.
25 | */
26 | Object proceed();
27 |
28 | /**
29 | * @return get the command method.
30 | */
31 | Method getMethod();
32 |
33 | /**
34 | * @return get the mutable list of command parameters.
35 | */
36 | List
")) return true;
36 | if (content.contains("
")) return true;
37 | if (content.contains("
")) return true;
38 | if (content.contains("
")) return true;
39 | return false;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/tomitribe-crest/src/main/java/org/tomitribe/crest/help/IllegalElementException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.help;
18 |
19 | import javax.lang.model.element.ExecutableElement;
20 |
21 | public class IllegalElementException extends RuntimeException {
22 | public IllegalElementException(final String s, final ExecutableElement executableElement) {
23 | this(s, executableElement, null);
24 | }
25 |
26 | public IllegalElementException(final String s, final ExecutableElement executableElement, final Throwable t) {
27 | super(String.format("%s: class %s, method %s",
28 | s,
29 | executableElement.getEnclosingElement(),
30 | executableElement.getSimpleName()
31 | ), t);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/tomitribe-crest/src/main/java/org/tomitribe/crest/help/InvalidJavadocFileException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.help;
18 |
19 | import java.io.IOException;
20 |
21 | public class InvalidJavadocFileException extends IllegalStateException {
22 | public InvalidJavadocFileException(final String resourceFileName, final IOException e) {
23 | super("Unable to read javadoc from store file: " + resourceFileName, e);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/tomitribe-crest/src/main/java/org/tomitribe/crest/help/Option.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.help;
18 |
19 | public class Option implements Element {
20 | private final String flag;
21 | private final Document document;
22 |
23 | public Option(final String flag, final Document document) {
24 | this.flag = flag;
25 | this.document = document;
26 | }
27 |
28 | public String getFlag() {
29 | return flag;
30 | }
31 |
32 | public Document getDocument() {
33 | return document;
34 | }
35 |
36 | @Override
37 | public String getContent() {
38 | return null;
39 | }
40 |
41 | @Override
42 | public String toString() {
43 | return "Option{" +
44 | "flag='" + flag + '\'' +
45 | '}';
46 | }
47 |
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/tomitribe-crest/src/main/java/org/tomitribe/crest/help/Paragraph.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.help;
18 |
19 | public class Paragraph implements Element {
20 |
21 | private final String content;
22 |
23 | public String getContent() {
24 | return content;
25 | }
26 |
27 | public Paragraph(final String content) {
28 | this.content = content.trim();
29 | }
30 |
31 | @Override
32 | public String toString() {
33 | return "Paragraph{" +
34 | "content='" + content + '\'' +
35 | '}';
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/tomitribe-crest/src/main/java/org/tomitribe/crest/help/Preformatted.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.help;
18 |
19 | public class Preformatted implements Element {
20 | private final String content;
21 |
22 | public Preformatted(final String content) {
23 | this.content = content;
24 | }
25 |
26 | @Override
27 | public String getContent() {
28 | return content;
29 | }
30 |
31 | @Override
32 | public String toString() {
33 | return "Preformatted{" +
34 | "content='" + content + '\'' +
35 | '}';
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/tomitribe-crest/src/main/java/org/tomitribe/crest/interceptor/InterceptorAnnotationNotFoundException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Tomitribe and community
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.tomitribe.crest.interceptor;
17 |
18 | public class InterceptorAnnotationNotFoundException extends IllegalStateException {
19 | public InterceptorAnnotationNotFoundException(final Class> clazz) {
20 | super("@CrestInterceptor not found on any methods of class " + clazz.getName() + ". " +
21 | "Expecting a method declaration like the following:\n" +
22 | " @CrestInterceptor\n" +
23 | " public Object intercept(final CrestContext crestContext) {\n" +
24 | " // do something fun\n" +
25 | " return crestContext.proceed();\n" +
26 | " }\n");
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/tomitribe-crest/src/main/java/org/tomitribe/crest/interceptor/UnresolvedInterceptorAnnotationException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Tomitribe and community
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.tomitribe.crest.interceptor;
17 |
18 | import org.tomitribe.crest.api.Loader;
19 |
20 | public class UnresolvedInterceptorAnnotationException extends IllegalStateException {
21 | public UnresolvedInterceptorAnnotationException(final Class> interceptorClass) {
22 | super(message(interceptorClass));
23 | }
24 |
25 | private static String message(final Class> interceptorClass) {
26 | return String.format("Custom interceptor annotation @%s did not resolve. " +
27 | "Please ensure the implementing class is returned by a %s and is" +
28 | " also annotated with @%s", interceptorClass.getName(), Loader.class.getName(), interceptorClass.getSimpleName());
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/tomitribe-crest/src/main/java/org/tomitribe/crest/interceptor/security/RoleProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.interceptor.security;
18 |
19 | public interface RoleProvider {
20 | boolean hasRole(String role);
21 | }
22 |
--------------------------------------------------------------------------------
/tomitribe-crest/src/main/java/org/tomitribe/crest/interceptor/security/SecurityInterceptor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.interceptor.security;
18 |
19 | import org.tomitribe.crest.api.interceptor.CrestContext;
20 | import org.tomitribe.crest.api.interceptor.CrestInterceptor;
21 | import org.tomitribe.crest.environments.Environment;
22 |
23 | import javax.annotation.security.RolesAllowed;
24 |
25 | public class SecurityInterceptor {
26 | @CrestInterceptor
27 | public Object secure(final CrestContext crestContext) {
28 | final RolesAllowed rolesAllowed = crestContext.getMethod().getAnnotation(RolesAllowed.class);
29 | if (rolesAllowed != null) {
30 | final RoleProvider provider = Environment.ENVIRONMENT_THREAD_LOCAL.get().findService(RoleProvider.class);
31 | if (provider == null) {
32 | throw new IllegalStateException("No RoleProvider registered, security interceptor can't work.");
33 | }
34 | for (final String role : rolesAllowed.value()) {
35 | if (provider.hasRole(role)) {
36 | return crestContext.proceed();
37 | }
38 | }
39 | throw new IllegalArgumentException("User is not allowed to perform this operation");
40 | }
41 | return crestContext.proceed();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/tomitribe-crest/src/main/java/org/tomitribe/crest/table/Lines.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.tomitribe.crest.table;
18 |
19 | import org.tomitribe.util.Join;
20 |
21 | import java.util.List;
22 | import java.util.regex.Pattern;
23 |
24 | public class Lines {
25 |
26 | private Lines() {
27 | }
28 |
29 | private static final Pattern separator = Pattern.compile(" *" + System.lineSeparator());
30 |
31 | public static String[] split(final String string) {
32 | return separator.split(string);
33 | }
34 |
35 | public static String join(final List