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(), cl));
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", dependencies);
repoNames.add(repoGBean.getAbstractName());
// Target repo
GBeanData targetRepoGBean = bootstrap.addGBean("TargetRepository", GBeanInfo.getGBeanInfo(Maven2Repository.class.getName(), cl));
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.GBEAN_INFO);
artifactResolverGBean.setAttribute("versionMapLocation", explicitResolutionProperties.getAbsolutePath());
ReferencePatterns repoPatterns = new ReferencePatterns(repoNames);
artifactResolverGBean.setReferencePatterns("Repositories", repoPatterns);
artifactResolverGBean.setReferencePattern("ArtifactManager", artifactManagerGBean.getAbstractName());
Set storeNames = new HashSet();
// Source config store
GBeanInfo configStoreInfo = GBeanInfo.getGBeanInfo(MavenConfigStore.class.getName(), cl);
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(), cl);
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.GBEAN_INFO);
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);