+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright 2005-2006 The Apache Software Foundation.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<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">
- <parent>
- <groupId>org.apache.maven.archiva</groupId>
- <artifactId>archiva</artifactId>
- <version>1.0-alpha-4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>maven-meeper</artifactId>
- <name>Maven Meeper</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-csv</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.2</version>
- </dependency>
- </dependencies>
-
- <repositories>
- <repository>
- <id>apache.snapshots</id>
- <name>Apache Snapshot Repository</name>
- <url>http://people.apache.org/repo/m2-snapshot-repository</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository>
- </repositories>
-
-</project>
+++ /dev/null
-
-############
-# README.txt
-############
-
-# Explanation of files found within maven-meeper
-
-##########################
-# One-button synchronizing
-##########################
-
-## Script to synchronize m1 repositories, convert them to m2, fix them,
-## sync the m2 repositories to ibiblio and update the mod_rewrite rules
-./synchronize.sh
-
-## Configuration for the above
-./synchronize.properties
-
-####################################################
-# Upload bundles from the Maven JIRA to a repository
-####################################################
-
-## dos2unix function
-./bundle-upload/d2u
-
-## See: http://maven.apache.org/guides/mini/guide-ibiblio-upload.html
-## Pulls a bundle down via wget, deploys jar, pom, license file, java-sources, javadocs
-./bundle-upload/deploy-bundle
-
-##############################################
-# Convert an m1 repository to an m2 repository
-##############################################
-
-## java.net uses CVS and only certain parts need to be synced.
-./m1-m2-conversion/java.net/sync-repoclean.sh
-
-## configuration for the above
-./m1-m2-conversion/java.net/synchronize.properties
-
-## Uses http://svn.apache.org/repos/asf/maven/sandbox/repoclean/src/main/bash/repoclean.sh
-## which runs Java code to do the bulk of the work.
-./m1-m2-conversion/sync-repoclean.sh
-
-## configuration for the above
-./m1-m2-conversion/synchronize.properties
-
-## Maven 1 -> Maven 2 mod-rewriting
-./synchronize/m1-m2-mod-rewrite-rules.txt
-
-## rsyncs from an m2 repository somewhere onto a subdirectory of
-## the central repository. By choosing the subdirectory, some security is ensured.
-./synchronize/m2-sync/m2-sync.sh
-
-## Bash scripts that set variables to be used by the above script
-./synchronize/m2-sync/conf/codehaus.sh
-./synchronize/m2-sync/conf/displaytag.sh
-./synchronize/m2-sync/conf/net.databinder.sh
-./synchronize/m2-sync/conf/net.sourceforge.jwebunit.sh
-./synchronize/m2-sync/conf/net.sourceforge.maven-taglib.sh
-./synchronize/m2-sync/conf/org.acegisecurity.sh
-./synchronize/m2-sync/conf/org.apache.sh
-./synchronize/m2-sync/conf/org.mortbay.sh
-./synchronize/m2-sync/conf/org.objectweb.sh
-./synchronize/m2-sync/conf/org.springframework.sh
-./synchronize/m2-sync/conf/wicket.sh
-
-## rsyncs the central m2 repository over to the ibiblio mirror
-./synchronize/sync-central-to-ibiblio.sh
-
-##################################################
-# M1 synchronize from upstream repositories script
-##################################################
-## INI configuration files
-./synchronize/syncopate/conf/apache.conf
-./synchronize/syncopate/conf/codehaus.conf
-./synchronize/syncopate/conf/maven-plugins-sf.conf
-./synchronize/syncopate/conf/mortbay.conf
-./synchronize/syncopate/conf/objectweb.conf
-./synchronize/syncopate/conf/opensymphony.conf
-./synchronize/syncopate/conf/osjava.conf
-./synchronize/syncopate/conf/stage.conf
-./synchronize/syncopate/conf/test.conf
-
-## standard exclusions. you can add to it in the configuration files
-./synchronize/syncopate/exclusions.txt
-
-## INI perl parser - pulled down from CPAN etc
-./synchronize/syncopate/IniFiles.pm
-
-## The perl synchronization file
-./synchronize/syncopate/sync
-
-## top level configuration
-./synchronize/syncopate/syncopate.conf
-
-###############################
-# DELETE THESE IF INDEED UNUSED
-###############################
-./unused/artifact-map.txt
-./unused/rewrite.conf
+++ /dev/null
-#!/bin/sh
-
-sudo svc -d /service/j2ee_repository.maven.org
-sudo svc -u /service/j2ee_repository.maven.org
-
+++ /dev/null
-#!/bin/sh
-
-BUNDLEURL=$1
-GROUPID=$2
-VERSION=$3
-
-[ "${BUNDLEURL}" = "" ] && echo && echo "You must specify a bundle URL!" && echo && exit
-
-WORKDIR=bundle.tmp
-
-SCRIPTDIR=`dirname ${0}`
-
-[ -d $SCRIPTDIR ] || SCRIPTDIR=.
-
-echo "Script directory is: ${SCRIPTDIR}"
-
-# repo dir relative to WORKDIR
-REPODIR=$HOME/repository-staging/to-ibiblio/maven
-REPO2DIR=$HOME/repository-staging/to-ibiblio/maven2
-
-rm -rf $WORKDIR > /dev/null 2>&1
-
-mkdir $WORKDIR
-
-cd $WORKDIR
-
-echo "Retrieving URL: '${BUNDLEURL}'"
-wget $BUNDLEURL
-BUNDLE=`echo $BUNDLEURL | sed -e 's#^.*/##;'`
-
-echo $BUNDLE
-mv $BUNDLE tmp.jar
-BUNDLE=tmp.jar
-
-(
-
- echo "Unzipping original bundle."
- jar xf $BUNDLE || unzip $BUNDLE
-
- # copy files in subdirs to workdir
- echo "Copying files to working directory."
- for d in `find ./* -type d` ; do
- for f in `find $d -type f` ; do cp $f .; done;
- done
-
- echo "Searching for POM:"
- echo "...checking for 'project.xml'"
- POM=project.xml
- if [ ! -f ${POM} ]
- then
- echo "...checking for 'pom.xml'"
- POM=pom.xml
- fi
-
- if [ ! -f ${POM} ]
- then
- echo "...searching for **/*.pom"
- POM=`find . -iname *.pom`
- fi
-
- [ "" == "${POM}" ] && echo && echo "Cannot deploy without the pom.xml or project.xml file!" && echo && exit
- [ ! -f ${POM} ] && echo && echo "Cannot deploy without the pom.xml or project.xml file!" && echo && exit
-
- echo "POM is: '${POM}'"
- dos2unix ${POM}
- less $POM
-
- if [ ! -z $VERSION ]
- then
- version=$VERSION
- else
- version=`cat ${POM} | tr '\n' ' ' | sed 's#<build>.*</build>##' | sed 's#<versions>.*</versions>##' | sed 's#<dependencies>.*</dependencies>##' | sed 's#<reporting>.*</reporting>##' | sed 's#<parent>.*</parent>##' | grep '<version>' | sed -e 's#^.*<version>##;s#</version>.*$##'`
-
- if [ -z $version ]
- then
- version=`grep currentVersion ${POM} | sed -e 's#^.*<currentVersion>##;s#</currentVersion>.*$##'`
- fi
- fi
-
- artifactId=`cat ${POM} | tr '\n' ' ' | sed 's#<build>.*</build>##' | sed 's#<dependencies>.*</dependencies>##' | sed 's#<contributors>.*</contributors>##' | sed 's#<dependencies>.*</dependencies>##' | sed 's#<reporting>.*</reporting>##' | sed 's#<parent>.*</parent>##' | grep '<artifactId>' | sed -e 's#^.*<artifactId>##;s#</artifactId>.*$##'`
-
- if [ -z $artifactId ]
- then
- artifactId=`cat ${POM} | tr '\n' ' ' | sed 's#<build>.*</build>##' | sed 's#<versions>.*</versions>##' | sed 's#<developers>.*</developers>##' | sed 's#<dependencies>.*</dependencies>##' | sed 's#<reporting>.*</reporting>##' | sed 's#<contributors>.*</contributors>##' | sed 's#<parent>.*</parent>##' | grep '<id>' | sed -e 's#^.*<id>##;s#</id>.*$##'`
- fi
-
- if [ ! -z $GROUPID ]
- then
- groupId=${GROUPID}
- else
- groupId=`cat ${POM} | tr '\n' ' ' | sed 's#<build>.*</build>##' | sed 's#<dependencies>.*</dependencies>##' | sed 's#<reporting>.*</reporting>##' | sed 's#<parent>.*</parent>##' | grep '<groupId>' | sed -e 's#^.*<groupId>##;s#</groupId>.*$##'`
-
- if [ -z $groupId ]
- then
- groupId=${artifactId}
- fi
- fi
-
- version=`echo ${version} | sed -e 's/ *$//'`
- artifactId=`echo ${artifactId} | sed -e 's/ *$//'`
- groupId=`echo ${groupId} | sed -e 's/ *$//'`
- groupDir=`echo ${groupId} | sed -e 's/\./\//g'`
-
- maven2=`cat ${POM} | grep '<modelVersion>'`
-
- echo
- if [ ! -z "${maven2}" ]
- then
- echo " ========= MAVEN 2 ========= "
- fi
-
- echo
- echo " version: [${version}]"
- echo " groupId: [${groupId}]"
- echo "artifactId: [${artifactId}]"
- echo
-
- if [ -d $REPO2DIR/${groupDir} ]
- then
- echo "The group already exists"
- else
- echo "The group does NOT already exist"
- fi
-
- echo
- echo -n Hit Enter to continue or Ctrl-C to abort...
- read
-
- LIC=LICENSE.txt
-
- # A little help for manually created upload bundles
- [ -f license.txt ] && mv license.txt $LIC
-
- if [ -f $LIC ]
- then
- $SCRIPTDIR/d2u $LIC
- mkdir -p $REPODIR/${groupId}/licenses
- cp -i $LIC $REPODIR/${groupId}/licenses/${artifactId}-${version}.license
- fi
-
- cp ${POM} ${artifactId}-${version}.pom
-
- m2dir=$REPO2DIR/${groupDir}/${artifactId}/${version}
-
- mkdir -p ${m2dir}
-
- if [ -z "${maven2}" ]
- then
- # Maven 1
- mkdir -p $REPODIR/${groupId}/poms
- cp -i ${artifactId}-${version}.pom $REPODIR/${groupId}/poms
- else
- # Maven 2
- cp -i ${artifactId}-${version}.pom ${m2dir}
- md5sum ${m2dir}/${artifactId}-${version}.pom > ${m2dir}/${artifactId}-${version}.pom.md5
- sha1sum ${m2dir}/${artifactId}-${version}.pom > ${m2dir}/${artifactId}-${version}.pom.sha1
- fi
-
- artifactType=`echo ${artifactId} | sed -e 's/maven-.*-plugin//'`
-
- if [ -z ${artifactType} ]
- then
- echo "Deploying Plugin ..."
- mkdir -p $REPODIR/${groupId}/plugins
- cp -i ${artifactId}-${version}.jar $REPODIR/${groupId}/plugins
- else
- echo "Deploying JAR ..."
-
- if [ -z "${maven2}" ]
- then
- # Maven 1
- mkdir -p $REPODIR/${groupId}/jars
- cp -i ${artifactId}-${version}.jar $REPODIR/${groupId}/jars
- fi
-
- cp -i ${artifactId}-${version}.jar ${m2dir}
- if [ -f ${m2dir}/${artifactId}-${version}.jar ]
- then
- md5sum ${m2dir}/${artifactId}-${version}.jar > ${m2dir}/${artifactId}-${version}.jar.md5
- sha1sum ${m2dir}/${artifactId}-${version}.jar > ${m2dir}/${artifactId}-${version}.jar.sha1
- fi
- fi
-
- if [ -f ${artifactId}-${version}-sources.jar ]
- then
- echo "Deploying Java sources ..."
- #mkdir -p $REPODIR/${groupId}/java-sources
- #cp -i ${artifactId}-${version}-sources.jar $REPODIR/${groupId}/java-sources
- cp -i ${artifactId}-${version}-sources.jar ${m2dir}
- md5sum ${m2dir}/${artifactId}-${version}-sources.jar > ${m2dir}/${artifactId}-${version}-sources.jar.md5
- sha1sum ${m2dir}/${artifactId}-${version}-sources.jar > ${m2dir}/${artifactId}-${version}-sources.jar.sha1
- else
- echo "No Java sources available in upload bundle, skipping ..."
- fi
-
- if [ -f ${artifactId}-${version}-javadoc.jar ]
- then
- echo "Deploying Javadocs ..."
- #mkdir -p $REPODIR/${groupId}/javadoc
- #cp -i ${artifactId}-${version}-javadoc.jar $REPODIR/${groupId}/javadoc
- cp -i ${artifactId}-${version}-javadoc.jar ${m2dir}
- md5sum ${m2dir}/${artifactId}-${version}-javadoc.jar > ${m2dir}/${artifactId}-${version}-javadoc.jar.md5
- sha1sum ${m2dir}/${artifactId}-${version}-javadoc.jar > ${m2dir}/${artifactId}-${version}-javadoc.jar.sha1
- else
- echo "No Javadocs available in upload bundle, skipping ..."
- fi
-
-)
+++ /dev/null
-#!/bin/sh
-
-POM=bundle.tmp/project.xml
-
-maven2=`cat ${POM} | grep '<modelVersion>' `
-
-echo ${maven2}
-if [ ! -z "${maven2}" ]
-then
- echo " ========= MAVEN 2 ========= "
-fi
-
-POM=bundle.tmp/pom.xml
-
-maven2=`cat ${POM} | grep '<modelVersion>' `
-
-echo ${maven2}
-if [ ! -z "${maven2}" ]
-then
- echo " ========= MAVEN 2 ========= "
-fi
-
+++ /dev/null
-# Cron jobs for the maven repository
-MAILTO=repository@maven.org
-0 */4 * * * cd $HOME/bin; ./kill_long_runners.sh rsync 3 && ./synchronize.sh
-0 0 * * * cd $HOME/reports; ./run.sh
+++ /dev/null
-#!/bin/sh
-
-# Thu Nov 16 06:55:11 EST 2006
-# A little script which gets rid of *.plugin files that were created by Archiva by mistake. We
-# don't want to convert Maven 1.x plugins to Maven 2.x plugins as they won't even run. Bad Jelly, bad.
-
-find . -name '*.plugin' -exec rm -f {} \;
+++ /dev/null
-These are little fixes that are one offs that need to be run to correct
-problems with faulty conversions or syncing errors.
+++ /dev/null
-#!/bin/bash
-
-##
-##Usage: <scriptname> <process name> <timeout in hours>
-##
-
-
- ps -eo comm,etime,pid |
- grep $1|
- awk -v TIMEOUT=4 '
-{
- if($2~/-/){
- system("kill -9 "$3);
- }
- else{
- tl=split($2, tm, ":");
- print tl;
- if(tl==3 && tm[1]>TIMEOUT){
- system("kill -9 "$3);
- }
- }
-}'
+++ /dev/null
-sourceRepositoryPath=/home/maven/repository-staging/to-ibiblio/maven
-targetRepositoryPath=/home/maven/repository-staging/to-ibiblio/maven2-converted-from-maven1
-blacklistedPatterns=**/*.pom,**/activation/**,**/javamail/**,**/jaxm/**,**/jaxp/**,**/jaxrpc/**,**/jca/**,**/jce/**,**/jdbc/**,**/jdo/**,**/jms/**,**/jndi/**,**/saaj/**
+++ /dev/null
-#!/bin/sh
-
-syncProperties=$1
-
-. $syncProperties
-
-$JAVA -jar archiva-cli-1.0-SNAPSHOT-cli.jar -c $CONVERSION_PROPERTIES
-
-dir=/home/maven/repository-staging/to-ibiblio
-src=$dir/maven2-converted-from-maven1
-dst=$dir/maven2
-log=$SYNC_REPORTS/last-changes.log
-
-rsync --ignore-existing -rvpl $src/ $dst/ > $log
-
-for f in `cat $log | grep maven-metadata.xml$` ; do
- md5sum $dst/$f > $dst/$f.md5;
- sha1sum $dst/$f > $dst/$f.sha1;
- md5sum $src/$f > $src/$f.md5;
- sha1sum $src/$f > $src/$f.sha1;
-done
+++ /dev/null
-#!/bin/sh
-
-JARS=`find $M2_REPO -iname "*.jar" | wc -l`
-POMS=`find $M2_REPO -iname "*.pom" | wc -l`
-BINJARS=`find $M2_REPO -iname "*.jar" ! -iname "*-sources.jar" ! -iname "*-javadoc.jar" | wc -l`
-SOURCES=`find $M2_REPO -iname "*-sources.jar" | wc -l`
-JAVADOCS=`find $M2_REPO -iname "*-javadoc.jar" | wc -l`
-
-echo total jars: $JARS
-echo poms: $POMS
-echo binary jars: $BINJARS
-echo sources: $SOURCES
-echo javadocs: $JAVADOCS
+++ /dev/null
-#!/bin/bash
-
-[ "$1" = "" ] && echo && echo "You must pass in the synchronize.properties file!" && echo && exit
-
-. $1
-
-echo ">>>>>>>>>>>>>>>>>> Syncing Maven 2.x repository to cica.es"
-
-rsync -e ssh --delete --max-delete=10 -v -riplt $MAVEN2_REPO/ $CICA_USERNAME@$CICA_SYNC_HOST:$M2_CICA_SYNC_DIR
+++ /dev/null
-#!/bin/bash
-
-[ "$1" = "" ] && echo && echo "You must pass in the synchronize.properties file!" && echo && exit
-
-. $1
-
-echo ">>>>>>>>>>>>>>>>>> Syncing Maven 2.x repository to Ibiblio"
-
-rsync -e ssh --delete --max-delete=10 -v -riplt $MAVEN2_REPO/ $IBIBLIO_SYNC_HOST:$M2_IBIBLIO_SYNC_DIR
-
-echo ">>>>>>>>>>>>>>>>>> Syncing Maven 1.x plugins to Ibiblio"
-
-# M1 Sync only for plugins ...
-rsync -e ssh --delete --max-delete=10 -v -riplt $MAVEN1_REPO/ $IBIBLIO_SYNC_HOST:$M1_IBIBLIO_SYNC_DIR
+++ /dev/null
-#!/bin/bash
-
-[ "$1" = "" ] && echo && echo "You must pass in the synchronize.properties file!" && echo && exit
-
-. $1
-
-# ------------------------------------------------------------------------
-# Copy the mod_rewrite rules to the Maven 1.x repository
-# ------------------------------------------------------------------------
-
-[ "$MODE" = "batch" ] && echo && echo "Press any key to copy the m1 to m2 rewrite rules, or hit ^C to quit." && echo
-
-echo "Copying rewrite rules into place"
-
-cp $M1_M2_REWRITE_RULES $MAVEN1_REPO/.htaccess
-
-scp $M1_M2_REWRITE_RULES $IBIBLIO_SYNC_HOST:$M1_IBIBLIO_SYNC_DIR/.htaccess
-
+++ /dev/null
-#!/bin/sh
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-export CENTRAL_HOST=maven01.managed.contegix.com
-export TOOLS_BASE=$HOME/bin
-export SYNC_TOOLS=$TOOLS_BASE/synchronize
-export SYNCOPATE=$SYNC_TOOLS/syncopate
-export M2_SYNC=$SYNC_TOOLS/m2-sync
-export REPOCLEAN=$TOOLS_BASE/m1-m2-conversion
-export CONVERSION_PROPERTIES=$REPOCLEAN/conversion.properties
-export M1_M2_REWRITE_RULES=$SYNC_TOOLS/m1-m2-mod-rewrite-rules.txt
-export SYNC_REPORTS=$HOME/repository-staging/to-ibiblio/reports/sync
-export JAVA_HOME=/opt/java/sdk/current
-export JAVA_CMD=$JAVA_HOME/bin/java
-export JAVA_OPTS="-Xms32m -Xmx2048m"
-export JAVA="$JAVA_CMD $JAVA_OPTS"
-
-export STAGING_DIR=$HOME/repository-staging/to-ibiblio
-export MAVEN1_REPO=$STAGING_DIR/maven
-export MAVEN2_REPO=$STAGING_DIR/maven2
-
-
-# ibiblio.org
-export IBIBLIO_SYNC_HOST=login.ibiblio.org
-export M1_IBIBLIO_SYNC_DIR=/public/ftp/pub/packages/maven
-export M2_IBIBLIO_SYNC_DIR=/export/mirrors/maven2
-
-# cica.es
-export CICA_USERNAME=m-maven
-export CICA_SYNC_HOST=ftp.cica.es
-export M2_CICA_SYNC_DIR=/home/m-maven/maven2
+++ /dev/null
-#!/bin/sh
-
-# ------------------------------------------------------------------------
-# 1. Sync Maven 1.x repositories to central
-# 2. Convert Maven 1.x repository to Maven 2.x repository
-# 3. Manual fixes
-# 4. Sync Maven 2.x repositories to central
-# 5. Sync the Maven 2.x repository to Cica and Ibiblio
-# 6. Copy the mod_rewrite rules to the Maven 1.x repository @ Ibiblio
-# ------------------------------------------------------------------------
-
-PID=$$
-RUNNING=`ps -ef | grep synchronize.sh | grep -v 'sh -c' | grep -v grep | grep -v $PID`
-echo $RUNNING
-if [ ! -z "$RUNNING" ]; then
- echo Sync already running... exiting
- echo $RUNNING
- exit 1
-fi
-
-dir=`pwd`
-syncProperties=$dir/synchronize.properties
-source $syncProperties
-
-((
-
-MODE=$1
-
-echo "Using the following settings:"
-echo "CENTRAL_HOST = $CENTRAL_HOST"
-echo "TOOLS_BASE = $TOOLS_BASE"
-echo "SYNC_TOOLS = $SYNC_TOOLS"
-echo "SYNCOPATE = $SYNCOPATE"
-echo "REPOCLEAN = $REPOCLEAN"
-echo "M1_M2_REWRITE_RULES = $M1_M2_REWRITE_RULES"
-echo "SYNC_REPORTS = $SYNC_REPORTS"
-echo "JAVA = $JAVA"
-
-[ "$MODE" = "batch" ] && echo && echo "Press any key to continue, or hit ^C to quit." && echo
-
-# ------------------------------------------------------------------------
-# Syncopate: Sync the Maven 1.x repositories
-# ------------------------------------------------------------------------
-
-[ "$MODE" = "batch" ] && echo && echo "Press any key to run syncopate, or hit ^C to quit." && echo
-
-echo ">>>>>>>>>>>>>>>>>> Running Syncopate"
-
-(
- cd $SYNCOPATE
- ./sync
- retval=$?; if [ $retval != 0 ]; then exit $retval; fi
-)
-retval=$?; if [ $retval != 0 ]; then exit $retval; fi
-
-# ------------------------------------------------------------------------
-# Repoclean: converting the Maven 1.x repository to Maven 2.x
-# ------------------------------------------------------------------------
-
-[ "$MODE" = "batch" ] && echo && echo "Press any key to run the m1 to m2 conversion, or hit ^C to quit." && echo
-
-echo ">>>>>>>>>>>>>>>>>> Running Maven 1.x to Maven 2.x conversion ..."
-
-(
- cd $REPOCLEAN
- ./convert-m1-m2.sh $syncProperties
- retval=$?; if [ $retval != 0 ]; then exit $retval; fi
-)
-retval=$?; if [ $retval != 0 ]; then exit $retval; fi
-
-# ------------------------------------------------------------------------
-# Manual fixes
-# ------------------------------------------------------------------------
-
-[ "$MODE" = "batch" ] && echo && echo "Press any key to run manual fixes, or hit ^C to quit." && echo
-
-echo ">>>>>>>>>>>>>>>>>> Removing commons-logging 1.1-dev"
-
-# hack prevent commons-logging-1.1-dev
-CL=$MAVEN2_REPO/commons-logging/commons-logging
-rm -rf $CL/1.1-dev
-grep -v 1.1-dev $CL/maven-metadata.xml > $CL/maven-metadata.xml.tmp
-mv $CL/maven-metadata.xml.tmp $CL/maven-metadata.xml
-md5sum $CL/maven-metadata.xml > $CL/maven-metadata.xml.md5
-sha1sum $CL/maven-metadata.xml > $CL/maven-metadata.xml.sha1
-
-# ------------------------------------------------------------------------
-# 4. Sync Maven 2.x repositories to central
-# ------------------------------------------------------------------------
-
-[ "$MODE" = "batch" ] && echo && echo "Press any key to sync Maven 2.x repositories to central, or hit ^C to quit." && echo
-
-(
- cd $M2_SYNC
- ./m2-sync.sh go
-)
-
-# ------------------------------------------------------------------------
-# Cica.es synchronization: sync the central repository to Cica.es
-# ------------------------------------------------------------------------
-
-[ "$MODE" = "batch" ] && echo && echo "Press any key to run the sync to Cica, or hit ^C to quit." && echo
-
-./synchronize-central-to-cica.sh $syncProperties
-retval=$?; if [ $retval != 0 ]; then exit $retval; fi
-retval=$?; if [ $retval != 0 ]; then exit $retval; fi
-
-# ------------------------------------------------------------------------
-# Ibiblio synchronization: sync the central repository to Ibiblio
-# ------------------------------------------------------------------------
-
-[ "$MODE" = "batch" ] && echo && echo "Press any key to run the sync to Ibiblio, or hit ^C to quit." && echo
-
-./synchronize-central-to-ibiblio.sh $syncProperties
-retval=$?; if [ $retval != 0 ]; then exit $retval; fi
-retval=$?; if [ $retval != 0 ]; then exit $retval; fi
-
-# ------------------------------------------------------------------------
-# Copy the mod_rewrite rules to the Maven 1.x repository
-# ------------------------------------------------------------------------
-
-./synchronize-rewrite-rules-to-ibiblio.sh $syncProperties
-
-) | tee $SYNC_REPORTS/last-sync-results.txt ) 2>&1
+++ /dev/null
-## IF YOU MODIFY THIS FILE, MAKE SURE IT GETS UPDATED IN SVN
-
-## MAVEN 1.0.2 doesn't deal with redirects. Avoid them
-
-RewriteEngine on
-
-RewriteBase /maven
-
-RewriteRule org.codehaus.modello/jars/modello-plugin-dom4j-(.+).jar(.*)$ /maven2/org/codehaus/modello/modello-plugin-dom4j/$1/modello-plugin-dom4j-$1.jar$2 [L]
-RewriteRule org.codehaus.modello/jars/modello-plugin-xpp3-(.+).jar(.*)$ /maven2/org/codehaus/modello/modello-plugin-xpp3/$1/modello-plugin-xpp3-$1.jar$2 [L]
-RewriteRule maven/jars/dom4j-(.+).jar(.*)$ /maven2/maven/dom4j/$1/dom4j-$1.jar$2 [L]
-RewriteRule dom4j/jars/dom4j-(.+).jar(.*)$ /maven2/dom4j/dom4j/$1/dom4j-$1.jar$2 [L]
-RewriteRule jaxen/jars/jaxen-1.0-FCS-full.jar$ /maven2/jaxen/jaxen/1.0-FCS/jaxen-1.0-FCS-full.jar [L]
-RewriteRule cactus/jars/cactus-([0-9]+)-(.+).jar$ /maven2/cactus/cactus/$1-$2/cactus-$1-$2.jar [L]
-RewriteRule commons-logging/jars/commons-logging-1.1-dev.jar /maven2/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar [L]
-RewriteRule strutstestcase/jars/strutstestcase-(.+).jar /maven2/strutstestcase/strutstestcase/$1/strutstestcase-$1.jar [L]
-RewriteRule stax-utils/jars/stax-utils-snapshot-(.+).jar /maven2/stax-utils/stax-utils/snapshot-$1/stax-utils-snapshot-$1.jar [L]
-RewriteRule batik/jars/batik-1.5-fop-(.+).jar /maven2/batik/batik-1.5-fop/$1/batik-1.5-fop-$1.jar [L]
-RewriteRule poi/jars/poi-(.+)-final-(.+).jar /maven2/poi/poi-$1-final/$2/poi-$1-final-$2.jar [L]
-RewriteRule jython/jars/jython-20020827-no-oro.jar /maven2/jython/jython/20020827/jython-20020827-no-oro.jar [L]
-RewriteRule xpp3/jars/xpp3-1.1.3.4-(.+?).jar /maven2/xpp3/xpp3/1.1.3.4/xpp3-1.1.3.4-$1.jar [L]
-
-# rewrite // to /
-RewriteRule ^/(.*)$ /maven/$1
-# rewrite mapped artifact
-# rewrite artifact
-# don't translate plugins - they aren't copied in the reposync
-RewriteRule ^([^/]+)/(jar|pom|config|distribution|java-source|dist|dtd|ear|ejb|license|licence|nbm|rar|sar|tld|war|xml|zip)s/([^0-9]+)-([0-9].+)\.([^0-9]+)(\.md5|\.sha1){0,1}$ r/$1/$3/$4/$3-$4.$5$6 [PT]
-RewriteRule ^([^/]+)/(jar|pom|config|distribution|java-source|dist|dtd|ear|ejb|license|licence|nbm|rar|sar|tld|war|xml|zip)s/(.+)-([0-9].+)\.([^0-9]+)(\.md5|\.sha1){0,1}$ r/$1/$3/$4/$3-$4.$5$6 [PT]
-# rewrite dotted groups
-RewriteRule ^r/([^/]+)\.(.*)$ r/$1/$2 [PT] [N]
-# final redirect
-RewriteRule ^r/(.*)$ /maven2/$1
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Eugene Kuleshov <eu@javatx.org>"
-MODE=rsync_ssh
-
-FROM=maven@forge.objectweb.org:../../groups/maven/htdocs/maven2
-GROUP_DIR=asm/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Simon Brandhof <simon.brandhof@hortis.ch>,Cedric Munger <cedric.munger@hortis.ch>"
-MODE=rsync
-
-FROM=rsync://maven2.hortis.ch/releases
-GROUP_DIR=ch/hortis/sonar/
-
-NO_SSH=true
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Ceki Gulcu <ceki@qos.ch>,Sebastien Pennec <sebastien@qos.ch>"
-MODE=rsync
-
-FROM=rsync://pixie.qos.ch/mvnrepo
-GROUP_DIR=ch/qos/logback/
-
-NO_SSH=true
+++ /dev/null
-#!/bin/sh
-
-CONTACTS=""
-MODE=rsync_ssh
-
-FROM=mavensync@repository.codehaus.org:/repository
-GROUP_DIR=
-SSH_OPTS="-i $HOME/.ssh/new-id_dsa"
-#RSYNC_OPTS="-L"
-
-## NOTE that codehaus only honours some rsync options. Others may be summarily discarded and/or cause the rsync to break - check
-## with them if changing them
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Daniel brolund <daniel.brolund@agical.com>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/r/rm/rmock/htdocs/repository
-GROUP_DIR=com/agical/rmock/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Wilfred Springer <wilfred@agilejava.com>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/b/bl/blammo/htdocs/repository
-GROUP_DIR=com/agilejava/blammo/
+++ /dev/null
-#!/bin/sh
-
-CONTACT="info@cedarsoft.de"
-MODE=rsync_ssh
-
-FROM=mavensync@maven.cedarsoft.com:/home/maven/public/release
-GROUP_DIR=com/cedarsoft/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Thomas Mueller <thomas.tom.mueller@gmail.com>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/h/hs/hsql/htdocs/m2-repo
-GROUP_DIR=com/h2database/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Adam Altemus <aaltemus@mobilvox.com>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/m/ma/maven-js-plugin/htdocs/m2repo
-GROUP_DIR=com/mobilvox/ossi/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Patrick Lightbody <plightbo@gmail.com>"
-MODE=rsync_ssh
-
-FROM=maven2.opensymphony.com:/opt/repository/maven2
-GROUP_DIR=com/opensymphony/
+++ /dev/null
-#!/bin/sh
-
-CONTACT="Vlad Skarzhevskyy <skarzhevskyy@gmail.com>"
-MODE=rsync
-
-FROM=mavensync@pyx4me.com::maven2-release
-GROUP_DIR=com/pyx4j/
-
-NO_SSH=true
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-
-CONTACT="Vlad Skarzhevskyy <skarzhevskyy@gmail.com>"
-MODE=rsync
-
-FROM=mavensync@pyx4me.com::maven2-release
-GROUP_DIR=com/pyx4me/
-
-NO_SSH=true
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Jochen Wiedmann <jochen@apache.org>"
-MODE=rsync_ssh
-
-FROM=jvanzyl@people.apache.org:/www/people.apache.org/repo/m2-ibiblio-rsync-repository
-GROUP_DIR=commons-fileupload/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Joerg Schaible <joerg.schaible@gmx.de>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.berlios.de:/home/groups/jsunit/htdocs/maven2/repo
-GROUP_DIR=de/berlios/jsunit/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="fabrizio giustina <fgiust@gmail.com>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/d/di/displaytag/htdocs/m2repo
-GROUP_DIR=displaytag/
+++ /dev/null
-#!/bin/sh
-
-CONTACT="info@cedarsoft.de"
-MODE=rsync_ssh
-
-FROM=mavensync@maven.cedarsoft.eu:/home/maven/public/release
-GROUP_DIR=eu/cedarsoft/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="David BERNARD <dwayneb@free.fr>"
-MODE=rsync_ssh
-
-FROM=mavensync@gforge.inria.fr:/home/groups/maven-repo/htdocs/releases
-GROUP_DIR=fr/inria/gforge/
+++ /dev/null
-#!/bin/sh
-
-CONTACT="Mark Matthews <mark@mysql.com>"
-MODE=rsync
-
-FROM=maven@rsync.mysql.com:/web/sites/live/maven/
-GROUP_DIR=mysql/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Nathan Hamblen <nathan@technically.us>"
-MODE=rsync_ssh
-FROM=maven@databinder.net:/var/dbwww/maven
-GROUP_DIR=net/databinder/
-
-#[info]
-#id = net.databinder
-#name = Databinder
-#contact = nathan@technically.us
-
-#[host]
-#address=databinder.net
-#directory=/var/dbwww/maven
-#rsyncUser=maven
-
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Christian Gruber <cgruber@israfil.net>"
-MODE=rsync_ssh
-SSH_OPTS="-l ibiblio"
-
-FROM=ibiblio@www.israfil.net:maven2
-GROUP_DIR=net/israfil/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Tomasz Pik <pikus@ais.pl>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/a/ai/aislib/htdocs/repos/sync
-GROUP_DIR=net/sf/aislib/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="David BERNARD <dwayneb@free.fr>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/a/al/alchim/htdocs/download/releases
-GROUP_DIR=net/sf/alchim/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Hervé BOUTEMY <herve.boutemy@free.fr>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/d/dt/dtddoc/htdocs/m2repo/releases
-GROUP_DIR=net/sf/dtddoc/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Greg Luck <gluck@gregluck.com>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/e/eh/ehcache/htdocs/repository
-GROUP_DIR=net/sf/ehcache/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Charles GAY <diabolo512@users.sourceforge.net>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/j/jg/jguard/htdocs/repository
-GROUP_DIR=net/sf/jguard/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Greg Ritchie <gregr20@gmail.com>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/j/jl/jlynx/htdocs/repos
-GROUP_DIR=net/sf/jlynx/
+++ /dev/null
-#!/bin/sh
-
-CONTACT="Vlad Skarzhevskyy <skarzhevskyy@gmail.com>"
-MODE=rsync
-
-FROM=mavensync@pyx4me.com::maven2-release
-GROUP_DIR=net/sf/jour/
-
-NO_SSH=true
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Andres Almiray <aalmiray@users.sourceforge.net>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/j/js/json-lib/htdocs/m2/repo/release
-GROUP_DIR=net/sf/json-lib/
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Lasse Koskela <lasse.koskela@gmail.com>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/j/js/jsptest/htdocs/maven2
-GROUP_DIR=net/sf/jsptest/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Leonid Vysochyn <leonid.vysochyn@gmail.com>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/j/jx/jxls/htdocs/repository/releases
-GROUP_DIR=net/sf/jxls/
+++ /dev/null
-#!/bin/sh
-
-CONTACT="tom.cort@state.vt.us"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/l/lo/locale4j/maven/upload-repo
-GROUP_DIR=net/sf/locale4j/
-
+++ /dev/null
-#!/bin/sh
-
-CONTACT="twenstar@users.sourceforge.net"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/m/ma/mapasuta/maven/upload-repo
-GROUP_DIR=net/sf/mapasuta/
+++ /dev/null
-#!/bin/sh
-
-CONTACT="tom.cort@state.vt.us"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/m/ma/maven-har/maven/upload-repo
-GROUP_DIR=net/sf/maven-har/
+++ /dev/null
-#!/bin/sh
-
-CONTACT="tom.cort@state.vt.us"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/m/ma/maven-sar/maven/upload-repo
-GROUP_DIR=net/sf/maven-sar/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Doug Culnane <doug@culnane.net>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/s/st/stat-scm/htdocs/maven2
-GROUP_DIR=net/sf/stat-scm/
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Igor Drobiazko <igor.drobiazko@gmail.com>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/t/ta/tacos/htdocs/repository
-GROUP_DIR=net/sf/tacos/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Antonio Talarico <atalarico@users.sourceforge.net >"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/s/sm/smartconfig/htdocs/releases
-GROUP_DIR=net/smartlab/config/
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Antonio Talarico <atalarico@users.sourceforge.net>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/s/sm/smartweb/htdocs/releases
-GROUP_DIR=net/smartlab/web/
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="max berger <max@berger.name>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/j/je/jeuclid/htdocs/m2-release
-GROUP_DIR=net/sourceforge/jeuclid/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Julien HENRY <henryju@yahoo.fr>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/j/jw/jwebunit/htdocs/m2-repo
-GROUP_DIR=net/sourceforge/jwebunit/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="fabrizio giustina <fgiust@gmail.com>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/m/ma/maven-taglib/htdocs/m2repo
-GROUP_DIR=net/sourceforge/maven-taglib/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="fabrizio giustina <fgiust@gmail.com>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/o/op/openutils/htdocs/repository/releases
-GROUP_DIR=net/sourceforge/openutils/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Choi Beom Kyun <madvirus2@gmail.com>"
-MODE=rsync_ssh
-
-FROM=maven@www.tleproject.net:~/mvnrepo
-GROUP_DIR=net/tleproject/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Patrick Lightbody <plightbo@gmail.com>"
-MODE=rsync_ssh
-
-FROM=maven2.opensymphony.com:/opt/repository/maven2
-GROUP_DIR=ognl/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Patrick Lightbody <plightbo@gmail.com>"
-MODE=rsync_ssh
-
-FROM=maven2.opensymphony.com:/opt/repository/maven2
-GROUP_DIR=opensymphony/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Carlos Sanchez <carlos@apache.org>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/a/ac/acegisecurity/htdocs/repository/releases
-GROUP_DIR=org/acegisecurity/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS=""
-MODE=rsync_ssh
-
-FROM=jvanzyl@people.apache.org:/www/people.apache.org/repo/m2-ibiblio-rsync-repository
-GROUP_DIR=org/apache/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="mraible@dev.java.net"
-MODE=rsync_ssh
-
-FROM=mavensync@static.appfuse.org:/var/www/appfuse-releases
-GROUP_DIR=org/appfuse/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="DSpace Developers <dspace-devel@lists.sourceforge.net>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/d/ds/dspace/htdocs/repository/release
-GROUP_DIR=org/dspace/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Christian Schulte <cs@jdtaus.org>, jDTAUS Support <support@jdtaus.org>"
-MODE=rsync
-
-FROM=rsync://repository.jdtaus.org/repository
-GROUP_DIR=org/jdtaus/
-
-NO_SSH=true
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Misha Gridnev <mishalg@users.sourceforge.net>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sf.net:/home/groups/j/jf/jframework/repository
-GROUP_DIR=org/jframework/
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Jerome Bernard <jerome.bernard@gmail.com>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/j/ji/jibx/htdocs/maven2
-GROUP_DIR=org/jibx/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Toby Ho <airportyh@users.sourceforge.net>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/j/jy/jyaml/htdocs/m2-repo
-GROUP_DIR=org/jyaml/
+++ /dev/null
-#!/bin/sh
-
-CONTACT="Vlad Skarzhevskyy <skarzhevskyy@gmail.com>"
-MODE=rsync
-
-FROM=mavensync@pyx4me.com::maven2-release
-GROUP_DIR=org/microemu/
-
-NO_SSH=true
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="xavier.moghrabi@objectweb.org"
-MODE=rsync_ssh
-
-FROM=maven@forge.objectweb.org:../../groups/maven/htdocs/maven2
-GROUP_DIR=org/objectweb/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="xavier.moghrabi@objectweb.org"
-MODE=rsync_ssh
-
-FROM=maven@forge.objectweb.org:../../groups/maven/htdocs/maven2
-GROUP_DIR=org/ow2/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Lucio Benfante <lucio.benfante@jugpadova.it>"
-MODE=rsync_ssh
-
-FROM=web3160@maven2.parancoe.org:/home/web/maven2.parancoe.org/repository/repo
-GROUP_DIR=org/parancoe/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Ceki Gulcu <ceki@qos.ch>"
-MODE=rsync
-
-FROM=rsync://pixie.qos.ch/mvnrepo
-GROUP_DIR=org/slf4j/
-
-NO_SSH=true
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Ben Hale <bhale@interface21.com>"
-MODE=svn
-SVN_URL=https://springframework.svn.sourceforge.net/svnroot/springframework/repos/repo
-
-FROM=/home/maven/repository-staging/to-ibiblio/maven-spring
-GROUP_DIR=org/springframework/
-
-svn up $FROM/$GROUP_DIR
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Ben Hale <bhale@interface21.com>"
-MODE=svn
-SVN_URL=https://springframework.svn.sourceforge.net/svnroot/springframework/repos/repo
-
-FROM=/home/maven/repository-staging/to-ibiblio/maven-spring
-GROUP_DIR=org/springmodules/
-
-svn up $FROM/$GROUP_DIR
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Fabio Kung <fabio.kung@gmail.com>"
-MODE=rsync_ssh
-
-FROM=mavensync@vraptor.org:/usr/java/webapps/vraptor.org/maven
-GROUP_DIR=org/vraptor/
+++ /dev/null
-#!/bin/sh
-
-CONTACTS="Martijn Dashorst <martijn.dashorst@gmail.com>"
-MODE=rsync_ssh
-
-FROM=mavensync@shell.sourceforge.net:/home/groups/w/wi/wicket/htdocs/maven2
-GROUP_DIR=wicket/
+++ /dev/null
-#!/bin/sh
-
-exclusions=$HOME/bin/synchronize/syncopate/exclusions.txt
-
-echo This script is very temporary. Please validate all input files in the source repository before blindly copying them in.
-echo Ensure all artifacts have a valid POM.
-echo This will be removed when the repository manager is in place.
-
-echo
-
-echo Options
-echo go - does the sync for real
-echo check - checks for changed files
-
-echo
-
-echo
-echo For a better explanation of the output flags please check --itemize-changes at rsync man page
-echo
-
-if [ "$1" == "go" ]; then
- echo Doing sync for real
-else
- echo Not syncing
- RSYNC_OPTS="$RSYNC_OPTS -n"
-fi
-
-BASEDIR=$HOME/repository-staging/to-ibiblio/maven2
-CHANGED_LOG=/tmp/sync-changed.log
-rm $CHANGED_LOG
-
-for f in `find conf -maxdepth 1 -iname "*.sh"`
- do
-
- FROM=
- GROUP_DIR=
- NO_SSH=
- SSH_OPTS=
- # to prevent empty variable
- RSYNC_SSH="-z"
-
- source $f
-
- if [ -z $NO_SSH ]
- then
- RSYNC_SSH="--rsh=ssh $SSH_OPTS"
- fi
-
- # check for changed files
- if [ "$1" == "check" ]; then
-
- rsync -n --exclude=**/maven-metadata.xml* --exclude-from=$exclusions --existing $RSYNC_OPTS -Lrtivzc "$RSYNC_SSH" $FROM/$GROUP_DIR $BASEDIR/$GROUP_DIR >> $CHANGED_LOG
-
- else
-
- echo "Syncing $FROM -> $GROUP_DIR"
- rsync --include=*/ --include=**/maven-metadata.xml* --exclude=* --exclude-from=$exclusions $RSYNC_OPTS -Lrtivz "$RSYNC_SSH" $FROM/$GROUP_DIR $BASEDIR/$GROUP_DIR
- rsync --exclude-from=$exclusions --ignore-existing $RSYNC_OPTS -Lrtivz "$RSYNC_SSH" $FROM/$GROUP_DIR $BASEDIR/$GROUP_DIR
-
- fi
-
-done
-
-if [ "$1" == "check" ]; then
- echo "*******************************************************************************"
- echo "******************************* CHANGED FILES *******************************"
- echo "*******************************************************************************"
- cat $CHANGED_LOG
- echo "*******************************************************************************"
- echo "*******************************************************************************"
- echo "*******************************************************************************"
-fi
+++ /dev/null
-package Config::IniFiles;
-$Config::IniFiles::VERSION = (qw($Revision$))[1];
-require 5.004;
-use strict;
-use Carp;
-use Symbol 'gensym','qualify_to_ref'; # For the 'any data type' hack
-
-@Config::IniFiles::errors = ( );
-
-# $Header$
-
-=head1 NAME
-
-Config::IniFiles - A module for reading .ini-style configuration files.
-
-=head1 SYNOPSIS
-
- use Config::IniFiles;
- my $cfg = new Config::IniFiles( -file => "/path/configfile.ini" );
- print "The value is " . $cfg->val( 'Section', 'Parameter' ) . "."
- if $cfg->val( 'Section', 'Parameter' );
-
-=head1 DESCRIPTION
-
-Config::IniFiles provides a way to have readable configuration files outside
-your Perl script. Configurations can be imported (inherited, stacked,...),
-sections can be grouped, and settings can be accessed from a tied hash.
-
-=head1 FILE FORMAT
-
-INI files consist of a number of sections, each preceded with the
-section name in square brackets. The first non-blank character of
-the line indicating a section must be a left bracket and the last
-non-blank character of a line indicating a section must be a right
-bracket. The characters making up the section name can be any
-symbols at all. However section names must be unique.
-
-Parameters are specified in each section as Name=Value. Any spaces
-around the equals sign will be ignored, and the value extends to the
-end of the line. Parameter names are localized to the namespace of
-the section, but must be unique within a section.
-
- [section]
- Parameter=Value
-
-Both the hash mark (#) and the semicolon (;) are comment characters.
-by default (this can be changed by configuration)
-Lines that begin with either of these characters will be ignored. Any
-amount of whitespace may precede the comment character.
-
-Multi-line or multi-valued parameters may also be defined ala UNIX
-"here document" syntax:
-
- Parameter=<<EOT
- value/line 1
- value/line 2
- EOT
-
-You may use any string you want in place of "EOT". Note that what
-follows the "<<" and what appears at the end of the text MUST match
-exactly, including any trailing whitespace.
-
-As a configuration option (default is off), continuation lines can
-be allowed:
-
- [Section]
- Parameter=this parameter \
- spreads across \
- a few lines
-
-
-=head1 USAGE -- Object Interface
-
-Get a new Config::IniFiles object with the I<new> method:
-
- $cfg = Config::IniFiles->new( -file => "/path/configfile.ini" );
- $cfg = new Config::IniFiles -file => "/path/configfile.ini";
-
-Optional named parameters may be specified after the configuration
-file name. See the I<new> in the B<METHODS> section, below.
-
-Values from the config file are fetched with the val method:
-
- $value = $cfg->val('Section', 'Parameter');
-
-If you want a multi-line/value field returned as an array, just
-specify an array as the receiver:
-
- @values = $cfg->val('Section', 'Parameter');
-
-=head1 METHODS
-
-=head2 new ( [-option=>value ...] )
-
-Returns a new configuration object (or "undef" if the configuration
-file has an error). One Config::IniFiles object is required per configuration
-file. The following named parameters are available:
-
-=over 10
-
-=item I<-file> filename
-
-Specifies a file to load the parameters from. This 'file' may actually be
-any of the following things:
-
- 1) a simple filehandle, such as STDIN
- 2) a filehandle glob, such as *CONFIG
- 3) a reference to a glob, such as \*CONFIG
- 4) an IO::File object
- 5) the pathname of a file
-
-If this option is not specified, (i.e. you are creating a config file from scratch)
-you must specify a target file using SetFileName in order to save the parameters.
-
-=item I<-default> section
-
-Specifies a section to be used for default values. For example, if you
-look up the "permissions" parameter in the "users" section, but there
-is none, Config::IniFiles will look to your default section for a "permissions"
-value before returning undef.
-
-=item I<-reloadwarn> 0|1
-
-Set -reloadwarn => 1 to enable a warning message (output to STDERR)
-whenever the config file is reloaded. The reload message is of the
-form:
-
- PID <PID> reloading config file <file> at YYYY.MM.DD HH:MM:SS
-
-Default behavior is to not warn (i.e. -reloadwarn => 0).
-
-=item I<-nocase> 0|1
-
-Set -nocase => 1 to handle the config file in a case-insensitive
-manner (case in values is preserved, however). By default, config
-files are case-sensitive (i.e., a section named 'Test' is not the same
-as a section named 'test'). Note that there is an added overhead for
-turning off case sensitivity.
-
-=item I<-allowcontinue> 0|1
-
-Set -allowcontinue => 1 to enable continuation lines in the config file.
-i.e. if a line ends with a backslash C<\>, then the following line is
-appended to the parameter value, dropping the backslash and the newline
-character(s).
-
-Default behavior is to keep a trailing backslash C<\> as a parameter
-value. Note that continuation cannot be mixed with the "here" value
-syntax.
-
-=item I<-import> object
-
-This allows you to import or inherit existing setting from another
-Config::IniFiles object. When importing settings from another object,
-sections with the same name will be merged and parameters that are
-defined in both the imported object and the I<-file> will take the
-value of given in the I<-file>.
-
-If a I<-default> section is also given on this call, and it does not
-coincide with the default of the imported object, the new default
-section will be used instead. If no I<-default> section is given,
-then the default of the imported object will be used.
-
-=item I<-commentchar> 'char'
-
-The default comment character is C<#>. You may change this by specifying
-this option to an arbitrary character, except alphanumeric characters
-and square brackets and the "equal" sign.
-
-=item I<-allowedcommentchars> 'chars'
-
-Allowed default comment characters are C<#> and C<;>. By specifying this
-option you may enlarge or narrow this range to a set of characters
-(concatenating them to a string). Note that the character specified by
-B<-commentchar> (see above) is always part of the allowed comment
-characters. Note: The given string is evaluated as a character class
-(i.e.: like C</[chars]/>).
-
-=back
-
-=cut
-
-sub new {
- my $class = shift;
- my %parms = @_;
-
- my $errs = 0;
- my @groups = ( );
-
- my $self = {};
- # Set config file to default value, which is nothing
- $self->{cf} = undef;
- if( ref($parms{-import}) && ($parms{-import}->isa('Config::IniFiles')) ) {
- # Import from the import object by COPYing, so we
- # don't clobber the old object
- %{$self} = %{$parms{-import}};
- } else {
- $self->{firstload} = 1;
- $self->{default} = '';
- $self->{imported} = [];
- if( defined $parms{-import} ) {
- carp "Invalid -import value \"$parms{-import}\" was ignored.";
- delete $parms{-import};
- } # end if
- } # end if
-
- # Copy the original parameters so we
- # can use them when we build new sections
- %{$self->{startup_settings}} = %parms;
-
- # Parse options
- my($k, $v);
- local $_;
- $self->{nocase} = 0;
-
- # Handle known parameters first in this order,
- # because each() could return parameters in any order
- if (defined ($v = delete $parms{'-import'})) {
- # Store the imported object's file parameter for reload
- if( $self->{cf} ) {
- push( @{$self->{imported}}, $self->{cf} );
- } else {
- push( @{$self->{imported}}, "<Un-named file>" );
- } # end if
- }
- if (defined ($v = delete $parms{'-file'})) {
- # Should we be pedantic and check that the file exists?
- # .. no, because now it could be a handle, IO:: object or something else
- $self->{cf} = $v;
- }
- if (defined ($v = delete $parms{'-default'})) {
- $self->{default} = $v;
- }
- if (defined ($v = delete $parms{'-nocase'})) {
- $self->{nocase} = $v ? 1 : 0;
- }
- if (defined ($v = delete $parms{'-reloadwarn'})) {
- $self->{reloadwarn} = $v ? 1 : 0;
- }
- if (defined ($v = delete $parms{'-allowcontinue'})) {
- $self->{allowcontinue} = $v ? 1 : 0;
- }
- if (defined ($v = delete $parms{'-commentchar'})) {
- if(!defined $v || length($v) != 1) {
- carp "Comment character must be unique.";
- $errs++;
- }
- elsif($v =~ /[\[\]=\w]/) {
- # must not be square bracket, equal sign or alphanumeric
- carp "Illegal comment character.";
- $errs++;
- }
- else {
- $self->{comment_char} = $v;
- }
- }
- if (defined ($v = delete $parms{'-allowedcommentchars'})) {
- # must not be square bracket, equal sign or alphanumeric
- if(!defined $v || $v =~ /[\[\]=\w]/) {
- carp "Illegal value for -allowedcommentchars.";
- $errs++;
- }
- else {
- $self->{comment_char} = $v;
- }
- }
- $self->{comment_char} = '#' unless exists $self->{comment_char};
- $self->{allowed_comment_char} = ';' unless exists $self->{allowed_comment_char};
- # make sure that comment character is always allowed
- $self->{allowed_comment_char} .= $self->{comment_char};
-
- # Any other parameters are unkown
- while (($k, $v) = each %parms) {
- carp "Unknown named parameter $k=>$v";
- $errs++;
- }
-
- return undef if $errs;
-
- bless $self, $class;
-
- # No config file specified, so everything's okay so far.
- if (not defined $self->{cf}) {
- return $self;
- }
-
- if ($self->ReadConfig) {
- return $self;
- } else {
- return undef;
- }
-}
-
-=head2 val ($section, $parameter [, $default] )
-
-Returns the value of the specified parameter (C<$parameter>) in section
-C<$section>, returns undef (or C<$default> if specified) if no section or
-no parameter for the given section section exists.
-
-
-If you want a multi-line/value field returned as an array, just
-specify an array as the receiver:
-
- @values = $cfg->val('Section', 'Parameter');
-
-A multi-line/value field that is returned in a scalar context will be
-joined using $/ (input record separator, default is \n) if defined,
-otherwise the values will be joined using \n.
-
-=cut
-
-sub val {
- my ($self, $sect, $parm, $def) = @_;
-
- # Always return undef on bad parameters
- return undef if not defined $sect;
- return undef if not defined $parm;
-
- if ($self->{nocase}) {
- $sect = lc($sect);
- $parm = lc($parm);
- }
-
- my $val = defined($self->{v}{$sect}{$parm}) ?
- $self->{v}{$sect}{$parm} :
- $self->{v}{$self->{default}}{$parm};
-
- # If the value is undef, make it $def instead (which could just be undef)
- $val = $def unless defined $val;
-
- # Return the value in the desired context
- if (wantarray and ref($val) eq "ARRAY") {
- return @$val;
- } elsif (ref($val) eq "ARRAY") {
- if (defined ($/)) {
- return join "$/", @$val;
- } else {
- return join "\n", @$val;
- }
- } else {
- return $val;
- }
-}
-
-=head2 setval ($section, $parameter, $value, [ $value2, ... ])
-
-Sets the value of parameter C<$parameter> in section C<$section> to
-C<$value> (or to a set of values). See below for methods to write
-the new configuration back out to a file.
-
-You may not set a parameter that didn't exist in the original
-configuration file. B<setval> will return I<undef> if this is
-attempted. See B<newval> below to do this. Otherwise, it returns 1.
-
-=cut
-
-sub setval {
- my $self = shift;
- my $sect = shift;
- my $parm = shift;
- my @val = @_;
-
- return undef if not defined $sect;
- return undef if not defined $parm;
-
-# tom@ytram.com +
- if ($self->{nocase}) {
- $sect = lc($sect);
- $parm = lc($parm);
- }
-# tom@ytram.com -
-
- if (defined($self->{v}{$sect}{$parm})) {
- if (@val > 1) {
- $self->{v}{$sect}{$parm} = \@val;
- $self->{EOT}{$sect}{$parm} = 'EOT';
- } else {
- $self->{v}{$sect}{$parm} = shift @val;
- }
- return 1;
- } else {
- return undef;
- }
-}
-
-=head2 newval($section, $parameter, $value [, $value2, ...])
-
-Assignes a new value, C<$value> (or set of values) to the
-parameter C<$parameter> in section C<$section> in the configuration
-file.
-
-=cut
-
-sub newval {
- my $self = shift;
- my $sect = shift;
- my $parm = shift;
- my @val = @_;
-
- return undef if not defined $sect;
- return undef if not defined $parm;
-
-# tom@ytram.com +
- if ($self->{nocase}) {
- $sect = lc($sect);
- $parm = lc($parm);
- }
-# tom@ytram.com -
- $self->AddSection($sect);
-
- push(@{$self->{parms}{$sect}}, $parm)
- unless (grep {/^\Q$parm\E$/} @{$self->{parms}{$sect}} );
-
- if (@val > 1) {
- $self->{v}{$sect}{$parm} = \@val;
- $self->{EOT}{$sect}{$parm} = 'EOT' unless defined
- $self->{EOT}{$sect}{$parm};
- } else {
- $self->{v}{$sect}{$parm} = shift @val;
- }
- return 1
-}
-
-=head2 delval($section, $parameter)
-
-Deletes the specified parameter from the configuration file
-
-=cut
-
-sub delval {
- my $self = shift;
- my $sect = shift;
- my $parm = shift;
-
- return undef if not defined $sect;
- return undef if not defined $parm;
-
-# tom@ytram.com +
- if ($self->{nocase}) {
- $sect = lc($sect);
- $parm = lc($parm);
- }
-# tom@ytram.com -
-
- @{$self->{parms}{$sect}} = grep !/^\Q$parm\E$/, @{$self->{parms}{$sect}};
- delete $self->{v}{$sect}{$parm};
- return 1
-}
-
-=head2 ReadConfig
-
-Forces the configuration file to be re-read. Returns undef if the
-file can not be opened, no filename was defined (with the C<-file>
-option) when the object was constructed, or an error occurred while
-reading.
-
-If an error occurs while parsing the INI file the @Config::IniFiles::errors
-array will contain messages that might help you figure out where the
-problem is in the file.
-
-=cut
-
-sub ReadConfig {
- my $self = shift;
-
- my($lineno, $sect);
- my($group, $groupmem);
- my($parm, $val);
- my @cmts;
- my %loaded_params = (); # A has to remember which params are loaded vs. imported
- @Config::IniFiles::errors = ( );
-
- # Initialize (and clear out) storage hashes
- # unless we imported them from another file [JW]
- if( @{$self->{imported}} ) {
- #
- # Run up the import tree to the top, then reload coming
- # back down, maintaining the imported file names and our
- # file name.
- # This is only needed on a re-load though
- unless( $self->{firstload} ) {
- my $cf = $self->{cf};
- $self->{cf} = pop @{$self->{imported}};
- $self->ReadConfig;
- push @{$self->{imported}}, $self->{cf};
- $self->{cf} = $cf;
- } # end unless
- } else {
- $self->{sects} = []; # Sections
- $self->{group} = {}; # Subsection lists
- $self->{v} = {}; # Parameter values
- $self->{sCMT} = {}; # Comments above section
- } # end if
-
- return undef if (
- (not exists $self->{cf}) or
- (not defined $self->{cf}) or
- ($self->{cf} eq '')
- );
-
- my $nocase = $self->{nocase};
-
- # If this is a reload and we want warnings then send one to the STDERR log
- unless( $self->{firstload} || !$self->{reloadwarn} ) {
- my ($ss, $mm, $hh, $DD, $MM, $YY) = (localtime(time))[0..5];
- printf STDERR
- "PID %d reloading config file %s at %d.%02d.%02d %02d:%02d:%02d\n",
- $$, $self->{cf}, $YY+1900, $MM+1, $DD, $hh, $mm, $ss;
- }
-
- # Turn off. Future loads are reloads
- $self->{firstload} = 0;
-
- # Get a filehandle, allowing almost any type of 'file' parameter
- my $fh = $self->_make_filehandle( $self->{cf} );
- if (!$fh) {
- carp "Failed to open $self->{cf}: $!";
- return undef;
- }
-
- # Get mod time of file so we can retain it (if not from STDIN)
- my @stats = stat $fh;
- $self->{file_mode} = sprintf("%04o", $stats[2]) if defined $stats[2];
-
- # Get the entire file into memory (let's hope it's small!)
- local $_;
- my @lines = split /\015\012?|\012|\025|\n/, join( '', <$fh>);
-
- # Only close if this is a filename, if it's
- # an open handle, then just roll back to the start
- if( !ref($fh) ) {
- close($fh);
- } else {
- # But we can't roll back STDIN so skip that one
- if( $fh != 0 ) {
- seek( $fh, 0, 0 );
- } # end if
- } # end if
-
- # If there's a UTF BOM (Byte-Order-Mark) in the first character of the first line
- # then remove it before processing (http://www.unicode.org/unicode/faq/utf_bom.html#22)
- ($lines[0] =~ s/^//);
-# Disabled the utf8 one for now (JW) because it doesn't work on all perl distros
-# e.g. 5.6.1 works with or w/o 'use utf8' 5.6.0 fails w/o it. 5.005_03
-# says "invalid hex value", etc. If anyone has a clue how to make this work
-# please let me know!
-# ($lines[0] =~ s/^//) || (eval('use utf8; $lines[0] =~ s/^\x{FEFF}//;'));
-# $@ = ''; $! = undef; # Clear any error messages
-
-
-
- # The first lines of the file must be blank, comments or start with [
- my $first = '';
- my $allCmt = $self->{allowed_comment_char};
- foreach ( @lines ) {
- next if /^\s*$/; # ignore blank lines
- next if /^\s*[$allCmt]/; # ignore comments
- $first = $_;
- last;
- }
- unless( $first =~ /^\s*\[/ ) {
- return undef;
- }
-
- # Store what our line ending char was for output
- ($self->{line_ends}) = $lines[0] =~ /([\015\012\025\n]+)/;
- while ( @lines ) {
- $_ = shift @lines;
-
- s/(\015\012?|\012|\025|\n)$//; # remove line ending char(s)
- $lineno++;
- if (/^\s*$/) { # ignore blank lines
- next;
- }
- elsif (/^\s*[$allCmt]/) { # collect comments
- push(@cmts, $_);
- next;
- }
- elsif (/^\s*\[\s*(\S|\S.*\S)\s*\]\s*$/) { # New Section
- $sect = $1;
- if ($self->{nocase}) {
- $sect = lc($sect);
- }
- $self->AddSection($sect);
- $self->SetSectionComment($sect, @cmts);
- @cmts = ();
- }
- elsif (($parm, $val) = /^\s*([^=]*?[^=\s])\s*=\s*(.*)$/) { # new parameter
- $parm = lc($parm) if $nocase;
- $self->{pCMT}{$sect}{$parm} = [@cmts];
- @cmts = ( );
- if ($val =~ /^<<(.*)$/) { # "here" value
- my $eotmark = $1;
- my $foundeot = 0;
- my $startline = $lineno;
- my @val = ( );
- while ( @lines ) {
- $_ = shift @lines;
- s/(\015\012?|\012|\025|\n)$//; # remove line ending char(s)
- $lineno++;
- if ($_ eq $eotmark) {
- $foundeot = 1;
- last;
- } else {
- push(@val, $_);
- }
- }
- if ($foundeot) {
- if (exists $self->{v}{$sect}{$parm} &&
- exists $loaded_params{$sect} &&
- grep( /^\Q$parm\E$/, @{$loaded_params{$sect}}) ) {
- if (ref($self->{v}{$sect}{$parm}) eq "ARRAY") {
- # Add to the array
- push @{$self->{v}{$sect}{$parm}}, @val;
- } else {
- # Create array
- my $old_value = $self->{v}{$sect}{$parm};
- my @new_value = ($old_value, @val);
- $self->{v}{$sect}{$parm} = \@new_value;
- }
- } else {
- $self->{v}{$sect}{$parm} = \@val;
- $loaded_params{$sect} = [] unless $loaded_params{$sect};
- push @{$loaded_params{$sect}}, $parm;
- }
- $self->{EOT}{$sect}{$parm} = $eotmark;
- } else {
- push(@Config::IniFiles::errors, sprintf('%d: %s', $startline,
- qq#no end marker ("$eotmark") found#));
- }
- } else { # no here value
-
- # process continuation lines, if any
- while($self->{allowcontinue} && $val =~ s/\\$//) {
- $_ = shift @lines;
- s/(\015\012?|\012|\025|\n)$//; # remove line ending char(s)
- $lineno++;
- $val .= $_;
- }
-
- # Now load value
- if (exists $self->{v}{$sect}{$parm} &&
- exists $loaded_params{$sect} &&
- grep( /^\Q$parm\E$/, @{$loaded_params{$sect}}) ) {
- if (ref($self->{v}{$sect}{$parm}) eq "ARRAY") {
- # Add to the array
- push @{$self->{v}{$sect}{$parm}}, $val;
- } else {
- # Create array
- my $old_value = $self->{v}{$sect}{$parm};
- my @new_value = ($old_value, $val);
- $self->{v}{$sect}{$parm} = \@new_value;
- }
- } else {
- $self->{v}{$sect}{$parm} = $val;
- $loaded_params{$sect} = [] unless $loaded_params{$sect};
- push @{$loaded_params{$sect}}, $parm;
- }
- }
- push(@{$self->{parms}{$sect}}, $parm) unless grep(/^\Q$parm\E$/, @{$self->{parms}{$sect}});
- }
- else {
- push(@Config::IniFiles::errors, sprintf("Line \%d in file " . $self->{cf} . " is mal-formed:\n\t\%s", $lineno, $_));
- }
- }
-
- #
- # Now convert all the parameter hashes into tied hashes.
- # This is in all uses, because it must be part of ReadConfig.
- #
- my %parms = %{$self->{startup_settings}};
- if( defined $parms{-default} ) {
- # If the default section doesn't exists, create it.
- unless( defined $self->{v}{$parms{-default}} ) {
- $self->{v}{$parms{-default}} = {};
- push(@{$self->{sects}}, $parms{-default}) unless (grep /^\Q$parms{-default}\E$/, @{$self->{sects}});
- $self->{parms}{$parms{-default}} = [];
- } # end unless
- $parms{-default} = $self->{v}{$parms{-default}};
- } # end if
- foreach( keys %{$self->{v}} ) {
- $parms{-_current_value} = $self->{v}{$_};
- $parms{-parms} = $self->{parms}{$_};
- $self->{v}{$_} = {};
- # Add a reference to our {parms} hash for each section
- tie %{$self->{v}{$_}}, 'Config::IniFiles::_section', %parms
- } # end foreach
-
- @Config::IniFiles::errors ? undef : 1;
-}
-
-
-=head2 Sections
-
-Returns an array containing section names in the configuration file.
-If the I<nocase> option was turned on when the config object was
-created, the section names will be returned in lowercase.
-
-=cut
-
-sub Sections {
- my $self = shift;
- return @{$self->{sects}} if ref $self->{sects} eq 'ARRAY';
- return ();
-}
-
-=head2 SectionExists ( $sect_name )
-
-Returns 1 if the specified section exists in the INI file, 0 otherwise (undefined if section_name is not defined).
-
-=cut
-
-sub SectionExists {
- my $self = shift;
- my $sect = shift;
-
- return undef if not defined $sect;
-
- if ($self->{nocase}) {
- $sect = lc($sect);
- }
-
- return undef() if not defined $sect;
- return 1 if (grep {/^\Q$sect\E$/} @{$self->{sects}});
- return 0;
-}
-
-=head2 AddSection ( $sect_name )
-
-Ensures that the named section exists in the INI file. If the section already
-exists, nothing is done. In this case, the "new" section will possibly contain
-data already.
-
-If you really need to have a new section with no parameters in it, check that
-the name that you're adding isn't in the list of sections already.
-
-=cut
-
-sub AddSection {
- my $self = shift;
- my $sect = shift;
-
- return undef if not defined $sect;
-
- if ($self->{nocase}) {
- $sect = lc($sect);
- }
-
- return if $self->SectionExists($sect);
- push @{$self->{sects}}, $sect;
- $self->SetGroupMember($sect);
-
- # Set up the parameter names and values lists
- $self->{parms}{$sect} = [] unless ref $self->{parms}{$sect} eq 'ARRAY';
- if (!defined($self->{v}{$sect})) {
- $self->{sCMT}{$sect} = [];
- $self->{pCMT}{$sect} = {}; # Comments above parameters
- $self->{parms}{$sect} = [];
- $self->{v}{$sect} = {};
- }
-}
-
-=head2 DeleteSection ( $sect_name )
-
-Completely removes the entire section from the configuration.
-
-=cut
-
-sub DeleteSection {
- my $self = shift;
- my $sect = shift;
-
- return undef if not defined $sect;
-
- if ($self->{nocase}) {
- $sect = lc($sect);
- }
-
- # This is done, the fast way, change if delval changes!!
- delete $self->{v}{$sect};
- delete $self->{sCMT}{$sect};
- delete $self->{pCMT}{$sect};
- delete $self->{EOT}{$sect};
- delete $self->{parms}{$sect};
-
- @{$self->{sects}} = grep !/^\Q$sect\E$/, @{$self->{sects}};
-
- if( $sect =~ /^(\S+)\s+\S+/ ) {
- my $group = $1;
- if( defined($self->{group}{$group}) ) {
- @{$self->{group}{$group}} = grep !/^\Q$sect\E$/, @{$self->{group}{$group}};
- } # end if
- } # end if
-
- return 1;
-} # end DeleteSection
-
-=head2 Parameters ($sect_name)
-
-Returns an array containing the parameters contained in the specified
-section.
-
-=cut
-
-sub Parameters {
- my $self = shift;
- my $sect = shift;
-
- return undef if not defined $sect;
-
- if ($self->{nocase}) {
- $sect = lc($sect);
- }
-
- return @{$self->{parms}{$sect}} if ref $self->{parms}{$sect} eq 'ARRAY';
- return ();
-}
-
-=head2 Groups
-
-Returns an array containing the names of available groups.
-
-Groups are specified in the config file as new sections of the form
-
- [GroupName MemberName]
-
-This is useful for building up lists. Note that parameters within a
-"member" section are referenced normally (i.e., the section name is
-still "Groupname Membername", including the space) - the concept of
-Groups is to aid people building more complex configuration files.
-
-=cut
-
-sub Groups {
- my $self = shift;
- return keys %{$self->{group}} if ref $self->{group} eq 'HASH';
- return ();
-}
-
-=head2 SetGroupMember ( $sect )
-
-Makes sure that the specified section is a member of the appropriate group.
-
-Only intended for use in newval.
-
-=cut
-
-sub SetGroupMember {
- my $self = shift;
- my $sect = shift;
-
- return undef if not defined $sect;
-
- return(1) unless $sect =~ /^(\S+)\s+\S+/;
-
- my $group = $1;
- if (not exists($self->{group}{$group})) {
- $self->{group}{$group} = [];
- }
- if (not grep {/^\Q$sect\E$/} @{$self->{group}{$group}}) {
- push @{$self->{group}{$group}}, $sect;
- }
-}
-
-=head2 RemoveGroupMember ( $sect )
-
-Makes sure that the specified section is no longer a member of the
-appropriate group. Only intended for use in DeleteSection.
-
-=cut
-
-sub RemoveGroupMember {
- my $self = shift;
- my $sect = shift;
-
- return undef if not defined $sect;
-
- return(1) unless $sect =~ /^(\S+)\s+\S+/;
-
- my $group = $1;
- return unless exists $self->{group}{$group};
- @{$self->{group}{$group}} = grep {!/^\Q$sect\E$/} @{$self->{group}{$group}};
-}
-
-=head2 GroupMembers ($group)
-
-Returns an array containing the members of specified $group. Each element
-of the array is a section name. For example, given the sections
-
- [Group Element 1]
- ...
-
- [Group Element 2]
- ...
-
-GroupMembers would return ("Group Element 1", "Group Element 2").
-
-=cut
-
-sub GroupMembers {
- my $self = shift;
- my $group = shift;
-
- return undef if not defined $group;
-
- if ($self->{nocase}) {
- $group = lc($group);
- }
-
- return @{$self->{group}{$group}} if ref $self->{group}{$group} eq 'ARRAY';
- return ();
-}
-
-=head2 SetWriteMode ($mode)
-
-Sets the mode (permissions) to use when writing the INI file.
-
-$mode must be a string representation of the octal mode.
-
-=cut
-
-sub SetWriteMode
-{
- my $self = shift;
- my $mode = shift;
- return undef if not defined ($mode);
- return undef if not ($mode =~ m/[0-7]{3,3}/);
- $self->{file_mode} = $mode;
- return $mode;
-}
-
-=head2 GetWriteMode ($mode)
-
-Gets the current mode (permissions) to use when writing the INI file.
-
-$mode is a string representation of the octal mode.
-
-=cut
-
-sub GetWriteMode
-{
- my $self = shift;
- return undef if not exists $self->{file_mode};
- return $self->{file_mode};
-}
-
-=head2 WriteConfig ($filename)
-
-Writes out a new copy of the configuration file. A temporary file
-(ending in '-new') is written out and then renamed to the specified
-filename. Also see B<BUGS> below.
-
-Returns true on success, C<undef> on failure.
-
-=cut
-
-sub WriteConfig {
- my $self = shift;
- my $file = shift;
-
- return undef unless defined $file;
-
- # If we are using a filename, then do mode checks and write to a
- # temporary file to avoid a race condition
- if( !ref($file) ) {
- if (-e $file) {
- if (not (-w $file))
- {
- #carp "File $file is not writable. Refusing to write config";
- return undef;
- }
- my $mode = (stat $file)[2];
- $self->{file_mode} = sprintf "%04o", ($mode & 0777);
- #carp "Using mode $self->{file_mode} for file $file";
- } elsif (defined($self->{file_mode}) and not (oct($self->{file_mode}) & 0222)) {
- #carp "Store mode $self->{file_mode} prohibits writing config";
- }
-
- my $new_file = $file . "-new";
- local(*F);
- open(F, "> $new_file") || do {
- carp "Unable to write temp config file $new_file: $!";
- return undef;
- };
- my $oldfh = select(F);
- $self->OutputConfig;
- close(F);
- select($oldfh);
- rename( $new_file, $file ) || do {
- carp "Unable to rename temp config file ($new_file) to $file: $!";
- return undef;
- };
- if (exists $self->{file_mode}) {
- chmod oct($self->{file_mode}), $file;
- }
-
- } # Otherwise, reset to the start of the file and write, unless we are using STDIN
- else {
- # Get a filehandle, allowing almost any type of 'file' parameter
- ## NB: If this were a filename, this would fail because _make_file
- ## opens a read-only handle, but we have already checked that case
- ## so re-using the logic is ok [JW/WADG]
- my $fh = $self->_make_filehandle( $file );
- if (!$fh) {
- carp "Could not find a filehandle for the input stream ($file): $!";
- return undef;
- }
-
-
- # Only roll back if it's not STDIN (if it is, Carp)
- if( $fh == 0 ) {
- carp "Cannot write configuration file to STDIN.";
- } else {
- seek( $fh, 0, 0 );
- my $oldfh = select($fh);
- $self->OutputConfig;
- seek( $fh, 0, 0 );
- select($oldfh);
- } # end if
-
- } # end if (filehandle/name)
-
- return 1;
-
-}
-
-=head2 RewriteConfig
-
-Same as WriteConfig, but specifies that the original configuration
-file should be rewritten.
-
-=cut
-
-sub RewriteConfig {
- my $self = shift;
-
- return undef if (
- (not exists $self->{cf}) or
- (not defined $self->{cf}) or
- ($self->{cf} eq '')
- );
-
- # Return whatever WriteConfig returns :)
- $self->WriteConfig($self->{cf});
-}
-
-=head2 GetFileName
-
-Returns the filename associated with this INI file.
-
-If no filename has been specified, returns undef.
-
-=cut
-
-sub GetFileName
-{
- my $self = shift;
- my $filename;
- if (exists $self->{cf}) {
- $filename = $self->{cf};
- } else {
- undef $filename;
- }
- return $filename;
-}
-
-=head2 SetFileName ($filename)
-
-If you created the Config::IniFiles object without initialising from
-a file, or if you just want to change the name of the file to use for
-ReadConfig/RewriteConfig from now on, use this method.
-
-Returns $filename if that was a valid name, undef otherwise.
-
-=cut
-
-sub SetFileName {
- my $self = shift;
- my $newfile = shift;
-
- return undef if not defined $newfile;
-
- if ($newfile ne "") {
- $self->{cf} = $newfile;
- return $self->{cf};
- }
- return undef;
-}
-
-# OutputConfig
-#
-# Writes OutputConfig to STDOUT. Use select() to redirect STDOUT to
-# the output target before calling this function
-
-sub OutputConfig {
- my $self = shift;
-
- my($sect, $parm, @cmts);
- my $ors = $self->{line_ends} || $\ || "\n"; # $\ is normally unset, but use input by default
- my $notfirst = 0;
- local $_;
- foreach $sect (@{$self->{sects}}) {
- next unless defined $self->{v}{$sect};
- print $ors if $notfirst;
- $notfirst = 1;
- if ((ref($self->{sCMT}{$sect}) eq 'ARRAY') &&
- (@cmts = @{$self->{sCMT}{$sect}})) {
- foreach (@cmts) {
- print "$_$ors";
- }
- }
- print "[$sect]$ors";
- next unless ref $self->{v}{$sect} eq 'HASH';
-
- foreach $parm (@{$self->{parms}{$sect}}) {
- if ((ref($self->{pCMT}{$sect}{$parm}) eq 'ARRAY') &&
- (@cmts = @{$self->{pCMT}{$sect}{$parm}})) {
- foreach (@cmts) {
- print "$_$ors";
- }
- }
-
- my $val = $self->{v}{$sect}{$parm};
- next if ! defined ($val); # No parameter exists !!
- if (ref($val) eq 'ARRAY') {
- my $eotmark = $self->{EOT}{$sect}{$parm} || 'EOT';
- print "$parm= <<$eotmark$ors";
- foreach (@{$val}) {
- print "$_$ors";
- }
- print "$eotmark$ors";
- } elsif( $val =~ /[$ors]/ ) {
- # The FETCH of a tied hash is never called in
- # an array context, so generate a EOT multiline
- # entry if the entry looks to be multiline
- my @val = split /[$ors]/, $val;
- if( @val > 1 ) {
- my $eotmark = $self->{EOT}{$sect}{$parm} || 'EOT';
- print "$parm= <<$eotmark$ors";
- print map "$_$ors", @val;
- print "$eotmark$ors";
- } else {
- print "$parm=$val[0]$ors";
- } # end if
- } else {
- print "$parm=$val$ors";
- }
- }
- }
- return 1;
-}
-
-=head2 SetSectionComment($section, @comment)
-
-Sets the comment for section $section to the lines contained in @comment.
-
-Each comment line will be prepended with the comment charcter (default
-is C<#>) if it doesn't already have a comment character (ie: if the
-line does not start with whitespace followed by an allowed comment
-character, default is C<#> and C<;>).
-
-To clear a section comment, use DeleteSectionComment ($section)
-
-=cut
-
-sub SetSectionComment
-{
- my $self = shift;
- my $sect = shift;
- my @comment = @_;
-
- return undef if not defined $sect;
- return undef unless @comment;
-
- if ($self->{nocase}) {
- $sect = lc($sect);
- }
-
- $self->{sCMT}{$sect} = [];
- # At this point it's possible to have a comment for a section that
- # doesn't exist. This comment will not get written to the INI file.
-
- push @{$self->{sCMT}{$sect}}, $self->_markup_comments(@comment);
- return scalar @comment;
-}
-
-
-
-# this helper makes sure that each line is preceded with the correct comment
-# character
-sub _markup_comments
-{
- my $self = shift;
- my @comment = @_;
-
- my $allCmt = $self->{allowed_comment_char};
- my $cmtChr = $self->{comment_char};
- foreach (@comment) {
- m/^\s*[$allCmt]/ or ($_ = "$cmtChr $_");
- }
- @comment;
-}
-
-
-
-=head2 GetSectionComment ($section)
-
-Returns a list of lines, being the comment attached to section $section. In
-scalar context, returns a string containing the lines of the comment separated
-by newlines.
-
-The lines are presented as-is, with whatever comment character was originally
-used on that line.
-
-=cut
-
-sub GetSectionComment
-{
- my $self = shift;
- my $sect = shift;
-
- return undef if not defined $sect;
-
- if ($self->{nocase}) {
- $sect = lc($sect);
- }
-
- if (exists $self->{sCMT}{$sect}) {
- return @{$self->{sCMT}{$sect}};
- } else {
- return undef;
- }
-}
-
-=head2 DeleteSectionComment ($section)
-
-Removes the comment for the specified section.
-
-=cut
-
-sub DeleteSectionComment
-{
- my $self = shift;
- my $sect = shift;
-
- return undef if not defined $sect;
-
- if ($self->{nocase}) {
- $sect = lc($sect);
- }
-
- delete $self->{sCMT}{$sect};
-}
-
-=head2 SetParameterComment ($section, $parameter, @comment)
-
-Sets the comment attached to a particular parameter.
-
-Any line of @comment that does not have a comment character will be
-prepended with one. See L</SetSectionComment($section, @comment)> above
-
-=cut
-
-sub SetParameterComment
-{
- my $self = shift;
- my $sect = shift;
- my $parm = shift;
- my @comment = @_;
-
- defined($sect) || return undef;
- defined($parm) || return undef;
- @comment || return undef;
-
- if ($self->{nocase}) {
- $sect = lc($sect);
- $parm = lc($parm);
- }
-
- if (not exists $self->{pCMT}{$sect}) {
- $self->{pCMT}{$sect} = {};
- }
-
- $self->{pCMT}{$sect}{$parm} = [];
- # Note that at this point, it's possible to have a comment for a parameter,
- # without that parameter actually existing in the INI file.
- push @{$self->{pCMT}{$sect}{$parm}}, $self->_markup_comments(@comment);
- return scalar @comment;
-}
-
-=head2 GetParameterComment ($section, $parameter)
-
-Gets the comment attached to a parameter.
-
-=cut
-
-sub GetParameterComment
-{
- my $self = shift;
- my $sect = shift;
- my $parm = shift;
-
- defined($sect) || return undef;
- defined($parm) || return undef;
-
- if ($self->{nocase}) {
- $sect = lc($sect);
- $parm = lc($parm);
- };
-
- exists($self->{pCMT}{$sect}) || return undef;
- exists($self->{pCMT}{$sect}{$parm}) || return undef;
-
- my @comment = @{$self->{pCMT}{$sect}{$parm}};
- return (wantarray)?@comment:join " ", @comment;
-}
-
-=head2 DeleteParameterComment ($section, $parmeter)
-
-Deletes the comment attached to a parameter.
-
-=cut
-
-sub DeleteParameterComment
-{
- my $self = shift;
- my $sect = shift;
- my $parm = shift;
-
- defined($sect) || return undef;
- defined($parm) || return undef;
-
- if ($self->{nocase}) {
- $sect = lc($sect);
- $parm = lc($parm);
- };
-
- # If the parameter doesn't exist, our goal has already been achieved
- exists($self->{pCMT}{$sect}) || return 1;
- exists($self->{pCMT}{$sect}{$parm}) || return 1;
-
- delete $self->{pCMT}{$sect}{$parm};
- return 1;
-}
-
-=head2 GetParameterEOT ($section, $parameter)
-
-Accessor method for the EOT text (in fact, style) of the specified parameter. If any text is used as an EOT mark, this will be returned. If the parameter was not recorded using HERE style multiple lines, GetParameterEOT returns undef.
-
-=cut
-
-sub GetParameterEOT
-{
- my $self = shift;
- my $sect = shift;
- my $parm = shift;
-
- defined($sect) || return undef;
- defined($parm) || return undef;
-
- if ($self->{nocase}) {
- $sect = lc($sect);
- $parm = lc($parm);
- };
-
- if (not exists $self->{EOT}{$sect}) {
- $self->{EOT}{$sect} = {};
- }
-
- if (not exists $self->{EOT}{$sect}{$parm}) {
- return undef;
- }
- return $self->{EOT}{$sect}{$parm};
-}
-
-=head2 SetParameterEOT ($section, $EOT)
-
-Accessor method for the EOT text for the specified parameter. Sets the HERE style marker text to the value $EOT. Once the EOT text is set, that parameter will be saved in HERE style.
-
-To un-set the EOT text, use DeleteParameterEOT ($section, $parameter).
-
-=cut
-
-sub SetParameterEOT
-{
- my $self = shift;
- my $sect = shift;
- my $parm = shift;
- my $EOT = shift;
-
- defined($sect) || return undef;
- defined($parm) || return undef;
- defined($EOT) || return undef;
-
- if ($self->{nocase}) {
- $sect = lc($sect);
- $parm = lc($parm);
- };
-
- if (not exists $self->{EOT}{$sect}) {
- $self->{EOT}{$sect} = {};
- }
-
- $self->{EOT}{$sect}{$parm} = $EOT;
-}
-
-=head2 DeleteParameterEOT ($section, $parmeter)
-
-Removes the EOT marker for the given section and parameter.
-When writing a configuration file, if no EOT marker is defined
-then "EOT" is used.
-
-=cut
-
-sub DeleteParameterEOT
-{
- my $self = shift;
- my $sect = shift;
- my $parm = shift;
-
- defined($sect) || return undef;
- defined($parm) || return undef;
-
- if ($self->{nocase}) {
- $sect = lc($sect);
- $parm = lc($parm);
- }
-
- delete $self->{EOT}{$sect}{$parm};
-}
-
-
-=head2 Delete
-
-Deletes the entire configuration file in memory.
-
-=cut
-
-sub Delete {
- my $self = shift;
-
- # Again, done the fast way, if the data structure changes, change this!
- $self->{sects} = [];
- $self->{parms} = {};
- $self->{group} = {};
- $self->{v} = {};
- $self->{sCMT} = {};
- $self->{pCMT} = {};
- $self->{EOT} = {};
-
- return 1;
-} # end Delete
-
-
-
-=head1 USAGE -- Tied Hash
-
-=head2 tie %ini, 'Config::IniFiles', (-file=>$filename, [-option=>value ...] )
-
-Using C<tie>, you can tie a hash to a B<Config::IniFiles> object. This creates a new
-object which you can access through your hash, so you use this instead of the
-B<new> method. This actually creates a hash of hashes to access the values in
-the INI file. The options you provide through C<tie> are the same as given for
-the B<new> method, above.
-
-Here's an example:
-
- use Config::IniFiles;
-
- my %ini
- tie %ini, 'Config::IniFiles', ( -file => "/path/configfile.ini" );
-
- print "We have $ini{Section}{Parameter}." if $ini{Section}{Parameter};
-
-Accessing and using the hash works just like accessing a regular hash and
-many of the object methods are made available through the hash interface.
-
-For those methods that do not coincide with the hash paradigm, you can use
-the Perl C<tied> function to get at the underlying object tied to the hash
-and call methods on that object. For example, to write the hash out to a new
-ini file, you would do something like this:
-
- tied( %ini )->WriteConfig( "/newpath/newconfig.ini" ) ||
- die "Could not write settings to new file.";
-
-=head2 $val = $ini{$section}{$parameter}
-
-Returns the value of $parameter in $section.
-
-Because of limitations in Perl's tie implementation,
-multiline values accessed through a hash will I<always> be returned
-as a single value with each line joined by the default line
-separator ($\). To break them apart you can simple do this:
-
- @lines = split( "$\", $ini{section}{multi_line_parameter} );
-
-=head2 $ini{$section}{$parameter} = $value;
-
-Sets the value of C<$parameter> in C<$section> to C<$value>.
-
-To set a multiline or multiv-alue parameter just assign an
-array reference to the hash entry, like this:
-
- $ini{$section}{$parameter} = [$value1, $value2, ...];
-
-If the parameter did not exist in the original file, it will
-be created. However, Perl does not seem to extend autovivification
-to tied hashes. That means that if you try to say
-
- $ini{new_section}{new_paramters} = $val;
-
-and the section 'new_section' does not exist, then Perl won't
-properly create it. In order to work around this you will need
-to create a hash reference in that section and then assign the
-parameter value. Something like this should do nicely:
-
- $ini{new_section} = {};
- $ini{new_section}{new_paramters} = $val;
-
-=head2 %hash = %{$ini{$section}}
-
-Using the tie interface, you can copy whole sections of the
-ini file into another hash. Note that this makes a copy of
-the entire section. The new hash in no longer tied to the
-ini file, In particular, this means -default and -nocase
-settings will not apply to C<%hash>.
-
-
-=head2 $ini{$section} = {}; %{$ini{$section}} = %parameters;
-
-Through the hash interface, you have the ability to replace
-the entire section with a new set of parameters. This call
-will fail, however, if the argument passed in NOT a hash
-reference. You must use both lines, as shown above so that
-Perl recognizes the section as a hash reference context
-before COPYing over the values from your C<%parameters> hash.
-
-=head2 delete $ini{$section}{$parameter}
-
-When tied to a hash, you can use the Perl C<delete> function
-to completely remove a parameter from a section.
-
-=head2 delete $ini{$section}
-
-The tied interface also allows you to delete an entire
-section from the ini file using the Perl C<delete> function.
-
-=head2 %ini = ();
-
-If you really want to delete B<all> the items in the ini file, this
-will do it. Of course, the changes won't be written to the actual
-file unless you call B<RewriteConfig> on the object tied to the hash.
-
-=head2 Parameter names
-
-=over 4
-
-=item my @keys = keys %{$ini{$section}}
-
-=item while (($k, $v) = each %{$ini{$section}}) {...}
-
-=item if( exists %{$ini{$section}}, $parameter ) {...}
-
-=back
-
-When tied to a hash, you use the Perl C<keys> and C<each>
-functions to iteratively list the parameters (C<keys>) or
-parameters and their values (C<each>) in a given section.
-
-You can also use the Perl C<exists> function to see if a
-parameter is defined in a given section.
-
-Note that none of these will return parameter names that
-are part if the default section (if set), although accessing
-an unknown parameter in the specified section will return a
-value from the default section if there is one.
-
-
-=head2 Section names
-
-=over 4
-
-=item foreach( keys %ini ) {...}
-
-=item while (($k, $v) = each %ini) {...}
-
-=item if( exists %ini, $section ) {...}
-
-=back
-
-When tied to a hash, you use the Perl C<keys> and C<each>
-functions to iteratively list the sections in the ini file.
-
-You can also use the Perl C<exists> function to see if a
-section is defined in the file.
-
-=cut
-
-############################################################
-#
-# TIEHASH Methods
-#
-# Description:
-# These methods allow you to tie a hash to the
-# Config::IniFiles object. Note that, when tied, the
-# user wants to look at thinks like $ini{sec}{parm}, but the
-# TIEHASH only provides one level of hash interace, so the
-# root object gets asked for a $ini{sec}, which this
-# implements. To further tie the {parm} hash, the internal
-# class Config::IniFiles::_section, is provided, below.
-#
-############################################################
-# ----------------------------------------------------------
-# Date Modification Author
-# ----------------------------------------------------------
-# 2000May09 Created method JW
-# ----------------------------------------------------------
-sub TIEHASH {
- my $class = shift;
- my %parms = @_;
-
- # Get a new object
- my $self = $class->new( %parms );
-
- return $self;
-} # end TIEHASH
-
-
-# ----------------------------------------------------------
-# Date Modification Author
-# ----------------------------------------------------------
-# 2000May09 Created method JW
-# ----------------------------------------------------------
-sub FETCH {
- my $self = shift;
- my( $key ) = @_;
-
- $key = lc($key) if( $self->{nocase} );
-
- return $self->{v}{$key};
-} # end FETCH
-
-# ----------------------------------------------------------
-# Date Modification Author
-# ----------------------------------------------------------
-# 2000Jun14 Fixed bug where wrong ref was saved JW
-# 2000Oct09 Fixed possible but in %parms with defaults JW
-# 2001Apr04 Fixed -nocase problem in storing JW
-# ----------------------------------------------------------
-sub STORE {
- my $self = shift;
- my( $key, $ref ) = @_;
-
- return undef unless ref($ref) eq 'HASH';
-
- $key = lc($key) if( $self->{nocase} );
-
- # Create a new hash and tie it to a _sections object with the ref's data
- $self->{v}{$key} = {};
-
- # Store the section name in the list
- push(@{$self->{sects}}, $key) unless (grep {/^\Q$key\E$/} @{$self->{sects}});
-
- my %parms = %{$self->{startup_settings}};
- $self->{parms}{$key} = [];
- $parms{-parms} = $self->{parms}{$key};
- $parms{-_current_value} = $ref;
- delete $parms{default};
- $parms{-default} = $self->{v}{$parms{-default}} if defined $parms{-default} && defined $self->{v}{$parms{-default}};
- tie %{$self->{v}{$key}}, 'Config::IniFiles::_section', %parms;
-} # end STORE
-
-
-# ----------------------------------------------------------
-# Date Modification Author
-# ----------------------------------------------------------
-# 2000May09 Created method JW
-# 2000Dec17 Now removes comments, groups and EOTs too JW
-# 2001Arp04 Fixed -nocase problem JW
-# ----------------------------------------------------------
-sub DELETE {
- my $self = shift;
- my( $key ) = @_;
-
- $key = lc($key) if( $self->{nocase} );
-
- delete $self->{sCMT}{$key};
- delete $self->{pCMT}{$key};
- delete $self->{EOT}{$key};
- delete $self->{parms}{$key};
-
- if( $key =~ /(\S+)\s+\S+/ ) {
- my $group = $1;
- if( defined($self->{group}{$group}) ) {
- @{$self->{group}{$group}} = grep !/\Q$key\E/, @{$self->{group}{$group}};
- } # end if
- } # end if
-
- @{$self->{sects}} = grep !/^\Q$key\E$/, @{$self->{sects}};
- return delete( $self->{v}{$key} );
-} # end DELETE
-
-
-# ----------------------------------------------------------
-# Date Modification Author
-# ----------------------------------------------------------
-# 2000May09 Created method JW
-# ----------------------------------------------------------
-sub CLEAR {
- my $self = shift;
-
- foreach (keys %{$self->{v}}) {
- $self->DELETE( $_ );
- } # end foreach
-
-} # end CLEAR
-
-# ----------------------------------------------------------
-# Date Modification Author
-# ----------------------------------------------------------
-# 2000May09 Created method JW
-# ----------------------------------------------------------
-sub FIRSTKEY {
- my $self = shift;
-
- my $a = keys %{$self->{v}};
- return each %{$self->{v}};
-} # end FIRSTKEY
-
-
-# ----------------------------------------------------------
-# Date Modification Author
-# ----------------------------------------------------------
-# 2000May09 Created method JW
-# ----------------------------------------------------------
-sub NEXTKEY {
- my $self = shift;
- my( $last ) = @_;
-
- return each %{$self->{v}};
-} # end NEXTKEY
-
-
-# ----------------------------------------------------------
-# Date Modification Author
-# ----------------------------------------------------------
-# 2000May09 Created method JW
-# 2001Apr04 Fixed -nocase bug and false true bug JW
-# ----------------------------------------------------------
-sub EXISTS {
- my $self = shift;
- my( $key ) = @_;
- $key = lc($key) if( $self->{nocase} );
-
- return exists $self->{v}{$key};
-} # end EXISTS
-
-
-# ----------------------------------------------------------
-# DESTROY is used by TIEHASH and the Perl garbage collector,
-# ----------------------------------------------------------
-# Date Modification Author
-# ----------------------------------------------------------
-# 2000May09 Created method JW
-# ----------------------------------------------------------
-sub DESTROY {
- # my $self = shift;
-} # end if
-
-
-# ----------------------------------------------------------
-# Sub: _make_filehandle
-#
-# Args: $thing
-# $thing An input source
-#
-# Description: Takes an input source of a filehandle,
-# filehandle glob, reference to a filehandle glob, IO::File
-# object or scalar filename and returns a file handle to
-# read from it with.
-# ----------------------------------------------------------
-# Date Modification Author
-# ----------------------------------------------------------
-# 06Dec2001 Added to support input from any source JW
-# ----------------------------------------------------------
-sub _make_filehandle {
- my $self = shift;
-
- #
- # This code is 'borrowed' from Lincoln D. Stein's GD.pm module
- # with modification for this module. Thanks Lincoln!
- #
-
- no strict 'refs';
- my $thing = shift;
- return $thing if defined(fileno $thing);
-# return $thing if defined($thing) && ref($thing) && defined(fileno $thing);
-
- # otherwise try qualifying it into caller's package
- my $fh = qualify_to_ref($thing,caller(1));
- return $fh if defined(fileno $fh);
-# return $fh if defined($thing) && ref($thing) && defined(fileno $fh);
-
- # otherwise treat it as a file to open
- $fh = gensym;
- open($fh,$thing) || return;
-
- return $fh;
-} # end _make_filehandle
-
-
-
-############################################################
-#
-# INTERNAL PACKAGE: Config::IniFiles::_section
-#
-# Description:
-# This package is used to provide a single-level TIEHASH
-# interface to the sections in the IniFile. When tied, the
-# user wants to look at thinks like $ini{sec}{parm}, but the
-# TIEHASH only provides one level of hash interace, so the
-# root object gets asked for a $ini{sec} and must return a
-# has reference that accurately covers the '{parm}' part.
-#
-# This package is only used when tied and is inter-woven
-# between the sections and their parameters when the TIEHASH
-# method is called by Perl. It's a very simple implementation
-# of a tied hash object with support for the Config::IniFiles
-# -nocase and -default options.
-#
-############################################################
-# Date Modification Author
-# ----------------------------------------------------------
-# 2000.May.09 Created to excapsulate TIEHASH interface JW
-############################################################
-package Config::IniFiles::_section;
-
-use strict;
-use Carp;
-use vars qw( $VERSION );
-
-$Config::IniFiles::_section::VERSION = 2.16;
-
-# ----------------------------------------------------------
-# Sub: Config::IniFiles::_section::TIEHASH
-#
-# Args: $class, %parms
-# $class The class that this is being tied to.
-# %parms Contains named parameters passed from the
-# constructor plus thes parameters
-# -_current_value holds the values to be inserted in the hash.
-# -default should be a hash ref.
-# -parms reference to the $self->{parms}{$sect} of the parent
-#
-# Description: Builds the object that gets tied to the
-# sections name. Inserts the existing hash, defined in the
-# named parameter '-_current_value' into the tied hash.
-# ----------------------------------------------------------
-# Date Modification Author
-# ----------------------------------------------------------
-# ----------------------------------------------------------
-sub TIEHASH {
- my $proto = shift;
- my $class = ref($proto) || $proto;
- my %parms = @_;
-
- # Make a new object
- my $self = {};
-
- # Put the passed hash into the holder
- $self->{v} = $parms{-_current_value};
-
- # Get all other the parms, removing leading '-', if any
- # Option checking is already handled in the Config::IniFiles contructor
- foreach( keys %parms ) {
- s/^-//g;
- $self->{$_} = $parms{-$_};
- } # end foreach
-
- return bless( $self, $class );
-} # end TIEHASH
-
-
-# ----------------------------------------------------------
-# Sub: Config::IniFiles::_section::FETCH
-#
-# Args: $key
-# $key The name of the key whose value to get
-#
-# Description: Returns the value associated with $key. If
-# the value is a hash, returns a hashref, just like normal
-# Perl hashes.
-# ----------------------------------------------------------
-# Date Modification Author
-# ----------------------------------------------------------
-# 2000Jun15 Fixed bugs in -default handler JW
-# 2000Dec07 Fixed another bug in -deault handler JW
-# 2002Jul04 Returning scalar values (Bug:447532) AS
-# ----------------------------------------------------------
-sub FETCH {
- my $self = shift;
- my $key = shift;
-
- $key = lc($key) if( $self->{nocase} );
-
- my $val = $self->{v}{$key};
-
- unless( defined $self->{v}{$key} ) {
- $val = $self->{default}{$key} if ref($self->{default}) eq 'HASH';
- } # end unless
-
- return $val;
-} # end FETCH
-
-
-# ----------------------------------------------------------
-# Sub: Config::IniFiles::_section::STORE
-#
-# Args: $key, @val
-# $key The key under which to store the value
-# @val The value to store, either an array or a scalar
-#
-# Description: Sets the value for the specified $key
-# ----------------------------------------------------------
-# Date Modification Author
-# ----------------------------------------------------------
-# 2001Apr04 Fixed -nocase bug JW
-# ----------------------------------------------------------
-sub STORE {
- my $self = shift;
- my $key = shift;
- my @val = @_;
-
- $key = lc($key) if( $self->{nocase} );
-
- # Add the parameter the the parent's list if it isn't there yet
- push(@{$self->{parms}}, $key) unless (grep /^\Q$key\E$/, @{$self->{parms}});
-
- if (@val > 1) {
- $self->{v}{$key} = @val;
- } else {
- $self->{v}{$key} = shift @val;
- }
-
- return $self->{v}{$key};
-} # end STORE
-
-
-# ----------------------------------------------------------
-# Sub: Config::IniFiles::_section::DELETE
-#
-# Args: $key
-# $key The key to remove from the hash
-#
-# Description: Removes the specified key from the hash
-# ----------------------------------------------------------
-# Date Modification Author
-# ----------------------------------------------------------
-# 2001Apr04 Fixed -nocase bug JW
-# ----------------------------------------------------------
-sub DELETE {
- my $self = shift;
- my $key = shift;
-
- $key = lc($key) if( $self->{nocase} );
-# @{$self->{parms}{$sect}} = grep !/^$parm$/, @{$self->{parms}{$sect}};
- return delete $self->{v}{$key};
-} # end DELETE
-
-# ----------------------------------------------------------
-# Sub: Config::IniFiles::_section::CLEAR
-#
-# Args: (None)
-#
-# Description: Empties the entire hash
-# ----------------------------------------------------------
-# Date Modification Author
-# ----------------------------------------------------------
-# ----------------------------------------------------------
-sub CLEAR {
- my $self = shift;
-
- foreach ( keys %{$self->{v}}) {
- $self->DELETE($_);
- } # end foreach
-
- return $self;
-} # end CLEAR
-
-# ----------------------------------------------------------
-# Sub: Config::IniFiles::_section::EXISTS
-#
-# Args: $key
-# $key The key to look for
-#
-# Description: Returns whether the key exists
-# ----------------------------------------------------------
-# Date Modification Author
-# ----------------------------------------------------------
-# 2001Apr04 Fixed -nocase bug JW
-# ----------------------------------------------------------
-sub EXISTS {
- my $self = shift;
- my $key = shift;
- $key = lc($key) if( $self->{nocase} );
- return exists $self->{v}{$key};
-} # end EXISTS
-
-# ----------------------------------------------------------
-# Sub: Config::IniFiles::_section::FIRSTKEY
-#
-# Args: (None)
-#
-# Description: Returns the first key in the hash
-# ----------------------------------------------------------
-# Date Modification Author
-# ----------------------------------------------------------
-# ----------------------------------------------------------
-sub FIRSTKEY {
- my $self = shift;
-
- # Reset the each() iterator
- my $a = keys %{$self->{v}};
-
- return each %{$self->{v}};
-} # end FIRST KEY
-
-# ----------------------------------------------------------
-# Sub: Config::IniFiles::_section::NEXTKEY
-#
-# Args: $last
-# $last The last key accessed by the interator
-#
-# Description: Returns the next key in line
-# ----------------------------------------------------------
-# Date Modification Author
-# ----------------------------------------------------------
-# ----------------------------------------------------------
-sub NEXTKEY {
- my $self = shift;
- my $last = shift;
-
- return each %{$self->{v}};
-} # end NEXTKEY
-
-
-# ----------------------------------------------------------
-# Sub: Config::IniFiles::_section::DESTROY
-#
-# Args: (None)
-#
-# Description: Called on cleanup
-# ----------------------------------------------------------
-# Date Modification Author
-# ----------------------------------------------------------
-# ----------------------------------------------------------
-sub DESTROY {
- # my $self = shift
-} # end DESTROY
-
-# Eliminate annoying warnings
-if ($^W) {
- $Config::IniFiles::VERSION = $Config::IniFiles::VERSION;
-}
-
-1;
-
-=head1 DIAGNOSTICS
-
-=head2 @Config::IniFiles::errors
-
-Contains a list of errors encountered while parsing the configuration
-file. If the I<new> method returns B<undef>, check the value of this
-to find out what's wrong. This value is reset each time a config file
-is read.
-
-=head1 BUGS
-
-=over 3
-
-=item *
-
-The output from [Re]WriteConfig/OutputConfig might not be as pretty as
-it can be. Comments are tied to whatever was immediately below them.
-And case is not preserved for Section and Parameter names if the -nocase
-option was used.
-
-=item *
-
-No locking is done by [Re]WriteConfig. When writing servers, take
-care that only the parent ever calls this, and consider making your
-own backup.
-
-=back
-
-=head1 Data Structure
-
-Note that this is only a reference for the package maintainers - one of the
-upcoming revisions to this package will include a total clean up of the
-data structure.
-
- $iniconf->{cf} = "config_file_name"
- ->{startup_settings} = \%orginal_object_parameters
- ->{firstload} = 0
- ->{nocase} = 0
- ->{reloadwarn} = 0
- ->{sects} = \@sections
- ->{sCMT}{$sect} = \@comment_lines
- ->{group}{$group} = \@group_members
- ->{parms}{$sect} = \@section_parms
- ->{EOT}{$sect}{$parm} = "end of text string"
- ->{pCMT}{$sect}{$parm} = \@comment_lines
- ->{v}{$sect}{$parm} = $value OR \@values
-
-=head1 AUTHOR and ACKNOWLEDGEMENTS
-
-The original code was written by Scott Hutton.
-Then handled for a time by Rich Bowen (thanks!),
-It is now managed by Jeremy Wadsack,
-with many contributions from various other people.
-
-In particular, special thanks go to (in roughly chronological order):
-
-Bernie Cosell, Alan Young, Alex Satrapa, Mike Blazer, Wilbert van de Pieterman,
-Steve Campbell, Robert Konigsberg, Scott Dellinger, R. Bernstein,
-Daniel Winkelmann, Pires Claudio, Adrian Phillips,
-Marek Rouchal, Luc St Louis, Adam Fischler, Kay Röpke, Matt Wilson,
-Raviraj Murdeshwar and Slaven Rezic, Florian Pfaff
-
-Geez, that's a lot of people. And apologies to the folks who were missed.
-
-If you want someone to bug about this, that would be:
-
- Jeremy Wadsack <dgsupport at wadsack-allen dot com>
-
-If you want more information, or want to participate, go to:
-
- http://sourceforge.net/projects/config-inifiles/
-
-Please send bug reports to config-inifiles-bugs@lists.sourceforge.net
-
-Development discussion occurs on the mailing list
-config-inifiles-dev@lists.sourceforge.net, which you can subscribe
-to by going to the project web site (link above).
-
-This program is free software; you can redistribute it and/or
-modify it under the same terms as Perl itself.
-
-=head1 Change log
-
- $Log$
- Revision 1.1 2004/08/30 15:57:41 jvanzyl
- Initial revision
-
- Revision 2.38 2003/05/14 01:30:32 wadg
- - fixed RewriteConfig and ReadConfig to work with open file handles
- - added a test to ensure that blank files throw no warnings
- - added a test for error messages from malformed lines
-
- Revision 2.37 2003/01/31 23:00:35 wadg
- Updated t/07misc test 4 to remove warning
-
- Revision 2.36 2002/12/18 01:43:11 wadg
- - Improved error message when an invalid line is encountered in INI file
- - Fixed bug 649220; importing a non-file-based object into a file one
- no longer destroys the original object
-
- Revision 2.33 2002/11/12 14:48:16 grail
- Addresses feature request - [ 403496 ] A simple change will allow support on more platforms
-
- Revision 2.32 2002/11/12 14:15:44 grail
- Addresses bug - [225971] Respect Read-Only Permissions of File System
-
- Revision 2.31 2002/10/29 01:45:47 grail
- [ 540867 ] Add GetFileName method
-
- Revision 2.30 2002/10/15 18:51:07 wadg
- Patched to stopwarnings about utf8 usage.
-
- Revision 2.29 2002/08/15 21:33:58 wadg
- - Support for UTF Byte-Order-Mark (Raviraj Murdeshwar)
- - Made tests portable to Mac (p. kent)
- - Made file parsing portable for s390/EBCDIC, etc. (Adam Fischler)
- - Fixed import bug with Perl 5.8.0 (Marek Rouchal)
- - Fixed precedence bug in WriteConfig (Luc St Louis)
- - Fixed broken group detection in SetGroupMember and RemoveGroupMember (Kay Röpke)
- - Added line continuation character (/) support (Marek Rouchal)
- - Added configurable comment character support (Marek Rouchal)
-
- Revision 2.28 2002/07/04 03:56:05 grail
- Changes for resolving bug 447532 - _section::FETCH should return array ref for multiline values.
-
- Revision 2.27 2001/12/20 16:03:49 wadg
- - Fixed bug introduced in new valid file check where ';' comments in first lines were not considered valid
- - Rearranged some tests to put them in the proper files (case and -default)
- - Added more comment test to cover more cases
- - Fixed first two comments tests which weren't doing anything
-
- Revision 2.26 2001/12/19 22:20:50 wadg
- #481513 Recognize badly formatted files
-
- Revision 2.25 2001/12/12 20:44:48 wadg
- Update to bring CVS version in synch
-
- Revision 2.24 2001/12/07 10:03:06 wadg
- 222444 Ability to load from arbitrary source
-
- Revision 2.23 2001/12/07 09:35:06 wadg
- Forgot to include updates t/test.ini
-
- Revision 2.22 2001/12/06 16:52:39 wadg
- Fixed bugs 482353,233372. Updated doc for new mgr.
-
- Revision 2.21 2001/08/14 01:49:06 wadg
- Bug fix: multiple blank lines counted as one
- Patched README change log to include recent updates
-
- Revision 2.20 2001/06/07 02:49:52 grail
- - Added checks for method parameters being defined
- - fixed some regexes to make them stricter
- - Fixed greps to make them consistent through the code (also a vain
- attempt to help my editors do syntax colouring properly)
- - Added AddSection method, replaced chunk of ReadConfig with AddSection
- - Added case handling stuff to more methods
- - Added RemoveGroupMember
- - Made variable names more consistent through OO methods
- - Restored Unix EOLs
-
- Revision 2.19 2001/04/04 23:33:40 wadg
- Fixed case sensitivity bug
-
- Revision 2.18 2001/03/30 04:41:08 rbowen
- Small documentation change in IniFiles.pm - pod2* was choking on misplaces
- =item tags. And I regenerated the README
- The main reason for this release is that the MANIFEST in the 2.17 version was
- missing one of the new test suite files, and that is included in this
- re-release.
-
- Revision 2.17 2001/03/21 21:05:12 wadg
- Documentation edits
-
- Revision 2.16 2001/03/21 19:59:09 wadg
- 410327 -default not in original; 233255 substring parameters
-
- Revision 2.15 2001/01/30 11:46:48 rbowen
- Very minor documentation bug fixed.
-
- Revision 2.14 2001/01/08 18:02:32 wadg
- [Bug #127325] Fixed proken import; changelog; moved
-
- Revision 2.13 2000/12/18 07:14:41 wadg
- [Bugs# 122441,122437] Alien EOLs and OO delete method
-
- Revision 2.12 2000/12/18 04:59:37 wadg
- [Bug #125524] Writing multiline of 2 with tied hash
-
- Revision 2.11 2000/12/16 12:53:13 grail
- [BUG #122455] Problem with File Permissions
-
- Revision 2.10 2000/12/13 17:40:18 rbowen
- Updated version number so that CPAN will stop being angry with us.
-
- Revision 1.18 2000/12/08 00:45:35 grail
- Change as requested by Jeremy Wadsack, for Bug 123146
-
- Revision 1.17 2000/12/07 15:32:36 grail
- Further patch to duplicate sections bug, and replacement of repeated values handling code.
-
- Revision 1.14 2000/11/29 11:26:03 grail
- Updates for task 22401 (no more reloadsig) and 22402 (Group and GroupMember doco)
-
- Revision 1.13 2000/11/28 12:41:42 grail
- Added test for being able to add sections with wierd names like section|version2
-
- Revision 1.11 2000/11/24 21:20:11 rbowen
- Resolved SourceForge bug #122445 - a parameter should be split from its value on the first = sign encountered, not on the last one. Added test suite to test this, and put test case in test.ini
-
- Revision 1.10 2000/11/24 20:40:58 rbowen
- Updated MANIFEST to have file list of new files in t/
- Updated IniFiles.pm to have mention of sourceforge addresses, rather than rcbowen.com addresses
- Regenerated README from IniFiles.pm
-
- Revision 1.9 2000/11/23 05:08:08 grail
- Fixed documentation for bug 122443 - Check that INI files can be created from scratch.
-
- Revision 1.1.1.1 2000/11/10 03:04:01 rbowen
- Initial checkin of the Config::IniFiles source to SourceForge
-
- Revision 1.8 2000/10/17 01:52:55 rbowen
- Patch from Jeremy. Fixed "defined" warnings.
-
- Revision 1.7 2000/09/21 11:19:17 rbowen
- Mostly documentation changes. I moved the change log into the POD rather
- than having it in a separate Changes file. This allows people to see the
- changes in the Readme before they download the module. Now I just
- need to make sure I remember to regenerate the Readme every time I do
- a commit.
-
-
- 1.6 September 19, 2000 by JW, AS
- * Applied several patches submitted to me by Jeremy and Alex.
- * Changed version number to the CVS version number, so that I won't
- have to think about changing it ever again. Big version change
- should not be taken as a huge leap forward.
-
- 0.12 September 13, 2000 by JW/WADG
- * Added documentation to clarify autovivification issues when
- creating new sections
- * Fixed version number (Oops!)
-
- 0.11 September 13, 2000 by JW/WADG
- * Applied patch to Group and GroupMembers functions to return empty
- list when no groups are present (submitted by John Bass, Sep 13)
-
- 0.10 September 13, 2000 by JW/WADG
- * Fixed reference in POD to ReWriteFile. changes to RewriteConfig
- * Applied patch for failed open bug submitted by Mordechai T. Abzug Aug 18
- * Doc'd behavior of failed open
- * Removed planned SIG testing from test.pl as SIGs have been removed
- * Applied patch from Thibault Deflers to fix bug in parameter list
- when a parameter value is undef
-
- 0.09
- Hey! Where's the change log for 0.09?
-
- 0.08
- 2000-07-30 Adrian Phillips <adrianp@powertech.no>
-
- * test.pl: Fixed some tests which use $\, and made those that try
- to check a non existant val check against ! defined.
-
- * IniFiles.pm: hopefully fixed use of $\ when this is unset
- (problems found when running tests with -w). Similar problem with
- $/ which can be undefined and trying to return a val which does
- not exist. Modified val docs section to indicate a undef return
- when this occurs.
-
- 0.07
- Looks like we missed a change log for 0.07. Bummer.
-
- 0.06 Sun Jun 25, 2000 by Daniel Winkelmann
- * Patch for uninitialized value bug in newval and setval
-
- 0.05 Sun Jun 18, 2000 by RBOW
- * Added something to shut up -w on VERSIONS
- * Removed unused variables
-
- 0.04 Thu Jun 15 - Fri Jun 16, 2000 by JW/WADG
- * Added support for -import option on ->new
- * Added support for tying a hash
- * Edited POD for grammer, clarity and updates
- * Updated test.pl file
- * Fixed bug in multiline/single line output
- * Fixed bug in default handling with tie interface
- * Added bugs to test.pl for regression
- * Fixed bug in {group} vs. {groups} property (first is valid)
- * Fixed return value for empty {sects} or {parms}{$sect} in
- Sections and Parameters methods
-
- 0.03 Thu Jun 15, 2000 by RBOW
- * Modifications to permit 'use strict', and to get 'make test' working
- again.
-
- 0.02 Tue Jun 13, 2000 by RBOW
- * Fixed bug reported by Bernie Cosell - Sections, Parameters,
- and GroupMembers return undef if there are no sections,
- parameters, or group members. These functions now return
- () if the particular value is undefined.
- * Added some contributed documentation, from Alex Satrapa, explaining
- how the internal data structure works.
- * Set up a project on SourceForge. (Not a change, but worth
- noting).
- * Added Groups method to return a list of section groups.
-
- 0.01 Mon Jun 12, 2000 by RBOW
- Some general code cleanup, in preparation for changes to
- come. Put up Majordomo mailing list and sent invitation to
- various people to join it.
-
-=cut
-#[JW for editor]:mode=perl:tabSize=8:indentSize=2:noTabs=true:indentOnEnter=true:
-
+++ /dev/null
-[info]
-id = apache
-name = Apache Software Foundation
-#contact = repository@apache.org
-contact = carlos@apache.org
-
-[host]
-mode=rsync_ssh
-address=people.apache.org
-directory=/www/people.apache.org/repo/m1-ibiblio-rsync-repository
-rsyncUser=jvanzyl
+++ /dev/null
-[info]
-id = codehaus
-name = Codehaus
-contact = carlos@apache.org
-
-[host]
-mode=rsync_ssh
-address=repository.codehaus.org
-directory=/dist
-rsyncUser=mavensync
-identity=/home/maven/.ssh/new-id_dsa
+++ /dev/null
-[info]
-id = maven-plugins-sf
-name = Maven Plugins @ SourceForge
-#contact = maven-plugins-developer@lists.sourceforge.net
-contact = carlos@apache.org
-
-[host]
-mode=rsync_ssh
-address=shell.sourceforge.net
-directory=/home/groups/m/ma/maven-plugins/htdocs/repository
-rsyncUser=brettporter
+++ /dev/null
-[info]
-id = mortbay
-name = Mortbay Consulting
-contact = gregw@mortbay.com
-
-[host]
-mode=rsync_ssh
-address=jetty.mortbay.org
-directory=maven
+++ /dev/null
-[info]
-id = objectweb
-name = ObjectWeb
-contact = xavier.moghrabi@objectweb.org
-
-[host]
-mode=rsync_ssh
-address=forge.objectweb.org
-directory=../../groups/maven/htdocs/maven1
-rsyncUser=maven
+++ /dev/null
-[info]
-id = opensymphony
-name = Open Symphony
-#contact = Patrick Lightbody <plightbo@gmail.com>
-# I'm monitoring this for a bit until it is just errors
-contact = brett@apache.org
-
-[host]
-mode=rsync_ssh
-address=maven1.opensymphony.com
-directory=/opt/repository/maven1
-rsyncUser=maven
+++ /dev/null
-[info]
-id = ibiblio
-name = Ibiblio staging area
-contact = jason@maven.org
-batchDisabled = true
-
-[host]
-mode=rsync_ssh
-address=beaver.codehaus.org
-directory=~/ibiblio-sync/repository
-rsyncUser=maven
+++ /dev/null
-[info]
-id = codehaus
-name = Codehaus
-contact = jason@maven.org
-batchDisabled = true
-
-[host]
-mode=rsync_ssh
-address=beaver.codehaus.org
-#directory=~/testRepo
-directory=/dist
-rsyncUser=rsync
-repoDirectory=testRepo
+++ /dev/null
-.htaccess
-**/.*
-**/distributions
-**SNAPSHOT*
-**snapshot*
-**-dev.*
-**-DEV.*
-**/dist
-**-200*
-README.txt
-**/CVS
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use IniFiles;
-use Net::SMTP;
-
-my $configuration = new Config::IniFiles( -file => "syncopate.conf" );
-
-my $globalRepoDirectory = $configuration->val( "syncopate", "repoDirectory" );
-
-my $repoDirectory = $configuration->val( "syncopate", "repoDirectory" );
-
-my $standardOptions = $configuration->val( "syncopate", "options" );
-
-my $rsyncUser = $configuration->val( "syncopate", "rsyncUser" );
-
-my $reportDirectory = $configuration->val( "syncopate", "reportDirectory" );
-
-my $smtpServer = $configuration->val( "syncopate", "smtpServer" );
-
-my $reportUrl = $configuration->val( "syncopate", "reportUrl" );
-
-if ( defined( $ARGV[0] ) )
-{
- my $sourceConfiguration = new Config::IniFiles( -file => "conf/m1/$ARGV[0]" . ".conf" );
-
- syncSource( $sourceConfiguration );
-}
-else
-{
- syncSources();
-}
-
-# -----------------------------------------------------------------------------
-#
-#
-# -----------------------------------------------------------------------------
-sub syncSources
-{
- my @sources = glob( "conf/m1/*.conf" );
-
- for my $source (@sources)
- {
- my $sourceConfiguration = new Config::IniFiles( -file => $source );
-
- my $batchDisabled = $sourceConfiguration->val( "info", "batchDisabled" );
-
- if ( not defined( $batchDisabled ) )
- {
- syncSource( $sourceConfiguration );
- }
- }
-}
-
-# -----------------------------------------------------------------------------
-#
-#
-# -----------------------------------------------------------------------------
-sub syncSource()
-{
- my $sourceConfiguration = shift;
-
- print "Syncing " . $sourceConfiguration->val( "info", "name" ) . "\n";
-
- my $address = $sourceConfiguration->val( "host", "address" );
-
- my $directory = $sourceConfiguration->val( "host", "directory" );
-
- my $options = $sourceConfiguration->val( "host", "options" );
-
- my $rsyncUser = $configuration->val( "syncopate", "rsyncUser" );
-
- my $identity = $configuration->val( "syncopate", "identity" );
-
- if ( $sourceConfiguration->val( "host", "rsyncUser" ) )
- {
- $rsyncUser = $sourceConfiguration->val( "host", "rsyncUser" );
- }
-
- if ( $sourceConfiguration->val( "host", "identity" ) )
- {
- $identity = "-i " . $sourceConfiguration->val( "host", "identity" );
- }
-
- if ( $sourceConfiguration->val( "host", "repoDirectory" ) )
- {
- $repoDirectory = $sourceConfiguration->val( "host", "repoDirectory" );
- }
-
- my $cmd = "rsync $standardOptions $options --rsh=\"ssh -oBatchMode=yes $identity -T -l $rsyncUser\" $address:$directory/ $repoDirectory";
-
- runRsync( $cmd, $sourceConfiguration );
-
- $repoDirectory = $globalRepoDirectory;
-}
-
-# -----------------------------------------------------------------------------
-#
-#
-# -----------------------------------------------------------------------------
-sub runRsync()
-{
- my $cmd = shift;
-
- my $sourceConfiguration = shift;
-
- # -------------------------------------------------------------------------
- # Now we want to run rsync and generate a small xdoc which describes the
- # syncronization that just occurred.
- # -------------------------------------------------------------------------
-
- my $id = $sourceConfiguration->val( "info", "id" );
-
- my $name = $sourceConfiguration->val( "info", "name" );
-
- my $reportName = "Synchronization report for " . $name;
-
- my @date = date();
-
- my $date = $date[0] . "-" . $date[1] . "-" . $date[2];
-
- my $dir = $date;
-
- $dir =~ s/-/\//g;
-
- $dir = $id . "/" . $dir;
-
- my $rdir = $reportDirectory . "/" . $dir;
-
- system( "mkdir -p $rdir > /dev/null 2>&1" );
-
- my $base = $id . "-" . $date[0] . $date[1] . $date[2] . "-" . $date[3] . $date[4] . $date[5];
-
- my $xmlReport = $rdir . "/" . $base . ".xml";
-
- my $rawReport = $rdir . "/" . $base . ".txt";
-
- open( REPORT, "> $xmlReport" );
-
- open( RAW_REPORT, "> $rawReport" );
-
- print REPORT "<document>" . "\n";
-
- print REPORT "<properties>" . "\n";
-
- print REPORT "<author>meeper</author>" . "\n";
-
- print REPORT "<title>$reportName</title>" . "\n";
-
- print REPORT "</properties>" . "\n";
-
- print REPORT "<body>" . "\n";
-
- print REPORT "<section name=\"$reportName\">" . "\n";
-
- print REPORT "<table>" . "\n";
-
- print REPORT "<tr>" . "\n";
-
- print REPORT "<th>Artifact</th>" . "\n";
-
- print REPORT "<th>Size (in bytes)</th>" . "\n";
-
- print REPORT "<th>Date</th>" . "\n";
-
- print REPORT "</tr>" . "\n";
-
- open( SYNC, "$cmd 2>&1 |" );
-
- my $rawReportText;
-
- my $sendMail = 0;
-
- while( <SYNC> )
- {
- # --------------------------------------------------------------------
- # We have a line that tells us about an artifact that was synced.
- # --------------------------------------------------------------------
- if ( /^artifact/ )
- {
- my @details = split;
-
- # TODO: fix hardcoding
- if ( ! ( $details[1] eq "home/maven/repository-staging/to-ibiblio/maven/." ) )
- {
- print REPORT "<tr>" . "\n";
-
- print REPORT "<td>" . $details[1] . "</td>" . "\n";
-
- print REPORT "<td>" . $details[2] . "</td>" . "\n";
-
- print REPORT "<td>" . $details[3] . " " . $details[4] . "</td>" . "\n";
-
- print REPORT "</tr>" . "\n";
-
- $sendMail = 1;
- }
- }
- else
- {
- $rawReportText = $rawReportText . $_;
-
- print RAW_REPORT;
- }
- }
-
- close SYNC;
- my $exitCode = $?;
-
- if ( $exitCode != 0 )
- {
- $sendMail = 1;
- }
-
- print REPORT "</table>" . "\n";
-
- print REPORT "<p><a href=\"$rawReport\">Raw report</a></p>";
-
- print REPORT "</section>" . "\n";
-
- print REPORT "</body>" . "\n";
-
- print REPORT "</document>" . "\n";
-
- close( REPORT );
-
- close( RAW_REPORT );
-
- if ( $rawReportText and $sendMail != 0 )
- {
-
- $rawReportText = $rawReportText . "\n\nYou can view the syncronization reports for today here: \n\n";
-
- $rawReportText = $rawReportText . $reportUrl . "/" . $dir;
-
- notify( $sourceConfiguration, $reportName, $rawReportText );
-
- }
-
-}
-
-sub date
-{
- my $second;
- my $minute;
- my $hour;
- my $day;
- my $month;
- my $year;
-
- ($second, $minute,$hour,$day, $month, $year) = (localtime)[0..5];
-
- $year = $year + 1900; #got 2004
-
- $month = $month + 1;
-
- $second = $second + 1;
-
- $minute = $minute + 1;
-
- $hour = $hour + 1;
-
- if ( $second <= 9 )
- {
- $second = "0".$second;
- }
- if ( $minute <= 9 )
- {
- $minute = "0".$minute;
- }
- if ( $hour <= 9 )
- {
- $hour = "0".$hour;
- }
- if ( $day <= 9 )
- {
- $day = "0".$day;
- }
- if ( $month <= 9)
- {
- $month = "0".$month;
- }
-
- return ($year,$month,$day,$hour,$minute,$second);
-}
-
-sub notify()
-{
- my $sourceConfiguration = shift;
-
- my $subject = shift;
-
- my $text = shift;
-
- my $smtp = new Net::SMTP( $smtpServer );
-
- $smtp->mail( "meeper\@maven.org" );
-
- $smtp->to( $sourceConfiguration->val( "info", "contact" ) );
-
- $smtp->data();
-
- $smtp->datasend( "Subject: $subject\n" );
-
- $smtp->datasend( "From: meeper\@maven.org\n" );
-
- $smtp->datasend( "\n" );
-
- $smtp->datasend( $text );
-
- $smtp->dataend();
-
- $smtp->quit();
-}
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use IniFiles;
-use Net::SMTP;
-
-my $configuration = new Config::IniFiles( -file => "syncopate.conf" );
-
-my $globalRepoDirectory = $configuration->val( "syncopate", "repoDirectory" );
-
-my $repoDirectory = $configuration->val( "syncopate", "repoDirectory" );
-
-my $standardOptions = $configuration->val( "syncopate", "options" );
-
-my $rsyncUser = $configuration->val( "syncopate", "rsyncUser" );
-
-my $reportDirectory = $configuration->val( "syncopate", "reportDirectory" );
-
-my $smtpServer = $configuration->val( "syncopate", "smtpServer" );
-
-my $reportUrl = $configuration->val( "syncopate", "reportUrl" );
-
-if ( defined( $ARGV[0] ) )
-{
- my $sourceConfiguration = new Config::IniFiles( -file => "conf/m1/$ARGV[0]" . ".conf" );
-
- syncSource( $sourceConfiguration );
-}
-else
-{
- syncSources();
-}
-
-# -----------------------------------------------------------------------------
-#
-#
-# -----------------------------------------------------------------------------
-sub syncSources
-{
- my @sources = glob( "conf/m1/*.conf" );
-
- for my $source (@sources)
- {
- my $sourceConfiguration = new Config::IniFiles( -file => $source );
-
- my $batchDisabled = $sourceConfiguration->val( "info", "batchDisabled" );
-
- if ( not defined( $batchDisabled ) )
- {
- syncSource( $sourceConfiguration );
- }
- }
-}
-
-# -----------------------------------------------------------------------------
-#
-#
-# -----------------------------------------------------------------------------
-sub syncSource()
-{
- my $sourceConfiguration = shift;
-
- print "Syncing " . $sourceConfiguration->val( "info", "name" ) . "\n";
-
- # Look at the mode we are going to use to sync: svn over https, rsync over ssh, or plain rsync (we should move away from this)
-
- my $syncMode = $sourceConfiguration->val( "host", "mode" );
-
- if ( $syncMode == "rsync_ssh" )
- {
- runRsyncOverSsh( $sourceConfiguration );
- }
- else if ( $syncMode == "rsync" )
- {
- runRsync( $sourceConfiguration );
- }
- else if ( $syncMode == "svn" )
- {
- runSvnOverHttps( $sourceConfiguration );
- }
-}
-
-# -----------------------------------------------------------------------------
-#
-# -----------------------------------------------------------------------------
-
-
-
-sub runRsyncOverSsh()
-{
- my $sourceConfiguration = shift;
-
- my $address = $sourceConfiguration->val( "host", "address" );
-
- my $directory = $sourceConfiguration->val( "host", "directory" );
-
- my $options = $sourceConfiguration->val( "host", "options" );
-
- my $rsyncUser = $configuration->val( "syncopate", "rsyncUser" );
-
- my $identity = $configuration->val( "syncopate", "identity" );
-
- if ( $sourceConfiguration->val( "host", "rsyncUser" ) )
- {
- $rsyncUser = $sourceConfiguration->val( "host", "rsyncUser" );
- }
-
- if ( $sourceConfiguration->val( "host", "identity" ) )
- {
- $identity = "-i " . $sourceConfiguration->val( "host", "identity" );
- }
-
- if ( $sourceConfiguration->val( "host", "repoDirectory" ) )
- {
- $repoDirectory = $sourceConfiguration->val( "host", "repoDirectory" );
- }
-
-
- my $cmd = "rsync $standardOptions $options --rsh=\"ssh -oBatchMode=yes $identity -T -l $rsyncUser\" $address:$directory/ $repoDirectory";
-
- # -------------------------------------------------------------------------
- # Now we want to run rsync and generate a small xdoc which describes the
- # syncronization that just occurred.
- # -------------------------------------------------------------------------
-
- my $id = $sourceConfiguration->val( "info", "id" );
-
- my $name = $sourceConfiguration->val( "info", "name" );
-
- my $reportName = "Synchronization report for " . $name;
-
- my @date = date();
-
- my $date = $date[0] . "-" . $date[1] . "-" . $date[2];
-
- my $dir = $date;
-
- $dir =~ s/-/\//g;
-
- $dir = $id . "/" . $dir;
-
- my $rdir = $reportDirectory . "/" . $dir;
-
- system( "mkdir -p $rdir > /dev/null 2>&1" );
-
- my $base = $id . "-" . $date[0] . $date[1] . $date[2] . "-" . $date[3] . $date[4] . $date[5];
-
- my $xmlReport = $rdir . "/" . $base . ".xml";
-
- my $rawReport = $rdir . "/" . $base . ".txt";
-
- open( REPORT, "> $xmlReport" );
-
- open( RAW_REPORT, "> $rawReport" );
-
- print REPORT "<document>" . "\n";
-
- print REPORT "<properties>" . "\n";
-
- print REPORT "<author>meeper</author>" . "\n";
-
- print REPORT "<title>$reportName</title>" . "\n";
-
- print REPORT "</properties>" . "\n";
-
- print REPORT "<body>" . "\n";
-
- print REPORT "<section name=\"$reportName\">" . "\n";
-
- print REPORT "<table>" . "\n";
-
- print REPORT "<tr>" . "\n";
-
- print REPORT "<th>Artifact</th>" . "\n";
-
- print REPORT "<th>Size (in bytes)</th>" . "\n";
-
- print REPORT "<th>Date</th>" . "\n";
-
- print REPORT "</tr>" . "\n";
-
- open( SYNC, "$cmd 2>&1 |" );
-
- my $rawReportText;
-
- while( <SYNC> )
- {
- # --------------------------------------------------------------------
- # We have a line that tells us about an artifact that was synced.
- # --------------------------------------------------------------------
- if ( /^artifact/ )
- {
- my @details = split;
-
- print REPORT "<tr>" . "\n";
-
- print REPORT "<td>" . $details[1] . "</td>" . "\n";
-
- print REPORT "<td>" . $details[2] . "</td>" . "\n";
-
- print REPORT "<td>" . $details[3] . " " . $details[4] . "</td>" . "\n";
-
- print REPORT "</tr>" . "\n";
- }
- else
- {
- $rawReportText = $rawReportText . $_;
-
- print RAW_REPORT;
- }
- }
-
- print REPORT "</table>" . "\n";
-
- print REPORT "<p><a href=\"$rawReport\">Raw report</a></p>";
-
- print REPORT "</section>" . "\n";
-
- print REPORT "</body>" . "\n";
-
- print REPORT "</document>" . "\n";
-
- close( REPORT );
-
- close( RAW_REPORT );
-
- if ( $rawReportText )
- {
- $rawReportText = $rawReportText . "\n\nYou can view the syncronization reports for today here: \n\n";
-
- $rawReportText = $rawReportText . $reportUrl . "/" . $dir;
-
- notify( $sourceConfiguration, $reportName, $rawReportText );
- }
-}
-
-sub runRsync()
-{
- my $sourceConfiguration = shift;
-}
-
-sub runSvnOverHttps()
-{
- my $sourceConfiguration = shift;
-}
-
-sub date
-{
- my $second;
- my $minute;
- my $hour;
- my $day;
- my $month;
- my $year;
-
- ($second, $minute,$hour,$day, $month, $year) = (localtime)[0..5];
-
- $year = $year + 1900; #got 2004
-
- $month = $month + 1;
-
- $second = $second + 1;
-
- $minute = $minute + 1;
-
- $hour = $hour + 1;
-
- if ( $second <= 9 )
- {
- $second = "0".$second;
- }
- if ( $minute <= 9 )
- {
- $minute = "0".$minute;
- }
- if ( $hour <= 9 )
- {
- $hour = "0".$hour;
- }
- if ( $day <= 9 )
- {
- $day = "0".$day;
- }
- if ( $month <= 9)
- {
- $month = "0".$month;
- }
-
- return ($year,$month,$day,$hour,$minute,$second);
-}
-
-sub notify()
-{
- my $sourceConfiguration = shift;
-
- my $subject = shift;
-
- my $text = shift;
-
- my $smtp = new Net::SMTP( $smtpServer );
-
- $smtp->mail( "meeper\@maven.org" );
-
- $smtp->to( $sourceConfiguration->val( "info", "contact" ) );
-
- $smtp->data();
-
- $smtp->datasend( "Subject: $subject\n" );
-
- $smtp->datasend( "From: meeper\@maven.org\n" );
-
- $smtp->datasend( "\n" );
-
- $smtp->datasend( $text );
-
- $smtp->dataend();
-
- $smtp->quit();
-}
+++ /dev/null
-[syncopate]
-repoDirectory=/home/maven/repository-staging/to-ibiblio/maven
-options=--log-format="artifact %f %l %t" -rvt -L --size-only --exclude-from=$HOME/bin/synchronize/syncopate/exclusions.txt
-rsyncUser=rsync
-
-reportUrl=http://repo1.maven.org/reports/syncopate
-reportDirectory=/home/maven/repository-staging/to-ibiblio/reports/syncopate
-smtpServer=localhost
+++ /dev/null
-package org.apache.maven.archiva.meeper;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.csv.CSVParser;
-
-/**
- * Read a csv file with the synced repositories information
- *
- * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
- * @version $Id$
- */
-public class Reader
-{
- private CSVParser parser;
-
- public Reader( InputStream stream )
- {
- parser = new CSVParser( new InputStreamReader( stream ) );
- }
-
- public List parse()
- throws IOException
- {
- String[][] data = parser.getAllValues();
- List repos = new ArrayList( data.length - 1 );
-
- /* ignore headers line */
- for ( int i = 1; i < data.length; i++ )
- {
- int j = 0;
- SyncedRepository repo = new SyncedRepository();
- repo.setGroupId( data[i][j++] );
- repo.setLocation( data[i][j++] );
- repo.setProtocol( data[i][j++] );
- repo.setContactName( data[i][j++] );
- repo.setContactMail( data[i][j++] );
- repos.add( repo );
- }
-
- return repos;
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.meeper;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-import org.apache.commons.lang.builder.ReflectionToStringBuilder;
-
-/**
- * Stores a synced repository data.
- *
- * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
- * @version $Id$
- */
-public class SyncedRepository
-{
- private String groupId;
-
- private String location;
-
- private String protocol;
-
- private String contactName;
-
- private String contactMail;
-
- public void setGroupId( String groupId )
- {
- this.groupId = groupId;
- }
-
- public String getGroupId()
- {
- return groupId;
- }
-
- public void setContactName( String contactName )
- {
- this.contactName = contactName;
- }
-
- public String getContactName()
- {
- return contactName;
- }
-
- public void setContactMail( String contactMail )
- {
- this.contactMail = contactMail;
- }
-
- public String getContactMail()
- {
- return contactMail;
- }
-
- public void setLocation( String location )
- {
- this.location = location;
- }
-
- public String getLocation()
- {
- return location;
- }
-
- public void setProtocol( String protocol )
- {
- this.protocol = protocol;
- }
-
- public String getProtocol()
- {
- return protocol;
- }
-
- public String toString()
- {
- return ReflectionToStringBuilder.toString( this );
- }
-}
+++ /dev/null
- ----
- Maven Repository Mirroring Kit
- -----
- Jason van Zyl
- -----
- 17 October 2006
- -----
-
-Maven Repository Mirroring Kit
-
-Requirements
-
- * SSH
-
- * Rsync
-
- * Maven's public SSH key
-
- * Sample Maven sync configuration (sample.conf)
-
- * Project PGP key
-
-Preparations
-
- * Create a user account with an id of <<<maven>>>
-
- * Setup SSH for the <<<maven>>> user
-
- * Create a valid Maven sync configuration
-
- * Submit configuration
+++ /dev/null
-[info]
-id = org.foo
-name = My Software Foundation
-contact = you@foo.org
-
-[host]
-address=repository.foo.org
-directory=/www/maven-2-repository
-rsyncUser=maven
+++ /dev/null
- ----
- Maven Repository Syncing Kit
- -----
- Jason van Zyl
- -----
- 17 October 2006
- -----
-
-Maven Repository Syncing Kit
-
-Requirements
-
- * SSH
-
- * Rsync
-
- * Maven's public SSH key
-
- * Sample Maven sync configuration (sample.conf)
-
- * Project PGP key
-
-Preparations
-
- * Create a user account with an id of <<<maven>>>
-
- * Setup SSH for the <<<maven>>> user
-
- * Create a valid Maven sync configuration
-
- * Submit configuration
+++ /dev/null
-ssh-dss AAAAB3NzaC1kc3MAAACBAL9WxLqVn4DgS3pl6XrHQ467FLfhX+9ESYUQNsmqOxsubixtVVfiNFDpDI/LlSZSs9YcKr6XUMrVy58y3yg8pxR+T+4h3xGlUIhr/YJ60z02X7mSYNa8S2uVVL2Gou8z/GjDJnlY1GGzqXwKI07WdQ8QSAK8AYgAAZfVzn4VbCcjAAAAFQCnVrFfasrKOb6s8gteHeYyYPgndwAAAIEAhtVdf/cQ+KuzBQQqEhz9O7rqSh5GqZE177oY+2lPNpR8lKg2TRk87j3sh506gmpk82Gm4RvAOBOI6zEwLoOLsR+ucVSzUfhqgGanUworHVUnGQ7mIBqBq91JVVGORfVfK5/omi0ShIdhyZscf3vmeE3GiYtH8J3aUbGXxylkpLYAAACAOBk/ghnjuujhVo4sypxn0ATVLJ4ZcyHkl2vC4SE6VQ2XgYQv3P+NLbQtKoiNASifF1V0sOrzXxPzhPwWoh+8SxVqVLui7VC+2MKgd3etBJ3tllXIjgsxL9k8LxfDwsM+3dmICf28YQePRt4XkXADthdhOdkgG7MnpSidVmNBgDc= maven@beaver.codehaus.org
+++ /dev/null
-[info]
-id = org.foo
-name = My Software Foundation
-contact = you@foo.org
-
-[host]
-address=repository.foo.org
-directory=/www/maven-2-repository
-rsyncUser=maven
+++ /dev/null
- ---
- Maven Repository Synchronization Refactor: Summary of Changes
- ---
- John Casey
- ---
- 2005-April-06
- ---
-
-~~ Copyright 2006 The Apache Software Foundation.
-~~
-~~ Licensed under the Apache License, Version 2.0 (the "License");
-~~ you may not use this file except in compliance with the License.
-~~ You may obtain a copy of the License at
-~~
-~~ http://www.apache.org/licenses/LICENSE-2.0
-~~
-~~ Unless required by applicable law or agreed to in writing, software
-~~ distributed under the License is distributed on an "AS IS" BASIS,
-~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-~~ See the License for the specific language governing permissions and
-~~ limitations under the License.
-
-~~ NOTE: For help with the syntax of this file, see:
-~~ http://maven.apache.org/guides/mini/guide-apt-format.html
-
-Summary of Changes for the Maven Repository Synchronization Process
-
-*Abstract
-
- In order to support the impending release of maven2 from a production-ready
- repository on ibiblio.org, several things had to be changed. Most importantly,
- we had to somehow find a way to synchronize the maven1 repository and feeds
- with maven2's repository, and find a way to integrate this conversion process
- with the synchronization already taking place on beaver.codehaus.org.
-
- What follows is a description of the changes I made to the original maven1
- synchronization process in order to accommodate maven2's release.
-
-*Conversion
-
- First, we needed a reliable tool to convert a maven1 repository into a maven2
- repository. There are several tasks involved in this process:
-
- [[1]] Parsing artifact paths for artifact information.
-
- [[2]] Moving artifacts from source repo to target repo, reformatting the
- relative artifact paths along the way (to conform with the new repo
- layout for m2).
-
- [[3]] Translating m1 POMs into m2 POMs, and creating skeletal POMs where they
- were missing, using the artifact information parsed in [1] above.
-
- [[4]] Repairing and/or moving MD5 checksums for each artifact from source to
- target repository.
-
- [[5]] Preserving a good log of errors encountered during the conversion
- process, for later auditing.
-
- Since I had limited time with which to implement a solution, and didn't have
- much familiarity with pre-existing repository conversion tools made by Carlos
- et al. I decided to design my own solution to the problem, and worry about
- merging with other tools later.
-
- The solution I have created is called repoclean, and can be found in
- <<<maven-components/sandbox/repoclean>>>. It's a plexus application, with some
- basic bash shell scripts used to install and run the application. The steps
- enumerated above were implemented as separate components, then stitched
- together with a Main class and controller component which serves as the entry
- point for Main.
-
- As a final point, the reporting takes place both at the entire-process level
- for operations such as artifact discovery, and at the per-artifact level. A
- report is only written in the event of an error or warning, and per-artifact
- reports are mentioned in the entire-process report if they contained an error.
- In the event that an error was detected, the entire-process report should be
- mailed to the m2-dev list with a subject similar to: <<[REPOCLEAN] Error(s)
- occurred while converting the repository>>. Other reports can be found in the
- reports directory of the sync work directory (mentioned below).
-
-*Synchronization
-
- Now, the synchronization process as-is was only maintaining a maven1 repository
- from a set of feeds. In order to refactor this into a maintenance process for
- both maven1 and maven2 repositories, I had to make a few minor changes.
-
- In order to aid in understanding this process, I moved the tools suite into
- $HOME/repository-tools. I moved the synchronization work directory (the
- directory into which all feeds will copy, and which the outbound rsync will
- use as a source) into $HOME/repository-staging. The tools suite (in
- $HOME/repository-tools) does NOT contain the only copy of syncopate and the
- outbound rsync script, only the copies I made and modified for the new
- synchronization process...this was an insurance policy made to allow rollback.
-
- As I said, I made some minor changes to the existing process. These mainly
- consisted of reconfiguring syncopate and the outbound rsync script to use the
- new directory structures, along with adding a control script which would be
- called from cron, and which would inject a call to repoclean into the middle
- of the process. The new controller script was used to consolidate all
- synchronization logic into the repository-tools directory, and expose it all
- equally as scripts to be maintained as a unit. Now, the crontab entry is very
- simple, only referencing the controller script.
-
- The new synchronization process executes the following operations:
-
- [[1]] Run syncopate to collect new artifacts from the feeder repositories.
-
- <<Syncopate location:>> $HOME/repository-tools/syncopate
- <<Target repository location:>> $HOME/repository-staging/to-ibiblio/maven
-
- [[2]] Run repoclean to convert any new added or updated artifacts to the
- maven2 repository work directory.
-
- <<Repoclean location:>> $HOME/repository-tools/repoclean
- <<Source repository location:>> $HOME/repository-staging/to-ibiblio/maven
- <<Target repository location:>> $HOME/repository-staging/to-ibiblio/maven2
-
- [[3]] Run the rsync to ibiblio.
-
- <<Rsync script location:>> $HOME/repository-tools/ibiblio-sync/synchronize-codehaus-to-ibiblio.sh
-
- <<*NOTE:>> This is accomplished as two separate rsync operations, to
- avoid unwanted directories being added to the outbound rsync (which
- would land in /public/html on ibiblio...a big no-no).
-
- All of the old synchronization stuff is still in place, with the exception of
- the old version of the canonical repositories, which were removed to keep our
- space usage to a minimum on beaver.codehaus.org.
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<faqs id="General FAQ">
- <part id="General">
- <faq id="where">
- <question>Where did Maven come from?</question>
- <answer>
- <p>
- Maven was created by a group of software developers who were tired
- of wasting their time fiddling around with builds and wanted to get
- down to brass tacks and actually develop software!
- </p>
- </answer>
- </faq>
- <faq id="why">
- <question>Why is maven so wildly popular?</question>
- <answer>
- <p>
- Maven saves you so much time in your software development efforts that
- you will have time to learn a second language, relax ten hours a
- day, and train for that marathon you've always wanted to run!
- </p>
- </answer>
- </faq>
- </part>
-</faqs>
+++ /dev/null
-\f
-Le format APT
-~~~~~~~~~~~~~
-
- Dans la section suivante, les bo?tes contenant du texte dans la police
- de type machine ? ?crire sont des exemples de source APT.
-
-* Structure du document
-~~~~~~~~~~~~~~~~~~~~~~~
-
- A short APT document is contained in a single text file. A longer document
- may be contained in a ordered list of text files. For instance, first text
- file contains section 1, second text file contains section 2, and so on.
-
- [Note:] Splitting the APT document in several text files on a section
- boundary is not mandatory. The split may occur anywhere.
- However doing so is recommended because a text file containing a
- section is by itself a valid APT document.
-
- A file contains a sequence of paragraphs and ``displays'' (non paragraphs
- such as tables) separated by open lines.
-
- A paragraph is simply a sequence of consecutive text lines.
-
-+------------------------------------------------------------------------+
- First line of first paragraph.
- Second line of first paragraph.
- Third line of first paragraph.
-
- Line 1 of paragraph 2 (separated from first paragraph by an open line).
- Line 2 of paragraph 2.
-+------------------------------------------------------------------------+
-
- The indentation of the first line of a paragraph is the main method used by
- an APT processor to recognize the type of the paragraph. For example, a
- section title must not be indented at all.
-
- A ``plain'' paragraph must be indented by a certain amount of space. For
- example, a plain paragraph which is not contained in a list may be indented
- by two spaces.
-
-+-------------------------------------------------+
-My section title (not indented).
-
- My paragraph first line (indented by 2 spaces).
-+-------------------------------------------------+
-
- Indentation is not rigid. Any amount of space will do. You don't even need
- to use a consistent indentation all over your document. What really matters
- for an APT processor is whether the paragraph is not indented at all or,
- when inside a list, whether a paragraph is more or less indented than the
- first item of the list (more about this later).
-
-+-------------------------------------------------------+
- First paragraph has its first line indented by four
-spaces. Then the author did even bother to indent the
-other lines of the paragraph.
-
- Second paragraph contains several lines which are all
- indented by two spaces. This style is much nicer than
- the one used for the previous paragraph.
-+-------------------------------------------------------+
-
- Note that tabs are expanded with a tab width set to 8.
-
-* Document elements
-~~~~~~~~~~~~~~~~~~~
-
-** Block level elements
-~~~~~~~~~~~~~~~~~~~~~~~
-
-*** Title
-~~~~~~~~~~
-
- A title is optional. If used, it must appear as the first block of the
- document.
-
-+----------------------------------------------------------------------------+
- ------
- Title
- ------
- Author
- ------
- Date
-+----------------------------------------------------------------------------+
-
- A title block is indented (centering it is nicer). It begins with a line
- containing at least 3 dashes (<<<--->>>).
-
- After the first <<<--->>> line, one or several consecutive lines of text
- (implicit line break after each line) specify the title of the document.
-
- This text may immediately be followed by another <<<--->>> line and one or
- several consecutive lines of text which specifies the author of the
- document.
-
- The author sub-block may optionaly be followed by a date sub-block using the
- same syntax.
-
- The following example is used for a document with an title and a date but
- with no declared author.
-
-+----------------------------------------------------------------------------+
- ------
- Title
- ------
- ------
- Date
- ------
-+----------------------------------------------------------------------------+
-
- The last line is ignored. It is just there to make the block nicer.
-
-*** Paragraph
-~~~~~~~~~~~~~
-
- Paragraphs other than the title block may appear before the first section.
-
-+----------------------+
- Paragraph 1, line 1.
- Paragraph 1, line 2.
-
- Paragraph 2, line 1.
- Paragraph 2, line 2.
-+----------------------+
-
- Paragraphs are indented. They have already been described in the {{document
- structure}} section.
-
-*** Section
-~~~~~~~~~~~
-
- Sections are created by inserting section titles into the document. Simple
- documents need not contain sections.
-
-+-----------------------------------+
-Section title
-
-* Sub-section title
-
-** Sub-sub-section title
-
-*** Sub-sub-sub-section title
-
-**** Sub-sub-sub-sub-section title
-+-----------------------------------+
-
- Section titles are not indented. A sub-section title begins with one
- asterisk (<<<*>>>), a sub-sub-section title begins with two asterisks
- (<<<**>>>), and so forth up to four sub-section levels.
-
-*** List
-~~~~~~~~
-
-+---------------------------------------+
- * List item 1.
-
- * List item 2.
-
- Paragraph contained in list item 2.
-
- * Sub-list item 1.
-
- * Sub-list item 2.
-
- * List item 3.
-+---------------------------------------+
-
- List items are indented and begin with a asterisk (<<<*>>>).
-
- Plain paragraphs more indented than the first list item are nested in that
- list. Displays such as tables (not indented) are always nested in the
- current list.
-
- To nest a list inside a list, indent its first item more than its parent
- list. To end a list, add a paragraph or list item less indented than the
- current list.
-
- Section titles always end a list. Displays cannot end a list but the
- <<<[]>>> pseudo-element may be used to force the end of a list.
-
-+------------------------------------+
- * List item 3.
- Force end of list:
-
- []
-
---------------------------------------------
-Verbatim text not contained in list item 3
---------------------------------------------
-+------------------------------------+
-
- In the previous example, without the <<<[]>>>, the verbatim text (not
- indented as all displays) would have been contained in list item 3.
-
- A single <<<[]>>> may be used to end several nested lists at the same
- time. The indentation of <<<[]>>> may be used to specify exactly which
- lists should be ended. Example:
-
-+------------------------------------+
- * List item 1.
-
- * List item 2.
-
- * Sub-list item 1.
-
- * Sub-list item 2.
-
- []
-
--------------------------------------------------------------------
-Verbatim text contained in list item 2, but not in sub-list item 2
--------------------------------------------------------------------
-+------------------------------------+
-
- There are three kind of lists, the bulleted lists we have already described,
- the numbered lists and the definition lists.
-
-+-----------------------------------------+
- [[1]] Numbered item 1.
-
- [[A]] Numbered item A.
-
- [[B]] Numbered item B.
-
- [[2]] Numbered item 2.
-+-----------------------------------------+
-
- A numbered list item begins with a label beetween two square brackets. The
- label of the first item establishes the numbering scheme for the whole list:
-
- [<<<[[1\]\]>>>] Decimal numbering: 1, 2, 3, 4, etc.
-
- [<<<[[a\]\]>>>] Lower-alpha numbering: a, b, c, d, etc.
-
- [<<<[[A\]\]>>>] Upper-alpha numbering: A, B, C, D, etc.
-
- [<<<[[i\]\]>>>] Lower-roman numbering: i, ii, iii, iv, etc.
-
- [<<<[[I\]\]>>>] Upper-roman numbering: I, II, III, IV, etc.
-
- The labels of the items other than the first one are ignored. It is
- recommended to take the time to type the correct label for each item in
- order to keep the APT source document readable.
-
-+-------------------------------------------+
- [Defined term 1] of definition list 2.
-
- [Defined term 2] of definition list 2.
-+-------------------------------------------+
-
- A definition list item begins with a defined term: text between square
- brackets.
-
-*** Verbatim text
-~~~~~~~~~~~~~~~~~
-
-+----------------------------------------+
-----------------------------------------
-Verbatim
- text,
- preformatted,
- escaped.
-----------------------------------------
-+----------------------------------------+
-
- A verbatim block is not indented. It begins with a non indented line
- containing at least 3 dashes (<<<--->>>). It ends with a similar line.
-
- <<<+-->>> instead of <<<--->>> draws a box around verbatim text.
-
- Like in HTML, verbatim text is preformatted. Unlike HTML, verbatim text is
- escaped: inside a verbatim display, markup is not interpreted by the APT
- processor.
-
-*** Figure
-~~~~~~~~~~
-
-+---------------------------+
-[Figure name] Figure caption
-+---------------------------+
-
- A figure block is not indented. It begins with the figure name between
- square brackets. The figure name is optionally followed by some text: the
- figure caption.
-
- The figure name is the pathname of the file containing the figure but
- without an extension. Example: if your figure is contained in
- <<</home/joe/docs/mylogo.jpeg>>>, the figure name is
- <<</home/joe/docs/mylogo>>>.
-
- If the figure name comes from a relative pathname (recommended practice)
- rather than from an absolute pathname, this relative pathname is taken to be
- relative to the directory of the current APT document (a la HTML)
- rather than relative to the current working directory.
-
- Why not leave the file extension in the figure name? This is better
- explained by an example. You need to convert an APT document to PostScript
- and your figure name is <<</home/joe/docs/mylogo>>>. A APT processor will
- first try to load <<</home/joe/docs/mylogo.eps>>>. When the desired format
- is not found, a APT processor tries to convert one of the existing
- formats. In our example, the APT processor tries to convert
- <<</home/joe/docs/mylogo.jpeg>>> to encapsulated PostScript.
-
-*** Table
-~~~~~~~~~
-
- A table block is not indented. It begins with a non indented line containing
- an asterisk and at least 2 dashes (<<<*-->>>). It ends with a
- similar line.
-
- The first line is not only used to recognize a table but also to specify
- column justification. In the following example,
-
- * the second asterisk (<<<*>>>) is used to specify that column 1 is
- centered,
-
- * the plus sign (<<<+>>>) specifies that column 2 is left aligned,
-
- * the colon (<<<:>>>) specifies that column 3 is right aligned.
-
- []
-
-+---------------------------------------------+
-*----------*--------------+----------------:
-| Centered | Left-aligned | Right-aligned |
-| cell 1,1 | cell 1,2 | cell 1,3 |
-*----------*--------------+----------------:
-| cell 2,1 | cell 2,2 | cell 2,3 |
-*----------*--------------+----------------:
-Table caption
-+---------------------------------------------+
-
- Rows are separated by a non indented line beginning with <<<*-->>>.
-
- An optional table caption (non indented text) may immediately follow the
- table.
-
- Rows may contain single line or multiple line cells. Each line of cell text
- is separated from the adjacent cell by the pipe character (<<<|>>>).
- (<<<|>>> may be used in the cell text if quoted: <<<\\|>>>.)
-
- The last <<<|>>> is only used to make the table nicer. The first <<<|>>> is
- not only used to make the table nicer, but also to specify that a grid is to
- be drawn around table cells.
-
- The following example shows a simple table with no grid and no caption.
-
-+---------------+
-*-----*------*
- cell | cell
-*-----*------*
- cell | cell
-*-----*------*
-+---------------+
-
-*** Horizontal rule
-~~~~~~~~~~~~~~~~~~~
-
-+---------------------+
-=====================
-+---------------------+
-
- A non indented line containing at least 3 equal signs (<<<===>>>).
-
-*** Page break
-~~~~~~~~~~~~~~
-
-+---+
-^L
-+---+
-
- A non indented line containing a single form feed character (Control-L).
-
-** Text level elements
-~~~~~~~~~~~~~~~~~~~~~~
-
-*** Font
-~~~~~~~~
-
-+-----------------------------------------------------+
- <Italic> font. <<Bold>> font. <<<Monospaced>>> font.
-+-----------------------------------------------------+
-
- Text between \< and > must be rendered in italic. Text between \<\< and >>
- must be rendered in bold. Text between \<\<\< and >>> must be rendered using
- a monospaced, typewriter-like font.
-
- Font elements may appear anywhere except inside other font elements.
-
- It is not recommended to use font elements inside titles, section titles,
- links and defined terms because a APT processor automatically applies
- appropriate font styles to these elements.
-
-*** Anchor and link
-~~~~~~~~~~~~~~~~~~~
-
-+-----------------------------------------------------------------+
- {Anchor}. Link to {{anchor}}. Link to {{http://www.pixware.fr}}.
- Link to {{{anchor}showing alternate text}}.
- Link to {{{http://www.pixware.fr}Pixware home page}}.
-+-----------------------------------------------------------------+
-
- Text between curly braces (<<<\{}>>>) specifies an anchor. Text between
- double curly braces (<<<\{\{}}>>>) specifies a link.
-
- It is an error to create a link element that does not refer to an anchor of
- the same name. The name of an anchor/link is its text with all non
- alphanumeric characters stripped.
-
- This rule does not apply to links to <external> anchors. Text beginning
- with <<<http:/>>>, <<<https:/>>>, <<<ftp:/>>>, <<<file:/>>>, <<<mailto:>>>,
- <<<../>>>, <<<./>>> (<<<..\\>>> and <<<.\\>>> on Windows) is recognized as
- an external anchor name.
-
- When the construct <<\{\{\{>><name><<}>><text><<}}>> is used, the link text
- <text> may differ from the link name <name>.
-
- Anchor/link elements may appear anywhere except inside other anchor/link
- elements.
-
- Section titles are implicitly defined anchors.
-
-*** Line break
-~~~~~~~~~~~~~~
-
-+-------------+
- Force line\
- break.
-+-------------+
-
- A backslash character (<<<\\>>>) followed by a newline character.
-
- Line breaks must not be used inside titles and tables (which are line
- oriented blocks with implicit line breaks).
-
-*** Non breaking space
-~~~~~~~~~~~~~~~~~~~~~~
-
-+----------------------+
- Non\ breaking\ space.
-+----------------------+
-
- A backslash character (<<<\\>>>) followed by a space character.
-
-*** Special character
-~~~~~~~~~~~~~~~~~~~~~
-
-+---------------------------------------------------------------------------+
- Escaped special characters: \~, \=, \-, \+, \*, \[, \], \<, \>, \{, \}, \\.
-+---------------------------------------------------------------------------+
-
- In certain contexts, these characters have a special meaning and therefore
- must be escaped if needed as is. They are escaped by adding a backslash in
- front of them. The backslash may itself be escaped by adding another
- backslash in front of it.
-
- Note that an asterisk, for example, needs to be escaped only if its begins a
- paragraph. (<<<*>>> has no special meaning in the middle of a paragraph.)
-
-+--------------------------------------+
- Copyright symbol: \251, \xA9, \u00a9.
-+--------------------------------------+
-
- Latin-1 characters (whatever is the encoding of the APT document) may be
- specified by their codes using a backslash followed by one to three octal
- digits or by using the <<<\x>>><NN> notation, where <NN> are two hexadecimal
- digits.
-
- Unicode characters may be specified by their codes using the <<<\u>>><NNNN>
- notation, where <NNNN> are four hexadecimal digits.
-
-*** Comment
-~~~~~~~~~~~
-
-+---------------+
-~~Commented out.
-+---------------+
-
- Text found after two tildes (<<<\~~>>>) is ignored up to the end of line.
-
- A line of <<<~>>> is often used to ``underline'' section titles in order to
- make them stand out of other paragraphs.
-
-\f
-* The APT format at a glance
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-------------------------------------------------------------------------------
- ------
- Title
- ------
- Author
- ------
- Date
-
- Paragraph 1, line 1.
- Paragraph 1, line 2.
-
- Paragraph 2, line 1.
- Paragraph 2, line 2.
-
-Section title
-
-* Sub-section title
-
-** Sub-sub-section title
-
-*** Sub-sub-sub-section title
-
-**** Sub-sub-sub-sub-section title
-
- * List item 1.
-
- * List item 2.
-
- Paragraph contained in list item 2.
-
- * Sub-list item 1.
-
- * Sub-list item 2.
-
- * List item 3.
- Force end of list:
-
- []
-
-+------------------------------------------+
-Verbatim text not contained in list item 3
-+------------------------------------------+
-
- [[1]] Numbered item 1.
-
- [[A]] Numbered item A.
-
- [[B]] Numbered item B.
-
- [[2]] Numbered item 2.
-
- List numbering schemes: [[1]], [[a]], [[A]], [[i]], [[I]].
-
- [Defined term 1] of definition list.
-
- [Defined term 2] of definition list.
-
-+-------------------------------+
-Verbatim text
- in a box
-+-------------------------------+
-
- --- instead of +-- suppresses the box around verbatim text.
-
-[Figure name] Figure caption
-
-*----------*--------------+----------------:
-| Centered | Left-aligned | Right-aligned |
-| cell 1,1 | cell 1,2 | cell 1,3 |
-*----------*--------------+----------------:
-| cell 2,1 | cell 2,2 | cell 2,3 |
-*----------*--------------+----------------:
-Table caption
-
- No grid, no caption:
-
-*-----*------*
- cell | cell
-*-----*------*
- cell | cell
-*-----*------*
-
- Horizontal line:
-
-=======================================================================
-
-^L
- New page.
-
- <Italic> font. <<Bold>> font. <<<Monospaced>>> font.
-
- {Anchor}. Link to {{anchor}}. Link to {{http://www.pixware.fr}}.
- Link to {{{anchor}showing alternate text}}.
- Link to {{{http://www.pixware.fr}Pixware home page}}.
-
- Force line\
- break.
-
- Non\ breaking\ space.
-
- Escaped special characters: \~, \=, \-, \+, \*, \[, \], \<, \>, \{, \}, \\.
-
- Copyright symbol: \251, \xA9, \u00a9.
-
-~~Commented out.
-
-------------------------------------------------------------------------------
-
+++ /dev/null
- -----
- Le Site
- -----
- L'?quipe Maven
- -----
-
-Site Maven pour votre projet
-
- F?licitations! Si vous regardez cette page alors vous avez
- g?n?r? avec succ?s un mod?le de site en utilisant l'arch?type
- de site et vous avez lanc? :
-
-+-----+
-
-m2 site:site
-
-+-----+
+++ /dev/null
-<?xml version="1.0"?>
-<faqs id="FAQ G?n?ral">
- <part id="General">
- <faq id="where">
- <question>D'o? vient Maven</question>
- <answer>
- <p>
- Maven was created by a group of software developers who were tired
- of wasting their time fiddling around with builds and wanted to get
- down to brass tacks and actually develop software!
- </p>
- </answer>
- </faq>
- <faq id="why">
- <question>Pourquoi Maven est-il si populaire?</question>
- <answer>
- <p>
- Maven saves you so much time in your software development efforts that
- you will have time to learn a second language, relax ten hours a
- day, and train for that marathon you've always wanted to run!
- </p>
- </answer>
- </faq>
- </part>
-</faqs>
+++ /dev/null
-<?xml version="1.0"?>
-<document>
- <properties>
- <title>Bienvenue</title>
- <author email="dev@maven.apache.org">The Maven Team</author>
- </properties>
- <body>
- <section name="Bienvenue dans un fichier XDOC!">
- <p>
- Ceci est du texte pour le fichier xdoc.
- </p>
- </section>
- </body>
-</document>
-
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<project name="Maven">
- <bannerLeft>
- <name>Maven</name>
- <src>http://maven.apache.org/images/apache-maven-project.png</src>
- <href>http://maven.apache.org/</href>
- </bannerLeft>
- <bannerRight>
- <src>http://maven.apache.org/images/maven-small.gif</src>
- </bannerRight>
- <body>
- <links>
- <item name="Apache" href="http://www.apache.org/" />
- <item name="Maven 1.0" href="http://maven.apache.org/"/>
- <item name="Maven 2" href="http://maven.apache.org/maven2/"/>
- </links>
-
- <menu name="Maven 2.0">
- <item name="APT Format" href="format.html"/>
- <item name="FAQ" href="faq.html"/>
- <item name="Xdoc Example" href="xdoc.html"/>
- </menu>
- </body>
-</project>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<project name="Maven">
- <bannerLeft>
- <name>Maven</name>
- <src>http://maven.apache.org/images/apache-maven-project.png</src>
- <href>http://maven.apache.org/</href>
- </bannerLeft>
- <bannerRight>
- <src>http://maven.apache.org/images/maven-small.gif</src>
- </bannerRight>
- <body>
- <links>
- <item name="Apache" href="http://www.apache.org/" />
- <item name="Maven 1.0" href="http://maven.apache.org/"/>
- <item name="Maven 2" href="http://maven.apache.org/maven2/"/>
- </links>
-
- <menu name="Maven 2.0">
- <item name="Format APT" href="format.html"/>
- <item name="FAQ" href="faq.html"/>
- <item name="Exemple Xdoc" href="xdoc.html"/>
- </menu>
- </body>
-</project>
+++ /dev/null
-<?xml version="1.0"?>
-<document>
- <properties>
- <title>Welcome</title>
- <author email="dev@maven.apache.org">The Maven Team</author>
- </properties>
- <body>
- <section name="Welcome to an XDOC file!">
- <p>
- This is some text for the xdoc file.
- </p>
- </section>
- </body>
-</document>
-
+++ /dev/null
-package org.apache.maven.archiva.meeper;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-import java.util.Iterator;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-public class ReaderTest
- extends TestCase
-{
-
- private Reader reader;
-
- protected void setUp()
- throws Exception
- {
- super.setUp();
-
- reader = new Reader( this.getClass().getClassLoader()
- .getResourceAsStream( "org/apache/maven/archiva/meeper/sync.csv" ) );
- }
-
- public void testParse()
- throws Exception
- {
- List repos = reader.parse();
- assertEquals( 2, repos.size() );
- for ( Iterator it = repos.iterator(); it.hasNext(); )
- {
- SyncedRepository repo = (SyncedRepository) it.next();
- System.out.println( repo );
- }
- }
-
-}
+++ /dev/null
-"groupId","location","protocol","contactName","contactMail"
-"asm","maven@forge.objectweb.org:../../groups/maven/htdocs/maven2","rsync_ssh","EugeneKuleshov","eu@javatx.org"
-"ch.qos.logback","rsync://pixie.qos.ch/mvnrepo","rsync","Ceki Gulcu","ceki@qos.ch"
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<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>
-
- <prerequisites>
- <maven>2.0.4</maven>
- </prerequisites>
-
- <groupId>org.apache.maven.archiva.tools</groupId>
- <artifactId>maven-archivadev-plugin</artifactId>
- <packaging>maven-plugin</packaging>
- <version>1.0-SNAPSHOT</version>
-
- <name>Archiva Dev Maven Plugin</name>
-
- <inceptionYear>2007</inceptionYear>
-
- <developers>
- <developer>
- <id>joakime</id>
- <name>Joakim Erdfelt</name>
- <email>joakime@apache.org</email>
- <roles>
- <role>Developer</role>
- </roles>
- <timezone>-5</timezone>
- </developer>
- </developers>
-
- <dependencies>
- <!-- maven plugin deps -->
- <dependency>
- <groupId>org.apache.maven.archiva</groupId>
- <artifactId>archiva-common</artifactId>
- <version>1.0-beta-2</version>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.2</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact</artifactId>
- <version>${maven.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>${maven.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.reporting</groupId>
- <artifactId>maven-reporting-api</artifactId>
- <version>${maven.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-project</artifactId>
- <version>${maven.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.reporting</groupId>
- <artifactId>maven-reporting-api</artifactId>
- <version>${maven.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-dependency-tree</artifactId>
- <version>1.0-alpha-2</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>1.2</version>
- </dependency>
- <!-- testing deps -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-plugin-testing-harness</artifactId>
- <version>1.0-beta-1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <properties>
- <maven.version>2.0.7</maven.version>
- </properties>
-</project>
+++ /dev/null
-package org.apache.maven.archiva.plugins.dev;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.archiva.plugins.dev.testgen.DependencyGraphTestCreator;
-import org.apache.maven.archiva.plugins.dev.testgen.MemoryRepositoryCreator;
-import org.apache.maven.archiva.plugins.dev.utils.VariableNames;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.ArtifactCollector;
-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.apache.maven.shared.dependency.tree.DependencyTreeBuilder;
-
-import java.io.File;
-
-/**
- * CreateArchivaDependencyResolutionTestCaseMojo
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- *
- * @goal generate-dependency-tests
- */
-public class CreateArchivaDependencyResolutionTestCaseMojo
- extends AbstractMojo
-{
- /**
- * The project of the current build.
- *
- * @parameter default-value="${project}"
- * @required
- * @readonly
- */
- private MavenProject project;
-
- /**
- * The artifact respository to use.
- *
- * @parameter expression="${localRepository}"
- * @required
- * @readonly
- */
- private ArtifactRepository localRepository;
-
- /**
- * The destination directory to generate the test files.
- *
- * @parameter expression="${archivadev.outputdir}" default-value="${project.build.directory}"
- * @required
- */
- private File destDir;
-
- /**
- * The artifact factory to use.
- *
- * @component
- */
- private ArtifactFactory artifactFactory;
-
- /**
- * @component
- */
- private DependencyTreeBuilder dependencyTreeBuilder;
-
- /**
- * @component
- */
- protected ArtifactMetadataSource artifactMetadataSource;
-
- /**
- * @component
- */
- private ArtifactCollector collector;
-
- public void execute()
- throws MojoExecutionException, MojoFailureException
- {
- String classPrefix = VariableNames.toClassName( project.getArtifactId() );
-
- getLog().info( "Generating into " + destDir );
-
- createMemoryRepository( classPrefix );
- createDependencyGraphTest( classPrefix );
- }
-
- private void createDependencyGraphTest( String classPrefix ) throws MojoExecutionException
- {
- DependencyGraphTestCreator creator = new DependencyGraphTestCreator();
- creator.setLog( getLog() );
- creator.setOutputDir( destDir );
- creator.setProject( project );
- creator.setArtifactFactory( artifactFactory );
- creator.setLocalRepository( localRepository );
- creator.setDependencyTreeBuilder( dependencyTreeBuilder );
- creator.setArtifactMetadataSource( artifactMetadataSource );
- creator.setCollector( collector );
-
- creator.create( classPrefix );
- }
-
- private void createMemoryRepository( String classPrefix ) throws MojoExecutionException
- {
- MemoryRepositoryCreator creator = new MemoryRepositoryCreator();
- creator.setLog( getLog() );
- creator.setOutputDir( destDir );
- creator.setProject( project );
- creator.setArtifactFactory( artifactFactory );
- creator.setLocalRepository( localRepository );
-
- creator.create( classPrefix );
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.plugins.dev.functors;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.artifact.Artifact;
-
-import java.util.Comparator;
-
-/**
- * ArtifactComparator
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class ArtifactComparator
- implements Comparator
-{
-
- public int compare( Object arg0, Object arg1 )
- {
- if( arg0 == null || arg1 == null )
- {
- return -1;
- }
-
- Artifact artifact1 = (Artifact) arg0;
- Artifact artifact2 = (Artifact) arg1;
-
- int diff;
-
- diff = artifact1.getGroupId().compareTo( artifact2.getGroupId() );
- if( diff != 0 )
- {
- return diff;
- }
-
- diff = artifact1.getArtifactId().compareTo( artifact2.getArtifactId() );
- if( diff != 0 )
- {
- return diff;
- }
-
- return artifact1.getVersion().compareTo( artifact2.getVersion() );
- }
-
-}
+++ /dev/null
-package org.apache.maven.archiva.plugins.dev.functors;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.commons.collections.Transformer;
-import org.apache.maven.shared.dependency.tree.DependencyNode;
-
-/**
- * DependencyNodeToArtifactTransformer
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class DependencyNodeToArtifactTransformer
- implements Transformer
-{
- public Object transform( Object input )
- {
- if( input instanceof DependencyNode )
- {
- DependencyNode node = (DependencyNode) input;
- return node.getArtifact();
- }
-
- return input;
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.plugins.dev.functors;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.commons.collections.Predicate;
-import org.apache.maven.model.Dependency;
-import org.codehaus.plexus.util.StringUtils;
-
-/**
- * MatchingDependencyPredicate
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class MatchingDependencyPredicate
- implements Predicate
-{
- private Dependency selectedDep;
-
- public MatchingDependencyPredicate( Dependency selectedDep )
- {
- this.selectedDep = selectedDep;
- }
-
- public boolean evaluate( Object input )
- {
- boolean satisfies = false;
-
- if ( input instanceof Dependency )
- {
- Dependency dep = (Dependency) input;
- if ( StringUtils.equals( dep.getArtifactId(), selectedDep.getArtifactId() )
- && StringUtils.equals( dep.getGroupId(), selectedDep.getGroupId() )
- && StringUtils.equals( dep.getType(), selectedDep.getType() ))
- {
- // So far, so good. groupId/artifactId/type match.
- satisfies = true;
-
- // Test classifier (if defined)
- if( StringUtils.isNotEmpty( selectedDep.getClassifier() ) )
- {
- satisfies = StringUtils.equals( dep.getClassifier(), selectedDep.getClassifier() );
- }
- }
- }
-
- return satisfies;
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.plugins.dev.testgen;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.archiva.common.utils.VersionUtil;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.Exclusion;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Parent;
-import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.interpolation.ModelInterpolator;
-import org.apache.maven.project.interpolation.RegexBasedModelInterpolator;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.StringUtils;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.PrintWriter;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Properties;
-
-/**
- * AbstractCreator
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- */
-public abstract class AbstractCreator
-{
- protected MavenProject project;
-
- protected ArtifactFactory artifactFactory;
-
- protected ArtifactRepository localRepository;
-
- protected File outputDir;
-
- private MavenXpp3Reader modelReader = new MavenXpp3Reader();
-
- private ModelInterpolator modelInterpolator;
-
- private Log log;
-
- public abstract void create( String classPrefix )
- throws MojoExecutionException;
-
- protected void writeLicense( PrintWriter out )
- {
- out.println( "/*" );
- out.println( " * Licensed to the Apache Software Foundation (ASF) under one" );
- out.println( " * or more contributor license agreements. See the NOTICE file" );
- out.println( " * distributed with this work for additional information" );
- out.println( " * regarding copyright ownership. The ASF licenses this file" );
- out.println( " * to you under the Apache License, Version 2.0 (the" );
- out.println( " * \"License\"); you may not use this file except in compliance" );
- out.println( " * with the License. You may obtain a copy of the License at" );
- out.println( " *" );
- out.println( " * http://www.apache.org/licenses/LICENSE-2.0" );
- out.println( " *" );
- out.println( " * Unless required by applicable law or agreed to in writing," );
- out.println( " * software distributed under the License is distributed on an" );
- out.println( " * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY" );
- out.println( " * KIND, either express or implied. See the License for the" );
- out.println( " * specific language governing permissions and limitations" );
- out.println( " * under the License." );
- out.println( " */" );
- out.println( "" );
- }
-
- protected boolean isNotEmpty( Properties properties )
- {
- return !isEmpty( properties );
- }
-
- private boolean isEmpty( Properties properties )
- {
- if ( properties == null )
- {
- return true;
- }
-
- return properties.isEmpty();
- }
-
- public Log getLog()
- {
- return log;
- }
-
- public void setLog( Log log )
- {
- this.log = log;
- }
-
- public MavenProject getProject()
- {
- return project;
- }
-
- public void setProject( MavenProject project )
- {
- this.project = project;
- }
-
- protected Model getModel( Dependency dep )
- {
- return getModel( dep.getGroupId(), dep.getArtifactId(), dep.getVersion(), dep.getType() );
- }
-
- protected Model getModel( Parent parent )
- {
- return getModel( parent.getGroupId(), parent.getArtifactId(), parent.getVersion(), "pom" );
- }
-
- protected Model getModel( String groupId, String artifactId, String version, String type )
- {
- // getLog().info( ".getModel(" + groupId + ", " + artifactId + ", " + version + ", " + type + ")" );
- Artifact pomArtifact = artifactFactory.createProjectArtifact( groupId, artifactId, version );
-
- String path = localRepository.getLayout().pathOf( pomArtifact );
-
- File pomFile = new File( localRepository.getBasedir(), path );
-
- if ( pomFile.exists() )
- {
- FileReader reader = null;
- try
- {
- reader = new FileReader( pomFile );
- Model model = modelReader.read( reader );
-
- // HACK: to allow ${pom.groupId} expressions to work, WITHOUT resolving/merginc parent.
- // (The merging of parent pom is done elsewhere)
- if ( StringUtils.isEmpty( model.getGroupId() ) )
- {
- if( model.getParent() != null )
- {
- model.setGroupId( model.getParent().getGroupId() );
- }
- }
-
- // HACK: to fix bad poms in repo (see jetty:jetty:4.2.10::jar for example)
- model.setVersion( version );
-
- // Interpolate the properties?
- if( modelInterpolator == null )
- {
- modelInterpolator = new RegexBasedModelInterpolator();
- }
-
- model = modelInterpolator.interpolate( model, Collections.EMPTY_MAP, false );
-
- return model;
- }
- catch ( Exception e )
- {
- getLog().warn(
- "Unable to read pom file " + pomFile.getAbsolutePath() + " : (" + e.getClass().getName()
- + "): " + e.getMessage() );
- }
- finally
- {
- IOUtil.close( reader );
- }
- }
-
- // no pom file.
-
- Model model = new Model();
- model.setGroupId( groupId );
- model.setArtifactId( artifactId );
- model.setVersion( version );
- model.setPackaging( type );
-
- return model;
- }
-
- private String getGroupId( Model model )
- {
- String groupId = model.getGroupId();
-
- if ( StringUtils.isEmpty( groupId ) )
- {
- if ( model.getParent() != null )
- {
- groupId = model.getParent().getGroupId();
- }
- }
-
- return groupId;
- }
-
- private String getVersion( Model model )
- {
- String version = model.getVersion();
-
- if ( StringUtils.isEmpty( version ) )
- {
- if ( model.getParent() != null )
- {
- version = model.getParent().getVersion();
- }
- }
-
- return VersionUtil.getBaseVersion( version );
- }
-
- protected boolean isNotBlank( String str )
- {
- return !isBlank( str );
- }
-
- private boolean isBlank( String str )
- {
- if ( str == null )
- {
- return true;
- }
-
- return ( str.trim().length() <= 0 );
- }
-
- protected boolean isNotEmpty( Collection coll )
- {
- return !isEmpty( coll );
- }
-
- protected boolean isEmpty( Collection coll )
- {
- if ( coll == null )
- {
- return true;
- }
-
- return coll.isEmpty();
- }
-
- protected String toKey( Parent ref )
- {
- StringBuffer key = new StringBuffer();
-
- key.append( ref.getGroupId() ).append( ":" );
- key.append( ref.getArtifactId() ).append( ":" );
- key.append( ref.getVersion() );
-
- return key.toString();
- }
-
- protected String toKey( Exclusion ref )
- {
- StringBuffer key = new StringBuffer();
-
- key.append( ref.getGroupId() ).append( ":" );
- key.append( ref.getArtifactId() );
-
- return key.toString();
- }
-
- protected String toKey( Model ref )
- {
- StringBuffer key = new StringBuffer();
-
- key.append( getGroupId( ref ) ).append( ":" );
- key.append( ref.getArtifactId() ).append( ":" );
- key.append( getVersion( ref ) );
-
- return key.toString();
- }
-
- protected String toKey( Dependency ref )
- {
- StringBuffer key = new StringBuffer();
-
- key.append( ref.getGroupId() ).append( ":" );
- key.append( ref.getArtifactId() ).append( ":" );
- key.append( ref.getVersion() ).append( ":" );
- key.append( StringUtils.defaultString( ref.getClassifier() ) ).append( ":" );
- key.append( ref.getType() );
-
- return key.toString();
- }
-
- protected String toKey( Artifact ref )
- {
- StringBuffer key = new StringBuffer();
-
- key.append( ref.getGroupId() ).append( ":" );
- key.append( ref.getArtifactId() ).append( ":" );
- key.append( ref.getVersion() ).append( ":" );
- key.append( StringUtils.defaultString( ref.getClassifier() ) ).append( ":" );
- key.append( ref.getType() );
-
- return key.toString();
- }
-
- public ArtifactFactory getArtifactFactory()
- {
- return artifactFactory;
- }
-
- public void setArtifactFactory( ArtifactFactory artifactFactory )
- {
- this.artifactFactory = artifactFactory;
- }
-
- public ArtifactRepository getLocalRepository()
- {
- return localRepository;
- }
-
- public void setLocalRepository( ArtifactRepository localRepository )
- {
- this.localRepository = localRepository;
- }
-
- public File getOutputDir()
- {
- return outputDir;
- }
-
- public void setOutputDir( File outputDir )
- {
- this.outputDir = outputDir;
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.plugins.dev.testgen;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.Predicate;
-import org.apache.commons.collections.functors.NotPredicate;
-import org.apache.maven.archiva.plugins.dev.functors.DependencyNodeToArtifactTransformer;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
-import org.apache.maven.artifact.resolver.ArtifactCollector;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.shared.dependency.tree.DependencyTree;
-import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder;
-import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.StringUtils;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * DependencyGraphTestCreator
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class DependencyGraphTestCreator
- extends AbstractCreator
-{
- private class RootArtifactPredicate
- implements Predicate
- {
- private String rootKey;
-
- public RootArtifactPredicate( DependencyTree tree )
- {
- this.rootKey = toKey( tree.getRootNode().getArtifact() );
- }
-
- public boolean evaluate( Object input )
- {
- boolean satisfies = false;
-
- if ( input instanceof Artifact )
- {
- Artifact nodeArtifact = (Artifact) input;
- String key = toKey( nodeArtifact );
-
- if ( key.equals( rootKey ) )
- {
- satisfies = true;
- }
- }
-
- return satisfies;
- }
- }
-
- private File outputFile;
-
- private PrintWriter out;
-
- private DependencyTreeBuilder dependencyTreeBuilder;
-
- private ArtifactMetadataSource artifactMetadataSource;
-
- private ArtifactCollector collector;
-
- public void create( String classPrefix )
- throws MojoExecutionException
- {
- String classname = classPrefix + "DependencyGraphTest";
-
- getLog().info( "Generating " + classname + ".java ..." );
-
- outputFile = new File( outputDir, classname + ".java" );
- try
- {
- out = new PrintWriter( outputFile );
- }
- catch ( FileNotFoundException e )
- {
- throw new MojoExecutionException( "Unable to open file " + outputFile.getName() + " for output: "
- + e.getMessage(), e );
- }
-
- try
- {
- out.println( "package org.apache.maven.archiva.dependency.graph;" );
- out.println( "" );
-
- writeLicense( out );
-
- // Imports
- out.println( "import org.apache.maven.archiva.dependency.DependencyGraphFactory;" );
- out.println( "import org.apache.maven.archiva.model.DependencyScope;" );
- out.println( "import org.apache.maven.archiva.model.VersionedReference;" );
- out.println( "" );
- out.println( "import java.util.ArrayList;" );
- out.println( "import java.util.List;" );
- out.println( "" );
-
- String projectKey = toKey( project.getModel() );
-
- writeJavadoc( classname, projectKey );
-
- // The class itself.
- out.println( "public class " + classname );
- out.println( " extends AbstractDependencyGraphFactoryTestCase" );
- out.println( "{" );
-
- DependencyTree dependencyTree = getDependencyTree();
-
- writeGraphNodesTest( classPrefix, dependencyTree );
-
- // TODO: enable in future, when resolution between archiva and maven are equal.
- // writeDirectCompileDepsTest( classPrefix, dependencyTree );
- // writeDirectTestDepsTest( classPrefix, dependencyTree );
- // writeTransitiveCompileDepsTest( classPrefix, dependencyTree );
- // writeTransitiveTestDepsTest( classPrefix, dependencyTree );
-
- out.println( "}" );
- }
- finally
- {
- out.flush();
- IOUtil.close( out );
- }
- }
-
- public ArtifactMetadataSource getArtifactMetadataSource()
- {
- return artifactMetadataSource;
- }
-
- public ArtifactCollector getCollector()
- {
- return collector;
- }
-
- public DependencyTreeBuilder getDependencyTreeBuilder()
- {
- return dependencyTreeBuilder;
- }
-
- public void setArtifactMetadataSource( ArtifactMetadataSource artifactMetadataSource )
- {
- this.artifactMetadataSource = artifactMetadataSource;
- }
-
- public void setCollector( ArtifactCollector collector )
- {
- this.collector = collector;
- }
-
- public void setDependencyTreeBuilder( DependencyTreeBuilder dependencyTreeBuilder )
- {
- this.dependencyTreeBuilder = dependencyTreeBuilder;
- }
-
- private DependencyTree getDependencyTree()
- throws MojoExecutionException
- {
- try
- {
- return dependencyTreeBuilder.buildDependencyTree( project, localRepository, artifactFactory,
- artifactMetadataSource, collector );
- }
- catch ( DependencyTreeBuilderException e )
- {
- String emsg = "Unable to build dependency tree.";
- getLog().error( emsg, e );
- throw new MojoExecutionException( emsg, e );
- }
- }
-
- private void writeDirectCompileDepsTest( String classPrefix, DependencyTree tree )
- {
- out.println( " public void testResolveOfDirectCompileDeps()" );
- out.println( " throws GraphTaskException" );
- out.println( " {" );
- writeTestProlog( classPrefix );
- writeDirectDependenciesCheck( tree, "compile" );
- out.println( " }" );
- out.println( "" );
- }
-
- private void writeDirectDependenciesCheck( DependencyTree dependencyTree, String scope )
- {
- out.println( " // Check for direct dependencies on scope " + scope );
- out.println( " expectedNodes.clear();" );
-
- List directDeps = new ArrayList();
- directDeps.addAll( dependencyTree.getRootNode().getChildren() );
- CollectionUtils.transform( directDeps, new DependencyNodeToArtifactTransformer() );
-
- Collections.sort( directDeps );
-
- writeExpectedNodesAdd( directDeps, scope );
-
- out.println( " assertDirectNodes( graph, expectedNodes, \"" + scope + "\" );" );
- }
-
- private void writeDirectTestDepsTest( String classPrefix, DependencyTree tree )
- {
- out.println( " public void testResolveOfDirectTestDeps()" );
- out.println( " throws GraphTaskException" );
- out.println( " {" );
- writeTestProlog( classPrefix );
- writeDirectDependenciesCheck( tree, "test" );
- out.println( " }" );
- out.println( "" );
- }
-
- private void writeExpectedNodesAdd( List deps, String scope )
- {
- Iterator it = deps.iterator();
- while ( it.hasNext() )
- {
- Artifact artifact = (Artifact) it.next();
- String depKey = toKey( artifact );
- if ( StringUtils.equals( scope, artifact.getScope() ) )
- {
- out.println( " expectedNodes.add( \"" + depKey + "\" );" );
- }
- }
- }
-
- private void writeJavadoc( String classname, String projectKey )
- {
- out.println( "/**" );
- out.println( " * " + classname );
- out.println( " * " );
- out.println( " * DependencyGraphTest for testing <code>" + projectKey + "</code>" );
- out.println( " *" );
- out.println( " * Generated by <code>archivadev:generate-dependency-tests</code> plugin" );
- out.println( " * @version $Id$" );
- out.println( " */" );
- }
-
- private void writeGraphNodesTest( String classPrefix, final DependencyTree tree )
- {
- out.println( " public void testResolvedDepsToNodes()" );
- out.println( " throws GraphTaskException" );
- out.println( " {" );
- writeTestProlog( classPrefix );
-
- String projectKey = toKey( project.getModel() );
- out.println( " String expectedRootRef = \"" + projectKey + "\";" );
- out.println( " List expectedNodes = new ArrayList();" );
- out.println( "" );
- out.println( " // Check for all nodes, regardless of scope." );
- out.println( " expectedNodes.clear();" );
-
- // Add all deps.
- List deps = new ArrayList();
- Predicate notRootNode = NotPredicate.getInstance( new RootArtifactPredicate( tree ) );
- CollectionUtils.select( tree.getArtifacts(), notRootNode, deps );
- CollectionUtils.transform( deps, new DependencyNodeToArtifactTransformer() );
- Collections.sort( deps );
-
- Iterator it = deps.iterator();
- while ( it.hasNext() )
- {
- Artifact artifact = (Artifact) it.next();
- String depKey = toKey( artifact );
- out.println( " expectedNodes.add( \"" + depKey + "\" );" );
- }
-
- out.println( "" );
- out.println( " assertGraph( graph, expectedRootRef, expectedNodes );" );
-
- out.println( " }" );
- out.println( "" );
-
- }
-
- private void writeTestProlog( String classPrefix )
- {
- out.println( " MemoryRepositoryDependencyGraphBuilder graphBuilder = " );
- out.println( " new MemoryRepositoryDependencyGraphBuilder();" );
- out.println( " MemoryRepository repository = new " + classPrefix + "MemoryRepository();" );
- out.println( " graphBuilder.setMemoryRepository( repository );" );
- out.println( "" );
- out.println( " // Create the factory, and add the test resolver." );
- out.println( " DependencyGraphFactory factory = new DependencyGraphFactory();" );
- out.println( " factory.setGraphBuilder( graphBuilder );" );
- out.println( " factory.setDesiredScope( DependencyScope.TEST );" );
- out.println( "" );
- out.println( " // Get the model to resolve from" );
- out.println( " VersionedReference rootRef = toVersionedReference( \"" + project.getGroupId() + ":"
- + project.getArtifactId() + ":" + project.getVersion() + "\"); " );
- out.println( "" );
- out.println( " // Perform the resolution." );
- out.println( " DependencyGraph graph = factory.getGraph( rootRef );" );
- out.println( "" );
- out.println( " // Test the results." );
- out.println( " assertNotNull( \"Graph shouldn't be null.\", graph );" );
- out.println( "" );
- }
-
- private void writeTransientDependenciesCheck( DependencyTree dependencyTree, String scope )
- {
- out.println( " // Check for transient dependencies on scope " + scope );
- out.println( " expectedNodes.clear();" );
-
- // Add all deps.
- List deps = new ArrayList( dependencyTree.getArtifacts() );
- // Remove the direct deps.
- List directDeps = new ArrayList();
- directDeps.addAll( dependencyTree.getRootNode().getChildren() );
- CollectionUtils.transform( directDeps, new DependencyNodeToArtifactTransformer() );
- deps.removeAll( directDeps );
-
- Collections.sort( deps );
-
- writeExpectedNodesAdd( deps, scope );
-
- out.println( " assertTransientNodes( graph, expectedNodes, \"" + scope + "\" );" );
- }
-
- private void writeTransitiveCompileDepsTest( String classPrefix, DependencyTree tree )
- {
- out.println( " public void testResolveOfTransitiveCompileDeps()" );
- out.println( " throws GraphTaskException" );
- out.println( " {" );
- writeTestProlog( classPrefix );
- writeTransientDependenciesCheck( tree, "compile" );
- out.println( " }" );
- out.println( "" );
- }
-
- private void writeTransitiveTestDepsTest( String classPrefix, DependencyTree tree )
- {
- out.println( " public void testResolveOfTransitiveTestDeps()" );
- out.println( " throws GraphTaskException" );
- out.println( " {" );
- writeTestProlog( classPrefix );
- writeTransientDependenciesCheck( tree, "test" );
- out.println( " }" );
- out.println( "" );
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.plugins.dev.testgen;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.DependencyManagement;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.ProjectBuildingException;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * DependencyUtils - common utilities for dependencies.
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class DependencyUtils
-{
- public static Map getManagedVersionMap( MavenProject project, ArtifactFactory factory ) throws ProjectBuildingException
- {
- DependencyManagement dependencyManagement = project.getDependencyManagement();
- Map managedVersionMap;
-
- if ( dependencyManagement != null && dependencyManagement.getDependencies() != null )
- {
- managedVersionMap = new HashMap();
-
- for ( Iterator iterator = dependencyManagement.getDependencies().iterator(); iterator.hasNext(); )
- {
- Dependency dependency = (Dependency) iterator.next();
-
- try
- {
- VersionRange versionRange = VersionRange.createFromVersionSpec( dependency.getVersion() );
-
- Artifact artifact =
- factory.createDependencyArtifact( dependency.getGroupId(), dependency.getArtifactId(),
- versionRange, dependency.getType(),
- dependency.getClassifier(), dependency.getScope() );
-
- managedVersionMap.put( dependency.getManagementKey(), artifact );
- }
- catch ( InvalidVersionSpecificationException exception )
- {
- throw new ProjectBuildingException( project.getId(), "Unable to parse version '"
- + dependency.getVersion() + "' for dependency '" + dependency.getManagementKey()
- + "': " + exception.getMessage(), exception );
- }
- }
- }
- else
- {
- managedVersionMap = Collections.EMPTY_MAP;
- }
-
- return managedVersionMap;
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.plugins.dev.testgen;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.Predicate;
-import org.apache.commons.collections.iterators.EnumerationIterator;
-import org.apache.maven.archiva.plugins.dev.functors.MatchingDependencyPredicate;
-import org.apache.maven.artifact.InvalidArtifactRTException;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.DistributionManagement;
-import org.apache.maven.model.Exclusion;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Relocation;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.StringUtils;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.PrintWriter;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-/**
- * MemoryRepositoryCreator
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class MemoryRepositoryCreator
- extends AbstractCreator
-{
- private File outputFile;
-
- private PrintWriter out;
-
- private int modelsProcessed = 0;
-
- public void create( String classPrefix )
- throws MojoExecutionException
- {
- getLog().info( "Generating " + classPrefix + "MemoryRepository.java ..." );
- getLog().info( "Please be patient, this can take a few minutes ..." );
-
- modelsProcessed = 0;
-
- outputFile = new File( outputDir, classPrefix + "MemoryRepository.java" );
- try
- {
- out = new PrintWriter( outputFile );
- }
- catch ( FileNotFoundException e )
- {
- throw new MojoExecutionException( "Unable to open file " + outputFile.getName() + " for output: "
- + e.getMessage(), e );
- }
-
- try
- {
- out.println( "package org.apache.maven.archiva.dependency.graph;" );
- out.println( "" );
-
- writeLicense( out );
-
- // Imports
- out.println( "import org.apache.maven.archiva.model.ArchivaProjectModel;" );
- out.println( "import org.apache.maven.archiva.model.Dependency;" );
- out.println( "import org.apache.maven.archiva.model.VersionedReference;" );
- out.println( "" );
-
- String projectKey = toKey( project.getModel() );
-
- writeJavadoc( classPrefix + "MemoryRepository", projectKey );
-
- // The class itself.
- out.println( "public class " + classPrefix + "MemoryRepository" );
- out.println( " extends AbstractMemoryRepository" );
- out.println( "{" );
-
- writeTest();
-
- out.println( "}" );
- }
- finally
- {
- out.flush();
- IOUtil.close( out );
- }
-
- }
-
- private void writeJavadoc( String classname, String projectKey )
- {
- out.println( "/**" );
- out.println( " * " + classname );
- out.println( " * " );
- out.println( " * MemoryRepository for testing <code>" + projectKey + "</code>" );
- out.println( " *" );
- out.println( " * Generated by <code>archivadev:generate-dependency-tests</code> plugin" );
- out.println( " * @version $Id$" );
- out.println( " */" );
- }
-
- private void writeTest()
- {
- out.println( " public void initialize()" );
- out.println( " {" );
- out.println( " ArchivaProjectModel model;" );
- out.println( " Dependency dep;" );
- out.println( "" );
-
- Set seenModels = new HashSet();
-
- writeModel( seenModels, project.getModel() );
-
- getLog().info(
- "Processing done: Processed " + modelsProcessed + " models (" + seenModels.size()
- + " were unique)" );
-
- out.println( " }" );
- }
-
- private void writeModel( Set seenModels, Model model )
- {
- String projectKey = toKey( model );
-
- modelsProcessed++;
-
- if ( ( modelsProcessed % 100 ) == 0 )
- {
- getLog()
- .info( "Processed " + modelsProcessed + " models (" + seenModels.size() + " unique) ..." );
- }
-
- Relocation relocation = null;
-
- if ( seenModels.contains( projectKey ) )
- {
- return;
- }
-
- seenModels.add( projectKey );
-
- out.println( " model = toModel( \"" + projectKey + "\" );" );
-
- if ( model.getParent() != null )
- {
- String parentKey = toKey( model.getParent() );
- out.println( " model.setParentProject( toParent( \"" + parentKey + "\" ) );" );
- }
-
- if ( isNotEmpty( model.getDependencies() ) )
- {
- Iterator it = model.getDependencies().iterator();
- while ( it.hasNext() )
- {
- Dependency dep = applyDepMan( (Dependency) it.next(), model );
-
- writeAddDependency( "addDependency", dep );
- }
- }
-
- if ( ( model.getDependencyManagement() != null )
- && isNotEmpty( model.getDependencyManagement().getDependencies() ) )
- {
- Iterator it = model.getDependencyManagement().getDependencies().iterator();
- while ( it.hasNext() )
- {
- Dependency dep = (Dependency) it.next();
-
- writeAddDependency( "addDependencyManagement", dep );
- }
- }
-
- if ( isNotEmpty( model.getProperties() ) )
- {
- Iterator it = new EnumerationIterator( model.getProperties().keys() );
- while ( it.hasNext() )
- {
- String key = (String) it.next();
- String value = model.getProperties().getProperty( key );
- out.println( " model.addProperty( \"" + key + "\", \"" + value + "\" );" );
- }
- }
-
- if ( model.getDistributionManagement() != null )
- {
- DistributionManagement distMgmt = model.getDistributionManagement();
-
- if ( distMgmt.getRelocation() != null )
- {
- relocation = distMgmt.getRelocation();
-
- out.println( " model.setRelocation( new VersionedReference() );" );
- if ( StringUtils.isNotEmpty( relocation.getGroupId() ) )
- {
- out.println( " model.getRelocation().setGroupId( \"" + relocation.getGroupId() + "\" );" );
- }
- if ( StringUtils.isNotEmpty( relocation.getArtifactId() ) )
- {
- out
- .println( " model.getRelocation().setArtifactId( \"" + relocation.getArtifactId()
- + "\" );" );
- }
- if ( StringUtils.isNotEmpty( relocation.getVersion() ) )
- {
- out.println( " model.getRelocation().setVersion( \"" + relocation.getVersion() + "\" );" );
- }
- }
- }
-
- out.println( " addModel( model );" );
- out.println( "" );
-
- if ( model.getParent() != null )
- {
- Model parentModel = getModel( model.getParent() );
- writeModel( seenModels, parentModel );
- }
-
- if ( relocation != null )
- {
- Model relocatedModel = getModel( model, relocation );
- writeModel( seenModels, relocatedModel );
- }
-
- writeModelDependencies( seenModels, projectKey, model );
- writeModelDependencyManagement( seenModels, projectKey, model );
- }
-
- private Model getModel( Model model, Relocation relocation )
- {
- String groupId = relocation.getGroupId();
- String artifactId = relocation.getArtifactId();
- String version = relocation.getVersion();
-
- // Set empty groupId.
- if ( StringUtils.isEmpty( groupId ) )
- {
- groupId = model.getGroupId();
-
- if ( StringUtils.isEmpty( groupId ) )
- {
- if ( model.getParent() == null )
- {
- throw new IllegalStateException( "BAD POM: GroupId for relocation in " + toKey( model )
- + " cannot be determined, as there is no Parent Pom reference." );
- }
-
- groupId = model.getParent().getGroupId();
- }
- }
-
- // Set empty artifactId.
- if ( StringUtils.isEmpty( artifactId ) )
- {
- artifactId = model.getArtifactId();
-
- if ( StringUtils.isEmpty( artifactId ) )
- {
- if ( model.getParent() == null )
- {
- throw new IllegalStateException( "BAD POM: ArtifactId for relocation in " + toKey( model )
- + " cannot be determined, as there is no Parent Pom reference." );
- }
-
- artifactId = model.getParent().getArtifactId();
- }
- }
-
- // Set empty version.
- if ( StringUtils.isEmpty( version ) )
- {
- version = model.getVersion();
-
- if ( StringUtils.isEmpty( version ) )
- {
- if ( model.getParent() == null )
- {
- throw new IllegalStateException( "BAD POM: version for relocation in " + toKey( model )
- + " cannot be determined, as there is no Parent Pom reference." );
- }
-
- version = model.getParent().getVersion();
- }
- }
-
- return getModel( groupId, artifactId, version, "pom" );
- }
-
- private void writeAddDependency( String addMethod, Dependency dep )
- {
- boolean useShortForm = true;
- String depKey = toKey( dep );
-
- useShortForm = isEmpty( dep.getExclusions() ) && !dep.isOptional();
-
- String scopePart = "";
-
- if ( isNotBlank( dep.getScope() ) )
- {
- scopePart = ", \"" + dep.getScope() + "\"";
- }
-
- if ( useShortForm )
- {
- out.println( " model." + addMethod + "( toDependency( \"" + depKey + "\"" + scopePart + " ) );" );
- return;
- }
-
- out.println( " dep = toDependency( \"" + depKey + "\"" + scopePart + " );" );
-
- if ( isNotEmpty( dep.getExclusions() ) )
- {
- Iterator it = dep.getExclusions().iterator();
- while ( it.hasNext() )
- {
- Exclusion exclusion = (Exclusion) it.next();
- String exkey = toKey( exclusion );
- out.println( " addExclusion( dep, \"" + exkey + "\" );" );
- }
- }
-
- if ( dep.isOptional() )
- {
- out.println( " dep.setOptional( true );" );
- }
-
- out.println( " model." + addMethod + "( dep );" );
- }
-
- private void writeModelDependencies( Set seenModels, String projectKey, Model model )
- {
- if ( model.getDependencies() == null )
- {
- return;
- }
-
- Iterator it = model.getDependencies().iterator();
-
- while ( it.hasNext() )
- {
- Dependency dep = applyDepMan( (Dependency) it.next(), model );
-
- Model rawModel = getModel( dep );
-
- try
- {
- writeModel( seenModels, rawModel );
- }
- catch ( InvalidArtifactRTException e )
- {
- getLog().error(
- "Encountered invalid dependency/artifact during [" + projectKey + "] : "
- + e.getMessage(), e );
- throw e;
- }
- }
- }
-
- private void writeModelDependencyManagement( Set seenModels, String projectKey, Model model )
- {
- if ( model.getDependencyManagement() == null )
- {
- return;
- }
-
- Iterator it = model.getDependencyManagement().getDependencies().iterator();
-
- while ( it.hasNext() )
- {
- Dependency dep = (Dependency) it.next();
-
- Model rawModel = getModel( dep );
-
- try
- {
- writeModel( seenModels, rawModel );
- }
- catch ( InvalidArtifactRTException e )
- {
- getLog().error(
- "Encountered invalid dependency/artifact during [" + projectKey + "] : "
- + e.getMessage(), e );
- throw e;
- }
- }
- }
-
- private Dependency applyDepMan( Dependency dependency, Model model )
- {
- if ( model.getDependencyManagement() != null )
- {
- if ( model.getDependencyManagement().getDependencies() != null )
- {
- // Attempt to find matching dep.
- Predicate matchingDep = new MatchingDependencyPredicate( dependency );
- Dependency depman = (Dependency) CollectionUtils.find( model.getDependencyManagement()
- .getDependencies(), matchingDep );
-
- if ( depman != null )
- {
- dependency.setVersion( depman.getVersion() );
- dependency.setScope( StringUtils.defaultString( depman.getScope(), dependency.getScope() ) );
-
- // Found it!
- return dependency;
- }
- }
- }
-
- if ( model.getParent() != null )
- {
- Model parentModel = getModel( model.getParent() );
- return applyDepMan( dependency, parentModel );
- }
-
- return dependency;
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.plugins.dev.utils;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.codehaus.plexus.util.StringUtils;
-
-/**
- * VariableNames
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class VariableNames
-{
- public static String toClassName( String raw )
- {
- return StringUtils.capitalise( toVariableName( raw ) );
- }
-
- public static String toVariableName( String raw )
- {
- StringBuffer sb = new StringBuffer();
-
- String parts[] = StringUtils.split( raw, "-_:." );
- for ( int i = 0; i < parts.length; i++ )
- {
- String part = parts[i];
- sb.append( StringUtils.capitalise( part ) );
- }
-
- return StringUtils.uncapitalise( sb.toString() );
- }
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright 2005-2006 The Apache Software Foundation.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<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.apache.maven.archiva</groupId>
- <artifactId>archiva</artifactId>
- <version>1.0-beta-4-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <groupId>org.apache.maven.archiva.tools</groupId>
- <artifactId>tools-parent</artifactId>
- <version>1.0-SNAPSHOT</version>
- <name>Archiva Tools :: Parent</name>
- <packaging>pom</packaging>
-
- <modules>
- <module>maven-archivadev-plugin</module>
- </modules>
-</project>