added an plugin archetype

This commit is contained in:
Sebastian Sdorra
2010-12-29 18:10:00 +01:00
parent 6c3ef84958
commit b06f2ab3a2
8 changed files with 294 additions and 0 deletions

View File

@@ -17,6 +17,7 @@
<modules>
<module>scm-web-compressor</module>
<module>scm-plugin-archetype</module>
</modules>
<dependencies>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>scm-maven-plugins</artifactId>
<groupId>sonia.scm.maven</groupId>
<version>1.0-M5-SNAPSHOT</version>
</parent>
<groupId>sonia.scm.maven</groupId>
<artifactId>scm-plugin-archetype</artifactId>
<version>1.0-M5-SNAPSHOT</version>
<name>scm-plugin-archetype</name>
</project>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Document : archetype-metadata.xml
Created on : December 29, 2010, 4:58 PM
Author : sdorra
Description:
Purpose of the document follows.
-->
<archetype-descriptor name="scm-plugin">
<fileSets>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet filtered="false" encoding="UTF-8">
<directory>src/main/resources</directory>
<includes>
<include>**/*.js</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Document : archetype.xml
Created on : December 29, 2010, 5:00 PM
Author : sdorra
Description:
Purpose of the document follows.
-->
<archetype>
<id>scm-plugin</id>
<sources>
<source>src/main/java/HelloResource.java</source>
</sources>
<resources>
<resource>src/main/resources/META-INF/scm/plugin.xml</resource>
<resource>src/main/resources/scm/sample.hello.js</resource>
</resources>
</archetype>

View File

@@ -0,0 +1,39 @@
#set($dollar = '$')
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>scm-plugins</artifactId>
<groupId>sonia.scm.plugins</groupId>
<version>1.0-M5-SNAPSHOT</version>
</parent>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<packaging>jar</packaging>
<version>${version}</version>
<name>${dollar}{project.artifactId}</name>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency>
<!-- test scope -->
<dependency>
<groupId>sonia.scm</groupId>
<artifactId>scm-test</artifactId>
<version>1.0-M5-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,83 @@
/**
* Copyright (c) 2010, Sebastian Sdorra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of SCM-Manager; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://bitbucket.org/sdorra/scm-manager
*
*/
package ${package};
//~--- non-JDK imports --------------------------------------------------------
import com.google.inject.Inject;
import com.google.inject.Provider;
import sonia.scm.security.SecurityContext;
//~--- JDK imports ------------------------------------------------------------
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("hello")
public class HelloResource {
/**
* Constructs ...
*
*
* @param securityContextProvider
*/
@Inject
public HelloResource(Provider<SecurityContext> securityContextProvider)
{
message = "Hello "
+ securityContextProvider.get().getUser().getDisplayName();
}
//~--- get methods ----------------------------------------------------------
/**
* Method description
*
*
* @return
*/
@GET
@Produces(MediaType.TEXT_PLAIN)
public String getHelloMessage()
{
return message;
}
//~--- fields ---------------------------------------------------------------
/** Field description */
private String message;
}

View File

@@ -0,0 +1,25 @@
#set($dollar = '$')
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<information>
<groupId>${dollar}{project.groupId}</groupId>
<artifactId>${dollar}{project.artifactId}</artifactId>
<version>${dollar}{project.version}</version>
<name>${dollar}{project.name}</name>
<description>${dollar}{project.description}</description>
<!--
<author></author>
<url>${dollar}{project.url}</url>
-->
</information>
<packages>
<package>${package}</package>
</packages>
<resources>
<script>/scm/sample.hello.js</script>
</resources>
</plugin>

View File

@@ -0,0 +1,68 @@
/* *
* Copyright (c) 2010, Sebastian Sdorra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of SCM-Manager; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://bitbucket.org/sdorra/scm-manager
*
*/
function sayHello(){
Ext.Ajax.request({
url: restUrl + 'hello',
method: 'GET',
disableCaching: true,
success: function(response){
var msg = response.responseText;
Ext.MessageBox.show({
title: 'Hello Message',
msg: msg,
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.INFO
});
},
failure: function(){
Ext.MessageBox.show({
title: 'Error',
msg: 'Could not display the hello message',
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.ERROR
});
}
});
}
loginCallbacks.push(function(){
var navPanel = Ext.getCmp('navigationPanel');
var count = navPanel.count() - 1;
navPanel.insertSection(count, {
title: 'Hello World',
items: [{
label: 'Say Hello',
fn: sayHello
}]
});
});