You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2016/05/07 13:24:56 UTC

[31/36] maven-aether git commit: Demonstrated how to boot the repo system using Sisu

Demonstrated how to boot the repo system using Sisu


Project: http://git-wip-us.apache.org/repos/asf/maven-aether/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-aether/commit/d8e8ae8c
Tree: http://git-wip-us.apache.org/repos/asf/maven-aether/tree/d8e8ae8c
Diff: http://git-wip-us.apache.org/repos/asf/maven-aether/diff/d8e8ae8c

Branch: refs/heads/demo
Commit: d8e8ae8cbb3b9ee54f541504303e08fa1a8e003a
Parents: 1468633
Author: Benjamin Bentmann <be...@sonatype.com>
Authored: Sun Jan 26 16:57:14 2014 +0100
Committer: Benjamin Bentmann <be...@sonatype.com>
Committed: Sun Jan 26 16:57:14 2014 +0100

----------------------------------------------------------------------
 .../sisu/SisuRepositorySystemFactory.java       | 62 ++++++++++++++++++++
 .../eclipse/aether/examples/util/Booter.java    |  3 +-
 2 files changed, 64 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-aether/blob/d8e8ae8c/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/sisu/SisuRepositorySystemFactory.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/sisu/SisuRepositorySystemFactory.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/sisu/SisuRepositorySystemFactory.java
new file mode 100644
index 0000000..379261a
--- /dev/null
+++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/sisu/SisuRepositorySystemFactory.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Sonatype, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.aether.examples.sisu;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+
+import org.apache.maven.model.building.DefaultModelBuilderFactory;
+import org.apache.maven.model.building.ModelBuilder;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.sisu.launch.Main;
+import org.slf4j.ILoggerFactory;
+
+/**
+ * A factory for repository system instances that employs Eclipse Sisu to wire up the system's components.
+ */
+@Named
+public class SisuRepositorySystemFactory
+{
+
+    @Inject
+    private RepositorySystem repositorySystem;
+
+    public static RepositorySystem newRepositorySystem()
+    {
+        return Main.boot( SisuRepositorySystemFactory.class ).repositorySystem;
+    }
+
+    @Named
+    private static class ModelBuilderProvider
+        implements Provider<ModelBuilder>
+    {
+
+        public ModelBuilder get()
+        {
+            return new DefaultModelBuilderFactory().newInstance();
+        }
+
+    }
+
+    @Named
+    private static class LoggerFactoryProvider
+        implements Provider<ILoggerFactory>
+    {
+
+        public ILoggerFactory get()
+        {
+            return org.slf4j.LoggerFactory.getILoggerFactory();
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven-aether/blob/d8e8ae8c/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/util/Booter.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/util/Booter.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/util/Booter.java
index 7ea82d5..e5e50b8 100644
--- a/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/util/Booter.java
+++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/util/Booter.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010, 2013 Sonatype, Inc.
+ * Copyright (c) 2010, 2014 Sonatype, Inc.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -31,6 +31,7 @@ public class Booter
     {
         return org.eclipse.aether.examples.manual.ManualRepositorySystemFactory.newRepositorySystem();
         // return org.eclipse.aether.examples.guice.GuiceRepositorySystemFactory.newRepositorySystem();
+        // return org.eclipse.aether.examples.sisu.SisuRepositorySystemFactory.newRepositorySystem();
         // return org.eclipse.aether.examples.plexus.PlexusRepositorySystemFactory.newRepositorySystem();
     }