#!/usr/local/bin/bash

SCHEMA_DIR=/www/people.apache.org/repo/m1-ibiblio-rsync-repository/org.apache.activemq/xsds
SNAPSHOT_SCHEMA_DIR=/www/people.apache.org/repo/m2-snapshot-repository/org/apache/activemq/

OUT_DIR=/www/activemq.apache.org/schema

mkdir -p $OUT_DIR/core
mkdir -p $OUT_DIR/ra
mkdir -p $OUT_DIR/jpa-store

cp $SCHEMA_DIR/activemq-core*.xsd* $OUT_DIR/core/
cp $SCHEMA_DIR/*.html $OUT_DIR/core/
/usr/local/bin/python ~/activemq-scripts/copy_snapshot_xsd.py  $SNAPSHOT_SCHEMA_DIR/activemq-core $OUT_DIR/core/

cp $SCHEMA_DIR/activemq-ra*.xsd* $OUT_DIR/ra/
cp $SCHEMA_DIR/*.html $OUT_DIR/ra/
/usr/local/bin/python ~/activemq-scripts/copy_snapshot_xsd.py  $SNAPSHOT_SCHEMA_DIR/activemq-ra $OUT_DIR/ra/

# TODO: uncomment when ActiveMQ 5.0 is released
#cp $SCHEMA_DIR/activemq-jpa-store*.xsd* $OUT_DIR/jpa-store/
cp $SCHEMA_DIR/*.html $OUT_DIR/jpa-store/

/usr/local/bin/python ~/activemq-scripts/copy_snapshot_xsd.py $SNAPSHOT_SCHEMA_DIR/activemq-jpa-store $OUT_DIR/jpa-store/



#
# Camel schemas
#          
OUT_DIR=/www/camel.apache.org/schema

# Copy the released schema
cp /www/people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/camel/camel-spring/*/*.xsd $OUT_DIR/spring/

cp /www/people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/camel/camel-cxf/*/*.xsd $OUT_DIR/cxf/

cp /www/people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/camel/camel-osgi/*/*.xsd $OUT_DIR/osgi/

cp /www/people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/camel/camel-rest/*/*.xsd $OUT_DIR/rest/

cp /www/people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/camel/camel-spring-integration/*/*.xsd $OUT_DIR/spring/integration

# Update the default schema with the latest released schema

/usr/local/bin/python ~/activemq-scripts/copy_released_xsd.py $OUT_DIR/spring camel-spring.xsd

/usr/local/bin/python ~/activemq-scripts/copy_released_xsd.py $OUT_DIR/osgi camel-osgi.xsd

/usr/local/bin/python ~/activemq-scripts/copy_released_xsd.py $OUT_DIR/cxf camel-cxf.xsd

/usr/local/bin/python ~/activemq-scripts/copy_released_xsd.py $OUT_DIR/rest camel-rest.xsd

/usr/local/bin/python ~/activemq-scripts/copy_released_xsd.py $OUT_DIR/spring/integration camel-spring-integration.xsd


# Copy the snapshot schema
SNAPSHOT_SCHEMA_DIR=/www/people.apache.org/repo/m2-snapshot-repository/org/apache/camel

/usr/local/bin/python ~/activemq-scripts/copy_snapshot_xsd.py $SNAPSHOT_SCHEMA_DIR/camel-spring $OUT_DIR/spring/

/usr/local/bin/python ~/activemq-scripts/copy_snapshot_xsd.py $SNAPSHOT_SCHEMA_DIR/camel-cxf $OUT_DIR/cxf/

/usr/local/bin/python ~/activemq-scripts/copy_snapshot_xsd.py $SNAPSHOT_SCHEMA_DIR/camel-osgi $OUT_DIR/osgi/

/usr/local/bin/python ~/activemq-scripts/copy_snapshot_xsd.py $SNAPSHOT_SCHEMA_DIR/camel-rest $OUT_DIR/rest/

/usr/local/bin/python ~/activemq-scripts/copy_snapshot_xsd.py $SNAPSHOT_SCHEMA_DIR/camel-spring-integration $OUT_DIR/spring/integration

/usr/local/bin/python ~/activemq-scripts/copy_snapshot.py /www/people.apache.org/repo/m2-snapshot-repository/org/apache/camel/camel-manual /www/camel.apache.org/manual ".pdf"
/usr/local/bin/python ~/activemq-scripts/copy_snapshot.py /www/people.apache.org/repo/m2-snapshot-repository/org/apache/camel/camel-manual /www/camel.apache.org/manual ".html"
/usr/local/bin/python ~/activemq-scripts/copy_released.py /www/people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/camel/camel-manual/ /www/camel.apache.org/manual ".pdf"
/usr/local/bin/python ~/activemq-scripts/copy_released.py /www/people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/camel/camel-manual/ /www/camel.apache.org/manual ".html"


