servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject servicemix-bundles git commit: [SM-2541]add TCCL into SwaggerContext classloaders
Date Thu, 07 May 2015 07:43:34 GMT
Repository: servicemix-bundles
Updated Branches:
  refs/heads/master 0606e1b8c -> 80021567e


[SM-2541]add TCCL into SwaggerContext classloaders


Project: http://git-wip-us.apache.org/repos/asf/servicemix-bundles/repo
Commit: http://git-wip-us.apache.org/repos/asf/servicemix-bundles/commit/80021567
Tree: http://git-wip-us.apache.org/repos/asf/servicemix-bundles/tree/80021567
Diff: http://git-wip-us.apache.org/repos/asf/servicemix-bundles/diff/80021567

Branch: refs/heads/master
Commit: 80021567eeba38adf9b53f6498dd9ba764f07c85
Parents: 0606e1b
Author: Freeman Fang <freeman.fang@gmail.com>
Authored: Thu May 7 15:42:57 2015 +0800
Committer: Freeman Fang <freeman.fang@gmail.com>
Committed: Thu May 7 15:42:57 2015 +0800

----------------------------------------------------------------------
 pom.xml                                         |  1 +
 swagger-core_2.11-1.3.12/pom.xml                | 21 +++++++++++++
 .../wordnik/swagger/core/SwaggerContext.scala   | 33 ++++++++++++++++++++
 3 files changed, 55 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/servicemix-bundles/blob/80021567/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 021fb2e..6b2881f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,6 +51,7 @@
         <module>swagger-core-1.3.10</module>
         <module>swagger-core-1.3.11</module>
         <module>swagger-core-1.3.12</module>
+        <module>swagger-core_2.11-1.3.12</module>
         <module>poi-3.11</module>
     </modules>
 

http://git-wip-us.apache.org/repos/asf/servicemix-bundles/blob/80021567/swagger-core_2.11-1.3.12/pom.xml
----------------------------------------------------------------------
diff --git a/swagger-core_2.11-1.3.12/pom.xml b/swagger-core_2.11-1.3.12/pom.xml
index 8aee860..91c14ce 100644
--- a/swagger-core_2.11-1.3.12/pom.xml
+++ b/swagger-core_2.11-1.3.12/pom.xml
@@ -89,6 +89,27 @@
     <build>
         <plugins>
             <plugin>
+                <groupId>net.alchim31.maven</groupId>
+                <artifactId>scala-maven-plugin</artifactId>
+                    <executions>
+                        <execution>
+                            <id>scala-compile-first</id>
+                            <phase>process-resources</phase>
+                            <goals>
+                                <goal>add-source</goal>
+                                <goal>compile</goal>
+                            </goals>
+                        </execution>
+                        <execution>
+                            <id>scala-test-compile</id>
+                            <phase>process-test-resources</phase>
+                            <goals>
+                                <goal>testCompile</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+            </plugin>
+            <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-shade-plugin</artifactId>
                 <executions>

http://git-wip-us.apache.org/repos/asf/servicemix-bundles/blob/80021567/swagger-core_2.11-1.3.12/src/main/scala/com/wordnik/swagger/core/SwaggerContext.scala
----------------------------------------------------------------------
diff --git a/swagger-core_2.11-1.3.12/src/main/scala/com/wordnik/swagger/core/SwaggerContext.scala
b/swagger-core_2.11-1.3.12/src/main/scala/com/wordnik/swagger/core/SwaggerContext.scala
new file mode 100644
index 0000000..0924949
--- /dev/null
+++ b/swagger-core_2.11-1.3.12/src/main/scala/com/wordnik/swagger/core/SwaggerContext.scala
@@ -0,0 +1,33 @@
+package com.wordnik.swagger.core
+
+import collection.mutable.ListBuffer
+import org.slf4j.{ LoggerFactory, Logger }
+
+object SwaggerContext {
+  private val LOGGER = LoggerFactory.getLogger("com.wordnik.swagger.core.SwaggerContext")
+
+  var suffixResponseFormat = true
+
+  private val classLoaders = ListBuffer.empty[ClassLoader]
+  registerClassLoader(this.getClass.getClassLoader)
+  registerClassLoader(Thread.currentThread().getContextClassLoader())
+
+  def registerClassLoader(cl: ClassLoader) = this.classLoaders += cl
+
+  def loadClass(name: String) = {
+    var cls: Class[_] = null
+    val itr = classLoaders.reverse.iterator
+    while (cls == null && itr.hasNext) {
+      try {
+        cls = Class.forName(name.trim, true, itr.next)
+      } catch {
+        case e: ClassNotFoundException => {
+          LOGGER.debug("Class %s not found in classLoader".format(name))
+        }
+      }
+    }
+    if (cls == null)
+      throw new ClassNotFoundException("class " + name + " not found")
+    cls
+  }
+}


Mime
View raw message