X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.repo%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Frepo%2Fmaven%2FGenerateBinaries.java;h=cd5283db4e1b568ff61d4bd1cff6a753df814cf4;hb=399702cec859f48ec171c30d268c55eb632d472a;hp=a1e2a071d263d941781ce67b8bf8e26ffc109e3b;hpb=1d6a2ecc676aac7dde0491ea5047bebc2ce69e80;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/maven/GenerateBinaries.java b/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/maven/GenerateBinaries.java index a1e2a071d..cd5283db4 100644 --- a/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/maven/GenerateBinaries.java +++ b/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/maven/GenerateBinaries.java @@ -16,10 +16,9 @@ package org.argeo.slc.repo.maven; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Set; +import java.util.StringTokenizer; import java.util.TreeSet; import javax.jcr.Credentials; @@ -29,7 +28,6 @@ import javax.jcr.Repository; import javax.jcr.RepositoryException; import javax.jcr.Session; -import org.apache.commons.io.FilenameUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.argeo.ArgeoMonitor; @@ -41,15 +39,13 @@ import org.argeo.slc.jcr.SlcTypes; import org.argeo.slc.repo.ArtifactIndexer; import org.argeo.slc.repo.RepoConstants; import org.argeo.slc.repo.RepoUtils; -import org.argeo.slc.repo.osgi.OsgiProfile; -import org.osgi.framework.Constants; import org.osgi.framework.Version; import org.sonatype.aether.artifact.Artifact; import org.sonatype.aether.util.artifact.DefaultArtifact; /** - * Make sure that all JCR metadata and Maven metadata are consistent for this - * group of OSGi bundles. + * Generates binaries-, sources- and sdk-version.pom artifacts for a given + * group. */ public class GenerateBinaries implements Runnable, SlcNames { private final static Log log = LogFactory.getLog(GenerateBinaries.class); @@ -62,35 +58,30 @@ public class GenerateBinaries implements Runnable, SlcNames { // Business info private String groupId; private String parentPomCoordinates; - private Boolean overridePoms = false; private String version = null; // Constants private String artifactBasePath = RepoConstants.DEFAULT_ARTIFACTS_BASE_PATH; private List excludedSuffixes = new ArrayList(); - /** TODO make it more generic */ - private List systemPackages = OsgiProfile.PROFILE_JAVA_SE_1_6 - .getSystemPackages(); - private ArtifactIndexer artifactIndexer = new ArtifactIndexer(); - - // Local indexes - private Map packagesToSymbolicNames = new HashMap(); - private Map symbolicNamesToNodes = new HashMap(); + // Indexes private Set binaries = new TreeSet( new ArtifactIdComparator()); private Set sources = new TreeSet( new ArtifactIdComparator()); + + // local cache + private ArtifactIndexer artifactIndexer = new ArtifactIndexer(); private Node allArtifactsHighestVersion; public void run() { Session session = null; try { - session = repository.login(workspace); + session = repository.login(credentials, workspace); Node groupNode = session.getNode(MavenConventionsUtils.groupPath( artifactBasePath, groupId)); internalPreProcessing(groupNode, null); - processGroupNode(groupNode, null); + internalProcessing(groupNode, null); } catch (Exception e) { throw new SlcException("Cannot normalize group " + groupId + " in " + workspace, e); @@ -99,19 +90,27 @@ public class GenerateBinaries implements Runnable, SlcNames { } } + /** + * Generates binaries-, sources- and sdk-version.pom artifacts for the given + * version (or the highest of all children version if none is precised). + * + * By default, it includes each latest version of all artifact of this + * group. + * + * The 3 generated artifacts are then marked as modular distributions and + * indexed. + */ public static void processGroupNode(Node groupNode, String version, - Boolean overridePoms, ArgeoMonitor monitor) - throws RepositoryException { + ArgeoMonitor monitor) throws RepositoryException { // TODO set artifactsBase based on group node GenerateBinaries gb = new GenerateBinaries(); String groupId = groupNode.getProperty(SlcNames.SLC_GROUP_BASE_ID) .getString(); gb.setGroupId(groupId); gb.setVersion(version); - gb.setOverridePoms(overridePoms); // TODO use already done pre-processing gb.internalPreProcessing(groupNode, monitor); - gb.processGroupNode(groupNode, monitor); + gb.internalProcessing(groupNode, monitor); } /** Only builds local indexes. Does not change anything in the local Session */ @@ -138,15 +137,26 @@ public class GenerateBinaries implements Runnable, SlcNames { .asArtifact(allArtifactsHighestVersion); } + // ////////////////////////////////////// + // INTERNAL METHODS + + /** + * Browse all children of a Node considered as a folder that follows Aether + * conventions i.e that has Aether's artifact base as children. + * + * Each of such child contains a set of Aether artifact versions. This + * methods build the binaries {@code Set} and other indexes. It + * does not impact the + */ protected void internalPreProcessing(Node groupNode, ArgeoMonitor monitor) throws RepositoryException { if (monitor != null) monitor.subTask("Pre processing group " + groupId); // Process all direct children nodes, - // gathering latest versions of all artifact base + // gathering latest versions of each artifact allArtifactsHighestVersion = null; - // Session session = groupNode.getSession(); + aBases: for (NodeIterator aBases = groupNode.getNodes(); aBases .hasNext();) { Node aBase = aBases.nextNode(); @@ -156,27 +166,28 @@ public class GenerateBinaries implements Runnable, SlcNames { continue aBases; else { // retrieve relevant child node + // Information is stored on the NT_FILE child node. for (NodeIterator files = highestAVersion.getNodes(); files .hasNext();) { Node file = files.nextNode(); if (file.isNodeType(SlcTypes.SLC_BUNDLE_ARTIFACT)) { - preProcessBundleArtifact(file); if (log.isDebugEnabled()) - log.debug("Pre-processed " + file.getName()); + log.debug("Pre-Processing " + file.getName()); + preProcessBundleArtifact(file); } } } } } - if (log.isDebugEnabled()) { - int bundleCount = symbolicNamesToNodes.size(); - log.debug("" + bundleCount + " bundles have been indexed for " - + groupId); - } + // if (log.isDebugEnabled()) { + // int bundleCount = symbolicNamesToNodes.size(); + // log.debug("" + bundleCount + " bundles have been indexed for " + // + groupId); + // } } /** Does the real job : writes JCR META-DATA and generates binaries */ - protected void processGroupNode(Node groupNode, ArgeoMonitor monitor) + protected void internalProcessing(Node groupNode, ArgeoMonitor monitor) throws RepositoryException { if (monitor != null) monitor.subTask("Processing group " + groupId); @@ -195,86 +206,47 @@ public class GenerateBinaries implements Runnable, SlcNames { throw new SlcException("Group version " + version + " is empty."); - int bundleCount = symbolicNamesToNodes.size(); - - int count = 1; - for (Node bundleNode : symbolicNamesToNodes.values()) { - processBundleArtifact(bundleNode); - bundleNode.getSession().save(); - if (log.isDebugEnabled()) - log.debug(count + "/" + bundleCount + " Processed " - + bundleNode.getName()); - count++; - } + // int bundleCount = symbolicNamesToNodes.size(); + // int count = 1; + // for (Node bundleNode : symbolicNamesToNodes.values()) { + // if (log.isDebugEnabled()) + // log.debug("Processing " + bundleNode.getName() + " ( " + count + // + "/" + bundleCount + " )"); + // + // // processBundleArtifact(bundleNode); + // // bundleNode.getSession().save(); + // count++; + // } // indexes Set indexes = new TreeSet( new ArtifactIdComparator()); - Artifact indexArtifact = writeIndex(session, - RepoConstants.BINARIES_ARTIFACT_ID, binaries); + + Artifact indexArtifact; + indexArtifact = writeIndex(session, RepoConstants.BINARIES_ARTIFACT_ID, + binaries); indexes.add(indexArtifact); + indexArtifact = writeIndex(session, RepoConstants.SOURCES_ARTIFACT_ID, sources); indexes.add(indexArtifact); + // sdk writeIndex(session, RepoConstants.SDK_ARTIFACT_ID, indexes); + if (monitor != null) monitor.worked(1); } - // Helpers - private Node getArtifactLatestVersion(Node artifactBase) { - try { - Node highestAVersion = null; - for (NodeIterator aVersions = artifactBase.getNodes(); aVersions - .hasNext();) { - Node aVersion = aVersions.nextNode(); - if (aVersion.isNodeType(SlcTypes.SLC_ARTIFACT_VERSION_BASE)) { - if (highestAVersion == null) { - highestAVersion = aVersion; - if (allArtifactsHighestVersion == null) - allArtifactsHighestVersion = aVersion; - // Correctly handle following arrival order: - // Name1 - V1, name2 - V3 - else { - Version cachedHighestVersion = extractOsgiVersion(allArtifactsHighestVersion); - Version currVersion = extractOsgiVersion(aVersion); - if (currVersion.compareTo(cachedHighestVersion) > 0) - allArtifactsHighestVersion = aVersion; - } - } else { - Version currVersion = extractOsgiVersion(aVersion); - Version currentHighestVersion = extractOsgiVersion(highestAVersion); - if (currVersion.compareTo(currentHighestVersion) > 0) { - highestAVersion = aVersion; - } - if (currVersion - .compareTo(extractOsgiVersion(allArtifactsHighestVersion)) > 0) { - allArtifactsHighestVersion = aVersion; - } - } - - } - } - return highestAVersion; - } catch (RepositoryException re) { - throw new SlcException("Unable to get latest version for node " - + artifactBase, re); - } - } - - private Version extractOsgiVersion(Node artifactVersion) - throws RepositoryException { - String rawVersion = artifactVersion.getProperty(SLC_ARTIFACT_VERSION) - .getString(); - String cleanVersion = rawVersion.replace("-SNAPSHOT", ".SNAPSHOT"); - return new Version(cleanVersion); - } - protected void preProcessBundleArtifact(Node bundleNode) throws RepositoryException { String symbolicName = JcrUtils.get(bundleNode, SLC_SYMBOLIC_NAME); + // Sanity check. + if (symbolicName == null) + log.warn("Symbolic name is null for bundle " + bundleNode); + + // Manage source bundles if (symbolicName.endsWith(".source")) { // TODO make a shared node with classifier 'sources'? String bundleName = RepoUtils @@ -287,50 +259,55 @@ public class GenerateBinaries implements Runnable, SlcNames { return; } - NodeIterator exportPackages = bundleNode.getNodes(SLC_ - + Constants.EXPORT_PACKAGE); - while (exportPackages.hasNext()) { - Node exportPackage = exportPackages.nextNode(); - String pkg = JcrUtils.get(exportPackage, SLC_NAME); - packagesToSymbolicNames.put(pkg, symbolicName); - } + // // Build indexes + // NodeIterator exportPackages = bundleNode.getNodes(SLC_ + // + Constants.EXPORT_PACKAGE); + // while (exportPackages.hasNext()) { + // Node exportPackage = exportPackages.nextNode(); + // String pkg = JcrUtils.get(exportPackage, SLC_NAME); + // packagesToSymbolicNames.put(pkg, symbolicName); + // } + // + // symbolicNamesToNodes.put(symbolicName, bundleNode); + // for (String excludedSuffix : excludedSuffixes) { + // if (symbolicName.endsWith(excludedSuffix)) + // return;// skip adding to binaries + // } - symbolicNamesToNodes.put(symbolicName, bundleNode); - for (String excludedSuffix : excludedSuffixes) { - if (symbolicName.endsWith(excludedSuffix)) - return;// skip adding to binaries - } binaries.add(RepoUtils.asArtifact(bundleNode)); + // Extra check. to remove if (bundleNode.getSession().hasPendingChanges()) throw new SlcException("Pending changes in the session, " + "this should not be true here."); - // bundleNode.getSession().save(); } - protected void processBundleArtifact(Node bundleNode) - throws RepositoryException { - Node artifactFolder = bundleNode.getParent(); - String baseName = FilenameUtils.getBaseName(bundleNode.getName()); - - // pom - String pomName = baseName + ".pom"; - if (artifactFolder.hasNode(pomName) && !overridePoms) - return;// skip - - String pom = generatePomForBundle(bundleNode); - Node pomNode = JcrUtils.copyBytesAsFile(artifactFolder, pomName, - pom.getBytes()); - // checksum - String bundleSha = JcrUtils.checksumFile(bundleNode, "SHA-1"); - JcrUtils.copyBytesAsFile(artifactFolder, - bundleNode.getName() + ".sha1", bundleSha.getBytes()); - String pomSha = JcrUtils.checksumFile(pomNode, "SHA-1"); - JcrUtils.copyBytesAsFile(artifactFolder, pomNode.getName() + ".sha1", - pomSha.getBytes()); - } + // protected void processBundleArtifact(Node bundleNode) + // throws RepositoryException { + // Node artifactFolder = bundleNode.getParent(); + // String baseName = FilenameUtils.getBaseName(bundleNode.getName()); + // + // // pom + // String pomName = baseName + ".pom"; + // if (artifactFolder.hasNode(pomName) && !overridePoms) + // return;// skip + // + // String pom = generatePomForBundle(bundleNode); + // Node pomNode = JcrUtils.copyBytesAsFile(artifactFolder, pomName, + // pom.getBytes()); + // // checksum + // String bundleSha = JcrUtils.checksumFile(bundleNode, "SHA-1"); + // JcrUtils.copyBytesAsFile(artifactFolder, + // bundleNode.getName() + ".sha1", bundleSha.getBytes()); + // String pomSha = JcrUtils.checksumFile(pomNode, "SHA-1"); + // JcrUtils.copyBytesAsFile(artifactFolder, pomNode.getName() + ".sha1", + // pomSha.getBytes()); + // } + + // //////////////////// + // LOCAL WRITERS + // - // Writers private Artifact writeIndex(Session session, String artifactId, Set artifacts) throws RepositoryException { Artifact artifact = new DefaultArtifact(groupId, artifactId, "pom", @@ -354,136 +331,229 @@ public class GenerateBinaries implements Runnable, SlcNames { return artifact; } - private String generatePomForBundle(Node n) throws RepositoryException { - String ownSymbolicName = JcrUtils.get(n, SLC_SYMBOLIC_NAME); - - StringBuffer p = new StringBuffer(); - - // XML header - p.append("\n"); - p.append("\n"); - p.append("4.0.0"); - - // Artifact - p.append("").append(JcrUtils.get(n, SLC_GROUP_ID)) - .append("\n"); - p.append("").append(JcrUtils.get(n, SLC_ARTIFACT_ID)) - .append("\n"); - p.append("").append(JcrUtils.get(n, SLC_ARTIFACT_VERSION)) - .append("\n"); - p.append("pom\n"); - if (n.hasProperty(SLC_ + Constants.BUNDLE_NAME)) - p.append("") - .append(JcrUtils.get(n, SLC_ + Constants.BUNDLE_NAME)) - .append("\n"); - if (n.hasProperty(SLC_ + Constants.BUNDLE_DESCRIPTION)) - p.append("") - .append(JcrUtils - .get(n, SLC_ + Constants.BUNDLE_DESCRIPTION)) - .append("\n"); - - // Dependencies - Set dependenciesSymbolicNames = new TreeSet(); - Set optionalSymbolicNames = new TreeSet(); - NodeIterator importPackages = n.getNodes(SLC_ - + Constants.IMPORT_PACKAGE); - while (importPackages.hasNext()) { - Node importPackage = importPackages.nextNode(); - String pkg = JcrUtils.get(importPackage, SLC_NAME); - if (packagesToSymbolicNames.containsKey(pkg)) { - String dependencySymbolicName = packagesToSymbolicNames - .get(pkg); - if (JcrUtils.check(importPackage, SLC_OPTIONAL)) - optionalSymbolicNames.add(dependencySymbolicName); - else - dependenciesSymbolicNames.add(dependencySymbolicName); - } else { - if (!JcrUtils.check(importPackage, SLC_OPTIONAL) - && !systemPackages.contains(pkg)) - log.warn("No bundle found for pkg " + pkg); - } - } - - if (n.hasNode(SLC_ + Constants.FRAGMENT_HOST)) { - String fragmentHost = JcrUtils.get( - n.getNode(SLC_ + Constants.FRAGMENT_HOST), - SLC_SYMBOLIC_NAME); - dependenciesSymbolicNames.add(fragmentHost); - } - - // TODO require bundles - - List dependencyNodes = new ArrayList(); - for (String depSymbName : dependenciesSymbolicNames) { - if (depSymbName.equals(ownSymbolicName)) - continue;// skip self + // Helpers + private Node getArtifactLatestVersion(Node artifactBase) { + try { + Node highestAVersion = null; + for (NodeIterator aVersions = artifactBase.getNodes(); aVersions + .hasNext();) { + Node aVersion = aVersions.nextNode(); + if (aVersion.isNodeType(SlcTypes.SLC_ARTIFACT_VERSION_BASE)) { + if (highestAVersion == null) { + highestAVersion = aVersion; + if (allArtifactsHighestVersion == null) + allArtifactsHighestVersion = aVersion; + // Correctly handle following arrival order: + // Name1 - V1, name2 - V3 + else { + Version cachedHighestVersion = extractOsgiVersion(allArtifactsHighestVersion); + Version currVersion = extractOsgiVersion(aVersion); + if (currVersion.compareTo(cachedHighestVersion) > 0) + allArtifactsHighestVersion = aVersion; + } + } else { + Version currVersion = extractOsgiVersion(aVersion); + Version currentHighestVersion = extractOsgiVersion(highestAVersion); + if (currVersion.compareTo(currentHighestVersion) > 0) { + highestAVersion = aVersion; + } + if (currVersion + .compareTo(extractOsgiVersion(allArtifactsHighestVersion)) > 0) { + allArtifactsHighestVersion = aVersion; + } + } - if (symbolicNamesToNodes.containsKey(depSymbName)) - dependencyNodes.add(symbolicNamesToNodes.get(depSymbName)); - else - log.warn("Could not find node for " + depSymbName); - } - List optionalDependencyNodes = new ArrayList(); - for (String depSymbName : optionalSymbolicNames) { - if (symbolicNamesToNodes.containsKey(depSymbName)) - optionalDependencyNodes.add(symbolicNamesToNodes - .get(depSymbName)); - else - log.warn("Could not find node for " + depSymbName); + } + } + return highestAVersion; + } catch (RepositoryException re) { + throw new SlcException("Unable to get latest version for node " + + artifactBase, re); } + } - p.append("\n"); - for (Node dependencyNode : dependencyNodes) { - p.append("\n"); - p.append("\t") - .append(JcrUtils.get(dependencyNode, SLC_GROUP_ID)) - .append("\n"); - p.append("\t") - .append(JcrUtils.get(dependencyNode, SLC_ARTIFACT_ID)) - .append("\n"); - p.append("\n"); + private Version extractOsgiVersion(Node artifactVersion) + throws RepositoryException { + String rawVersion = artifactVersion.getProperty(SLC_ARTIFACT_VERSION) + .getString(); + String cleanVersion = rawVersion.replace("-SNAPSHOT", ".SNAPSHOT"); + Version osgiVersion = null; + // log invalid version value to enable tracking them + try { + osgiVersion = new Version(cleanVersion); + } catch (IllegalArgumentException e) { + log.error("Version string " + cleanVersion + " is invalid "); + String twickedVersion = twickInvalidVersion(cleanVersion); + osgiVersion = new Version(twickedVersion); + log.error("Using " + twickedVersion + " instead"); + // throw e; } + return osgiVersion; + } - if (optionalDependencyNodes.size() > 0) - p.append("\n"); - for (Node dependencyNode : optionalDependencyNodes) { - p.append("\n"); - p.append("\t") - .append(JcrUtils.get(dependencyNode, SLC_GROUP_ID)) - .append("\n"); - p.append("\t") - .append(JcrUtils.get(dependencyNode, SLC_ARTIFACT_ID)) - .append("\n"); - p.append("\ttrue\n"); - p.append("\n"); + private String twickInvalidVersion(String tmpVersion) { + String[] tokens = tmpVersion.split("\\."); + if (tokens.length == 3 && tokens[2].lastIndexOf("-") > 0) { + String newSuffix = tokens[2].replaceFirst("-", "."); + tmpVersion = tmpVersion.replaceFirst(tokens[2], newSuffix); + } else if (tokens.length > 4) { + // FIXME manually remove other "." + StringTokenizer st = new StringTokenizer(tmpVersion, ".", true); + StringBuilder builder = new StringBuilder(); + // Major + builder.append(st.nextToken()).append(st.nextToken()); + // Minor + builder.append(st.nextToken()).append(st.nextToken()); + // Micro + builder.append(st.nextToken()).append(st.nextToken()); + // Qualifier + builder.append(st.nextToken()); + while (st.hasMoreTokens()) { + // consume delimiter + st.nextToken(); + if (st.hasMoreTokens()) + builder.append("-").append(st.nextToken()); + } + tmpVersion = builder.toString(); } - p.append("\n"); - - // Dependency management - p.append("\n"); - p.append("\n"); - p.append("\n"); - p.append("\t").append(groupId).append("\n"); - p.append("\t") - .append(ownSymbolicName.endsWith(".source") ? RepoConstants.SOURCES_ARTIFACT_ID - : RepoConstants.BINARIES_ARTIFACT_ID) - .append("\n"); - p.append("\t").append(version).append("\n"); - p.append("\tpom\n"); - p.append("\timport\n"); - p.append("\n"); - p.append("\n"); - p.append("\n"); - - p.append("\n"); - return p.toString(); + return tmpVersion; } + // private String generatePomForBundle(Node n) throws RepositoryException { + // String ownSymbolicName = JcrUtils.get(n, SLC_SYMBOLIC_NAME); + // + // StringBuffer p = new StringBuffer(); + // + // // XML header + // p.append("\n"); + // p.append("\n"); + // p.append("4.0.0"); + // + // // Artifact + // p.append("").append(JcrUtils.get(n, SLC_GROUP_ID)) + // .append("\n"); + // p.append("").append(JcrUtils.get(n, SLC_ARTIFACT_ID)) + // .append("\n"); + // p.append("").append(JcrUtils.get(n, SLC_ARTIFACT_VERSION)) + // .append("\n"); + // p.append("pom\n"); + // if (n.hasProperty(SLC_ + Constants.BUNDLE_NAME)) + // p.append("") + // .append(JcrUtils.get(n, SLC_ + Constants.BUNDLE_NAME)) + // .append("\n"); + // if (n.hasProperty(SLC_ + Constants.BUNDLE_DESCRIPTION)) + // p.append("") + // .append(JcrUtils + // .get(n, SLC_ + Constants.BUNDLE_DESCRIPTION)) + // .append("\n"); + // + // // Dependencies + // Set dependenciesSymbolicNames = new TreeSet(); + // Set optionalSymbolicNames = new TreeSet(); + // NodeIterator importPackages = n.getNodes(SLC_ + // + Constants.IMPORT_PACKAGE); + // while (importPackages.hasNext()) { + // Node importPackage = importPackages.nextNode(); + // String pkg = JcrUtils.get(importPackage, SLC_NAME); + // if (packagesToSymbolicNames.containsKey(pkg)) { + // String dependencySymbolicName = packagesToSymbolicNames + // .get(pkg); + // if (JcrUtils.check(importPackage, SLC_OPTIONAL)) + // optionalSymbolicNames.add(dependencySymbolicName); + // else + // dependenciesSymbolicNames.add(dependencySymbolicName); + // } else { + // if (!JcrUtils.check(importPackage, SLC_OPTIONAL) + // && !systemPackages.contains(pkg)) + // log.warn("No bundle found for pkg " + pkg); + // } + // } + // + // if (n.hasNode(SLC_ + Constants.FRAGMENT_HOST)) { + // String fragmentHost = JcrUtils.get( + // n.getNode(SLC_ + Constants.FRAGMENT_HOST), + // SLC_SYMBOLIC_NAME); + // dependenciesSymbolicNames.add(fragmentHost); + // } + // + // // TODO require bundles + // + // List dependencyNodes = new ArrayList(); + // for (String depSymbName : dependenciesSymbolicNames) { + // if (depSymbName.equals(ownSymbolicName)) + // continue;// skip self + // + // if (symbolicNamesToNodes.containsKey(depSymbName)) + // dependencyNodes.add(symbolicNamesToNodes.get(depSymbName)); + // else + // log.warn("Could not find node for " + depSymbName); + // } + // List optionalDependencyNodes = new ArrayList(); + // for (String depSymbName : optionalSymbolicNames) { + // if (symbolicNamesToNodes.containsKey(depSymbName)) + // optionalDependencyNodes.add(symbolicNamesToNodes + // .get(depSymbName)); + // else + // log.warn("Could not find node for " + depSymbName); + // } + // + // p.append("\n"); + // for (Node dependencyNode : dependencyNodes) { + // p.append("\n"); + // p.append("\t") + // .append(JcrUtils.get(dependencyNode, SLC_GROUP_ID)) + // .append("\n"); + // p.append("\t") + // .append(JcrUtils.get(dependencyNode, SLC_ARTIFACT_ID)) + // .append("\n"); + // p.append("\n"); + // } + // + // if (optionalDependencyNodes.size() > 0) + // p.append("\n"); + // for (Node dependencyNode : optionalDependencyNodes) { + // p.append("\n"); + // p.append("\t") + // .append(JcrUtils.get(dependencyNode, SLC_GROUP_ID)) + // .append("\n"); + // p.append("\t") + // .append(JcrUtils.get(dependencyNode, SLC_ARTIFACT_ID)) + // .append("\n"); + // p.append("\ttrue\n"); + // p.append("\n"); + // } + // p.append("\n"); + // + // // Dependency management + // p.append("\n"); + // p.append("\n"); + // p.append("\n"); + // p.append("\t").append(groupId).append("\n"); + // p.append("\t") + // .append(ownSymbolicName.endsWith(".source") ? + // RepoConstants.SOURCES_ARTIFACT_ID + // : RepoConstants.BINARIES_ARTIFACT_ID) + // .append("\n"); + // p.append("\t").append(version).append("\n"); + // p.append("\tpom\n"); + // p.append("\timport\n"); + // p.append("\n"); + // p.append("\n"); + // p.append("\n"); + // + // p.append("\n"); + // return p.toString(); + // } + /* SETTERS */ public void setRepository(Repository repository) { this.repository = repository; } + public void setCredentials(Credentials credentials) { + this.credentials = credentials; + } + public void setWorkspace(String workspace) { this.workspace = workspace; } @@ -508,10 +578,6 @@ public class GenerateBinaries implements Runnable, SlcNames { this.excludedSuffixes = excludedSuffixes; } - public void setOverridePoms(Boolean overridePoms) { - this.overridePoms = overridePoms; - } - public void setArtifactIndexer(ArtifactIndexer artifactIndexer) { this.artifactIndexer = artifactIndexer; }