Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

WIP: Siesta plugin #648

Merged
merged 26 commits into from

1 participant

jdillon added some commits
@jdillon jdillon Re-add siesta + siesta-test plugins 8249c64
@jdillon jdillon Merge branch 'move-rest-api-to-plugin' into siesta-plugin2
Conflicts:
	nexus/nexus-core-plugins/pom.xml
fd1dc13
@jdillon jdillon Merge branch 'move-rest-api-to-plugin' into siesta-plugin2
Conflicts:
	nexus/nexus-core-plugins/pom.xml
15adceb
@jdillon jdillon Merge branch 'move-rest-api-to-plugin' into siesta-plugin2 caaea85
@jdillon jdillon update for upstream changes 62bee8d
@jdillon jdillon Merge branch 'move-rest-api-to-plugin' into siesta-plugin2 1cf0fc6
@jdillon jdillon Merge branch 'master' into siesta-plugin2 afcce84
@jdillon jdillon Move to plugins directory 53388eb
@jdillon jdillon Merge branch 'master' into siesta-plugin2 e6face9
@jdillon jdillon update headers 276eede
@jdillon jdillon Merge branch 'master' into siesta-plugin2
Conflicts:
	nexus/plugins/pom.xml
645d1ea
@jdillon jdillon Merge branch 'master' into siesta-plugin2 cbb0412
@jdillon jdillon Move into new location, update versions bdf849c
@jdillon jdillon Merge branch 'master' into siesta-plugin2
Conflicts:
	plugins/pom.xml
68a9671
@jdillon jdillon Merge branch 'master' into siesta-plugin2 3d9231c
@jdillon jdillon Checkpoint some work, pending more changes before this is usable. 75ae833
@jdillon jdillon Merge branch 'master' into siesta-plugin2 edce0ab
@jdillon jdillon Merge branch 'master' into siesta-plugin2 e3597b8
@jdillon jdillon More configuration for aspectj 4381e3b
@jdillon jdillon Drop aspectj 648d650
@jdillon jdillon Merge branch 'master' into siesta-plugin2 90b412e
@jdillon jdillon Add deps on shiro-guice 23d7ca7
@jdillon jdillon notes a264814
@jdillon jdillon Merge branch 'master' into siesta-plugin2 398c6d0
@jdillon jdillon Expose contextPath as contextPath, mark resourcePath as @deprecated, …
…"resource" use here is confusing term, prefer context since that is what this value is.
ef8999d
@jdillon jdillon Add some javascript to siesta plugin so we can contribute helper api.
Add Nexus.siesta.basePath so that plugins can find the right mount point.
8375460
@jdillon jdillon merged commit 7d46107 into master
@jdillon jdillon deleted the siesta-plugin2 branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 7, 2012
  1. @jdillon
Commits on Nov 8, 2012
  1. @jdillon

    Merge branch 'move-rest-api-to-plugin' into siesta-plugin2

    jdillon authored
    Conflicts:
    	nexus/nexus-core-plugins/pom.xml
  2. @jdillon

    Merge branch 'move-rest-api-to-plugin' into siesta-plugin2

    jdillon authored
    Conflicts:
    	nexus/nexus-core-plugins/pom.xml
  3. @jdillon
  4. @jdillon

    update for upstream changes

    jdillon authored
Commits on Nov 9, 2012
  1. @jdillon
  2. @jdillon
  3. @jdillon

    Move to plugins directory

    jdillon authored
Commits on Nov 18, 2012
  1. @jdillon
  2. @jdillon

    update headers

    jdillon authored
Commits on Jan 4, 2013
  1. @jdillon

    Merge branch 'master' into siesta-plugin2

    jdillon authored
    Conflicts:
    	nexus/plugins/pom.xml
  2. @jdillon
  3. @jdillon
Commits on Jan 9, 2013
  1. @jdillon

    Merge branch 'master' into siesta-plugin2

    jdillon authored
    Conflicts:
    	plugins/pom.xml
Commits on Jan 17, 2013
  1. @jdillon
  2. @jdillon
Commits on Jan 18, 2013
  1. @jdillon
  2. @jdillon
  3. @jdillon

    More configuration for aspectj

    jdillon authored
Commits on Jan 22, 2013
  1. @jdillon

    Drop aspectj

    jdillon authored
  2. @jdillon
  3. @jdillon

    Add deps on shiro-guice

    jdillon authored
Commits on Jan 23, 2013
  1. @jdillon

    notes

    jdillon authored
  2. @jdillon
Commits on Jan 24, 2013
  1. @jdillon

    Expose contextPath as contextPath, mark resourcePath as @deprecated, …

    jdillon authored
    …"resource" use here is confusing term, prefer context since that is what this value is.
  2. @jdillon

    Add some javascript to siesta plugin so we can contribute helper api.

    jdillon authored
    Add Nexus.siesta.basePath so that plugins can find the right mount point.
This page is out of date. Refresh to see the latest.
Showing with 849 additions and 30 deletions.
  1. +5 −1 nexus-core/pom.xml
  2. +1 −0  nexus-core/src/main/java/org/sonatype/nexus/plugins/DefaultNexusPluginManager.java
  3. +1 −0  nexus-web-utils/src/main/java/org/sonatype/nexus/web/PlexusContainerContextListener.java
  4. +32 −0 nexus-webapp/pom.xml
  5. +4 −3 nexus-webapp/src/main/webapp/js/nexus/config.js
  6. +6 −18 plugin-parent/pom.xml
  7. +1 −0  plugins/pom.xml
  8. +184 −0 plugins/siesta/nexus-siesta-plugin/pom.xml
  9. +58 −0 ...ta/nexus-siesta-plugin/src/main/java/org/sonatype/nexus/plugins/siesta/LogConfigurationParticipantImpl.java
  10. +53 −0 ...iesta/nexus-siesta-plugin/src/main/java/org/sonatype/nexus/plugins/siesta/NexusIndexHtmlCustomizerImpl.java
  11. +72 −0 plugins/siesta/nexus-siesta-plugin/src/main/java/org/sonatype/nexus/plugins/siesta/SiestaModule.java
  12. +20 −0 plugins/siesta/nexus-siesta-plugin/src/main/js/nexus-siesta-plugin.js
  13. +27 −0 plugins/siesta/nexus-siesta-plugin/src/main/js/nexus/siesta.js
  14. +23 −0 plugins/siesta/nexus-siesta-plugin/src/main/resources/org/sonatype/nexus/plugins/siesta/logback-siesta.xml
  15. +34 −0 plugins/siesta/nexus-siesta-test-plugin/enunciate.xml
  16. +98 −0 plugins/siesta/nexus-siesta-test-plugin/pom.xml
  17. +84 −0 plugins/siesta/nexus-siesta-test-plugin/src/main/java/org/sonatype/nexus/plugins/siesta/test/TestResource.java
  18. +46 −0 plugins/siesta/nexus-siesta-test-plugin/src/main/schema/bindings.xjb
  19. +38 −0 plugins/siesta/nexus-siesta-test-plugin/src/main/schema/model.xsd
  20. +33 −0 plugins/siesta/pom.xml
  21. +29 −8 pom.xml
View
6 nexus-core/pom.xml
@@ -150,7 +150,11 @@
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
</dependency>
-
+ <dependency>
+ <groupId>org.apache.shiro</groupId>
+ <artifactId>shiro-guice</artifactId>
+ </dependency>
+
<!-- SISU Container -->
<dependency>
<groupId>org.sonatype.sisu</groupId>
View
1  nexus-core/src/main/java/org/sonatype/nexus/plugins/DefaultNexusPluginManager.java
@@ -465,6 +465,7 @@ protected void configure()
final Module[] modules = {
resourceModule,
+ // TODO: May want a central location to configure NX core + NX plugin modules
// Add support for @Timed
new TimingModule()
};
View
1  nexus-web-utils/src/main/java/org/sonatype/nexus/web/PlexusContainerContextListener.java
@@ -82,6 +82,7 @@ public void contextInitialized( final ServletContextEvent sce )
modules.add( new NexusWebModule( sce.getServletContext() ) );
modules.add( new AppContextModule( appContext ) );
+ // TODO: May want a central location to configure NX core + NX plugin modules
// Add support for @Timed
modules.add( new TimingModule() );
View
32 nexus-webapp/pom.xml
@@ -90,6 +90,24 @@
<dependency>
<groupId>org.sonatype.nexus.plugins</groupId>
+ <artifactId>nexus-siesta-plugin</artifactId>
+ <version>${project.version}</version>
+ <classifier>bundle</classifier>
+ <type>zip</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.sonatype.nexus.plugins</groupId>
+ <artifactId>nexus-siesta-test-plugin</artifactId>
+ <version>${project.version}</version>
+ <classifier>bundle</classifier>
+ <type>zip</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.sonatype.nexus.plugins</groupId>
<artifactId>nexus-lvo-plugin</artifactId>
<version>${project.version}</version>
<classifier>bundle</classifier>
@@ -192,6 +210,20 @@
</artifactItem>
<artifactItem>
<groupId>org.sonatype.nexus.plugins</groupId>
+ <artifactId>nexus-siesta-plugin</artifactId>
+ <version>${project.version}</version>
+ <classifier>bundle</classifier>
+ <type>zip</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.sonatype.nexus.plugins</groupId>
+ <artifactId>nexus-siesta-test-plugin</artifactId>
+ <version>${project.version}</version>
+ <classifier>bundle</classifier>
+ <type>zip</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.sonatype.nexus.plugins</groupId>
<artifactId>nexus-lvo-plugin</artifactId>
<version>${project.version}</version>
<classifier>bundle</classifier>
View
7 nexus-webapp/src/main/webapp/js/nexus/config.js
@@ -38,7 +38,6 @@ define('nexus/config',['extjs', 'nexus/messagebox', 'sonatype/init'], function(E
contextPath = path.substr(0, path.lastIndexOf('/')),
servicePathSnippet = '/service/local',
servicePath = contextPath + servicePathSnippet,
- resourcePath = contextPath,
browsePathSnippet = '/content',
contentPath = contextPath + browsePathSnippet,
repoBrowsePathSnippet = browsePathSnippet + '/repositories',
@@ -49,9 +48,11 @@ define('nexus/config',['extjs', 'nexus/messagebox', 'sonatype/init'], function(E
return {
isDebug : window.location.search === '?debug',
host : host,
+ contextPath : contextPath,
servicePath : servicePath,
- resourcePath : resourcePath,
- extPath : resourcePath + '/ext-3.4.0',
+ // @deprecated use contextPath
+ resourcePath : contextPath,
+ extPath : contextPath + '/ext-3.4.0',
contentPath : contentPath,
cssPath : '/styles',
jsPath : '/js',
View
24 plugin-parent/pom.xml
@@ -179,12 +179,12 @@
<!--
Required for plugins which provide modern JAX-RS 1.1 REST resources.
-->
- <!--<dependency>-->
- <!--<groupId>org.sonatype.nexus.plugins</groupId>-->
- <!--<artifactId>nexus-siesta-plugin</artifactId>-->
- <!--<type>${nexus-plugin.type}</type>-->
- <!--<version>${nexus.version}</version>-->
- <!--</dependency>-->
+ <dependency>
+ <groupId>org.sonatype.nexus.plugins</groupId>
+ <artifactId>nexus-siesta-plugin</artifactId>
+ <type>${nexus-plugin.type}</type>
+ <version>${nexus.version}</version>
+ </dependency>
<!--
Required for plugins which provide indexer integration.
@@ -271,18 +271,6 @@
</plugin>
<!--
- Required for nexus-plugin packaging (via nexus-plugin-bundle-maven-plugin).
- -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>aspectj-maven-plugin</artifactId>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
-
- <!--
For legacy-plugins which still need Plexus descriptors.
-->
<plugin>
View
1  plugins/pom.xml
@@ -42,6 +42,7 @@
<modules>
<module>h2</module>
+ <module>siesta</module>
<module>restlet1x</module>
<module>indexer</module>
<module>ldap</module>
View
184 plugins/siesta/nexus-siesta-plugin/pom.xml
@@ -0,0 +1,184 @@
+<!--
+
+ Sonatype Nexus (TM) Open Source Version
+ Copyright (c) 2007-2012 Sonatype, Inc.
+ All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
+
+ This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
+ which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
+
+ Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
+ of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
+ Eclipse Foundation. All other trademarks are the property of their respective owners.
+
+-->
+<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>
+ <groupId>org.sonatype.nexus.plugins</groupId>
+ <artifactId>nexus-siesta</artifactId>
+ <version>2.4-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>nexus-siesta-plugin</artifactId>
+ <packaging>nexus-plugin</packaging>
+
+ <properties>
+ <pluginName>Nexus Siesta Plugin</pluginName>
+ <pluginDescription>Support for Siesta (Jersey) REST API.</pluginDescription>
+
+ <siesta.version>1.3</siesta.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.sonatype.nexus</groupId>
+ <artifactId>nexus-plugin-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!--
+ TODO: Sort out if we should exclude com.sun.xml.bind:jaxb-impl...
+ TODO: Though probably should pull it in to ensure we have the right JAXB impl and not left up to the version in the JDK.
+ -->
+
+ <dependency>
+ <groupId>org.sonatype.sisu.siesta</groupId>
+ <artifactId>siesta-common</artifactId>
+ <version>${siesta.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.sonatype.sisu</groupId>
+ <artifactId>sisu-inject-bean</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.sonatype.sisu.siesta</groupId>
+ <artifactId>siesta-server</artifactId>
+ <version>${siesta.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.sonatype.sisu.siesta</groupId>
+ <artifactId>siesta-client</artifactId>
+ <version>${siesta.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <!--
+ TODO: Sort out what to do about jackson here, and in NX core.
+ -->
+
+ <dependency>
+ <groupId>org.sonatype.sisu.siesta</groupId>
+ <artifactId>siesta-jackson</artifactId>
+ <version>${siesta.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.sonatype.sisu.jacksbee</groupId>
+ <artifactId>jacksbee-runtime</artifactId>
+ <version>1.1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.sonatype.nexus</groupId>
+ <artifactId>nexus-plugin-bundle-maven-plugin</artifactId>
+ <configuration>
+ <sharedDependencies>
+ <sharedDependency>javax.ws.rs:jsr311-api</sharedDependency>
+ <sharedDependency>org.sonatype.sisu.siesta:siesta-common</sharedDependency>
+ <sharedDependency>org.sonatype.sisu.siesta:siesta-server</sharedDependency>
+ <sharedDependency>org.sonatype.sisu.siesta:siesta-client</sharedDependency>
+ <sharedDependency>org.sonatype.sisu.siesta:siesta-jackson</sharedDependency>
+
+ <!-- FIXME: Unsure which parts of this need to be marked as shared, and which should not be ... -->
+ <sharedDependency>com.sun.jersey:jersey-core</sharedDependency>
+ <sharedDependency>com.sun.jersey:jersey-server</sharedDependency>
+ <sharedDependency>com.sun.jersey:jersey-servlet</sharedDependency>
+ <sharedDependency>com.sun.jersey:jersey-client</sharedDependency>
+ <!--<sharedDependency>com.sun.jersey:jersey-guice</sharedDependency>-->
+ <!--<sharedDependency>com.sun.jersey:jersey-json</sharedDependency>-->
+ <!--<sharedDependency>com.sun.jersey.contribs:jersey-multipart</sharedDependency>-->
+ <!--<sharedDependency>com.sun.jersey.contribs:jersey-apache-client4</sharedDependency>-->
+
+ <!--<sharedDependency>org.codehaus.jackson:jackson-core-asl</sharedDependency>-->
+ <!--<sharedDependency>org.codehaus.jackson:jackson-mapper-asl</sharedDependency>-->
+ <!--<sharedDependency>org.codehaus.jackson:jackson-jaxrs</sharedDependency>-->
+ <!--<sharedDependency>org.codehaus.jackson:jackson-xc</sharedDependency>-->
+
+ <!--<sharedDependency>asm:asm</sharedDependency>-->
+ <!--<sharedDependency>org.jvnet.mimepull:mimepull</sharedDependency>-->
+ <!--<sharedDependency>com.sun.xml.bind:jaxb-impl</sharedDependency>-->
+ <sharedDependency>org.sonatype.sisu.jacksbee:jacksbee-runtime</sharedDependency>
+ </sharedDependencies>
+ </configuration>
+ </plugin>
+
+ <!--
+ FIXME: Use requirejs and avoid needing explicit ordering here, and to be able to use the default configuration.
+ -->
+ <plugin>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>yuicompressor-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>js</id>
+ <goals>
+ <goal>aggregate</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <!-- relative to src/main/js -->
+ <include>nexus/**</include>
+ <include>${project.artifactId}.js</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
View
58 ...ugin/src/main/java/org/sonatype/nexus/plugins/siesta/LogConfigurationParticipantImpl.java
@@ -0,0 +1,58 @@
+/*
+ * Sonatype Nexus (TM) Open Source Version
+ * Copyright (c) 2007-2012 Sonatype, Inc.
+ * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
+ *
+ * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
+ * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
+ * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
+ * Eclipse Foundation. All other trademarks are the property of their respective owners.
+ */
+package org.sonatype.nexus.plugins.siesta;
+
+import com.google.common.base.Throwables;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.sonatype.nexus.log.LogConfigurationParticipant;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import static com.google.common.base.Preconditions.checkState;
+
+/**
+ * Contributes "logback-siesta.xml" logging configuration.
+ *
+ * @since 2.4
+ */
+@Named
+@Singleton
+public class LogConfigurationParticipantImpl
+ implements LogConfigurationParticipant
+{
+ private static final Logger log = LoggerFactory.getLogger(LogConfigurationParticipantImpl.class);
+
+ @Override
+ public String getName() {
+ return "logback-siesta.xml";
+ }
+
+ @Override
+ public InputStream getConfiguration() {
+ URL resource = getClass().getResource(getName());
+ log.debug("Using resource: {}", resource);
+ checkState(resource != null);
+ try {
+ assert resource != null; // Keep IDEA happy
+ return resource.openStream();
+ }
+ catch (IOException e) {
+ throw Throwables.propagate(e);
+ }
+ }
+}
View
53 ...-plugin/src/main/java/org/sonatype/nexus/plugins/siesta/NexusIndexHtmlCustomizerImpl.java
@@ -0,0 +1,53 @@
+/*
+ * Sonatype Nexus (TM) Open Source Version
+ * Copyright (c) 2007-2012 Sonatype, Inc.
+ * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
+ *
+ * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
+ * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
+ * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
+ * Eclipse Foundation. All other trademarks are the property of their respective owners.
+ */
+
+package org.sonatype.nexus.plugins.siesta;
+
+import org.sonatype.nexus.plugins.rest.AbstractNexusIndexHtmlCustomizer;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+import java.util.Map;
+
+/**
+ * Contributes Javascript support for Siesta.
+ *
+ * @since 2.4
+ */
+@Named
+@Singleton
+public class NexusIndexHtmlCustomizerImpl
+ extends AbstractNexusIndexHtmlCustomizer
+{
+ public static final String GROUP_ID = "org.sonatype.nexus.plugins";
+
+ public static final String ARTIFACT_ID = "nexus-siesta-plugin";
+
+ private String getUrlSuffix() {
+ String version = getVersionFromJarFile(String.format("/META-INF/maven/%s/%s/pom.properties", GROUP_ID, ARTIFACT_ID));
+ if (version == null) {
+ return "";
+ }
+ else if (version.endsWith("SNAPSHOT")) {
+ return String.format("?v=%s&t=%s", version, System.currentTimeMillis());
+ }
+ else {
+ return "?v=" + version;
+ }
+ }
+
+ @Override
+ public String getPostHeadContribution(final Map<String, Object> ctx) {
+ return String.format("<script src='static/js/%s-all.js%s' type='text/javascript' charset='UTF-8'></script>", ARTIFACT_ID, getUrlSuffix());
+ }
+}
View
72 ...sta/nexus-siesta-plugin/src/main/java/org/sonatype/nexus/plugins/siesta/SiestaModule.java
@@ -0,0 +1,72 @@
+/*
+ * Sonatype Nexus (TM) Open Source Version
+ * Copyright (c) 2007-2012 Sonatype, Inc.
+ * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
+ *
+ * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
+ * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
+ * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
+ * Eclipse Foundation. All other trademarks are the property of their respective owners.
+ */
+package org.sonatype.nexus.plugins.siesta;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.servlet.ServletModule;
+import org.apache.shiro.guice.aop.ShiroAopModule;
+import org.sonatype.security.web.guice.SecurityWebFilter;
+import org.sonatype.sisu.siesta.jackson.SiestaJacksonModule;
+import org.sonatype.sisu.siesta.server.internal.ComponentDiscoveryApplication;
+import org.sonatype.sisu.siesta.server.internal.SiestaServlet;
+import org.sonatype.sisu.siesta.server.internal.jersey.SiestaJerseyModule;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+/**
+ * Siesta plugin module.
+ *
+ * @since 2.4
+ */
+@Named
+public class SiestaModule
+ extends AbstractModule
+{
+ public static final String SERVICE_NAME = "siesta";
+
+ public static final String MOUNT_POINT = "/service/" + SERVICE_NAME;
+
+ @Override
+ protected void configure() {
+ // TODO: We might want to make this default for core+plugins as its generally useful.
+ install(new ShiroAopModule());
+
+ // FIXME: Sort this out... nexus-restlet1x-plugin should not have anything to do with this plugin
+
+ // We need to import some components from nexus-restlet1x-plugin for SecurityWebFilter, but its use is
+ // hidden behind guice-servlet muck. We therefore bind it explicitly here so it will get seen by Sisu.
+ // It would have been preferable to use "requireBinding(SecurityWebFilter.class)" to import the
+ // SecurityWebFilter instance from nexus-restlet1x-plugin, but guice-servlet only wants to see filters
+ // bound directly as singletons in this Injector (odd limitation). An alternative would have been to
+ // requireBinding's for SecuritySystem and FilterChainResolver, which are the filter's dependencies.
+
+ bind(SecurityWebFilter.class);
+
+ install(new org.sonatype.sisu.siesta.server.internal.SiestaModule());
+ install(new SiestaJerseyModule());
+ install(new SiestaJacksonModule());
+
+ // Dynamically discover JAX-RS components
+ bind(javax.ws.rs.core.Application.class).to(ComponentDiscoveryApplication.class).in(Singleton.class);
+
+ install(new ServletModule()
+ {
+ @Override
+ protected void configureServlets() {
+ serve(MOUNT_POINT + "/*").with(SiestaServlet.class);
+ filter(MOUNT_POINT + "/*").through(SecurityWebFilter.class);
+ }
+ });
+ }
+}
View
20 plugins/siesta/nexus-siesta-plugin/src/main/js/nexus-siesta-plugin.js
@@ -0,0 +1,20 @@
+/*
+ * Sonatype Nexus (TM) Open Source Version
+ * Copyright (c) 2007-2012 Sonatype, Inc.
+ * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
+ *
+ * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
+ * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
+ * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
+ * Eclipse Foundation. All other trademarks are the property of their respective owners.
+ */
+
+/*global requirejs*/
+
+// This file must be last in the aggregate plugin javascript file
+
+requirejs([
+ 'nexus/siesta'
+]);
View
27 plugins/siesta/nexus-siesta-plugin/src/main/js/nexus/siesta.js
@@ -0,0 +1,27 @@
+/*
+ * Sonatype Nexus (TM) Open Source Version
+ * Copyright (c) 2007-2012 Sonatype, Inc.
+ * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
+ *
+ * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
+ * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
+ * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
+ * Eclipse Foundation. All other trademarks are the property of their respective owners.
+ */
+
+/*global Sonatype, Ext*/
+
+define('nexus/siesta', [], function ()
+{
+ Ext.namespace('Nexus.siesta');
+
+ /**
+ * Base path for all siesta-based REST resources.
+ *
+ * @type {string}
+ * @static
+ */
+ Nexus.siesta.basePath = Sonatype.config.contextPath + '/service/siesta';
+});
View
23 ...xus-siesta-plugin/src/main/resources/org/sonatype/nexus/plugins/siesta/logback-siesta.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Sonatype Nexus (TM) Open Source Version
+ Copyright (c) 2007-2012 Sonatype, Inc.
+ All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
+
+ This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
+ which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
+
+ Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
+ of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
+ Eclipse Foundation. All other trademarks are the property of their respective owners.
+
+-->
+<!-- WARNING: DO NOT EDIT – This file is automatically generated. -->
+
+<included>
+ <!--
+ This will prevent duplicate 'Initiating Jersey application' messages, though won't omit them all... not sure why ATM.
+ -->
+ <logger name="com.sun.jersey.server.impl.application.WebApplicationImpl" level="WARN"/>
+</included>
View
34 plugins/siesta/nexus-siesta-test-plugin/enunciate.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Sonatype Nexus (TM) Open Source Version
+ Copyright (c) 2007-2012 Sonatype, Inc.
+ All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
+
+ This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
+ which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
+
+ Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
+ of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
+ Eclipse Foundation. All other trademarks are the property of their respective owners.
+
+-->
+<enunciate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.26.xsd">
+
+ <services>
+ <rest defaultRestSubcontext="service/siesta"/>
+ </services>
+
+ <modules>
+ <docs disabled="false"
+ title="${pluginName} REST API"
+ copyright="Sonatype, Inc. ${copyright.year}"
+ includeExampleXml="true"
+ includeExampleJson="true"
+ includeDefaultDownloads="false"
+ groupRestResources="byPath">
+ </docs>
+ </modules>
+
+</enunciate>
View
98 plugins/siesta/nexus-siesta-test-plugin/pom.xml
@@ -0,0 +1,98 @@
+<!--
+
+ Sonatype Nexus (TM) Open Source Version
+ Copyright (c) 2007-2012 Sonatype, Inc.
+ All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
+
+ This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
+ which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
+
+ Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
+ of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
+ Eclipse Foundation. All other trademarks are the property of their respective owners.
+
+-->
+<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>
+ <groupId>org.sonatype.nexus.plugins</groupId>
+ <artifactId>nexus-siesta</artifactId>
+ <version>2.4-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>nexus-siesta-test-plugin</artifactId>
+ <packaging>nexus-plugin</packaging>
+
+ <properties>
+ <pluginName>Nexus Siesta Test Plugin</pluginName>
+ <pluginDescription>Siesta plugin test thingy.</pluginDescription>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.sonatype.nexus</groupId>
+ <artifactId>nexus-plugin-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.sonatype.nexus.plugins</groupId>
+ <artifactId>nexus-siesta-plugin</artifactId>
+ <type>${nexus-plugin.type}</type>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.sonatype.nexus</groupId>
+ <artifactId>nexus-plugin-bundle-maven-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ <version>0.8.2</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.sonatype.sisu.jacksbee</groupId>
+ <artifactId>jacksbee-xjc</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <extension>true</extension>
+ <schemaDirectory>src/main/schema</schemaDirectory>
+ <plugins>
+ <plugin>
+ <groupId>org.sonatype.sisu.jacksbee</groupId>
+ <artifactId>jacksbee-xjc</artifactId>
+ <version>1.1.1</version>
+ </plugin>
+ </plugins>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <args>
+ <arg>-Xsetters</arg>
+ <arg>-Xfluent-api</arg>
+ <arg>-Xgenerated</arg>
+ <arg>-Xannotate</arg>
+ <!--<arg>-XjsonProperty</arg>-->
+ </args>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
View
84 ...siesta-test-plugin/src/main/java/org/sonatype/nexus/plugins/siesta/test/TestResource.java
@@ -0,0 +1,84 @@
+/*
+ * Sonatype Nexus (TM) Open Source Version
+ * Copyright (c) 2007-2012 Sonatype, Inc.
+ * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
+ *
+ * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
+ * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
+ * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
+ * Eclipse Foundation. All other trademarks are the property of their respective owners.
+ */
+package org.sonatype.nexus.plugins.siesta.test;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.sonatype.nexus.configuration.application.ApplicationConfiguration;
+import org.sonatype.nexus.plugins.siesta.test.model.UserXO;
+import org.sonatype.sisu.siesta.common.Resource;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import java.util.Date;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static javax.ws.rs.core.MediaType.APPLICATION_XML;
+import static javax.ws.rs.core.MediaType.TEXT_PLAIN;
+
+/**
+ * Siesta testing resource.
+ *
+ * @since 2.4
+ */
+@Named
+@Singleton
+@Path("/test")
+public class TestResource
+ implements Resource
+{
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ // Test injection
+ private final ApplicationConfiguration config;
+
+ @Inject
+ public TestResource(final ApplicationConfiguration config) {
+ this.config = checkNotNull(config);
+ }
+
+ @GET
+ @Produces({APPLICATION_XML, APPLICATION_JSON})
+ @RequiresPermissions("nexus:logs")
+ public UserXO get() {
+ log.info("GET");
+
+ return new UserXO()
+ .withName("jdillon")
+ .withDescription("avid crack smoker")
+ .withCreated(new Date());
+ }
+
+ // Test sub-resource
+ @GET
+ @Path("/config-dir")
+ @Produces(TEXT_PLAIN)
+ public String configDir() {
+ return config.getConfigurationDirectory().getAbsolutePath();
+ }
+
+ @PUT
+ @Consumes({APPLICATION_XML, APPLICATION_JSON})
+ public void put(final UserXO user) {
+ log.info("PUT name='{}' description='{}' created='{}'",
+ user.getName(), user.getDescription(), user.getCreated());
+ }
+}
View
46 plugins/siesta/nexus-siesta-test-plugin/src/main/schema/bindings.xjb
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Sonatype Nexus (TM) Open Source Version
+ Copyright (c) 2007-2012 Sonatype, Inc.
+ All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
+
+ This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
+ which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
+
+ Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
+ of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
+ Eclipse Foundation. All other trademarks are the property of their respective owners.
+
+-->
+<bindings
+ xmlns="http://java.sun.com/xml/ns/jaxb"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
+ version="2.1">
+
+ <globalBindings
+ fixedAttributeAsConstantProperty="true"
+ collectionType="java.util.ArrayList">
+
+ <javaType name="java.util.Date" xmlType="xsd:dateTime"
+ parseMethod="org.sonatype.sisu.jacksbee.runtime.Iso8601DateTimeAdapter.parse"
+ printMethod="org.sonatype.sisu.jacksbee.runtime.Iso8601DateTimeAdapter.print"
+ />
+
+ <xjc:simple/>
+ </globalBindings>
+
+ <bindings schemaLocation="model.xsd" node="/xsd:schema">
+ <schemaBindings>
+ <package name="org.sonatype.nexus.plugins.siesta.test.model"/>
+ <nameXmlTransform>
+ <elementName suffix="XO"/>
+ <typeName suffix="XO"/>
+ </nameXmlTransform>
+ </schemaBindings>
+ </bindings>
+
+</bindings>
View
38 plugins/siesta/nexus-siesta-test-plugin/src/main/schema/model.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Sonatype Nexus (TM) Open Source Version
+ Copyright (c) 2007-2012 Sonatype, Inc.
+ All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
+
+ This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
+ which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
+
+ Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
+ of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
+ Eclipse Foundation. All other trademarks are the property of their respective owners.
+
+-->
+<xsd:schema
+ targetNamespace="http://sonatype.com/xsd/nexus-siesta-test-plugin/rest/1.0"
+ version="1.1"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:model="http://sonatype.com/xsd/nexus-siesta-test-plugin/rest/1.0"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+ jaxb:version="2.1"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd
+ http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd">
+
+ <xsd:complexType name="user">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="description" type="xsd:string"/>
+ <xsd:element name="created" type="xsd:dateTime"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="user" type="model:user"/>
+
+</xsd:schema>
View
33 plugins/siesta/pom.xml
@@ -0,0 +1,33 @@
+<!--
+
+ Sonatype Nexus (TM) Open Source Version
+ Copyright (c) 2007-2012 Sonatype, Inc.
+ All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
+
+ This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
+ which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
+
+ Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
+ of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
+ Eclipse Foundation. All other trademarks are the property of their respective owners.
+
+-->
+<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>
+ <groupId>org.sonatype.nexus.plugins</groupId>
+ <artifactId>nexus-plugins</artifactId>
+ <version>2.4-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>nexus-siesta</artifactId>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>nexus-siesta-plugin</module>
+ <module>nexus-siesta-test-plugin</module>
+ </modules>
+
+</project>
View
37 pom.xml
@@ -455,6 +455,26 @@
</dependency>
<dependency>
+ <groupId>org.apache.shiro</groupId>
+ <artifactId>shiro-guice</artifactId>
+ <version>${shiro.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-multibindings</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
<groupId>org.sonatype.security</groupId>
<artifactId>security-configuration</artifactId>
<version>${plexus-security.version}</version>
@@ -966,6 +986,14 @@
<build>
<pluginManagement>
<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.jboss.tattletale</groupId>
@@ -1387,14 +1415,7 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
+
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
Something went wrong with that request. Please try again.