Removed framework-api which is completely useless. Changed framework-ipc to reference gson itself. Move VOs into engine-schema.

This commit is contained in:
Alex Huang 2013-04-30 19:06:20 -07:00
parent 5e87b0a385
commit e0d8f01ecd
34 changed files with 86 additions and 223 deletions

View File

@ -16,12 +16,12 @@
// under the License. // under the License.
package com.cloud.storage.snapshot; package com.cloud.storage.snapshot;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
import java.util.Date; import java.util.Date;
public interface SnapshotSchedule { public interface SnapshotSchedule extends InternalIdentity, Identity {
long getId();
String getUuid();
Long getVolumeId(); Long getVolumeId();
@ -38,10 +38,9 @@ public interface SnapshotSchedule {
Long getAsyncJobId(); Long getAsyncJobId();
void setAsyncJobId(long asyncJobId); void setAsyncJobId(Long asyncJobId);
Long getSnapshotId(); Long getSnapshotId();
void setSnapshotId(Long snapshotId); void setSnapshotId(Long snapshotId);
} }

View File

@ -36,6 +36,11 @@
<artifactId>cloud-engine-api</artifactId> <artifactId>cloud-engine-api</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine-schema</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>commons-httpclient</groupId> <groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId> <artifactId>commons-httpclient</artifactId>
@ -55,7 +60,5 @@
</dependencies> </dependencies>
<build> <build>
<defaultGoal>install</defaultGoal> <defaultGoal>install</defaultGoal>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
</build> </build>
</project> </project>

View File

@ -1,46 +0,0 @@
// 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.
package com.cloud.storage.snapshot;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
import java.util.Date;
public interface SnapshotSchedule extends InternalIdentity, Identity {
Long getVolumeId();
Long getPolicyId();
void setPolicyId(long policyId);
/**
* @return the scheduledTimestamp
*/
Date getScheduledTimestamp();
void setScheduledTimestamp(Date scheduledTimestamp);
Long getAsyncJobId();
void setAsyncJobId(Long asyncJobId);
Long getSnapshotId();
void setSnapshotId(Long snapshotId);
}

View File

@ -1,31 +0,0 @@
// 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.
package com.cloud.vm;
import com.cloud.storage.Storage;
/**
* VirtualDisk describes the disks that are plugged into
* the virtual machine.
*
*/
public class VirtualDisk {
public Storage.ImageFormat format;
public String url;
public boolean bootable;
public long size;
}

View File

@ -29,8 +29,6 @@
</parent> </parent>
<build> <build>
<defaultGoal>install</defaultGoal> <defaultGoal>install</defaultGoal>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
</build> </build>
<modules> <modules>
<module>api</module> <module>api</module>

View File

@ -20,16 +20,15 @@ import java.util.Date;
import java.util.List; import java.util.List;
import com.cloud.event.UsageEventVO; import com.cloud.event.UsageEventVO;
import com.cloud.exception.UsageServerException;
import com.cloud.utils.db.GenericDao; import com.cloud.utils.db.GenericDao;
public interface UsageEventDao extends GenericDao<UsageEventVO, Long> { public interface UsageEventDao extends GenericDao<UsageEventVO, Long> {
public List<UsageEventVO> listLatestEvents(Date endDate); public List<UsageEventVO> listLatestEvents(Date endDate);
public List<UsageEventVO> getLatestEvent(); public List<UsageEventVO> getLatestEvent();
List<UsageEventVO> getRecentEvents(Date endDate) throws UsageServerException; List<UsageEventVO> getRecentEvents(Date endDate);
List<UsageEventVO> listDirectIpEvents(Date startDate, Date endDate, long zoneId); List<UsageEventVO> listDirectIpEvents(Date startDate, Date endDate, long zoneId);

View File

@ -30,7 +30,6 @@ import org.springframework.stereotype.Component;
import com.cloud.dc.Vlan; import com.cloud.dc.Vlan;
import com.cloud.event.EventTypes; import com.cloud.event.EventTypes;
import com.cloud.event.UsageEventVO; import com.cloud.event.UsageEventVO;
import com.cloud.exception.UsageServerException;
import com.cloud.utils.DateUtil; import com.cloud.utils.DateUtil;
import com.cloud.utils.db.DB; import com.cloud.utils.db.DB;
import com.cloud.utils.db.Filter; import com.cloud.utils.db.Filter;
@ -38,6 +37,7 @@ import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.Transaction; import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
@Component @Component
@Local(value={UsageEventDao.class}) @Local(value={UsageEventDao.class})
@ -58,8 +58,8 @@ public class UsageEventDaoImpl extends GenericDaoBase<UsageEventVO, Long> implem
latestEventsSearch.and("processed", latestEventsSearch.entity().isProcessed(), SearchCriteria.Op.EQ); latestEventsSearch.and("processed", latestEventsSearch.entity().isProcessed(), SearchCriteria.Op.EQ);
latestEventsSearch.and("enddate", latestEventsSearch.entity().getCreateDate(), SearchCriteria.Op.LTEQ); latestEventsSearch.and("enddate", latestEventsSearch.entity().getCreateDate(), SearchCriteria.Op.LTEQ);
latestEventsSearch.done(); latestEventsSearch.done();
IpeventsSearch = createSearchBuilder(); IpeventsSearch = createSearchBuilder();
IpeventsSearch.and("startdate", IpeventsSearch.entity().getCreateDate(), SearchCriteria.Op.GTEQ); IpeventsSearch.and("startdate", IpeventsSearch.entity().getCreateDate(), SearchCriteria.Op.GTEQ);
IpeventsSearch.and("enddate", IpeventsSearch.entity().getCreateDate(), SearchCriteria.Op.LTEQ); IpeventsSearch.and("enddate", IpeventsSearch.entity().getCreateDate(), SearchCriteria.Op.LTEQ);
IpeventsSearch.and("zoneid", IpeventsSearch.entity().getZoneId(), SearchCriteria.Op.EQ); IpeventsSearch.and("zoneid", IpeventsSearch.entity().getZoneId(), SearchCriteria.Op.EQ);
@ -84,10 +84,10 @@ public class UsageEventDaoImpl extends GenericDaoBase<UsageEventVO, Long> implem
Filter filter = new Filter(UsageEventVO.class, "id", Boolean.FALSE, Long.valueOf(0), Long.valueOf(1)); Filter filter = new Filter(UsageEventVO.class, "id", Boolean.FALSE, Long.valueOf(0), Long.valueOf(1));
return listAll(filter); return listAll(filter);
} }
@Override @Override
@DB @DB
public synchronized List<UsageEventVO> getRecentEvents(Date endDate) throws UsageServerException { public synchronized List<UsageEventVO> getRecentEvents(Date endDate) {
long recentEventId = getMostRecentEventId(); long recentEventId = getMostRecentEventId();
long maxEventId = getMaxEventId(endDate); long maxEventId = getMaxEventId(endDate);
Transaction txn = Transaction.open(Transaction.USAGE_DB); Transaction txn = Transaction.open(Transaction.USAGE_DB);
@ -114,12 +114,12 @@ public class UsageEventDaoImpl extends GenericDaoBase<UsageEventVO, Long> implem
} catch (Exception ex) { } catch (Exception ex) {
txn.rollback(); txn.rollback();
s_logger.error("error copying events from cloud db to usage db", ex); s_logger.error("error copying events from cloud db to usage db", ex);
throw new UsageServerException(ex.getMessage()); throw new CloudRuntimeException(ex.getMessage());
} }
} }
@DB @DB
private long getMostRecentEventId() throws UsageServerException { private long getMostRecentEventId() {
Transaction txn = Transaction.open(Transaction.USAGE_DB); Transaction txn = Transaction.open(Transaction.USAGE_DB);
try { try {
List<UsageEventVO> latestEvents = getLatestEvent(); List<UsageEventVO> latestEvents = getLatestEvent();
@ -133,25 +133,25 @@ public class UsageEventDaoImpl extends GenericDaoBase<UsageEventVO, Long> implem
return 0; return 0;
} catch (Exception ex) { } catch (Exception ex) {
s_logger.error("error getting most recent event id", ex); s_logger.error("error getting most recent event id", ex);
throw new UsageServerException(ex.getMessage()); throw new CloudRuntimeException(ex.getMessage());
} finally { } finally {
txn.close(); txn.close();
} }
} }
private List<UsageEventVO> findRecentEvents(Date endDate) throws UsageServerException { private List<UsageEventVO> findRecentEvents(Date endDate) {
Transaction txn = Transaction.open(Transaction.USAGE_DB); Transaction txn = Transaction.open(Transaction.USAGE_DB);
try { try {
return listLatestEvents(endDate); return listLatestEvents(endDate);
} catch (Exception ex) { } catch (Exception ex) {
s_logger.error("error getting most recent event date", ex); s_logger.error("error getting most recent event date", ex);
throw new UsageServerException(ex.getMessage()); throw new CloudRuntimeException(ex.getMessage());
} finally { } finally {
txn.close(); txn.close();
} }
} }
private long getMaxEventId(Date endDate) throws UsageServerException { private long getMaxEventId(Date endDate) {
Transaction txn = Transaction.currentTxn(); Transaction txn = Transaction.currentTxn();
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try { try {
@ -165,7 +165,7 @@ public class UsageEventDaoImpl extends GenericDaoBase<UsageEventVO, Long> implem
return 0; return 0;
} catch (Exception ex) { } catch (Exception ex) {
s_logger.error("error getting max event id", ex); s_logger.error("error getting max event id", ex);
throw new UsageServerException(ex.getMessage()); throw new CloudRuntimeException(ex.getMessage());
} finally { } finally {
txn.close(); txn.close();
} }

View File

@ -1,42 +0,0 @@
<!-- 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-framework-api</artifactId>
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
<version>4.2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<!-- <dependency> <groupId>org.hornetq</groupId> <artifactId>hornetq-core-client</artifactId>
<version>snap-r9548</version> </dependency> -->
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-utils</artifactId>
<version>4.2.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>${project.basedir}/test</testSourceDirectory>
<testResources>
<testResource>
<directory>${project.basedir}/test/resources</directory>
</testResource>
</testResources>
</build>
</project>

View File

@ -20,26 +20,24 @@
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<dependencies> <dependencies>
<!-- <dependency> <groupId>org.hornetq</groupId> <artifactId>hornetq-core-client</artifactId>
<version>snap-r9548</version> </dependency> -->
<dependency> <dependency>
<groupId>org.apache.cloudstack</groupId> <groupId>cglib</groupId>
<artifactId>cloud-core</artifactId> <artifactId>cglib-nodep</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>${cs.cglib.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${cs.gson.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.cloudstack</groupId> <groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-utils</artifactId> <artifactId>cloud-utils</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>${project.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<defaultGoal>install</defaultGoal> <defaultGoal>install</defaultGoal>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>${project.basedir}/test</testSourceDirectory>
<testResources> <testResources>
<testResource> <testResource>
<directory>${project.basedir}/test/resources</directory> <directory>${project.basedir}/test/resources</directory>

View File

@ -28,7 +28,7 @@ import org.apache.cloudstack.framework.transport.TransportEndpoint;
import org.apache.cloudstack.framework.transport.TransportEndpointSite; import org.apache.cloudstack.framework.transport.TransportEndpointSite;
import org.apache.cloudstack.framework.transport.TransportProvider; import org.apache.cloudstack.framework.transport.TransportProvider;
import com.cloud.utils.concurrency.NamedThreadFactory; import com.cloud.utils.concurrency.NamedThreadFactory;
public class ClientTransportProvider implements TransportProvider { public class ClientTransportProvider implements TransportProvider {
public static final int DEFAULT_WORKER_POOL_SIZE = 5; public static final int DEFAULT_WORKER_POOL_SIZE = 5;

View File

@ -33,6 +33,5 @@
<module>ipc</module> <module>ipc</module>
<module>rest</module> <module>rest</module>
<module>events</module> <module>events</module>
<module>api</module>
</modules> </modules>
</project> </project>

13
pom.xml
View File

@ -255,6 +255,13 @@
<build> <build>
<defaultGoal>install</defaultGoal> <defaultGoal>install</defaultGoal>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<testResources>
<testResource>
<directory>test/resources</directory>
</testResource>
</testResources>
<outputDirectory>${basedir}/${cs.target.dir}/classes</outputDirectory> <outputDirectory>${basedir}/${cs.target.dir}/classes</outputDirectory>
<testOutputDirectory>${basedir}/${cs.target.dir}/test-classes</testOutputDirectory> <testOutputDirectory>${basedir}/${cs.target.dir}/test-classes</testOutputDirectory>
<pluginManagement> <pluginManagement>
@ -275,8 +282,8 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings <!--This plugin's configuration is used to store Eclipse m2e settings only.
only. It has no influence on the Maven build itself. --> It has no influence on the Maven build itself. -->
<plugin> <plugin>
<groupId>org.eclipse.m2e</groupId> <groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId> <artifactId>lifecycle-mapping</artifactId>
@ -298,7 +305,7 @@
</goals> </goals>
</pluginExecutionFilter> </pluginExecutionFilter>
<action> <action>
<ignore/> <ignore />
</action> </action>
</pluginExecution> </pluginExecution>
</pluginExecutions> </pluginExecutions>

View File

@ -1,22 +1,14 @@
<!-- <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
Licensed to the Apache Software Foundation (ASF) under one license agreements. See the NOTICE file distributed with this work for additional
or more contributor license agreements. See the NOTICE file information regarding copyright ownership. The ASF licenses this file to you under
distributed with this work for additional information the Apache License, Version 2.0 (the "License"); you may not use this file except
regarding copyright ownership. The ASF licenses this file in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
to you under the Apache License, Version 2.0 (the Unless required by applicable law or agreed to in writing, software distributed under
"License"); you may not use this file except in compliance the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
with the License. You may obtain a copy of the License at OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License. -->
http://www.apache.org/licenses/LICENSE-2.0 <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">
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> <modelVersion>4.0.0</modelVersion>
<artifactId>cloud-server</artifactId> <artifactId>cloud-server</artifactId>
<name>Apache CloudStack Server</name> <name>Apache CloudStack Server</name>
@ -110,35 +102,35 @@
<include>**/*.xml</include> <include>**/*.xml</include>
</includes> </includes>
</resource> </resource>
</resources> </resources>
<testResources> <testResources>
<testResource> <testResource>
<directory>test/resources</directory> <directory>test/resources</directory>
<excludes> <excludes>
<exclude>%regex[.*[0-9]*To[0-9]*.*Test.*]</exclude> <exclude>%regex[.*[0-9]*To[0-9]*.*Test.*]</exclude>
</excludes> </excludes>
</testResource> </testResource>
</testResources> </testResources>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<executions> <executions>
<execution> <execution>
<id>default-testCompile</id> <id>default-testCompile</id>
<phase>test-compile</phase> <phase>test-compile</phase>
<configuration> <configuration>
<testExcludes> <testExcludes>
<exclude>**/com/cloud/upgrade/*.java</exclude> <exclude>**/com/cloud/upgrade/*.java</exclude>
<exclude>**/com/cloud/async/*.java</exclude> <exclude>**/com/cloud/async/*.java</exclude>
</testExcludes> </testExcludes>
</configuration> </configuration>
<goals> <goals>
<goal>testCompile</goal> <goal>testCompile</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
@ -146,8 +138,8 @@
<argLine>-Xmx1024m</argLine> <argLine>-Xmx1024m</argLine>
<excludes> <excludes>
<exclude>%regex[.*[0-9]*To[0-9]*.*Test.*]</exclude> <exclude>%regex[.*[0-9]*To[0-9]*.*Test.*]</exclude>
<exclude>com/cloud/upgrade/AdvanceZone223To224UpgradeTest</exclude> <exclude>com/cloud/upgrade/AdvanceZone223To224UpgradeTest</exclude>
<exclude>com/cloud/upgrade/AdvanceZone217To224UpgradeTest</exclude> <exclude>com/cloud/upgrade/AdvanceZone217To224UpgradeTest</exclude>
<exclude>com/cloud/async/*</exclude> <exclude>com/cloud/async/*</exclude>
<exclude>com/cloud/cluster/*</exclude> <exclude>com/cloud/cluster/*</exclude>
<exclude>com/cloud/snapshot/*</exclude> <exclude>com/cloud/snapshot/*</exclude>
@ -173,22 +165,18 @@
</goals> </goals>
<configuration> <configuration>
<target> <target>
<copy overwrite="true" <copy overwrite="true" todir="${basedir}/target/conf">
todir="${basedir}/target/conf">
<fileset dir="${basedir}/conf"> <fileset dir="${basedir}/conf">
<include name="*.in" /> <include name="*.in" />
</fileset> </fileset>
<globmapper from="*.in" to="*" /> <globmapper from="*.in" to="*" />
<filterchain> <filterchain>
<filterreader <filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
classname="org.apache.tools.ant.filters.ReplaceTokens"> <param type="propertiesfile" value="${cs.replace.properties}" />
<param type="propertiesfile"
value="${cs.replace.properties}" />
</filterreader> </filterreader>
</filterchain> </filterchain>
</copy> </copy>
<copy <copy todir="${basedir}/target/conf">
todir="${basedir}/target/conf">
<fileset dir="${basedir}/conf"> <fileset dir="${basedir}/conf">
<exclude name="*.in" /> <exclude name="*.in" />
</fileset> </fileset>

View File

@ -172,15 +172,6 @@
<directory>${project.basedir}/test/resources</directory> <directory>${project.basedir}/test/resources</directory>
</testResource> </testResource>
</testResources> </testResources>
<!--
<testResources>
<testResource>
<directory>test/resources</directory>
</testResource>
<testResource>
<directory>conf</directory>
</testResource>
</testResources> -->
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>