Skip to content

Commit

Permalink
v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
antonwierenga committed Nov 8, 2017
1 parent f7726d9 commit 1f48642
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/scala/activemq/cli/ActiveMQCLI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,17 @@ import org.springframework.stereotype.Component
class ActiveMQCLI extends CommandMarker {

@CliCommand(value = Array("release-notes"), help = "Displays release notes")
def releaseNotes: String = ActiveMQCLI.ReleaseNotes.keySet.toSeq.sorted.reverse.map(x s"$x\n" + ActiveMQCLI.ReleaseNotes(x).map(y s" - $y").mkString("\n")).mkString("\n")

def releaseNotes: String = ActiveMQCLI.ReleaseNotes.keySet.toSeq.sorted.map(x s"$x\n" + ActiveMQCLI.ReleaseNotes(x)
.map(y s" - $y").mkString("\n")).mkString("\n")
}

object ActiveMQCLI extends App {

lazy val ReleaseNotes = Map("v0.4.0" List(
"Fixed a bug that prevented the embedded broker from being started"
"Updated shell command 'connect': option --broker now uses tab completion",
"Updated shell command 'list-messages': option --queue now mandatory",
"Fixed a bug that prevented the embedded broker from being started",
"Fixed a bug that caused an error when export-messages is run against a queue containing a message with empty text"
), "v0.3.0" List(
"Updated shell command 'list-queues': new filter options --pending, --enqueued, --dequeued and --consumers (replaces --no-consumer)",
"Updated shell command 'purge-all-queues': new filter options --pending, --enqueued, --dequeued and --consumers (replaces --no-consumer)",
Expand Down
49 changes: 49 additions & 0 deletions src/main/scala/activemq/cli/converter/BrokerConverter.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright 2017 Anton Wierenga
*
* 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 activemq.cli.converter

import activemq.cli.ActiveMQCLI
import activemq.cli.domain.Broker

import java.util.List

import org.springframework.shell.core.Completion
import org.springframework.shell.core.Converter
import org.springframework.shell.core.MethodTarget
import org.springframework.stereotype.Component
import scala.collection.JavaConversions._

@Component
class BrokerConverter extends Converter[Broker] {

@Override
def convertFromText(text: String, requiredType: Class[_], optionContext: String): Broker = {
new Broker(text, null, null, null, null, null) //scalastyle:ignore
}

@Override
def supports(requiredType: Class[_], optionContext: String): Boolean = {
classOf[Broker].isAssignableFrom(requiredType)
}

@Override
def getAllPossibleValues(completions: List[Completion], requiredType: Class[_],
existingData: String, optionContext: String, target: MethodTarget): Boolean = {
ActiveMQCLI.Config.getObject("broker").foreach({ case (k: String, v) completions.add(new Completion(k)) })
true
}
}

0 comments on commit 1f48642

Please sign in to comment.