Permalink
Browse files

Re-packaging. All Kara APIs now reside in kara.* while rest of the co…

…de is in kara.internal.*
  • Loading branch information...
1 parent 405c029 commit c43ca5b0e068cc3632c2cc1cd08d053b022ca6ae @shafirov shafirov committed Apr 9, 2013
Showing with 177 additions and 261 deletions.
  1. +3 −1 .idea/libraries/javax_servlet_3_0_0_v201112011016.xml
  2. +2 −2 samples/KaraDemo/src/karademo/Application.kt
  3. +1 −2 samples/KaraDemo/src/karademo/routes/Home.kt
  4. +1 −1 samples/KaraDemo/src/karademo/styles/DefaultStyles.kt
  5. +1 −1 samples/KaraDemo/src/karademo/styles/StyleClasses.kt
  6. +1 −2 samples/KaraDemo/src/karademo/views/DefaultLayout.kt
  7. +1 −4 samples/KaraDemo/src/karademo/views/home/Forms.kt
  8. +1 −3 samples/KaraDemo/src/karademo/views/home/Index.kt
  9. +1 −2 samples/KaraDemo/src/karademo/views/posts/Show.kt
  10. +1 −1 src/KaraExec/src/CLMain.kt
  11. +3 −2 src/KaraExec/src/Main.kt
  12. +2 −2 src/KaraExec/src/dependencies/DependenciesResolver.kt
  13. +2 −1 src/KaraExec/src/generators/Generator.kt
  14. +3 −3 src/KaraExec/src/generators/templates/GeneralTemplates.kt
  15. +3 −3 src/KaraExec/src/generators/templates/ViewTemplates.kt
  16. +2 −3 src/KaraExec/src/server/AppLoader.kt
  17. +4 −2 src/KaraExec/src/server/JettyRunner.kt
  18. +1 −1 src/KaraLib/src/kara/Exceptions.kt
  19. +2 −6 src/KaraLib/src/kara/app/Application.kt
  20. +2 −3 src/KaraLib/src/kara/config/AppConfig.kt
  21. +1 −1 src/KaraLib/src/kara/config/Config.kt
  22. +2 −3 src/KaraLib/src/kara/controllers/ActionResult.kt
  23. +1 −1 src/KaraLib/src/kara/controllers/Annotations.kt
  24. +0 −32 src/KaraLib/src/kara/controllers/BaseController.kt
  25. +1 −1 src/KaraLib/src/kara/controllers/HttpMethod.kt
  26. +1 −1 src/KaraLib/src/kara/controllers/Link.kt
  27. +2 −7 src/KaraLib/src/kara/controllers/Request.kt
  28. +2 −2 src/KaraLib/src/kara/controllers/RouteParams.kt
  29. +2 −8 src/KaraLib/src/kara/{controllers → internal}/ActionInfo.kt
  30. +1 −1 src/KaraLib/src/kara/{styles → internal}/AttributeFilters.kt
  31. +2 −9 src/KaraLib/src/kara/{views/attributes → internal}/AttributeTypes.kt
  32. +2 −2 src/KaraLib/src/kara/{views/attributes → internal}/Attributes.kt
  33. +1 −1 src/KaraLib/src/kara/{views → internal}/BodyTags.kt.erb
  34. +2 −2 src/KaraLib/src/kara/{config → internal}/ConfigReader.kt
  35. +2 −4 src/KaraLib/src/kara/{controllers → internal}/Dispatcher.kt
  36. +2 −2 src/KaraLib/src/kara/{styles → internal}/Enums.kt.erb
  37. +1 −1 src/KaraLib/src/kara/{controllers → internal}/ParamDeserializer.kt
  38. +2 −0 src/KaraLib/src/kara/{controllers → internal}/PathUtils.kt
  39. +2 −1 src/KaraLib/src/kara/{controllers → internal}/ReflectionUtils.kt
  40. +3 −1 src/KaraLib/src/kara/{controllers → internal}/RouteComp.kt
  41. +2 −1 src/KaraLib/src/kara/{controllers → internal}/RoutesBuilder.kt
  42. +2 −4 src/KaraLib/src/kara/{app → internal}/Servlet.kt
  43. +1 −1 src/KaraLib/src/kara/{helpers → internal}/StringHelpers.kt
  44. +28 −0 src/KaraLib/src/kara/internal/TagStack.kt
  45. +2 −2 src/KaraLib/src/kara/{ → internal}/Util.kt
  46. 0 src/KaraLib/src/kara/{views → internal}/build_bodytags.rb
  47. 0 src/KaraLib/src/kara/{styles → internal}/build_enums.rb
  48. +2 −3 src/KaraLib/src/kara/middleware/Middleware.kt
  49. +2 −2 src/KaraLib/src/kara/middleware/MiddlewareList.kt
  50. +1 −1 src/KaraLib/src/kara/styles/Color.kt
  51. +6 −7 src/KaraLib/src/kara/styles/{Element.kt → CssDSL.kt}
  52. +1 −1 src/KaraLib/src/kara/styles/Dimensions.kt
  53. +10 −10 src/KaraLib/src/kara/styles/Enums.kt
  54. +3 −3 src/KaraLib/src/kara/styles/Stylesheet.kt
  55. +2 −6 src/KaraLib/src/kara/views/ActionContext.kt
  56. +8 −40 src/KaraLib/src/kara/views/BaseTags.kt
  57. +2 −10 src/KaraLib/src/kara/views/BodyTags.kt
  58. +1 −3 src/KaraLib/src/kara/views/ErrorView.kt
  59. +3 −12 src/KaraLib/src/kara/views/FormBuilder.kt
  60. +2 −2 src/KaraLib/src/kara/views/HtmlLayout.kt
  61. +2 −3 src/KaraLib/src/kara/views/HtmlView.kt
  62. +1 −2 src/KaraLib/src/kara/views/Json.kt
  63. +3 −1 src/KaraLib/src/kara/views/attributes/EncodingType.kt
  64. +3 −1 src/KaraLib/src/kara/views/attributes/FormMethod.kt
  65. +3 −4 src/KaraLib/src/kara/views/attributes/InputType.kt
  66. +3 −1 src/KaraLib/src/kara/views/attributes/Wrap.kt
  67. +0 −2 src/KaraTests/src/karatests/controllers/ActionTests.kt
  68. +2 −3 src/KaraTests/src/karatests/controllers/DispatchTests.kt
  69. +2 −3 src/KaraTests/src/karatests/controllers/Routes.kt
  70. +2 −3 src/KaraTests/src/karatests/mock/MockDispatch.kt
  71. +2 −1 src/KaraTests/src/karatests/styles/CSSSelectorsTest.kt
  72. +2 −1 src/KaraTests/src/karatests/styles/TestStylesheet.kt
  73. +2 −1 src/KaraTests/src/karatests/views/DefaultLayout.kt
  74. +2 −1 src/KaraTests/src/karatests/views/HomeView.kt
  75. +1 −1 src/KaraTests/src/karatests/views/Html.kt
@@ -4,6 +4,8 @@
<root url="jar://$PROJECT_DIR$/lib/javax.servlet-3.0.0.v201112011016.jar!/" />
</CLASSES>
<JAVADOC />
- <SOURCES />
+ <SOURCES>
+ <root url="jar://$USER_HOME$/.ideaLibSources/javax.servlet-3.0.0.v201112011016-sources.jar!/" />
+ </SOURCES>
</library>
</component>
@@ -1,6 +1,6 @@
package karademo
-import kara.config.AppConfig
+import kara.*
-public class Application(config: AppConfig) : kara.app.Application(config)
+public class Application(config: AppConfig) : kara.Application(config)
@@ -1,7 +1,6 @@
package karademo.routes
-import kara.controllers.Get
-import kara.controllers.*
+import kara.*
import karademo.views.DefaultLayout
import java.util.Date
import karademo.views.posts.Show
@@ -1,6 +1,6 @@
package karademo.styles
-import kara.styles.*
+import kara.*
import karademo.styles.StyleClasses.*
/** The default stylesheet for the demo application.
@@ -1,6 +1,6 @@
package karademo.styles
-import kara.styles.StyleClass
+import kara.*
public enum class StyleClasses : StyleClass {
fields cLabel top
@@ -1,8 +1,7 @@
package karademo.views
-import kara.views.*
+import kara.*
import karademo.styles.DefaultStyles
-import kara.controllers.link
class DefaultLayout() : HtmlLayout() {
override fun render(context: ActionContext, mainView: HtmlView) {
@@ -1,12 +1,9 @@
package karademo.views.home
-import kara.views.*
-import kara.styles.*
+import kara.*
import karademo.models.Book
import karademo.styles.StyleClasses.*
-import kara.views.FormMethod
import karademo.routes.Home
-import kara.controllers.link
class Forms(val book : Book) : HtmlView() {
override fun render(context: ActionContext) {
@@ -1,8 +1,6 @@
package karademo.views.home
-import kara.views.*
-import kara.views.InputType
-import kara.styles.Color
+import kara.*
class Index() : HtmlView() {
@@ -1,7 +1,6 @@
package karademo.views.posts
-import kara.views.HtmlView
-import kara.views.*
+import kara.*
import karademo.models.*
import karademo.styles.StyleClasses.*
import karademo.styles.StyleClasses
@@ -9,7 +9,7 @@ import java.net.URLDecoder
fun main(args: Array<String>) {
val cl = URLClassLoader(HomePathResolver.collectJars(), null)
Thread.currentThread().setContextClassLoader(cl)
- val clazz = cl.loadClass("kara.KaraPackage")!!
+ val clazz = cl.loadClass("kara.cli.CliPackage")!!
clazz.getMethod("main2", javaClass<Array<String>>()).invoke(null, args)
}
View
@@ -1,7 +1,8 @@
-package kara
+package kara.cli
import java.util.HashMap
-import kara.config.*
+import kara.*
+import kara.internal.*
import kara.server.JettyRunner
import org.apache.log4j.BasicConfigurator
import org.apache.log4j.Logger
@@ -1,6 +1,6 @@
package dependencies
-import kara.config.AppConfig
+import kara.*
import org.apache.ivy.core.settings.IvySettings
import org.apache.ivy.Ivy
import org.apache.ivy.core.event.EventManager
@@ -18,4 +18,4 @@ public class DependenciesResolver(val appConfig : AppConfig) {
val pattern = "${appConfig.appRoot}/lib/[artifact]-[revision].[ext]"
Main.main(array("-retrieve", pattern, "-types", "jar"))
}
-}
+}
@@ -5,7 +5,8 @@ import java.io.File
import kara.generators.Permissions
import java.io.*
import java.util.Properties
-import kara.config.AppConfig
+import kara.*
+import kara.internal.*
import generators.templates.*
import com.google.common.io.Files
@@ -48,12 +48,12 @@ fun Generator.applicationTemplate() : String {
return """
package ${appPackage}
-import kara.config.*
+import kara.*
/**
* This is the primary class for your application.
*/
-public class Application(config: AppConfig) : kara.app.Application(config) {
+public class Application(config: AppConfig) : kara.Application(config) {
/**
* Application-specific initialization code goes here.
@@ -73,7 +73,7 @@ package ${appPackage}.routes
import ${appPackage}.views.*
import ${appPackage}.views.${routeSlug}.*
-import kara.controllers.*
+import kara.*
object ${routeClassName} {
val layout = DefaultLayout()
@@ -25,7 +25,7 @@ fun Generator.viewTemplate(filePath : String, isLanding : Boolean = false) : Str
return """
package ${appPackage}.views.${routeSlug}
-import kara.views.*
+import kara.*
class ${viewName}() : HtmlView() {
override fun render(context: ActionContext) {
@@ -41,7 +41,7 @@ fun Generator.layoutTemplate() : String {
return """
package ${appPackage}.views
-import kara.views.*
+import kara.*
import ${appPackage}.styles.*
class ${viewName}() : HtmlLayout() {
@@ -67,7 +67,7 @@ fun Generator.stylesheetTemplate() : String {
return """
package ${appPackage}.styles
-import kara.styles.*
+import kara.*
class ${stylesheetName}() : Stylesheet() {
override fun render() {
@@ -4,14 +4,13 @@ import java.net.URLClassLoader
import java.io.*
import kara.server.FileWatchListener
import java.util.ArrayList
-import kara.controllers.Dispatcher
-import kara.controllers.BaseController
import kara.server.FileWatcher
import java.util.concurrent.Executors
import java.util.concurrent.Executor
-import kara.config.AppConfig
import org.apache.log4j.Logger
import java.net.URL
+import kara.*
+import kara.internal.*
/** Interface for object that want to listen for when an app is loaded.
*/
@@ -1,12 +1,14 @@
package kara.server
import javax.servlet.http.*
-import kara.app.*
import org.eclipse.jetty.server.*
import org.eclipse.jetty.server.handler.*
import org.eclipse.jetty.server.session.*
import org.apache.log4j.Logger
-import kara.config.AppConfig
+import kara.internal.*
+import kara.app.*
+import kara.AppConfig
+import kara.Application
/** A Runnable responsible for managing a Jetty server instance.
*/
@@ -1,4 +1,4 @@
-package kara.exceptions
+package kara
/**
* If thrown during the handling of a request, a 404 response will be returned.
@@ -1,17 +1,13 @@
-package kara.app
+package kara
-import kara.controllers.Dispatcher
-import kara.config.AppConfig
import org.reflections.Reflections
import java.util.regex.Pattern
-import kara.controllers.objectInstance
import java.util.ArrayList
import org.reflections.util.ClasspathHelper
import java.net.URLClassLoader
import org.reflections.util.ConfigurationBuilder
import org.reflections.scanners.SubTypesScanner
-import kara.controllers.scanPackage
-import kara.controllers.scanObjects
+import kara.internal.*
/** The base Kara application class.
*/
@@ -1,9 +1,8 @@
-package kara.config
+package kara
-import kara.controllers.ParamDeserializer
import java.io.File
import java.util.HashMap
-import kara.middleware.MiddlewareList
+import kara.internal.*
/**
* Store application configuration.
@@ -1,4 +1,4 @@
-package kara.config
+package kara
import java.util.HashMap
@@ -1,7 +1,6 @@
-package kara.controllers
+package kara
import javax.servlet.http.HttpServletResponse
-import kara.views.ActionContext
/** Base class for objects that are returned from actions.
*/
@@ -30,4 +29,4 @@ open class RedirectResult(val url : String) : ActionResult {
override fun writeResponse(context : ActionContext) {
context.response.sendRedirect(url)
}
-}
+}
@@ -1,4 +1,4 @@
-package kara.controllers
+package kara
import java.lang.annotation.*
@@ -1,32 +0,0 @@
-package kara.controllers
-
-import javax.servlet.http.*
-import kara.views.HtmlLayout
-
-/** Base class for all controllers.
- * This should be subclassed to provide controller classes for your application.
- */
-open class BaseController(var layout : HtmlLayout? = null) {
-
- public var request : HttpServletRequest? = null
- public var response : HttpServletResponse? = null
- public var params : RouteParams = RouteParams()
-
- public val session : HttpSession
- get() = request?.getSession()!!
-
- public var root : String = "/" + this.javaClass.getSimpleName().replace("Controller", "").toLowerCase() + "/"
-
- fun beforeRequest(request: HttpServletRequest, response : HttpServletResponse, params : RouteParams) {
- this.request = request
- this.response = response
- this.params = params
- }
-
- /** Redirects to the given url.
- */
- fun redirect(url : String) : ActionResult {
- return RedirectResult(url)
- }
-
-}
@@ -1,4 +1,4 @@
-package kara.controllers
+package kara
public enum class HttpMethod {
GET
@@ -1,4 +1,4 @@
-package kara.controllers
+package kara
import java.net.URL
import java.net.MalformedURLException
@@ -1,15 +1,10 @@
-package kara.controllers
+package kara
-import kara.controllers.Get
-import kara.controllers.Post
import java.net.URL
-import kara.controllers.ActionResult
-import kara.controllers.BaseController
import javax.servlet.http.HttpServletResponse
import javax.servlet.http.HttpServletRequest
import java.lang.reflect.Modifier
-import kara.views.ActionContext
-import kara.util.*
+import kara.internal.*
import java.util.HashSet
import java.util.LinkedHashSet
@@ -1,7 +1,7 @@
-package kara.controllers
+package kara
import java.util.*
-import kara.util.*
+import kara.internal.*
/** Contains all of the parameters for a matched route. */
class RouteParams() {
@@ -1,19 +1,13 @@
-package kara.controllers
+package kara.internal
import java.lang.reflect.Method
import javax.servlet.http.*
import java.util.ArrayList
-import kara.config.AppConfig
-import kara.views.HtmlView
import java.lang.reflect.Type
-import kara.views.ActionContext
-import kara.views.ErrorView
-import kara.views.ErrorLayout
import jet.runtime.typeinfo.JetValueParameter
import java.lang.reflect.Constructor
-import kara.views.HtmlLayout
-import kara.util.propertyValue
import java.net.URLDecoder
+import kara.*
/** Contains all the information necessary to match a route and execute an action.
@@ -1,4 +1,4 @@
-package kara.styles
+package kara.internal
public trait AttFilter {
fun toExternalForm() : String
Oops, something went wrong.

0 comments on commit c43ca5b

Please sign in to comment.