Skip to content

Commit 3478faf

Browse files
committed
initial commit
0 parents  commit 3478faf

16 files changed

+468
-0
lines changed

LICENSE

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
This software is licensed under the Apache 2 license, quoted below.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with
4+
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
5+
6+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
7+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
8+
language governing permissions and limitations under the License.

README

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This is your new Play application
2+
=================================
3+
4+
This file will be packaged with your application, when using `activator dist`.

activator.bat

+227
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
@REM activator launcher script
2+
@REM
3+
@REM Envioronment:
4+
@REM JAVA_HOME - location of a JDK home dir (optional if java on path)
5+
@REM CFG_OPTS - JVM options (optional)
6+
@REM Configuration:
7+
@REM activatorconfig.txt found in the ACTIVATOR_HOME or ACTIVATOR_HOME/ACTIVATOR_VERSION
8+
@setlocal enabledelayedexpansion
9+
10+
@echo off
11+
12+
set "var1=%~1"
13+
if defined var1 (
14+
if "%var1%"=="help" (
15+
echo.
16+
echo Usage activator [options] [command]
17+
echo.
18+
echo Commands:
19+
echo ui Start the Activator UI
20+
echo new [name] [template-id] Create a new project with [name] using template [template-id]
21+
echo list-templates Print all available template names
22+
echo help Print this message
23+
echo.
24+
echo Options:
25+
echo -jvm-debug [port] Turn on JVM debugging, open at the given port. Defaults to 9999 if no port given.
26+
echo.
27+
echo Environment variables ^(read from context^):
28+
echo JAVA_OPTS Environment variable, if unset uses ""
29+
echo SBT_OPTS Environment variable, if unset uses ""
30+
echo ACTIVATOR_OPTS Environment variable, if unset uses ""
31+
echo.
32+
goto :end
33+
)
34+
)
35+
36+
if "%ACTIVATOR_HOME%"=="" (
37+
set "ACTIVATOR_HOME=%~dp0"
38+
@REM remove trailing "\" from path
39+
set ACTIVATOR_HOME=!ACTIVATOR_HOME:~0,-1!
40+
)
41+
42+
set ERROR_CODE=0
43+
set APP_VERSION=1.2.12
44+
set ACTIVATOR_LAUNCH_JAR=activator-launch-%APP_VERSION%.jar
45+
46+
rem Detect if we were double clicked, although theoretically A user could
47+
rem manually run cmd /c
48+
for %%x in (%cmdcmdline%) do if %%~x==/c set DOUBLECLICKED=1
49+
50+
rem FIRST we load a config file of extra options (if there is one)
51+
set "CFG_FILE_HOME=%UserProfile%\.activator\activatorconfig.txt"
52+
set "CFG_FILE_VERSION=%UserProfile%\.activator\%APP_VERSION%\activatorconfig.txt"
53+
set CFG_OPTS=
54+
if exist %CFG_FILE_VERSION% (
55+
FOR /F "tokens=* eol=# usebackq delims=" %%i IN ("%CFG_FILE_VERSION%") DO (
56+
set DO_NOT_REUSE_ME=%%i
57+
rem ZOMG (Part #2) WE use !! here to delay the expansion of
58+
rem CFG_OPTS, otherwise it remains "" for this loop.
59+
set CFG_OPTS=!CFG_OPTS! !DO_NOT_REUSE_ME!
60+
)
61+
)
62+
if "%CFG_OPTS%"=="" (
63+
if exist %CFG_FILE_HOME% (
64+
FOR /F "tokens=* eol=# usebackq delims=" %%i IN ("%CFG_FILE_HOME%") DO (
65+
set DO_NOT_REUSE_ME=%%i
66+
rem ZOMG (Part #2) WE use !! here to delay the expansion of
67+
rem CFG_OPTS, otherwise it remains "" for this loop.
68+
set CFG_OPTS=!CFG_OPTS! !DO_NOT_REUSE_ME!
69+
)
70+
)
71+
)
72+
73+
rem We use the value of the JAVACMD environment variable if defined
74+
set _JAVACMD=%JAVACMD%
75+
76+
if "%_JAVACMD%"=="" (
77+
if not "%JAVA_HOME%"=="" (
78+
if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe"
79+
80+
rem if there is a java home set we make sure it is the first picked up when invoking 'java'
81+
SET "PATH=%JAVA_HOME%\bin;%PATH%"
82+
)
83+
)
84+
85+
if "%_JAVACMD%"=="" set _JAVACMD=java
86+
87+
rem Detect if this java is ok to use.
88+
for /F %%j in ('"%_JAVACMD%" -version 2^>^&1') do (
89+
if %%~j==Java set JAVAINSTALLED=1
90+
)
91+
92+
rem Detect the same thing about javac
93+
if "%_JAVACCMD%"=="" (
94+
if not "%JAVA_HOME%"=="" (
95+
if exist "%JAVA_HOME%\bin\javac.exe" set "_JAVACCMD=%JAVA_HOME%\bin\javac.exe"
96+
)
97+
)
98+
if "%_JAVACCMD%"=="" set _JAVACCMD=javac
99+
for /F %%j in ('"%_JAVACCMD%" -version 2^>^&1') do (
100+
if %%~j==javac set JAVACINSTALLED=1
101+
)
102+
103+
rem BAT has no logical or, so we do it OLD SCHOOL! Oppan Redmond Style
104+
set JAVAOK=true
105+
if not defined JAVAINSTALLED set JAVAOK=false
106+
if not defined JAVACINSTALLED set JAVAOK=false
107+
108+
if "%JAVAOK%"=="false" (
109+
echo.
110+
echo A Java JDK is not installed or can't be found.
111+
if not "%JAVA_HOME%"=="" (
112+
echo JAVA_HOME = "%JAVA_HOME%"
113+
)
114+
echo.
115+
echo Please go to
116+
echo http://www.oracle.com/technetwork/java/javase/downloads/index.html
117+
echo and download a valid Java JDK and install before running Activator.
118+
echo.
119+
echo If you think this message is in error, please check
120+
echo your environment variables to see if "java.exe" and "javac.exe" are
121+
echo available via JAVA_HOME or PATH.
122+
echo.
123+
if defined DOUBLECLICKED pause
124+
exit /B 1
125+
)
126+
127+
rem Check what Java version is being used to determine what memory options to use
128+
for /f "tokens=3" %%g in ('java -version 2^>^&1 ^| findstr /i "version"') do (
129+
set JAVA_VERSION=%%g
130+
)
131+
132+
rem Strips away the " characters
133+
set JAVA_VERSION=%JAVA_VERSION:"=%
134+
135+
rem TODO Check if there are existing mem settings in JAVA_OPTS/CFG_OPTS and use those instead of the below
136+
for /f "delims=. tokens=1-3" %%v in ("%JAVA_VERSION%") do (
137+
set MAJOR=%%v
138+
set MINOR=%%w
139+
set BUILD=%%x
140+
141+
set META_SIZE=-XX:MetaspaceSize=64M -XX:MaxMetaspaceSize=256M
142+
if "!MINOR!" LSS "8" (
143+
set META_SIZE=-XX:PermSize=64M -XX:MaxPermSize=256M
144+
)
145+
146+
set MEM_OPTS=!META_SIZE!
147+
)
148+
149+
rem We use the value of the JAVA_OPTS environment variable if defined, rather than the config.
150+
set _JAVA_OPTS=%JAVA_OPTS%
151+
if "%_JAVA_OPTS%"=="" set _JAVA_OPTS=%CFG_OPTS%
152+
153+
set DEBUG_OPTS=
154+
155+
rem Loop through the arguments, building remaining args in args variable
156+
set args=
157+
:argsloop
158+
if not "%~1"=="" (
159+
rem Checks if the argument contains "-D" and if true, adds argument 1 with 2 and puts an equal sign between them.
160+
rem This is done since batch considers "=" to be a delimiter so we need to circumvent this behavior with a small hack.
161+
set arg1=%~1
162+
if "!arg1:~0,2!"=="-D" (
163+
set "args=%args% "%~1"="%~2""
164+
shift
165+
shift
166+
goto argsloop
167+
)
168+
169+
if "%~1"=="-jvm-debug" (
170+
if not "%~2"=="" (
171+
rem This piece of magic somehow checks that an argument is a number
172+
for /F "delims=0123456789" %%i in ("%~2") do (
173+
set var="%%i"
174+
)
175+
if defined var (
176+
rem Not a number, assume no argument given and default to 9999
177+
set JPDA_PORT=9999
178+
) else (
179+
rem Port was given, shift arguments
180+
set JPDA_PORT=%~2
181+
shift
182+
)
183+
) else (
184+
set JPDA_PORT=9999
185+
)
186+
shift
187+
188+
set DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=!JPDA_PORT!
189+
goto argsloop
190+
)
191+
rem else
192+
set "args=%args% "%~1""
193+
shift
194+
goto argsloop
195+
)
196+
197+
:run
198+
199+
if "!args!"=="" (
200+
if defined DOUBLECLICKED (
201+
set CMDS="ui"
202+
) else set CMDS=!args!
203+
) else set CMDS=!args!
204+
205+
rem We add a / in front, so we get file:///C: instead of file://C:
206+
rem Java considers the later a UNC path.
207+
rem We also attempt a solid effort at making it URI friendly.
208+
rem We don't even bother with UNC paths.
209+
set JAVA_FRIENDLY_HOME_1=/!ACTIVATOR_HOME:\=/!
210+
set JAVA_FRIENDLY_HOME=/!JAVA_FRIENDLY_HOME_1: =%%20!
211+
212+
rem Checks if the command contains spaces to know if it should be wrapped in quotes or not
213+
set NON_SPACED_CMD=%_JAVACMD: =%
214+
if "%_JAVACMD%"=="%NON_SPACED_CMD%" %_JAVACMD% %DEBUG_OPTS% %MEM_OPTS% %ACTIVATOR_OPTS% %SBT_OPTS% %_JAVA_OPTS% "-Dactivator.home=%JAVA_FRIENDLY_HOME%" -jar "%ACTIVATOR_HOME%\%ACTIVATOR_LAUNCH_JAR%" %CMDS%
215+
if NOT "%_JAVACMD%"=="%NON_SPACED_CMD%" "%_JAVACMD%" %DEBUG_OPTS% %MEM_OPTS% %ACTIVATOR_OPTS% %SBT_OPTS% %_JAVA_OPTS% "-Dactivator.home=%JAVA_FRIENDLY_HOME%" -jar "%ACTIVATOR_HOME%\%ACTIVATOR_LAUNCH_JAR%" %CMDS%
216+
217+
if ERRORLEVEL 1 goto error
218+
goto end
219+
220+
:error
221+
set ERROR_CODE=1
222+
223+
:end
224+
225+
@endlocal
226+
227+
exit /B %ERROR_CODE%

app/controllers/Application.java

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package controllers;
2+
3+
import play.*;
4+
import play.mvc.*;
5+
6+
import views.html.*;
7+
8+
public class Application extends Controller {
9+
10+
public static Result index() {
11+
return ok(index.render("Your new application is ready."));
12+
}
13+
14+
}

app/views/index.scala.html

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@(message: String)
2+
3+
@main("Welcome to Play") {
4+
5+
@play20.welcome(message, style = "Java")
6+
7+
}

app/views/main.scala.html

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@(title: String)(content: Html)
2+
3+
<!DOCTYPE html>
4+
5+
<html>
6+
<head>
7+
<title>@title</title>
8+
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")">
9+
<link rel="shortcut icon" type="image/png" href="@routes.Assets.at("images/favicon.png")">
10+
<script src="@routes.Assets.at("javascripts/hello.js")" type="text/javascript"></script>
11+
</head>
12+
<body>
13+
@content
14+
</body>
15+
</html>

build.sbt

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name := """mediaDB"""
2+
3+
version := "1.0-SNAPSHOT"
4+
5+
lazy val root = (project in file(".")).enablePlugins(PlayJava)
6+
7+
scalaVersion := "2.11.1"
8+
9+
libraryDependencies ++= Seq(
10+
javaJdbc,
11+
javaEbean,
12+
cache,
13+
javaWs
14+
)

conf/application.conf

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# This is the main configuration file for the application.
2+
# ~~~~~
3+
4+
# Secret key
5+
# ~~~~~
6+
# The secret key is used to secure cryptographics functions.
7+
#
8+
# This must be changed for production, but we recommend not changing it in this file.
9+
#
10+
# See http://www.playframework.com/documentation/latest/ApplicationSecret for more details.
11+
application.secret="dC0[71PA/qK[5C3bql6NCR5A<EEb<OuUM<03NlEsjDvQjfePgS>VisZa`ZH[bFrR"
12+
13+
# The application languages
14+
# ~~~~~
15+
application.langs="en"
16+
17+
# Global object class
18+
# ~~~~~
19+
# Define the Global object class for this application.
20+
# Default to Global in the root package.
21+
# application.global=Global
22+
23+
# Router
24+
# ~~~~~
25+
# Define the Router object to use for this application.
26+
# This router will be looked up first when the application is starting up,
27+
# so make sure this is the entry point.
28+
# Furthermore, it's assumed your route file is named properly.
29+
# So for an application router like `conf/my.application.Router`,
30+
# you may need to define a router file `my.application.routes`.
31+
# Default to Routes in the root package (and `conf/routes`)
32+
# application.router=my.application.Routes
33+
34+
# Database configuration
35+
# ~~~~~
36+
# You can declare as many datasources as you want.
37+
# By convention, the default datasource is named `default`
38+
#
39+
# db.default.driver=org.h2.Driver
40+
# db.default.url="jdbc:h2:mem:play"
41+
# db.default.user=sa
42+
# db.default.password=""
43+
#
44+
# You can expose this datasource via JNDI if needed (Useful for JPA)
45+
# db.default.jndiName=DefaultDS
46+
47+
# Evolutions
48+
# ~~~~~
49+
# You can disable evolutions if needed
50+
# evolutionplugin=disabled
51+
52+
# Ebean configuration
53+
# ~~~~~
54+
# You can declare as many Ebean servers as you want.
55+
# By convention, the default server is named `default`
56+
#
57+
# ebean.default="models.*"
58+
59+
# Logger
60+
# ~~~~~
61+
# You can also configure logback (http://logback.qos.ch/),
62+
# by providing an application-logger.xml file in the conf directory.
63+
64+
# Root logger:
65+
logger.root=ERROR
66+
67+
# Logger used by the framework:
68+
logger.play=INFO
69+
70+
# Logger provided to your application:
71+
logger.application=DEBUG
72+

conf/routes

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Routes
2+
# This file defines all application routes (Higher priority routes first)
3+
# ~~~~
4+
5+
# Home page
6+
GET / controllers.Application.index()
7+
8+
# Map static resources from the /public folder to the /assets URL path
9+
GET /assets/*file controllers.Assets.at(path="/public", file)

project/build.properties

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#Activator-generated Properties
2+
#Wed Mar 04 22:12:00 CET 2015
3+
template.uuid=6ba5ad51-aeec-4916-ba7d-5517456a13c0
4+
sbt.version=0.13.5

0 commit comments

Comments
 (0)