Skip to content

Commit b0a32b0

Browse files
committed
Initial commit. Lots of stuff still undone. First and foremost fix
indexation and add some Quartz jobs to schedule it for every board object persisted.
0 parents  commit b0a32b0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+4260
-0
lines changed

olccs-ng/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

olccs-ng/.project

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>olccs-ng</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.wst.common.project.facet.core.builder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.jdt.core.javabuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>com.springsource.sts.grails.core.nature</nature>
21+
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
22+
<nature>org.eclipse.jdt.core.javanature</nature>
23+
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
24+
</natures>
25+
<linkedResources>
26+
<link>
27+
<name>.link_to_grails_plugins</name>
28+
<type>2</type>
29+
<locationURI>GRAILS_ROOT/2.0.0.M2/projects/olccs-ng/plugins</locationURI>
30+
</link>
31+
<link>
32+
<name>grails-app/conf/olccs-ng-config.groovy</name>
33+
<type>1</type>
34+
<location>C:/Users/AlainP/.grails/olccs-ng-config.groovy</location>
35+
</link>
36+
</linkedResources>
37+
</projectDescription>

olccs-ng/application.properties

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#Grails Metadata file
2+
#Tue Sep 27 22:20:13 CEST 2011
3+
app.grails.version=2.0.0.M2
4+
app.name=olccs-ng
5+
app.servlet.version=2.5
6+
app.version=0.1
7+
plugins.quartz=0.4.2
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import org.bouchot.*
2+
import grails.util.Environment
3+
4+
class BootStrap {
5+
def init = { servletContext ->
6+
if(!Board.findByName('shoop')) {
7+
def b = new Board()
8+
b.name = 'shoop'
9+
b.getURL = 'http://dax.sveetch.net/tribune/remote.xml'
10+
b.postURL = 'http://dax.sveetch.net/tribune/post.xml'
11+
b.lastIdParameter = 'last'
12+
b.postParameter = 'content'
13+
b.addToAliases('dax')
14+
b.addToAliases('sveetch')
15+
b.save()
16+
}
17+
//ESService.initService()
18+
}
19+
def destroy = {
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
grails.servlet.version = "2.5" // Change depending on target container compliance (2.5 or 3.0)
2+
grails.project.class.dir = "target/classes"
3+
grails.project.test.class.dir = "target/test-classes"
4+
grails.project.test.reports.dir = "target/test-reports"
5+
//grails.project.war.file = "target/${appName}-${appVersion}.war"
6+
7+
grails.project.dependency.resolution = {
8+
// inherit Grails' default dependencies
9+
inherits("global") {
10+
// uncomment to disable ehcache
11+
// excludes 'ehcache'
12+
}
13+
log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
14+
checksums true // Whether to verify checksums on resolve
15+
16+
repositories {
17+
inherits true // Whether to inherit repository definitions from plugins
18+
grailsPlugins()
19+
grailsHome()
20+
grailsCentral()
21+
mavenCentral()
22+
23+
// uncomment these to enable remote dependency resolution from public Maven repositories
24+
//mavenCentral()
25+
//mavenLocal()
26+
//mavenRepo "http://snapshots.repository.codehaus.org"
27+
//mavenRepo "http://repository.codehaus.org"
28+
//mavenRepo "http://download.java.net/maven/2/"
29+
//mavenRepo "http://repository.jboss.com/maven2/"
30+
mavenRepo "https://oss.sonatype.org/content/repositories/releases"
31+
}
32+
dependencies {
33+
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
34+
35+
// runtime 'mysql:mysql-connector-java:5.1.16'
36+
37+
runtime 'org.elasticsearch:elasticsearch:0.17.6'
38+
runtime 'org.elasticsearch:elasticsearch-lang-groovy:0.17.6'
39+
runtime 'org.ccil.cowan.tagsoup:tagsoup:1.2.1'
40+
}
41+
42+
plugins {
43+
compile ":hibernate:$grailsVersion"
44+
compile ":jquery:1.6.1.1"
45+
compile ":resources:1.0.2"
46+
47+
build ":tomcat:$grailsVersion"
48+
}
49+
}
+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// locations to search for config files that get merged into the main config
2+
// config files can either be Java properties files or ConfigSlurper scripts
3+
4+
grails.config.locations = [ /*"classpath:${appName}-config.properties",
5+
"classpath:${appName}-config.groovy",
6+
"file:${userHome}/.grails/${appName}-config.properties",*/
7+
"file:${userHome}/.grails/${appName}-config.groovy"]
8+
9+
// if (System.properties["${appName}.config.location"]) {
10+
// grails.config.locations << "file:" + System.properties["${appName}.config.location"]
11+
// }
12+
13+
14+
grails.project.groupId = appName // change this to alter the default package name and Maven publishing destination
15+
grails.mime.file.extensions = true // enables the parsing of file extensions from URLs into the request format
16+
grails.mime.use.accept.header = false
17+
grails.mime.types = [ html: ['text/html','application/xhtml+xml'],
18+
xml: ['text/xml', 'application/xml'],
19+
text: 'text/plain',
20+
js: 'text/javascript',
21+
rss: 'application/rss+xml',
22+
atom: 'application/atom+xml',
23+
css: 'text/css',
24+
csv: 'text/csv',
25+
all: '*/*',
26+
json: ['application/json','text/json'],
27+
form: 'application/x-www-form-urlencoded',
28+
multipartForm: 'multipart/form-data'
29+
]
30+
31+
// URL Mapping Cache Max Size, defaults to 5000
32+
//grails.urlmapping.cache.maxsize = 1000
33+
34+
// What URL patterns should be processed by the resources plugin
35+
grails.resources.adhoc.patterns = ['/images/*', '/css/*', '/js/*', '/plugins/*']
36+
37+
38+
// The default codec used to encode data with ${}
39+
grails.views.default.codec = "none" // none, html, base64
40+
grails.views.gsp.encoding = "UTF-8"
41+
grails.converters.encoding = "UTF-8"
42+
// enable Sitemesh preprocessing of GSP pages
43+
grails.views.gsp.sitemesh.preprocess = true
44+
// scaffolding templates configuration
45+
grails.scaffolding.templates.domainSuffix = 'Instance'
46+
47+
// Set to false to use the new Grails 1.2 JSONBuilder in the render method
48+
grails.json.legacy.builder = false
49+
// enabled native2ascii conversion of i18n properties files
50+
grails.enable.native2ascii = true
51+
// packages to include in Spring bean scanning
52+
grails.spring.bean.packages = []
53+
// whether to disable processing of multi part requests
54+
grails.web.disable.multipart=false
55+
56+
// request parameters to mask when logging exceptions
57+
grails.exceptionresolver.params.exclude = ['password']
58+
59+
// set per-environment serverURL stem for creating absolute links
60+
environments {
61+
development {
62+
grails.logging.jul.usebridge = true
63+
}
64+
production {
65+
grails.logging.jul.usebridge = false
66+
grails.serverURL = "http://www.changeme.com"
67+
}
68+
}
69+
70+
// log4j configuration
71+
log4j = {
72+
// Example of changing the log pattern for the default console
73+
// appender:
74+
//
75+
//appenders {
76+
// console name:'stdout', layout:pattern(conversionPattern: '%c{2} %m%n')
77+
//}
78+
79+
error 'org.codehaus.groovy.grails.web.servlet', // controllers
80+
'org.codehaus.groovy.grails.web.pages', // GSP
81+
'org.codehaus.groovy.grails.web.sitemesh', // layouts
82+
'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping
83+
'org.codehaus.groovy.grails.web.mapping', // URL mapping
84+
'org.codehaus.groovy.grails.commons', // core / classloading
85+
'org.codehaus.groovy.grails.plugins', // plugins
86+
'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration
87+
'org.springframework',
88+
'org.hibernate',
89+
'net.sf.ehcache.hibernate'
90+
}
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
dataSource {
2+
pooled = true
3+
driverClassName = "org.h2.Driver"
4+
username = "sa"
5+
password = ""
6+
}
7+
hibernate {
8+
cache.use_second_level_cache = true
9+
cache.use_query_cache = true
10+
cache.provider_class = 'net.sf.ehcache.hibernate.EhCacheProvider'
11+
}
12+
// environment specific settings
13+
environments {
14+
development {
15+
dataSource {
16+
dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
17+
url = "jdbc:h2:mem:devDb"
18+
}
19+
}
20+
test {
21+
dataSource {
22+
dbCreate = "update"
23+
url = "jdbc:h2:mem:testDb"
24+
}
25+
}
26+
production {
27+
dataSource {
28+
dbCreate = "update"
29+
url = "jdbc:h2:prodDb"
30+
// For MySQL production scenarios enable the following settings
31+
// pooled = true
32+
// properties {
33+
// minEvictableIdleTimeMillis=1800000
34+
// timeBetweenEvictionRunsMillis=1800000
35+
// numTestsPerEvictionRun=3
36+
// testOnBorrow=true
37+
// testWhileIdle=true
38+
// testOnReturn=true
39+
// validationQuery="SELECT 1"
40+
// }
41+
}
42+
}
43+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import org.bouchot.*
2+
3+
class UrlMappings {
4+
static mappings = {
5+
"/$controller/$action?/$id?"{
6+
constraints {
7+
// apply constraints here
8+
}
9+
}
10+
11+
"/$board/$action" {
12+
controller = "API"
13+
constraints {
14+
board(validator: {
15+
Board.list()*.name.contains(it)
16+
})
17+
}
18+
}
19+
20+
"/"(view:"/index")
21+
"500"(view:'/error')
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Place your Spring DSL code here
2+
beans = {
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package org.bouchot
2+
3+
import grails.converters.*
4+
5+
class APIController {
6+
def ESService
7+
8+
def xml = {
9+
def hits = ESService.backend(params.board)?.hits
10+
render(contentType: "text/xml") {
11+
board(site: params.board) {
12+
for (h in hits) {
13+
post(time: h.source.time, id: h.id) {
14+
info(h.source.info)
15+
message(h.source.message)
16+
login(h.source.login)
17+
}
18+
}
19+
}
20+
}
21+
}
22+
23+
def json = {
24+
def res = ESService.backend(params.board)
25+
render res
26+
}
27+
28+
def search = {
29+
def hits = ESService.search(params.board, params.query)?.hits
30+
render(contentType: "text/xml") {
31+
board(site: params.board) {
32+
for (h in hits) {
33+
post(time: h.source.time, id: h.id) {
34+
info(h.source.info)
35+
message(h.source.message)
36+
login(h.source.login)
37+
}
38+
}
39+
}
40+
}
41+
}
42+
43+
def index = {
44+
def b = Board.findByName(params.board)
45+
if (!b)
46+
render 'Non existent board'
47+
def res = ESService.index(b)
48+
render res
49+
}
50+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.bouchot
2+
3+
class BoardController {
4+
static scaffold = true
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.bouchot
2+
3+
class Board {
4+
static hasMany = [aliases: String]
5+
String name
6+
String getURL
7+
String postURL
8+
String postParameter
9+
String lastIdParameter
10+
11+
static constraints = {
12+
name(nullable: false, blank: false, unique: true)
13+
getURL(nullable: false, blank: false, url: true)
14+
postURL(nullable: false, blank: false, url: true)
15+
postParameter(nullable: false, blank: false)
16+
lastIdParameter(nullable: true, blank: true)
17+
aliases(nullable: true)
18+
}
19+
}

0 commit comments

Comments
 (0)