From 4c2925ab015950cec630923ac10c2cdc352f75a0 Mon Sep 17 00:00:00 2001 From: David Nalley Date: Wed, 14 Sep 2011 16:45:43 -0400 Subject: [PATCH] restoring proper licensing notices originally committed in ad79436f2c304db27f5aee355527ffce18cf2590 but unintentionally reverted when trying to fix a few build issues --- .../cloud/usage/UsageAlertManagerImpl.java | 84 +++++++++++-------- usage/src/com/cloud/usage/UsageManager.java | 22 ++++- .../src/com/cloud/usage/UsageManagerImpl.java | 40 ++++++--- .../com/cloud/usage/UsageSanityChecker.java | 16 +++- usage/src/com/cloud/usage/UsageServer.java | 22 ++++- .../usage/parser/IPAddressUsageParser.java | 22 ++++- .../usage/parser/LoadBalancerUsageParser.java | 22 ++++- .../parser/NetworkOfferingUsageParser.java | 22 ++++- .../usage/parser/NetworkUsageParser.java | 22 ++++- .../parser/PortForwardingUsageParser.java | 22 ++++- .../usage/parser/StorageUsageParser.java | 42 ++++++---- .../com/cloud/usage/parser/UsageParser.java | 22 ++++- .../usage/parser/VMInstanceUsageParser.java | 22 ++++- .../cloud/usage/parser/VolumeUsageParser.java | 22 ++++- 14 files changed, 298 insertions(+), 104 deletions(-) diff --git a/usage/src/com/cloud/usage/UsageAlertManagerImpl.java b/usage/src/com/cloud/usage/UsageAlertManagerImpl.java index 6ac23df96c2..dca0392de60 100644 --- a/usage/src/com/cloud/usage/UsageAlertManagerImpl.java +++ b/usage/src/com/cloud/usage/UsageAlertManagerImpl.java @@ -1,35 +1,49 @@ -/** - * Copyright (C) 2011 Cloud.com, 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; -import java.io.UnsupportedEncodingException; -import java.util.Date; -import java.util.Map; -import java.util.Properties; - -import javax.ejb.Local; -import javax.mail.Authenticator; -import javax.mail.MessagingException; -import javax.mail.PasswordAuthentication; -import javax.mail.Session; -import javax.mail.URLName; -import javax.mail.Message.RecipientType; -import javax.mail.internet.InternetAddress; -import javax.naming.ConfigurationException; - -import org.apache.log4j.Logger; - -import com.cloud.alert.AlertManager; -import com.cloud.alert.AlertVO; -import com.cloud.alert.dao.AlertDao; -import com.cloud.configuration.dao.ConfigurationDao; -import com.cloud.utils.NumbersUtil; -import com.cloud.utils.component.ComponentLocator; -import com.sun.mail.smtp.SMTPMessage; -import com.sun.mail.smtp.SMTPSSLTransport; -import com.sun.mail.smtp.SMTPTransport; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.util.Map; +import java.util.Properties; + +import javax.ejb.Local; +import javax.mail.Authenticator; +import javax.mail.MessagingException; +import javax.mail.PasswordAuthentication; +import javax.mail.Session; +import javax.mail.URLName; +import javax.mail.Message.RecipientType; +import javax.mail.internet.InternetAddress; +import javax.naming.ConfigurationException; + +import org.apache.log4j.Logger; + +import com.cloud.alert.AlertManager; +import com.cloud.alert.AlertVO; +import com.cloud.alert.dao.AlertDao; +import com.cloud.configuration.dao.ConfigurationDao; +import com.cloud.utils.NumbersUtil; +import com.cloud.utils.component.ComponentLocator; +import com.sun.mail.smtp.SMTPMessage; +import com.sun.mail.smtp.SMTPSSLTransport; +import com.sun.mail.smtp.SMTPTransport; @Local(value={AlertManager.class}) public class UsageAlertManagerImpl implements AlertManager { @@ -186,7 +200,7 @@ public class UsageAlertManagerImpl implements AlertManager { // TODO: make sure this handles SSL transport (useAuth is true) and regular public void sendAlert(short alertType, long dataCenterId, Long podId, String subject, String content) throws MessagingException, UnsupportedEncodingException { - AlertVO alert = null; + AlertVO alert = null; if ((alertType != AlertManager.ALERT_TYPE_HOST) && (alertType != AlertManager.ALERT_TYPE_USERVM) && @@ -250,9 +264,9 @@ public class UsageAlertManagerImpl implements AlertManager { } } - @Override - public void recalculateCapacity() { - // TODO Auto-generated method stub - + @Override + public void recalculateCapacity() { + // TODO Auto-generated method stub + } } diff --git a/usage/src/com/cloud/usage/UsageManager.java b/usage/src/com/cloud/usage/UsageManager.java index a715341da23..978d0f47f7e 100644 --- a/usage/src/com/cloud/usage/UsageManager.java +++ b/usage/src/com/cloud/usage/UsageManager.java @@ -1,7 +1,21 @@ -/** - * Copyright (C) 2011 Cloud.com, 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; import com.cloud.usage.UsageJobVO; diff --git a/usage/src/com/cloud/usage/UsageManagerImpl.java b/usage/src/com/cloud/usage/UsageManagerImpl.java index d873779ba29..037084a99bf 100644 --- a/usage/src/com/cloud/usage/UsageManagerImpl.java +++ b/usage/src/com/cloud/usage/UsageManagerImpl.java @@ -1,7 +1,21 @@ -/** - * Copyright (C) 2011 Cloud.com, 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; import java.net.InetAddress; @@ -145,10 +159,10 @@ public class UsageManagerImpl implements UsageManager, Runnable { String execTime = configs.get("usage.stats.job.exec.time"); String aggregationRange = configs.get("usage.stats.job.aggregation.range"); String execTimeZone = configs.get("usage.execution.timezone"); - String aggreagationTimeZone = configs.get("usage.aggregation.timezone"); + String aggreagationTimeZone = configs.get("usage.aggregation.timezone"); m_usageTimezone = TimeZone.getTimeZone(aggreagationTimeZone); - s_logger.debug("Usage stats aggregation time zone: "+aggreagationTimeZone); + s_logger.debug("Usage stats aggregation time zone: "+aggreagationTimeZone); try { if ((execTime == null) || (aggregationRange == null)) { @@ -453,13 +467,13 @@ public class UsageManagerImpl implements UsageManager, Runnable { } finally { userTxn.close(); } - - // TODO: Fetch a maximum number of events and process them before moving on to the next range of events - - // - get a list of the latest events - // - insert the latest events into the usage.events table - List events = _usageEventDao.getRecentEvents(new Date(endDateMillis)); - + + // TODO: Fetch a maximum number of events and process them before moving on to the next range of events + + // - get a list of the latest events + // - insert the latest events into the usage.events table + List events = _usageEventDao.getRecentEvents(new Date(endDateMillis)); + Transaction usageTxn = Transaction.open(Transaction.USAGE_DB); try { diff --git a/usage/src/com/cloud/usage/UsageSanityChecker.java b/usage/src/com/cloud/usage/UsageSanityChecker.java index ef47de6465c..8b8d1343671 100644 --- a/usage/src/com/cloud/usage/UsageSanityChecker.java +++ b/usage/src/com/cloud/usage/UsageSanityChecker.java @@ -1,6 +1,18 @@ /** - * * 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 6558fa5b4cd..1057afbced8 100644 --- a/usage/src/com/cloud/usage/UsageServer.java +++ b/usage/src/com/cloud/usage/UsageServer.java @@ -1,7 +1,21 @@ -/** - * Copyright (C) 2011 Cloud.com, 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; import org.apache.log4j.Logger; diff --git a/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java b/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java index f0d1d8e3e2c..a0845f48769 100644 --- a/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java +++ b/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java @@ -1,7 +1,21 @@ -/** - * Copyright (C) 2011 Cloud.com, 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.Calendar; diff --git a/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java b/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java index 2312cc8dcb9..a05fdd1fb71 100644 --- a/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java +++ b/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java @@ -1,7 +1,21 @@ -/** - * Copyright (C) 2011 Cloud.com, 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 a1230b66f2a..cab484e433d 100644 --- a/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java +++ b/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java @@ -1,7 +1,21 @@ -/** - * Copyright (C) 2011 Cloud.com, 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 b754ade14fe..c3d38e38883 100644 --- a/usage/src/com/cloud/usage/parser/NetworkUsageParser.java +++ b/usage/src/com/cloud/usage/parser/NetworkUsageParser.java @@ -1,7 +1,21 @@ -/** - * Copyright (C) 2011 Cloud.com, 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 7366d79b652..53c3b897a30 100644 --- a/usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java +++ b/usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java @@ -1,7 +1,21 @@ -/** - * Copyright (C) 2011 Cloud.com, 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 4d82e7601f0..d8917e4b64e 100644 --- a/usage/src/com/cloud/usage/parser/StorageUsageParser.java +++ b/usage/src/com/cloud/usage/parser/StorageUsageParser.java @@ -1,7 +1,21 @@ -/** - * Copyright (C) 2011 Cloud.com, 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; @@ -60,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; @@ -126,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: @@ -157,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; } @@ -180,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 46bc5375850..682be236a89 100644 --- a/usage/src/com/cloud/usage/parser/UsageParser.java +++ b/usage/src/com/cloud/usage/parser/UsageParser.java @@ -1,7 +1,21 @@ -/** - * Copyright (C) 2011 Cloud.com, 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 6268d13b268..b9a74a4c9a0 100644 --- a/usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java +++ b/usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java @@ -1,7 +1,21 @@ -/** - * Copyright (C) 2011 Cloud.com, 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 bc0c0bc3f6d..d2de0c7599d 100644 --- a/usage/src/com/cloud/usage/parser/VolumeUsageParser.java +++ b/usage/src/com/cloud/usage/parser/VolumeUsageParser.java @@ -1,7 +1,21 @@ -/** - * Copyright (C) 2011 Cloud.com, 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;