/scalate-camel/src/main/scala/org/fusesource/scalate/camel/ScalateComponent.scala

http://github.com/scalate/scalate · Scala · 50 lines · 22 code · 8 blank · 20 comment · 0 complexity · d787ed2dabbe9826617c6b5f364a3716 MD5 · raw file

  1. /**
  2. * Copyright (C) 2009-2011 the original author or authors.
  3. * See the notice.md file distributed with this work for additional
  4. * information regarding copyright ownership.
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. package org.fusesource.scalate
  19. package camel
  20. import java.io.File
  21. import java.util.Map
  22. import org.apache.camel.Endpoint
  23. import org.apache.camel.impl.DefaultComponent
  24. import org.springframework.core.io.DefaultResourceLoader
  25. import org.fusesource.scalate.util.FileResourceLoader
  26. /**
  27. * @version $Revision : 1.1 $
  28. */
  29. @deprecated("because Apache Camel-Scala has become deprecated", since = "1.9.4")
  30. class ScalateComponent() extends DefaultComponent {
  31. var defaultTemplateExtension: String = "ssp"
  32. var templateEngine: TemplateEngine = new TemplateEngine()
  33. var resourceLoader = new DefaultResourceLoader()
  34. templateEngine.resourceLoader = new FileResourceLoader() {
  35. override protected def toFile(uri: String): File = {
  36. resourceLoader.getResource(uri).getFile
  37. }
  38. }
  39. def createEndpoint(uri: String, remaining: String, parameters: Map[String, Object]): Endpoint = {
  40. new ScalateEndpoint(this, uri, remaining, defaultTemplateExtension)
  41. }
  42. }