camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/4] camel git commit: CAMEL-8161: camel-swagger - Use JMX to lookup Camel's so we support everyone
Date Tue, 23 Dec 2014 14:13:44 GMT
Repository: camel
Updated Branches:
  refs/heads/master 06449f471 -> 524a4e52d


CAMEL-8161: camel-swagger - Use JMX to lookup Camel's so we support everyone


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8fd09cc1
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8fd09cc1
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8fd09cc1

Branch: refs/heads/master
Commit: 8fd09cc1535dbb5ecb288874f9a41a8f06f012f0
Parents: 06449f4
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Dec 23 13:43:22 2014 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Dec 23 13:43:22 2014 +0100

----------------------------------------------------------------------
 .../camel/component/swagger/RestApiListingCache.scala       | 8 +++-----
 .../swagger/RestSwaggerApiDeclarationServlet.scala          | 9 +++++++--
 .../apache/camel/component/swagger/RestSwaggerReader.scala  | 2 --
 3 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8fd09cc1/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestApiListingCache.scala
----------------------------------------------------------------------
diff --git a/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestApiListingCache.scala
b/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestApiListingCache.scala
index 2b47bd4..8ffe8ef 100644
--- a/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestApiListingCache.scala
+++ b/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestApiListingCache.scala
@@ -20,12 +20,11 @@ import com.wordnik.swagger.core.util.ReaderUtil
 import com.wordnik.swagger.config.SwaggerConfig
 import com.wordnik.swagger.model.ApiListing
 
-import org.apache.camel.CamelContext
+import org.apache.camel.model.rest.RestDefinition
 
+import scala.collection.mutable
 import scala.collection.mutable.ListBuffer
 
-// to iterate Java list using for loop
-import scala.collection.JavaConverters._
 
 /**
  * To cache the RestSwaggerReader
@@ -35,11 +34,10 @@ object RestApiListingCache extends ReaderUtil {
   var cache: Option[Map[String, ApiListing]] = None
   val reader = new RestSwaggerReader()
 
-  def listing(camel: CamelContext, config: SwaggerConfig): Option[Map[String, ApiListing]]
= {
+  def listing(rests: mutable.Buffer[RestDefinition], config: SwaggerConfig): Option[Map[String,
ApiListing]] = {
     cache.orElse {
       val listings = new ListBuffer[ApiListing]
 
-      val rests = camel.getRestDefinitions.asScala
       for (rest <- rests) {
         val some = reader.read(rest, config)
         if (!some.isEmpty) {

http://git-wip-us.apache.org/repos/asf/camel/blob/8fd09cc1/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerApiDeclarationServlet.scala
----------------------------------------------------------------------
diff --git a/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerApiDeclarationServlet.scala
b/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerApiDeclarationServlet.scala
index 925042f..a42e60f 100644
--- a/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerApiDeclarationServlet.scala
+++ b/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerApiDeclarationServlet.scala
@@ -27,6 +27,9 @@ import com.wordnik.swagger.model.{ApiInfo, ResourceListing, ApiListingReference}
 import org.apache.camel.CamelContext
 import org.slf4j.LoggerFactory
 
+// to iterate Java list using for loop
+import scala.collection.JavaConverters._
+
 /**
  * A Http Servlet to expose the REST services as Swagger APIs.
  */
@@ -116,7 +119,8 @@ abstract class RestSwaggerApiDeclarationServlet extends HttpServlet {
 
     if (camel != null) {
       val f = new SpecFilter
-      val listings = RestApiListingCache.listing(camel, swaggerConfig).map(specs => {
+      val rests = camel.getRestDefinitions.asScala
+      val listings = RestApiListingCache.listing(rests, swaggerConfig).map(specs => {
         (for (spec <- specs.values)
         yield f.filter(spec, FilterFactory.filter, queryParams, cookies, headers)
           ).filter(m => m.apis.size > 0)
@@ -159,7 +163,8 @@ abstract class RestSwaggerApiDeclarationServlet extends HttpServlet {
     }
 
     if (camel != null) {
-      val listings = RestApiListingCache.listing(camel, swaggerConfig).map(specs => {
+      val rests = camel.getRestDefinitions.asScala
+      val listings = RestApiListingCache.listing(rests, swaggerConfig).map(specs => {
           (for (spec <- specs.values) yield {
           f.filter(spec, FilterFactory.filter, queryParams, cookies, headers)
         }).filter(m => m.resourcePath == pathPart)

http://git-wip-us.apache.org/repos/asf/camel/blob/8fd09cc1/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerReader.scala
----------------------------------------------------------------------
diff --git a/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerReader.scala
b/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerReader.scala
index baa7dbd..ca5bff2 100644
--- a/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerReader.scala
+++ b/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerReader.scala
@@ -30,10 +30,8 @@ import org.slf4j.LoggerFactory
 import scala.collection.mutable.ListBuffer
 import com.wordnik.swagger.model.Parameter
 import com.wordnik.swagger.model.ApiDescription
-import scala.Some
 import com.wordnik.swagger.model.Operation
 import com.wordnik.swagger.model.ApiListing
-import scala.util.Sorting
 
 // to iterate Java list using for loop
 import scala.collection.JavaConverters._


Mime
View raw message