http://git-wip-us.apache.org/repos/asf/isis/blob/1c328cf2/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/WEB-INF/web.xml b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..7b6d253 --- /dev/null +++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,136 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<web-app id="WebApp_ID" version="2.4" + xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> + + <display-name>Quickstart Wicket app</display-name> + + <!-- which configuration directory to read overloaded property files from --> + <!-- + Normally configuration like this should be done from outside your web + application. Especially if your configuration is not know in advance or + if it can change depending on where the application gets deployed. + + For instance to configure this in Tomcat outside the application WAR add + the following line to your application context ( For more detail see: + http://tomcat.apache.org/tomcat-7.0-doc/config/context.html${symbol_pound}Context_Parameters ) + + <Parameter name="isis.config.dir" value="/usr/local/tomcat/conf/" + override="true"/> + + If your configuration directory is fixed you can enable the following + context parameter in here and forget about the outside part. + + <context-param> + <param-name>isis.config.dir</param-name> + <param-value>location of your config directory if fixed</param-value> + </context-param> + --> + + <!-- cache static resources for 1 day --> + <filter> + <filter-name>ResourceCachingFilter</filter-name> + <filter-class>org.apache.isis.core.webapp.content.ResourceCachingFilter</filter-class> + <init-param> + <param-name>CacheTime</param-name> + <param-value>86400</param-value> + </init-param> + </filter> + <filter-mapping> + <filter-name>ResourceCachingFilter</filter-name> + <url-pattern>*.js</url-pattern> + </filter-mapping> + <filter-mapping> + <filter-name>ResourceCachingFilter</filter-name> + <url-pattern>*.css</url-pattern> + </filter-mapping> + <filter-mapping> + <filter-name>ResourceCachingFilter</filter-name> + <url-pattern>*.png</url-pattern> + </filter-mapping> + <filter-mapping> + <filter-name>ResourceCachingFilter</filter-name> + <url-pattern>*.jpg</url-pattern> + </filter-mapping> + <filter-mapping> + <filter-name>ResourceCachingFilter</filter-name> + <url-pattern>*.gif</url-pattern> + </filter-mapping> + <filter-mapping> + <filter-name>ResourceCachingFilter</filter-name> + <url-pattern>*.html</url-pattern> + </filter-mapping> + + <servlet> + <servlet-name>Resource</servlet-name> + <servlet-class>org.apache.isis.core.webapp.content.ResourceServlet</servlet-class> + </servlet> + <servlet-mapping> + <servlet-name>Resource</servlet-name> + <url-pattern>*.css</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>Resource</servlet-name> + <url-pattern>*.png</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>Resource</servlet-name> + <url-pattern>*.jpg</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>Resource</servlet-name> + <url-pattern>*.gif</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>Resource</servlet-name> + <url-pattern>*.js</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>Resource</servlet-name> + <url-pattern>*.html</url-pattern> + </servlet-mapping> + + + + <!-- + - + - config specific to the wicket-viewer + - + --> + <filter> + <filter-name>wicket</filter-name> + <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class> + <init-param> + <param-name>applicationClassName</param-name> + <param-value>app.QuickStartApplication</param-value> + </init-param> + </filter> + + <filter-mapping> + <filter-name>wicket</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + + +</web-app>
http://git-wip-us.apache.org/repos/asf/isis/blob/1c328cf2/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/css/application.css ---------------------------------------------------------------------- diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/css/application.css b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/css/application.css new file mode 100644 index 0000000..1e2caf9 --- /dev/null +++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/css/application.css @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* +uncomment to add a logo (in an ../images directory relative to this file) + +#header { + height: 48px; + background-image: url("../images/logo.png"); + background-repeat: no-repeat; +} + +#header h1 { + display: none; +} +*/ http://git-wip-us.apache.org/repos/asf/isis/blob/1c328cf2/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/scripts/application.js ---------------------------------------------------------------------- diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/scripts/application.js b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/scripts/application.js new file mode 100644 index 0000000..d8cf6fe --- /dev/null +++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/scripts/application.js @@ -0,0 +1,3 @@ +$(document).ready(function() { + /// here... +}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/1c328cf2/example/archetype/quickstart_wicket_restful_jdo/src/test/resources/projects/basic/archetype.properties ---------------------------------------------------------------------- diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/test/resources/projects/basic/archetype.properties b/example/archetype/quickstart_wicket_restful_jdo/src/test/resources/projects/basic/archetype.properties new file mode 100644 index 0000000..44e71e3 --- /dev/null +++ b/example/archetype/quickstart_wicket_restful_jdo/src/test/resources/projects/basic/archetype.properties @@ -0,0 +1,5 @@ +#Wed Dec 19 00:06:17 GMT 2012 +package=it.pkg +version=0.1-SNAPSHOT +groupId=archetype.it +artifactId=basic http://git-wip-us.apache.org/repos/asf/isis/blob/1c328cf2/example/archetype/quickstart_wicket_restful_jdo/src/test/resources/projects/basic/goal.txt ---------------------------------------------------------------------- diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/test/resources/projects/basic/goal.txt b/example/archetype/quickstart_wicket_restful_jdo/src/test/resources/projects/basic/goal.txt new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/isis/blob/1c328cf2/scripts/updateGeneratedArchetypeSources.groovy ---------------------------------------------------------------------- diff --git a/scripts/updateGeneratedArchetypeSources.groovy b/scripts/updateGeneratedArchetypeSources.groovy index 1f1ed9b..dd449f7 100644 --- a/scripts/updateGeneratedArchetypeSources.groovy +++ b/scripts/updateGeneratedArchetypeSources.groovy @@ -21,14 +21,15 @@ import groovy.xml.XmlUtil import javax.xml.transform.* import javax.xml.transform.stream.* -def ROOT="quickstart/target/generated-sources/archetype/src/main/resources/" - ///////////////////////////////////////////////////// // -// update archetype-metadata.xml +// constants // ///////////////////////////////////////////////////// +def BASE="target/generated-sources/archetype/" +def ROOT=BASE + "src/main/resources/" + def license_using_xml_comments="""<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one @@ -49,6 +50,44 @@ def license_using_xml_comments="""<?xml version="1.0" encoding="UTF-8"?> under the License. --> """ +///////////////////////////////////////////////////// +// +// update pom.xml's groupId +// +///////////////////////////////////////////////////// + +def pomFile=new File(BASE+"pom.xml") + +println "updating ${pomFile.path}" + +// read file, ignoring XML pragma +def pomFileText = stripXmlPragma(pomFile) + +def pomXml = new XmlSlurper(false,true).parseText(pomFileText) +pomXml.groupId='org.apache.isis.archetype' + +def pomSmb = new groovy.xml.StreamingMarkupBuilder().bind { + mkp.declareNamespace("":"http://maven.apache.org/POM/4.0.0") + mkp.yield(pomXml) +} + +def pomTempFile = File.createTempFile("temp",".xml") +pomTempFile.text = indentXml(pomSmb.toString()) +def pomXmlText = stripXmlPragma(pomTempFile) + + +pomFile.text = + license_using_xml_comments + + pomXmlText + + + +///////////////////////////////////////////////////// +// +// update archetype-metadata.xml +// +///////////////////////////////////////////////////// + def metaDataFile=new File(ROOT+"META-INF/maven/archetype-metadata.xml") @@ -71,31 +110,14 @@ def metaDataSmb = new groovy.xml.StreamingMarkupBuilder().bind { mkp.yield(metaDataXml) } -String indentXml(xml) { - def factory = TransformerFactory.newInstance() - factory.setAttribute("indent-number", 2); - - Transformer transformer = factory.newTransformer() - transformer.setOutputProperty(OutputKeys.INDENT, 'yes') - StreamResult result = new StreamResult(new StringWriter()) - transformer.transform(new StreamSource(new ByteArrayInputStream(xml.toString().bytes)), result) - return result.writer.toString() -} - -String stripXmlPragma(File file) { - def sw = new StringWriter() - file.filterLine(sw) { ! (it =~ /^\<\?xml/ ) } - return sw.toString() -} - def tempFile = File.createTempFile("temp",".xml") tempFile.text = indentXml(metaDataSmb.toString()) -def xmlText = stripXmlPragma(tempFile) +def metaDataXmlText = stripXmlPragma(tempFile) metaDataFile.text = license_using_xml_comments + - xmlText + metaDataXmlText ///////////////////////////////////////////////////// @@ -125,4 +147,26 @@ new File(ROOT+"archetype-resources/").eachDirRecurse() { dir -> } +/////////////////////////////////////////////////// +// +// helper methods +// +/////////////////////////////////////////////////// + +String indentXml(xml) { + def factory = TransformerFactory.newInstance() + factory.setAttribute("indent-number", 2); + + Transformer transformer = factory.newTransformer() + transformer.setOutputProperty(OutputKeys.INDENT, 'yes') + StreamResult result = new StreamResult(new StringWriter()) + transformer.transform(new StreamSource(new ByteArrayInputStream(xml.toString().bytes)), result) + return result.writer.toString() +} + +String stripXmlPragma(File file) { + def sw = new StringWriter() + file.filterLine(sw) { ! (it =~ /^\<\?xml/ ) } + return sw.toString() +}
