2013-01-09 04:41:27 -08:00

632 lines
26 KiB
XML

<!-- 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. -->
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>cloud-developer</artifactId>
<name>Apache CloudStack Developer Tools</name>
<packaging>pom</packaging>
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
<version>4.1.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.21</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
</build>
<profiles>
<profile>
<id>deploydb</id>
<activation>
<property>
<name>deploydb</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.parent.basedir}/utils/conf/db.properties</file>
<file>${project.parent.basedir}/utils/conf/db.properties.override</file>
</files>
<quiet>true</quiet>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<filter token="VERSION" value="${project.version}" />
<copy todir="${basedir}/target/db" filtering="true">
<fileset dir="${project.basedir}/../setup/db/" />
</copy>
<copy todir="${basedir}/target/db" filtering="true">
<fileset
dir="${project.basedir}/../awsapi-setup/db/mysql/">
<include name="**/*.sql" />
</fileset>
</copy>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${cs.mysql.version}</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>${cs.dbcp.version}</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>${cs.pool.version}</version>
</dependency>
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId>
<version>${cs.jasypt.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-utils</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-server</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>process-test-resources</phase>
<id>create-schema</id>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<includeProjectDependencies>false</includeProjectDependencies>
<includePluginDependencies>true</includePluginDependencies>
<executableDependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-server</artifactId>
</executableDependency>
<mainClass>com.cloud.upgrade.DatabaseCreator</mainClass>
<arguments>
<argument>${basedir}/target/db/create-schema.sql</argument>
<argument>${basedir}/target/db/4.1-new-db-schema.sql</argument>
<argument>${basedir}/target/db/create-schema-premium.sql</argument>
<argument>com.cloud.upgrade.DatabaseUpgradeChecker</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.5</version>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${cs.mysql.version}</version>
</dependency>
</dependencies>
<configuration>
<driver>org.gjt.mm.mysql.Driver</driver>
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}/cloud</url>
<username>${db.cloud.username}</username>
<password>${db.cloud.password}</password>
<!--all executions are ignored if -Dmaven.test.skip=true -->
<skip>${maven.test.skip}</skip>
<forceMojoExecution>true</forceMojoExecution>
</configuration>
<executions>
<execution>
<id>create-other-schema</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<srcFiles>
<srcFile>${basedir}/target/db/templates.sql</srcFile>
<srcFile>${basedir}/target/db/cloudbridge_schema.sql</srcFile>
<srcFile>${basedir}/target/db/cloudbridge_multipart.sql</srcFile>
<srcFile>${basedir}/target/db/cloudbridge_index.sql</srcFile>
<srcFile>${basedir}/target/db/cloudbridge_multipart_alter.sql</srcFile>
<srcFile>${basedir}/target/db/cloudbridge_bucketpolicy.sql</srcFile>
<srcFile>${basedir}/target/db/cloudbridge_policy_alter.sql</srcFile>
<srcFile>${basedir}/target/db/cloudbridge_offering.sql</srcFile>
<srcFile>${basedir}/target/db/cloudbridge_offering_alter.sql</srcFile>
</srcFiles>
</configuration>
</execution>
<execution>
<id>prefill-schema</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<sqlCommand>INSERT INTO `cloud`.`domain` (id, name,
parent, path, owner) VALUES (1, 'ROOT', NULL, '/',
2)</sqlCommand>
</configuration>
</execution>
<execution>
<id>prefill-configuration</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<sqlCommand>INSERT INTO `cloud`.`configuration`
(category, instance, component, name, value) VALUES
('Hidden', 'DEFAULT', 'management-server', 'init',
'false')</sqlCommand>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>cleandb</id>
<activation>
<property>
<name>cleandb</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.parent.basedir}/utils/conf/db.properties</file>
<file>${project.parent.basedir}/utils/conf/db.properties.override</file>
</files>
<quiet>true</quiet>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<filter token="VERSION" value="${project.version}" />
<copy todir="${basedir}/target/db" filtering="true">
<fileset dir="${project.basedir}/../setup/db/" />
</copy>
<copy todir="${basedir}/target/db" filtering="true">
<fileset
dir="${project.basedir}/../awsapi-setup/db/mysql/">
<include name="**/*.sql" />
</fileset>
</copy>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.5</version>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${cs.mysql.version}</version>
</dependency>
</dependencies>
<configuration>
<driver>org.gjt.mm.mysql.Driver</driver>
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}/cloud</url>
<username>${db.cloud.username}</username>
<password>${db.cloud.password}</password>
<!--all executions are ignored if -Dmaven.test.skip=true -->
<skip>${maven.test.skip}</skip>
<forceMojoExecution>true</forceMojoExecution>
</configuration>
<executions>
<execution>
<id>drop-database</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<username>root</username>
<password>${db.root.password}</password>
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
<sqlCommand>drop database if exists `cloud`</sqlCommand>
</configuration>
</execution>
<execution>
<id>create-database</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<username>root</username>
<password>${db.root.password}</password>
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
<sqlCommand>create database `cloud`</sqlCommand>
</configuration>
</execution>
<execution>
<id>grant-user-cloud</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<username>root</username>
<password>${db.root.password}</password>
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
<sqlCommand>GRANT ALL ON cloud.* to
${db.cloud.username}@`localhost` identified by
'${db.cloud.password}';</sqlCommand>
</configuration>
</execution>
<execution>
<id>grant-user-cloud-all</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<username>root</username>
<password>${db.root.password}</password>
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
<sqlCommand>GRANT ALL ON cloud.* to
${db.cloud.username}@`%` identified by
'${db.cloud.password}';</sqlCommand>
</configuration>
</execution>
<execution>
<id>drop-database-usage</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<username>root</username>
<password>${db.root.password}</password>
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
<sqlCommand>drop database if exists `cloud_usage`</sqlCommand>
</configuration>
</execution>
<execution>
<id>create-database-usage</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<username>root</username>
<password>${db.root.password}</password>
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
<sqlCommand>create database `cloud_usage`</sqlCommand>
</configuration>
</execution>
<execution>
<id>grant-user-cloud-usage</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<username>root</username>
<password>${db.root.password}</password>
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
<sqlCommand>GRANT ALL ON cloud_usage.* to
${db.cloud.username}@`localhost` identified by
'${db.cloud.password}';</sqlCommand>
</configuration>
</execution>
<execution>
<id>grant-user-cloud-usage-all</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<username>root</username>
<password>${db.root.password}</password>
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
<sqlCommand>GRANT ALL ON cloud_usage.* to
${db.cloud.username}@`%` identified by
'${db.cloud.password}';</sqlCommand>
</configuration>
</execution>
<execution>
<id>drop-database-cloudbridge</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<username>root</username>
<password>${db.root.password}</password>
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
<sqlCommand>GRANT ALL ON cloud_usage.* to
${db.cloud.username}@`localhost` identified by
'${db.cloud.password}';</sqlCommand>
</configuration>
</execution>
<execution>
<id>grant-user-cloud-bridge</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<username>root</username>
<password>${db.root.password}</password>
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
<sqlCommand>GRANT ALL ON cloudbridge.* to
${db.cloud.username}@`localhost` identified by
'${db.cloud.password}';</sqlCommand>
</configuration>
</execution>
<execution>
<id>grant-user-cloud-bridge-all</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<username>root</username>
<password>${db.root.password}</password>
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
<sqlCommand>GRANT ALL ON cloudbridge.* to
${db.cloud.username}@`%` identified by
'${db.cloud.password}';</sqlCommand>
</configuration>
</execution>
<execution>
<id>create-schema</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<srcFiles>
<srcFile>${basedir}/target/db/create-schema.sql</srcFile>
<srcFile>${basedir}/target/db/create-schema-view.sql</srcFile>
<srcFile>${basedir}/target/db/create-schema-premium.sql</srcFile>
<srcFile>${basedir}/target/db/templates.sql</srcFile>
<srcFile>${basedir}/target/db/create-index-fk.sql</srcFile>
<srcFile>${basedir}/target/db/cloudbridge_schema.sql</srcFile>
<srcFile>${basedir}/target/db/cloudbridge_multipart.sql</srcFile>
<srcFile>${basedir}/target/db/cloudbridge_index.sql</srcFile>
<srcFile>${basedir}/target/db/cloudbridge_multipart_alter.sql</srcFile>
<srcFile>${basedir}/target/db/cloudbridge_bucketpolicy.sql</srcFile>
<srcFile>${basedir}/target/db/cloudbridge_policy_alter.sql</srcFile>
<srcFile>${basedir}/target/db/cloudbridge_offering.sql</srcFile>
<srcFile>${basedir}/target/db/cloudbridge_offering_alter.sql</srcFile>
</srcFiles>
</configuration>
</execution>
<execution>
<id>prefill-developer-schema</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<autocommit>true</autocommit>
<srcFiles>
<srcFile>${basedir}/developer-prefill.sql</srcFile>
</srcFiles>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- Simulator profile -->
<profile>
<id>simulator</id>
<activation>
<property>
<name>deploydb-simulator</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.parent.basedir}/utils/conf/db.properties</file>
<file>${project.parent.basedir}/utils/conf/db.properties.override</file>
</files>
<quiet>true</quiet>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.5</version>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${cs.mysql.version}</version>
</dependency>
</dependencies>
<configuration>
<driver>org.gjt.mm.mysql.Driver</driver>
<url>jdbc:mysql://${db.simulator.host}:3306/simulator</url>
<username>${db.simulator.username}</username>
<password>${db.simulator.password}</password>
<skip>${maven.test.skip}</skip>
<forceMojoExecution>true</forceMojoExecution>
</configuration>
<executions>
<execution>
<id>drop-database</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<username>root</username>
<password>${db.root.password}</password>
<url>jdbc:mysql://${db.simulator.host}:3306</url>
<sqlCommand>drop database if exists `simulator`</sqlCommand>
</configuration>
</execution>
<execution>
<id>create-database</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<username>root</username>
<password>${db.root.password}</password>
<url>jdbc:mysql://${db.simulator.host}:3306</url>
<sqlCommand>create database `simulator`</sqlCommand>
</configuration>
</execution>
<execution>
<id>grant-user-cloud</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<username>root</username>
<password>${db.root.password}</password>
<url>jdbc:mysql://${db.simulator.host}:3306</url>
<sqlCommand>GRANT ALL ON simulator.* to
${db.simulator.username}@`localhost` identified by
'${db.simulator.password}';</sqlCommand>
</configuration>
</execution>
<execution>
<id>grant-user-cloud-all</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<username>root</username>
<password>${db.root.password}</password>
<url>jdbc:mysql://${db.simulator.host}:3306</url>
<sqlCommand>GRANT ALL ON simulator.* to
${db.simulator.username}@`%` identified by
'${db.simulator.password}';</sqlCommand>
</configuration>
</execution>
<execution>
<id>create-schema</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<srcFiles>
<srcFile>${basedir}/target/db/create-schema-simulator.sql</srcFile>
<srcFile>${basedir}/target/db/templates.simulator.sql</srcFile>
</srcFiles>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>