diff --git a/build.xml b/build.xml
index f1f4b7fb1ac..c6712e42be3 100755
--- a/build.xml
+++ b/build.xml
@@ -25,4 +25,5 @@
+
diff --git a/build/build-usage.xml b/build/build-usage.xml
new file mode 100644
index 00000000000..b3baae9b1ae
--- /dev/null
+++ b/build/build-usage.xml
@@ -0,0 +1,49 @@
+
+
+
+
+ Cloud Stack Usage server build
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/usage/src/com/cloud/usage/UsageAlertManagerImpl.java b/usage/src/com/cloud/usage/UsageAlertManagerImpl.java
index 0fe8dc83e83..4779363fc55 100644
--- a/usage/src/com/cloud/usage/UsageAlertManagerImpl.java
+++ b/usage/src/com/cloud/usage/UsageAlertManagerImpl.java
@@ -1,5 +1,21 @@
/**
* * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
+ *
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+
+
*
*
*/
diff --git a/usage/src/com/cloud/usage/UsageManager.java b/usage/src/com/cloud/usage/UsageManager.java
index 42b583975ef..47a46459ecf 100644
--- a/usage/src/com/cloud/usage/UsageManager.java
+++ b/usage/src/com/cloud/usage/UsageManager.java
@@ -1,5 +1,20 @@
/**
- * * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
+ * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
+ *
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+
*
*
*/
diff --git a/usage/src/com/cloud/usage/UsageManagerImpl.java b/usage/src/com/cloud/usage/UsageManagerImpl.java
index dc50596cd87..70d190d754a 100644
--- a/usage/src/com/cloud/usage/UsageManagerImpl.java
+++ b/usage/src/com/cloud/usage/UsageManagerImpl.java
@@ -1,5 +1,21 @@
/**
- * * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
+ * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
+ *
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+
+
*
*
*/
diff --git a/usage/src/com/cloud/usage/UsageSanityChecker.java b/usage/src/com/cloud/usage/UsageSanityChecker.java
index ef47de6465c..e3fc88d822e 100644
--- a/usage/src/com/cloud/usage/UsageSanityChecker.java
+++ b/usage/src/com/cloud/usage/UsageSanityChecker.java
@@ -1,5 +1,20 @@
/**
- * * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
+ * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
+ *
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+
*
*
*/
diff --git a/usage/src/com/cloud/usage/UsageServer.java b/usage/src/com/cloud/usage/UsageServer.java
index 83876d89959..f2f6c121571 100644
--- a/usage/src/com/cloud/usage/UsageServer.java
+++ b/usage/src/com/cloud/usage/UsageServer.java
@@ -1,6 +1,19 @@
/**
- * * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
-*
+ * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
+ *
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .*
*
*/
diff --git a/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java b/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java
index 892117a7b97..ad86346733b 100644
--- a/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java
@@ -1,16 +1,29 @@
-/**
- * * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
-*
- *
- */
-
+/**
+ * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
+ *
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+
package com.cloud.usage.parser;
-import java.text.DecimalFormat;
+import java.text.DecimalFormat;
import java.util.Date;
-import java.util.HashMap;
+import java.util.HashMap;
import java.util.List;
-import java.util.Map;
+import java.util.Map;
import org.apache.log4j.Logger;
@@ -21,7 +34,7 @@ import com.cloud.usage.UsageVO;
import com.cloud.usage.dao.UsageDao;
import com.cloud.usage.dao.UsageIPAddressDao;
import com.cloud.user.AccountVO;
-import com.cloud.utils.Pair;
+import com.cloud.utils.Pair;
import com.cloud.utils.component.ComponentLocator;
public class IPAddressUsageParser {
@@ -30,136 +43,136 @@ public class IPAddressUsageParser {
private static ComponentLocator _locator = ComponentLocator.getLocator(UsageServer.Name, "usage-components.xml", "log4j-cloud_usage");
private static UsageDao m_usageDao = _locator.getDao(UsageDao.class);
private static UsageIPAddressDao m_usageIPAddressDao = _locator.getDao(UsageIPAddressDao.class);
-
-
- public static boolean parse(AccountVO account, Date startDate, Date endDate) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Parsing IP Address usage for account: " + account.getId());
- }
- if ((endDate == null) || endDate.after(new Date())) {
- endDate = new Date();
- }
-
- // - query usage_ip_address table with the following criteria:
- // - look for an entry for accountId with start date in the given range
- // - look for an entry for accountId with end date in the given range
- // - look for an entry for accountId with end date null (currently running vm or owned IP)
- // - look for an entry for accountId with start date before given range *and* end date after given range
- List usageIPAddress = m_usageIPAddressDao.getUsageRecords(account.getId(), account.getDomainId(), startDate, endDate);
-
- if(usageIPAddress.isEmpty()){
- s_logger.debug("No IP Address usage for this period");
- return true;
- }
-
- // This map has both the running time *and* the usage amount.
- Map> usageMap = new HashMap>();
-
- Map IPMap = new HashMap();
-
- // loop through all the usage IPs, create a usage record for each
- for (UsageIPAddressVO usageIp : usageIPAddress) {
- long IpId = usageIp.getId();
-
- String key = ""+IpId;
-
- // store the info in the IP map
- IPMap.put(key, new IpInfo(usageIp.getZoneId(), IpId, usageIp.getAddress(), usageIp.isSourceNat()));
-
- Date IpAssignDate = usageIp.getAssigned();
- Date IpReleaseDeleteDate = usageIp.getReleased();
-
- if ((IpReleaseDeleteDate == null) || IpReleaseDeleteDate.after(endDate)) {
- IpReleaseDeleteDate = endDate;
- }
-
- // clip the start date to the beginning of our aggregation range if the vm has been running for a while
- if (IpAssignDate.before(startDate)) {
- IpAssignDate = startDate;
- }
-
- long currentDuration = (IpReleaseDeleteDate.getTime() - IpAssignDate.getTime()) + 1; // make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total number of millis to charge)
-
- updateIpUsageData(usageMap, key, usageIp.getId(), currentDuration);
- }
-
- for (String ipIdKey : usageMap.keySet()) {
- Pair ipTimeInfo = usageMap.get(ipIdKey);
- long useTime = ipTimeInfo.second().longValue();
-
- // Only create a usage record if we have a runningTime of bigger than zero.
- if (useTime > 0L) {
- IpInfo info = IPMap.get(ipIdKey);
- createUsageRecord(info.getZoneId(), useTime, startDate, endDate, account, info.getIpId(), info.getIPAddress(), info.isSourceNat());
- }
- }
-
- return true;
- }
-
- private static void updateIpUsageData(Map> usageDataMap, String key, long ipId, long duration) {
- Pair ipUsageInfo = usageDataMap.get(key);
- if (ipUsageInfo == null) {
- ipUsageInfo = new Pair(new Long(ipId), new Long(duration));
- } else {
- Long runningTime = ipUsageInfo.second();
- runningTime = new Long(runningTime.longValue() + duration);
- ipUsageInfo = new Pair(ipUsageInfo.first(), runningTime);
- }
- usageDataMap.put(key, ipUsageInfo);
- }
-
- private static void createUsageRecord(long zoneId, long runningTime, Date startDate, Date endDate, AccountVO account, long IpId, String IPAddress, boolean isSourceNat) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Total usage time " + runningTime + "ms");
- }
-
- float usage = runningTime / 1000f / 60f / 60f;
-
- DecimalFormat dFormat = new DecimalFormat("#.######");
- String usageDisplay = dFormat.format(usage);
-
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Creating IP usage record with id: " + IpId + ", usage: " + usageDisplay + ", startDate: " + startDate + ", endDate: " + endDate + ", for account: " + account.getId());
- }
-
- String usageDesc = "IPAddress: "+IPAddress;
-
- // Create the usage record
-
- UsageVO usageRecord = new UsageVO(zoneId, account.getAccountId(), account.getDomainId(), usageDesc, usageDisplay + " Hrs",
- UsageTypes.IP_ADDRESS, new Double(usage), null, null, null, null, IpId, startDate, endDate, (isSourceNat?"SourceNat":""));
- m_usageDao.persist(usageRecord);
- }
-
- private static class IpInfo {
- private long zoneId;
- private long IpId;
- private String IPAddress;
- private boolean isSourceNat;
-
- public IpInfo(long zoneId,long IpId, String IPAddress, boolean isSourceNat) {
- this.zoneId = zoneId;
- this.IpId = IpId;
- this.IPAddress = IPAddress;
- this.isSourceNat = isSourceNat;
- }
-
- public long getZoneId() {
- return zoneId;
- }
-
- public long getIpId() {
- return IpId;
- }
-
- public String getIPAddress() {
- return IPAddress;
- }
-
- public boolean isSourceNat() {
- return isSourceNat;
- }
- }
+
+
+ public static boolean parse(AccountVO account, Date startDate, Date endDate) {
+ if (s_logger.isDebugEnabled()) {
+ s_logger.debug("Parsing IP Address usage for account: " + account.getId());
+ }
+ if ((endDate == null) || endDate.after(new Date())) {
+ endDate = new Date();
+ }
+
+ // - query usage_ip_address table with the following criteria:
+ // - look for an entry for accountId with start date in the given range
+ // - look for an entry for accountId with end date in the given range
+ // - look for an entry for accountId with end date null (currently running vm or owned IP)
+ // - look for an entry for accountId with start date before given range *and* end date after given range
+ List usageIPAddress = m_usageIPAddressDao.getUsageRecords(account.getId(), account.getDomainId(), startDate, endDate);
+
+ if(usageIPAddress.isEmpty()){
+ s_logger.debug("No IP Address usage for this period");
+ return true;
+ }
+
+ // This map has both the running time *and* the usage amount.
+ Map> usageMap = new HashMap>();
+
+ Map IPMap = new HashMap();
+
+ // loop through all the usage IPs, create a usage record for each
+ for (UsageIPAddressVO usageIp : usageIPAddress) {
+ long IpId = usageIp.getId();
+
+ String key = ""+IpId;
+
+ // store the info in the IP map
+ IPMap.put(key, new IpInfo(usageIp.getZoneId(), IpId, usageIp.getAddress(), usageIp.isSourceNat()));
+
+ Date IpAssignDate = usageIp.getAssigned();
+ Date IpReleaseDeleteDate = usageIp.getReleased();
+
+ if ((IpReleaseDeleteDate == null) || IpReleaseDeleteDate.after(endDate)) {
+ IpReleaseDeleteDate = endDate;
+ }
+
+ // clip the start date to the beginning of our aggregation range if the vm has been running for a while
+ if (IpAssignDate.before(startDate)) {
+ IpAssignDate = startDate;
+ }
+
+ long currentDuration = (IpReleaseDeleteDate.getTime() - IpAssignDate.getTime()) + 1; // make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total number of millis to charge)
+
+ updateIpUsageData(usageMap, key, usageIp.getId(), currentDuration);
+ }
+
+ for (String ipIdKey : usageMap.keySet()) {
+ Pair ipTimeInfo = usageMap.get(ipIdKey);
+ long useTime = ipTimeInfo.second().longValue();
+
+ // Only create a usage record if we have a runningTime of bigger than zero.
+ if (useTime > 0L) {
+ IpInfo info = IPMap.get(ipIdKey);
+ createUsageRecord(info.getZoneId(), useTime, startDate, endDate, account, info.getIpId(), info.getIPAddress(), info.isSourceNat());
+ }
+ }
+
+ return true;
+ }
+
+ private static void updateIpUsageData(Map> usageDataMap, String key, long ipId, long duration) {
+ Pair ipUsageInfo = usageDataMap.get(key);
+ if (ipUsageInfo == null) {
+ ipUsageInfo = new Pair(new Long(ipId), new Long(duration));
+ } else {
+ Long runningTime = ipUsageInfo.second();
+ runningTime = new Long(runningTime.longValue() + duration);
+ ipUsageInfo = new Pair(ipUsageInfo.first(), runningTime);
+ }
+ usageDataMap.put(key, ipUsageInfo);
+ }
+
+ private static void createUsageRecord(long zoneId, long runningTime, Date startDate, Date endDate, AccountVO account, long IpId, String IPAddress, boolean isSourceNat) {
+ if (s_logger.isDebugEnabled()) {
+ s_logger.debug("Total usage time " + runningTime + "ms");
+ }
+
+ float usage = runningTime / 1000f / 60f / 60f;
+
+ DecimalFormat dFormat = new DecimalFormat("#.######");
+ String usageDisplay = dFormat.format(usage);
+
+ if (s_logger.isDebugEnabled()) {
+ s_logger.debug("Creating IP usage record with id: " + IpId + ", usage: " + usageDisplay + ", startDate: " + startDate + ", endDate: " + endDate + ", for account: " + account.getId());
+ }
+
+ String usageDesc = "IPAddress: "+IPAddress;
+
+ // Create the usage record
+
+ UsageVO usageRecord = new UsageVO(zoneId, account.getAccountId(), account.getDomainId(), usageDesc, usageDisplay + " Hrs",
+ UsageTypes.IP_ADDRESS, new Double(usage), null, null, null, null, IpId, startDate, endDate, (isSourceNat?"SourceNat":""));
+ m_usageDao.persist(usageRecord);
+ }
+
+ private static class IpInfo {
+ private long zoneId;
+ private long IpId;
+ private String IPAddress;
+ private boolean isSourceNat;
+
+ public IpInfo(long zoneId,long IpId, String IPAddress, boolean isSourceNat) {
+ this.zoneId = zoneId;
+ this.IpId = IpId;
+ this.IPAddress = IPAddress;
+ this.isSourceNat = isSourceNat;
+ }
+
+ public long getZoneId() {
+ return zoneId;
+ }
+
+ public long getIpId() {
+ return IpId;
+ }
+
+ public String getIPAddress() {
+ return IPAddress;
+ }
+
+ public boolean isSourceNat() {
+ return isSourceNat;
+ }
+ }
}
diff --git a/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java b/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java
index 504c999f046..e0d0b1b01be 100644
--- a/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java
@@ -1,8 +1,21 @@
-/**
- * * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
- *
- */
-
+/**
+ * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
+ *
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package com.cloud.usage.parser;
import java.text.DecimalFormat;
diff --git a/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java b/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java
index 0128c0b0501..3672fdc95ba 100644
--- a/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java
@@ -1,8 +1,21 @@
-/**
- * * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
- *
- */
-
+/**
+ * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
+ *
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package com.cloud.usage.parser;
import java.text.DecimalFormat;
diff --git a/usage/src/com/cloud/usage/parser/NetworkUsageParser.java b/usage/src/com/cloud/usage/parser/NetworkUsageParser.java
index 24b7e0145c2..fa9c0375e3d 100644
--- a/usage/src/com/cloud/usage/parser/NetworkUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/NetworkUsageParser.java
@@ -1,8 +1,21 @@
-/**
- * * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
- *
- */
-
+/**
+ * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
+ *
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package com.cloud.usage.parser;
import java.util.Date;
diff --git a/usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java b/usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java
index c098786e474..575b39ce675 100644
--- a/usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java
@@ -1,8 +1,21 @@
-/**
- * * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
- *
- */
-
+/**
+ * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
+ *
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package com.cloud.usage.parser;
import java.text.DecimalFormat;
diff --git a/usage/src/com/cloud/usage/parser/StorageUsageParser.java b/usage/src/com/cloud/usage/parser/StorageUsageParser.java
index 0d4c7f5e99f..6faf56fb869 100644
--- a/usage/src/com/cloud/usage/parser/StorageUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/StorageUsageParser.java
@@ -1,8 +1,21 @@
-/**
- * * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
- *
- */
-
+/**
+ * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
+ *
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package com.cloud.usage.parser;
import java.text.DecimalFormat;
@@ -61,7 +74,7 @@ public class StorageUsageParser {
long storageId = usageStorage.getId();
int storage_type = usageStorage.getStorageType();
long size = usageStorage.getSize();
- long zoneId = usageStorage.getZoneId();
+ long zoneId = usageStorage.getZoneId();
Long sourceId = usageStorage.getSourceId();
String key = ""+storageId+"Z"+zoneId+"T"+storage_type;
@@ -127,14 +140,14 @@ public class StorageUsageParser {
s_logger.debug("Creating Storage usage record for type: "+ type + " with id: " + storageId + ", usage: " + usageDisplay + ", startDate: " + startDate + ", endDate: " + endDate + ", for account: " + account.getId());
}
- String usageDesc = "";
+ String usageDesc = "";
Long tmplSourceId = null;
int usage_type = 0;
switch(type){
case StorageTypes.TEMPLATE:
usage_type = UsageTypes.TEMPLATE;
- usageDesc += "Template ";
+ usageDesc += "Template ";
tmplSourceId = sourceId;
break;
case StorageTypes.ISO:
@@ -158,14 +171,14 @@ public class StorageUsageParser {
private static class StorageInfo {
private long zoneId;
private long storageId;
- private int storageType;
+ private int storageType;
private Long sourceId;
private long size;
public StorageInfo(long zoneId, long storageId, int storageType, Long sourceId, long size) {
this.zoneId = zoneId;
this.storageId = storageId;
- this.storageType = storageType;
+ this.storageType = storageType;
this.sourceId = sourceId;
this.size = size;
}
@@ -181,11 +194,11 @@ public class StorageUsageParser {
public int getStorageType() {
return storageType;
}
-
- public long getSourceId() {
- return sourceId;
- }
-
+
+ public long getSourceId() {
+ return sourceId;
+ }
+
public long getSize() {
return size;
diff --git a/usage/src/com/cloud/usage/parser/UsageParser.java b/usage/src/com/cloud/usage/parser/UsageParser.java
index 2802390f63f..b628a4e39c6 100644
--- a/usage/src/com/cloud/usage/parser/UsageParser.java
+++ b/usage/src/com/cloud/usage/parser/UsageParser.java
@@ -1,8 +1,21 @@
-/**
- * * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
- *
- */
-
+/**
+ * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
+ *
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package com.cloud.usage.parser;
import java.util.Date;
diff --git a/usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java b/usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java
index 2f79f287bad..93bb324d3be 100644
--- a/usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java
@@ -1,8 +1,21 @@
-/**
- * * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
- *
- */
-
+/**
+ * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
+ *
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package com.cloud.usage.parser;
import java.text.DecimalFormat;
diff --git a/usage/src/com/cloud/usage/parser/VolumeUsageParser.java b/usage/src/com/cloud/usage/parser/VolumeUsageParser.java
index f805eb74f89..85f3005a266 100644
--- a/usage/src/com/cloud/usage/parser/VolumeUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/VolumeUsageParser.java
@@ -1,8 +1,21 @@
-/**
- * * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
- *
- */
-
+/**
+ * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
+ *
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package com.cloud.usage.parser;
import java.text.DecimalFormat;