geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1098894 - in /geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin: ./ src/main/java/org/apache/geronimo/mavenplugins/car/ src/test/java/org/apache/geronimo/mavenplugins/car/
Date Tue, 03 May 2011 02:16:42 GMT
Author: djencks
Date: Tue May  3 02:16:41 2011
New Revision: 1098894

URL: http://svn.apache.org/viewvc?rev=1098894&view=rev
Log:
car-maven-plugin uses transitive dependencies as calculated by karaf-maven-plugin feature
xml goal

Removed:
    geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginBootstrap2.java
Modified:
    geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/pom.xml
    geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractFrameworkMojo.java
    geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/FrameworkHelper.java
    geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java
    geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/test/java/org/apache/geronimo/mavenplugins/car/FrameworkHelperTest.java

Modified: geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/pom.xml?rev=1098894&r1=1098893&r2=1098894&view=diff
==============================================================================
--- geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/pom.xml (original)
+++ geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/pom.xml Tue
May  3 02:16:41 2011
@@ -270,6 +270,11 @@
             <groupId>org.ops4j.pax.url</groupId>
             <artifactId>pax-url-mvn</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.karaf.tooling</groupId>
+            <artifactId>karaf-maven-plugin</artifactId>
+            <version>3.0.0-SNAPSHOT</version>
+        </dependency>
     </dependencies>
 
     <profiles>

Modified: geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractFrameworkMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractFrameworkMojo.java?rev=1098894&r1=1098893&r2=1098894&view=diff
==============================================================================
--- geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractFrameworkMojo.java
(original)
+++ geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractFrameworkMojo.java
Tue May  3 02:16:41 2011
@@ -23,22 +23,24 @@ package org.apache.geronimo.mavenplugins
 import java.io.File;
 import java.lang.Override;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.geronimo.deployment.ConfigurationBuilder;
 import org.apache.geronimo.deployment.Deployer;
 import org.apache.karaf.features.FeaturesService;
-import org.apache.maven.artifact.Artifact;
+import org.apache.karaf.tooling.features.DependencyHelper;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.launch.Framework;
 import org.sonatype.aether.RepositorySystem;
 import org.sonatype.aether.RepositorySystemSession;
+import org.sonatype.aether.artifact.Artifact;
 import org.sonatype.aether.repository.RemoteRepository;
 import org.sonatype.aether.resolution.ArtifactRequest;
 import org.sonatype.aether.resolution.ArtifactResolutionException;
@@ -144,7 +146,7 @@ public class AbstractFrameworkMojo exten
     }
 
     void initializeFramework() throws MojoFailureException {
-        FrameworkHelper helper = new FrameworkHelper(karafHome, new AetherResolver(), Collections.<Artifact>emptyList());
+        FrameworkHelper helper = new FrameworkHelper(karafHome, new AetherResolver());
         try {
             framework = helper.start();
         } catch (Exception e) {
@@ -152,6 +154,12 @@ public class AbstractFrameworkMojo exten
         }
     }
 
+    protected Map<Artifact, String> getTransitiveDependencies(MavenProject project)
throws MojoExecutionException {
+        DependencyHelper dependencyHelper = new DependencyHelper(remoteRepos, remoteRepos,
repoSession, repoSystem);
+        dependencyHelper.getDependencies(project, true);
+        return dependencyHelper.getLocalDependencies();
+    }
+
     protected void listBundles() {
         StringBuilder b = new StringBuilder("Bundles:");
         for (Bundle bundle: framework.getBundleContext().getBundles()) {
@@ -160,6 +168,29 @@ public class AbstractFrameworkMojo exten
         getLog().info(b.toString());
     }
 
+    protected File resolve(Artifact artifact) {
+        ArtifactRequest request = new ArtifactRequest();
+        request.setArtifact(artifact);
+        request.setRepositories(remoteRepos);
+
+        getLog().debug("Resolving artifact " + artifact +
+                " from " + remoteRepos);
+
+        ArtifactResult result;
+        try {
+            result = repoSystem.resolveArtifact(repoSession, request);
+        } catch (ArtifactResolutionException e) {
+            getLog().warn("could not resolve " + artifact, e);
+            return null;
+        }
+
+        getLog().debug("Resolved artifact " + artifact + " to " +
+                result.getArtifact().getFile() + " from "
+                + result.getRepository());
+        return result.getArtifact().getFile();
+
+    }
+
     class AetherResolver implements FrameworkHelper.Resolver {
 
         @Override

Modified: geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/FrameworkHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/FrameworkHelper.java?rev=1098894&r1=1098893&r2=1098894&view=diff
==============================================================================
--- geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/FrameworkHelper.java
(original)
+++ geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/FrameworkHelper.java
Tue May  3 02:16:41 2011
@@ -20,14 +20,12 @@
 
 package org.apache.geronimo.mavenplugins.car;
 
-import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
 import java.lang.management.ManagementFactory;
@@ -87,9 +85,7 @@ public class FrameworkHelper {
 
     private Resolver resolver;
 
-    private List<Artifact> bundles;
-
-    public FrameworkHelper(String karafHome, Resolver resolver, List<Artifact> bundles)
{
+    public FrameworkHelper(String karafHome, Resolver resolver) {
         this.karafHomeString = karafHome;
         File f = new File(karafHome);
         if (f.exists() && !f.isDirectory()) {
@@ -97,7 +93,6 @@ public class FrameworkHelper {
         }
         f.mkdirs();
         this.resolver = resolver;
-        this.bundles = bundles;
     }
 
     public Framework start() throws Exception {
@@ -111,7 +106,6 @@ public class FrameworkHelper {
         System.setProperty(PROP_KARAF_HOME, karafHomeString);
         System.setProperty(PROP_KARAF_BASE, karafHomeString);
         launch();
-        deployBundles(bundles);
         return getFramework();
     }
 

Modified: geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java?rev=1098894&r1=1098893&r2=1098894&view=diff
==============================================================================
--- geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java
(original)
+++ geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java
Tue May  3 02:16:41 2011
@@ -21,49 +21,16 @@ package org.apache.geronimo.mavenplugins
 
 import java.io.File;
 import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.net.URI;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Dictionary;
-import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
+import java.util.Map;
 
 import org.apache.geronimo.deployment.Deployer;
-import org.apache.geronimo.gbean.AbstractName;
-import org.apache.geronimo.gbean.AbstractNameQuery;
-import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.ReferencePatterns;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.Naming;
-import org.apache.geronimo.kernel.basic.BasicKernel;
-import org.apache.geronimo.kernel.config.ConfigurationData;
-import org.apache.geronimo.kernel.config.ConfigurationManager;
-import org.apache.geronimo.kernel.config.ConfigurationUtil;
-import org.apache.geronimo.kernel.config.KernelConfigurationManager;
-import org.apache.geronimo.kernel.config.LifecycleException;
-import org.apache.geronimo.kernel.config.RecordingLifecycleMonitor;
-import org.apache.geronimo.kernel.management.State;
-import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
-import org.apache.geronimo.system.configuration.DependencyManager;
-import org.apache.geronimo.system.configuration.RepositoryConfigurationStore;
-import org.apache.geronimo.system.repository.Maven2Repository;
-import org.apache.geronimo.system.resolver.ExplicitDefaultArtifactResolver;
-import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.FileUtils;
 import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.framework.launch.Framework;
 
 /**
  * Build a Geronimo Configuration using the local Maven infrastructure.
@@ -118,14 +85,6 @@ public class PackageMojo extends Abstrac
     private String[] deploymentConfigs;
 
     /**
-     * The name of the deployer which will be used to deploy the CAR.
-     *
-     * @parameter expression="org.apache.geronimo.framework/geronimo-gbean-deployer/${geronimoVersion}/car?j2eeType=Deployer,name=Deployer"
-     * @required
-     */
-    private String deployerName = null;
-
-    /**
      * The plan file for the CAR.
      *
      * @parameter expression="${project.build.directory}/work/plan.xml"
@@ -147,30 +106,6 @@ public class PackageMojo extends Abstrac
      */
     private Dependency module = null;
 
-//    /**
-//     * The location where the properties mapping will be generated.
-//     * <p/>
-//     * <p>
-//     * Probably don't want to change this.
-//     * </p>
-//     *
-//     * @parameter expression="${project.build.directory}/explicit-versions.properties"
-//     */
-//    private File explicitResolutionProperties = null;
-
-//    /**
-//     * True to enable the bootshell when packaging.
-//     *
-//     * @parameter
-//     */
-//    private boolean bootstrap = false;
-
-//    /**
-//     * Holds a local repo lookup instance so that we can use the current project to resolve.
-//     * This is required since the Kernel used to deploy is cached.
-//     */
-//    private static ThreadLocal<Maven2RepositoryAdapter.ArtifactLookup> lookupHolder
= new ThreadLocal<Maven2RepositoryAdapter.ArtifactLookup>();
-
     /**
      * Directory for generated plugin metadata file.
      *
@@ -187,10 +122,6 @@ public class PackageMojo extends Abstrac
      */
     protected String pluginMetadataFileName = null;
 
-//    private BundleContext bundleContext;
-//    private ServiceRegistration kernelRegistration;
-//    private ServiceReference kernelReference;
-
     /**
      * The maven project.
      *
@@ -215,14 +146,15 @@ public class PackageMojo extends Abstrac
                     return;
                 }
                 List<Long> ids = new ArrayList<Long>();
-                for (Artifact dependency : (Set<Artifact>) project.getDependencyArtifacts())
{
-                    if ("compile".equals(dependency.getScope()) || "runtime".equals(dependency.getScope()))
{
+                Map<org.sonatype.aether.artifact.Artifact, String> artifacts = getTransitiveDependencies(project);
+                for (org.sonatype.aether.artifact.Artifact dependency : artifacts.keySet())
{
+                    if ("jar".equals(dependency.getExtension()) || "car".equals(dependency.getExtension()))
{
                         getLog().info("starting dependency: " + dependency);
-                        File file = dependency.getFile();
+                        File file = resolve(dependency);
                         try {
                             ids.add(getFramework().getBundleContext().installBundle("reference:"
+ file.toURI().toURL()).getBundleId());
                         } catch (BundleException e) {
-                            getLog().info("Can't start " + dependency + " due to " + e.getMessage());
+                            getLog().info("Can't install " + dependency + " due to " + e.getMessage());
                         }
                     }
                 }
@@ -236,7 +168,6 @@ public class PackageMojo extends Abstrac
                 listBundles();
                 Object deployer = getService(Deployer.class);
                 invokeDeployer(deployer, null);
-//            } catch (MojoExecutionException e) {
             } catch (Exception e) {
                 getLog().info("Exception, use console to investigate ", e);
                 listBundles();
@@ -258,317 +189,12 @@ public class PackageMojo extends Abstrac
                     }
                 }
                 throw e;
-//            } catch (RuntimeException e) {
-//                getLog().info("RuntimeException, use console to investigate ", e);
-//                listBundles();
-//                while (1 == 1) {
-//                    try {
-//                        Thread.sleep(1000L);
-//                    } catch (InterruptedException e1) {
-//                        //exit
-//                        break;
-//                    }
-//                }
-//                throw e;
             }
-
-            // Use the default configs if none specified
-//            if (deploymentConfigs == null) {
-//                if (bootstrap) {
-//                    deploymentConfigs = new String[]{};
-//                } else {
-//                    deploymentConfigs = new String[]{defaultDeploymentConfig};
-//                }
-//            }
-//            getLog().debug("Deployment configs: " + Arrays.asList(deploymentConfigs));
-//
-//            getDependencies(project, false);
-            // If module is set, then resolve the artifact and set moduleFile
-//            if (module != null) {
-//                Artifact artifact = resolveArtifact(module.getGroupId(), module.getArtifactId(),
module.getType());
-//                if (artifact == null) {
-//                    throw new MojoExecutionException("Could not resolve module " + module.getGroupId()
+ ":" + module.getArtifactId() + ":" + module.getType() + ". Perhaps it is not listed as a
dependency");
-//                }
-//                moduleFile = artifact.getFile();
-//                getLog().debug("Using module file: " + moduleFile);
-//            }
-
-
-//            generateExplicitVersionProperties(explicitResolutionProperties, dependencyArtifacts);
-
-            //
-            // NOTE: Install a local lookup, so that the cached kernel can resolve based
on the current project
-            //       and not the project where the kernel was first initialized.
-            //
-//            lookupHolder.set(new ArtifactLookupImpl());
-
-//            if (bootstrap) {
-//                executeBootShell();
-//            } else {
-//                buildPackage();
-//            }
         } catch (Exception e) {
             throw new MojoExecutionException("could not package plugin", e);
-//        } finally {
-//            cleanup();
         }
     }
 
-//    private File getArtifactInRepositoryDir() {
-//        //
-//        // HACK: Generate the filename in the repo... really should delegate this to the
repo impl
-//        //
-//
-//        File dir = new File(targetRepository, project.getGroupId().replace('.', '/'));
-//        dir = new File(dir, project.getArtifactId());
-//        dir = new File(dir, project.getVersion());
-//        dir = new File(dir, project.getArtifactId() + "-" + project.getVersion() + ".car");
-//
-//        return dir;
-//    }
-
-//    public void executeBootShell() throws Exception {
-//        getLog().debug("Starting bootstrap shell...");
-//
-//        PluginBootstrap2 boot = new PluginBootstrap2();
-//
-//        boot.setBuildDir(outputDirectory);
-//        boot.setCarFile(getArtifactInRepositoryDir());
-//        boot.setLocalRepo(repository);
-//        boot.setPlan(planFile);
-//        Framework framework = getFramework();
-//        BundleContext bundleContext = framework.getBundleContext();
-//        boot.setBundleContext(bundleContext);
-//
-//        // Keep the same behavior with RepositoryConfigurationStore
-//        boot.setExpanded(false);
-//
-//        boot.bootstrap();
-//    }
-
-    //
-    // Deployment
-    //
-
-//    private static final String KERNEL_NAME = "geronimo.maven";
-//
-//    /**
-//     * Reference to the kernel that will last the lifetime of this classloader.
-//     * The KernelRegistry keeps soft references that may be garbage collected.
-//     */
-//    private Kernel kernel;
-//
-//    private AbstractName targetConfigStoreAName;
-//
-//    private AbstractName targetRepositoryAName;
-//
-//    private boolean targetSet;
-//
-    public void buildPackage() throws Exception {
-        getLog().info("Packaging module configuration: " + planFile);
-
-//        Kernel kernel = createKernel();
-//        if (!targetSet) {
-//            kernel.stopGBean(targetRepositoryAName);
-//            kernel.setAttribute(targetRepositoryAName, "root", targetRepository.toURI());
-//            kernel.startGBean(targetRepositoryAName);
-//
-//            if (kernel.getGBeanState(targetConfigStoreAName) != State.RUNNING_INDEX) {
-//                throw new IllegalStateException("After restarted repository then config
store is not running");
-//            }
-//
-//            targetSet = true;
-//        }
-//
-//        getLog().debug("Starting configurations..." + Arrays.asList(deploymentConfigs));
-//
-//        // start the Configuration we're going to use for this deployment
-//        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
-//
-//        DependencyManager dependencyManager = kernel.getGBean(DependencyManager.class);
-        //Register ConfigurationExtender Listener
-//        ConfigurationExtender configurationExtender = new ConfigurationExtender(configurationManager,
dependencyManager, bundleContext);
-//        configurationExtender.doStart();
-
-//        try {
-//            for (String artifactName : deploymentConfigs) {
-//                org.apache.geronimo.kernel.repository.Artifact configName = org.apache.geronimo.kernel.repository.Artifact.create(artifactName);
-//                if (!configurationManager.isLoaded(configName)) {
-//                    RecordingLifecycleMonitor monitor = new RecordingLifecycleMonitor();
-//                    try {
-//                        configurationManager.loadConfiguration(configName, monitor);
-//                    } catch (LifecycleException e) {
-//                        getLog().error("Could not load deployer configuration: " + configName
+ "\n" + monitor.toString(), e);
-//                    }
-//                    monitor = new RecordingLifecycleMonitor();
-//                    try {
-//                        configurationManager.startConfiguration(configName, monitor);
-//                        getLog().info("Started deployer: " + configName);
-//                    } catch (LifecycleException e) {
-//                        getLog().error("Could not start deployer configuration: " + configName
+ "\n" + monitor.toString(), e);
-//                    }
-//                }
-//            }
-//        } finally {
-//            ConfigurationUtil.releaseConfigurationManager(kernel, configurationManager);
-//        }
-
-//        getLog().debug("Deploying...");
-//
-//        AbstractName deployer = locateDeployer(kernel);
-//        invokeDeployer(kernel, deployer, targetConfigStoreAName.toString());
-//        //use a fresh kernel for each module
-////        configurationExtender.doStop();
-////        kernel.shutdown();
-//        kernel = null;
-//        bundleContext.ungetService(kernelReference);
-//        bundleContext.getBundle().stop();
-//        bundleContext = null;
-    }
-
-    /**
-     * Create a Geronimo Kernel to contain the deployment configurations.
-     */
-//    private synchronized Kernel createKernel() throws Exception {
-//        // first return our cached version
-////        if (kernel != null) {
-////            return kernel;
-////        }
-//        getLog().debug("Creating kernel...");
-//
-//        // check the registry in case someone else created one
-////        kernel = KernelRegistry.getKernel(KERNEL_NAME);
-////        if (kernel != null) {
-////            return kernel;
-////        }
-//
-//        // boot one ourselves
-//        bundleContext = getFramework().getBundleContext();
-//
-////        kernel = KernelFactory.newInstance(bundleContext).createKernel(KERNEL_NAME);
-////        kernel.boot();
-//        AbstractName sourceRepoName = bootDeployerSystem();
-//        Dictionary dictionary = null;
-////        kernelRegistration = bundleContext.registerService(Kernel.class.getName(), kernel,
dictionary);
-//        kernelReference = bundleContext.getServiceReference(Kernel.class.getName());
-//
-//        return (Kernel) bundleContext.getService(kernelReference);
-//    }
-
-    /**
-     * Boot the in-Maven deployment system.
-     * <p/>
-     * <p>
-     * This contains Repository and ConfigurationStore GBeans that map to
-     * the local maven installation.
-     * </p>
-     */
-//    private AbstractName bootDeployerSystem() throws Exception {
-//        getLog().debug("Booting deployer system...");
-//
-//        org.apache.geronimo.kernel.repository.Artifact baseId =
-//                new org.apache.geronimo.kernel.repository.Artifact("geronimo", "packaging",
"fixed", "car");
-//        Naming naming = kernel.getNaming();
-//        ConfigurationData bootstrap = new ConfigurationData(baseId, naming);
-//        ClassLoader cl = getClass().getClassLoader();
-//        Set<AbstractName> repoNames = new HashSet<AbstractName>();
-//
-//        //
-//        // NOTE: Install an adapter for the source repository that will leverage the Maven2
repository subsystem
-//        //       to allow for better handling of SNAPSHOT values.
-//        //
-//        GBeanData repoGBean = bootstrap.addGBean("SourceRepository", GBeanInfo.getGBeanInfo(Maven2RepositoryAdapter.class.getName(),
bundleContext.getBundle()));
-//        Maven2RepositoryAdapter.ArtifactLookup lookup = new Maven2RepositoryAdapter.ArtifactLookup()
{
-//            private Maven2RepositoryAdapter.ArtifactLookup getDelegate() {
-//                return lookupHolder.get();
-//            }
-//
-//            public File getBasedir() {
-//                return getDelegate().getBasedir();
-//            }
-//
-//            public File getLocation(final org.apache.geronimo.kernel.repository.Artifact
artifact) {
-//                return getDelegate().getLocation(artifact);
-//            }
-//        };
-//        repoGBean.setAttribute("lookup", lookup);
-//        repoGBean.setAttribute("dependencies", dependencyArtifacts);
-//        repoNames.add(repoGBean.getAbstractName());
-//
-//        // Target repo
-//        GBeanData targetRepoGBean = bootstrap.addGBean("TargetRepository", GBeanInfo.getGBeanInfo(Maven2Repository.class.getName(),
bundleContext.getBundle()));
-//        URI targetRepositoryURI = targetRepository.toURI();
-//        targetRepoGBean.setAttribute("root", targetRepositoryURI);
-//        repoNames.add(targetRepoGBean.getAbstractName());
-//        targetRepositoryAName = targetRepoGBean.getAbstractName();
-//
-//        GBeanData artifactManagerGBean = bootstrap.addGBean("ArtifactManager", DefaultArtifactManager.GBEAN_INFO);
-//        GBeanData artifactResolverGBean = bootstrap.addGBean("ArtifactResolver", ExplicitDefaultArtifactResolver.class);
-//        artifactResolverGBean.setAttribute("versionMapLocation", explicitResolutionProperties.getAbsolutePath());
-//        ReferencePatterns repoPatterns = new ReferencePatterns(repoNames);
-//        artifactResolverGBean.setReferencePatterns("Repositories", repoPatterns);
-//        artifactResolverGBean.setReferencePattern("ArtifactManager", artifactManagerGBean.getAbstractName());
-//
-//        GBeanData dependencyManager = bootstrap.addGBean("DependencyManager", DependencyManager.class);
-//        dependencyManager.setReferencePattern("Repositories", repoGBean.getAbstractName());
-//        dependencyManager.setReferencePattern("ArtifactResolver", artifactResolverGBean.getAbstractName());
-//
-//        Set storeNames = new HashSet();
-//
-//        // Source config store
-//        GBeanInfo configStoreInfo = GBeanInfo.getGBeanInfo(MavenConfigStore.class.getName(),
bundleContext.getBundle());
-//        GBeanData storeGBean = bootstrap.addGBean("ConfigStore", configStoreInfo);
-//        if (configStoreInfo.getReference("Repository") != null) {
-//            storeGBean.setReferencePattern("Repository", repoGBean.getAbstractName());
-//        }
-//        storeNames.add(storeGBean.getAbstractName());
-//
-//        // Target config store
-//        GBeanInfo targetConfigStoreInfo = GBeanInfo.getGBeanInfo(RepositoryConfigurationStore.class.getName(),
bundleContext.getBundle());
-//        GBeanData targetStoreGBean = bootstrap.addGBean("TargetConfigStore", targetConfigStoreInfo);
-//        if (targetConfigStoreInfo.getReference("Repository") != null) {
-//            targetStoreGBean.setReferencePattern("Repository", targetRepoGBean.getAbstractName());
-//        }
-//        storeNames.add(targetStoreGBean.getAbstractName());
-//
-//        targetConfigStoreAName = targetStoreGBean.getAbstractName();
-//        targetSet = true;
-//
-//        GBeanData attrManagerGBean = bootstrap.addGBean("AttributeStore", MavenAttributeStore.GBEAN_INFO);
-//        GBeanData configManagerGBean = bootstrap.addGBean("ConfigManager", KernelConfigurationManager.class);
-//        configManagerGBean.setReferencePatterns("Stores", new ReferencePatterns(storeNames));
-//        configManagerGBean.setReferencePattern("AttributeStore", attrManagerGBean.getAbstractName());
-//        configManagerGBean.setReferencePattern("ArtifactManager", artifactManagerGBean.getAbstractName());
-//        configManagerGBean.setReferencePattern("ArtifactResolver", artifactResolverGBean.getAbstractName());
-//        configManagerGBean.setReferencePatterns("Repositories", repoPatterns);
-//
-//        ConfigurationUtil.loadBootstrapConfiguration(kernel, bootstrap, bundleContext);
-//
-//        return repoGBean.getAbstractName();
-//    }
-
-    /**
-     * Locate a Deployer GBean matching the deployerName pattern.
-     *
-     * @param kernel the kernel to search.
-     * @return the ObjectName of the Deployer GBean
-     * @throws IllegalStateException if there is not exactly one GBean matching the deployerName
pattern
-     */
-//    private AbstractName locateDeployer(final Kernel kernel) {
-//        AbstractName name = new AbstractName(URI.create(deployerName));
-//
-//        Iterator i = kernel.listGBeans(new AbstractNameQuery(name)).iterator();
-//        if (!i.hasNext()) {
-//            throw new IllegalStateException("No deployer found matching deployerName: "
+ name);
-//        }
-//
-//        AbstractName deployer = (AbstractName) i.next();
-//        if (i.hasNext()) {
-//            throw new IllegalStateException("Multiple deployers found matching deployerName:
" + name);
-//        }
-//
-//        return deployer;
-//    }
 
     private static final Class[] DEPLOY_SIGNATURE = {
             boolean.class,

Modified: geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/test/java/org/apache/geronimo/mavenplugins/car/FrameworkHelperTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/test/java/org/apache/geronimo/mavenplugins/car/FrameworkHelperTest.java?rev=1098894&r1=1098893&r2=1098894&view=diff
==============================================================================
--- geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/test/java/org/apache/geronimo/mavenplugins/car/FrameworkHelperTest.java
(original)
+++ geronimo/server/branches/3.0-osgi/framework/buildsupport/car-maven-plugin/src/test/java/org/apache/geronimo/mavenplugins/car/FrameworkHelperTest.java
Tue May  3 02:16:41 2011
@@ -21,9 +21,7 @@
 package org.apache.geronimo.mavenplugins.car;
 
 import java.io.File;
-import java.util.Collections;
 
-import org.apache.maven.artifact.Artifact;
 import org.junit.Test;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.launch.Framework;
@@ -38,7 +36,7 @@ public class FrameworkHelperTest {
         String path = getClass().getProtectionDomain().getCodeSource().getLocation().getFile();
         File f = new File(new File(path).getParentFile(), "karaf");
         String karafHome = f.getAbsolutePath();
-        FrameworkHelper fh = new FrameworkHelper(karafHome, null, Collections.<Artifact>emptyList());
+        FrameworkHelper fh = new FrameworkHelper(karafHome, null);
         Framework framework = fh.start();
         BundleContext bc = framework.getBundleContext();
         fh.stop();



Mime
View raw message