Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 312F6F613 for ; Sat, 6 Apr 2013 00:34:37 +0000 (UTC) Received: (qmail 78374 invoked by uid 500); 6 Apr 2013 00:34:35 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 78201 invoked by uid 500); 6 Apr 2013 00:34:34 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 78012 invoked by uid 99); 6 Apr 2013 00:34:34 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Apr 2013 00:34:34 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 3A5551EF9D; Sat, 6 Apr 2013 00:34:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mchen@apache.org To: commits@cloudstack.apache.org Date: Sat, 06 Apr 2013 00:34:40 -0000 Message-Id: <02c0cda361d842caa100ebf882ec077c@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [07/57] [abbrv] Removing ^M's from code. http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469c4dd1/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineDataCenterVO.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineDataCenterVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineDataCenterVO.java index 15bed6f..cdf08cc 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineDataCenterVO.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineDataCenterVO.java @@ -8,10 +8,10 @@ // 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. -// +// // Automatically generated by addcopyright.py at 04/03/2012 -package org.apache.cloudstack.engine.datacenter.entity.api.db; - +package org.apache.cloudstack.engine.datacenter.entity.api.db; + import java.util.Date; import java.util.Map; import java.util.UUID; @@ -39,43 +39,43 @@ import com.cloud.org.Grouping; import com.cloud.utils.NumbersUtil; import com.cloud.utils.db.GenericDao; import com.cloud.utils.db.StateMachine; - -@Entity -@Table(name="data_center") -public class EngineDataCenterVO implements EngineDataCenter, Identity { - - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name="id") - private long id; - - @Column(name="name") - private String name = null; - - @Column(name="description") - private String description = null; - - @Column(name="dns1") - private String dns1 = null; - - @Column(name="dns2") - private String dns2 = null; - - @Column(name="ip6Dns1") - private String ip6Dns1 = null; - - @Column(name="ip6Dns2") - private String ip6Dns2 = null; - - @Column(name="internal_dns1") - private String internalDns1 = null; - - @Column(name="internal_dns2") - private String internalDns2 = null; - - @Column(name="router_mac_address", updatable = false, nullable=false) - private String routerMacAddress = "02:00:00:00:00:01"; - + +@Entity +@Table(name="data_center") +public class EngineDataCenterVO implements EngineDataCenter, Identity { + + @Id + @GeneratedValue(strategy=GenerationType.IDENTITY) + @Column(name="id") + private long id; + + @Column(name="name") + private String name = null; + + @Column(name="description") + private String description = null; + + @Column(name="dns1") + private String dns1 = null; + + @Column(name="dns2") + private String dns2 = null; + + @Column(name="ip6Dns1") + private String ip6Dns1 = null; + + @Column(name="ip6Dns2") + private String ip6Dns2 = null; + + @Column(name="internal_dns1") + private String internalDns1 = null; + + @Column(name="internal_dns2") + private String internalDns2 = null; + + @Column(name="router_mac_address", updatable = false, nullable=false) + private String routerMacAddress = "02:00:00:00:00:01"; + @Column(name="guest_network_cidr") private String guestNetworkCidr = null; @@ -207,13 +207,13 @@ public class EngineDataCenterVO implements EngineDataCenter, Identity { } public EngineDataCenterVO(long id, String name, String description, String dns1, String dns2, String dns3, String dns4, String guestCidr, String domain, Long domainId, NetworkType zoneType, String zoneToken, String domainSuffix) { - this(name, description, dns1, dns2, dns3, dns4, guestCidr, domain, domainId, zoneType, zoneToken, domainSuffix, false, false, null, null); + this(name, description, dns1, dns2, dns3, dns4, guestCidr, domain, domainId, zoneType, zoneToken, domainSuffix, false, false, null, null); this.id = id; this.allocationState = Grouping.AllocationState.Enabled; - this.uuid = UUID.randomUUID().toString(); - } - - public EngineDataCenterVO(String name, String description, String dns1, String dns2, String dns3, String dns4, String guestCidr, String domain, Long domainId, NetworkType zoneType, String zoneToken, String domainSuffix, boolean securityGroupEnabled, boolean localStorageEnabled, String ip6Dns1, String ip6Dns2) { + this.uuid = UUID.randomUUID().toString(); + } + + public EngineDataCenterVO(String name, String description, String dns1, String dns2, String dns3, String dns4, String guestCidr, String domain, Long domainId, NetworkType zoneType, String zoneToken, String domainSuffix, boolean securityGroupEnabled, boolean localStorageEnabled, String ip6Dns1, String ip6Dns2) { this.name = name; this.description = description; this.dns1 = dns1; @@ -285,72 +285,72 @@ public class EngineDataCenterVO implements EngineDataCenter, Identity { public void setDomainId(Long domainId) { this.domainId = domainId; - } - + } + @Override - public String getDescription() { - return description; - } - - public String getRouterMacAddress() { - return routerMacAddress; - } - + public String getDescription() { + return description; + } + + public String getRouterMacAddress() { + return routerMacAddress; + } + @Override - public String getDns1() { - return dns1; - } - + public String getDns1() { + return dns1; + } + @Override - public String getDns2() { - return dns2; - } - + public String getDns2() { + return dns2; + } + @Override - public String getInternalDns1() { - return internalDns1; - } - + public String getInternalDns1() { + return internalDns1; + } + @Override - public String getInternalDns2() { - return internalDns2; - } - - protected EngineDataCenterVO() { - } - + public String getInternalDns2() { + return internalDns2; + } + + protected EngineDataCenterVO() { + } + @Override - public long getId() { - return id; - } - + public long getId() { + return id; + } + @Override - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public void setDns1(String dns1) { - this.dns1 = dns1; - } - - public void setDns2(String dns2) { - this.dns2 = dns2; - } - - public void setInternalDns1(String dns3) { - this.internalDns1 = dns3; - } - - public void setInternalDns2(String dns4) { - this.internalDns2 = dns4; - } - - public void setRouterMacAddress(String routerMacAddress) { - this.routerMacAddress = routerMacAddress; + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public void setDns1(String dns1) { + this.dns1 = dns1; + } + + public void setDns2(String dns2) { + this.dns2 = dns2; + } + + public void setInternalDns1(String dns3) { + this.internalDns1 = dns3; + } + + public void setInternalDns2(String dns4) { + this.internalDns2 = dns4; + } + + public void setRouterMacAddress(String routerMacAddress) { + this.routerMacAddress = routerMacAddress; } @Override @@ -501,4 +501,4 @@ public class EngineDataCenterVO implements EngineDataCenter, Identity { public void setIp6Dns2(String ip6Dns2) { this.ip6Dns2 = ip6Dns2; } -} +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469c4dd1/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHost.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHost.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHost.java index fe1b832..127c445 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHost.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHost.java @@ -1,24 +1,24 @@ -// 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 org.apache.cloudstack.engine.datacenter.entity.api.db; - -import com.cloud.host.Host; - -public interface EngineHost extends Host { - -} +// 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 org.apache.cloudstack.engine.datacenter.entity.api.db; + +import com.cloud.host.Host; + +public interface EngineHost extends Host { + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469c4dd1/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHostPodVO.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHostPodVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHostPodVO.java index 99c9540..65b9db5 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHostPodVO.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHostPodVO.java @@ -8,10 +8,10 @@ // 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. -// +// // Automatically generated by addcopyright.py at 04/03/2012 -package org.apache.cloudstack.engine.datacenter.entity.api.db; - +package org.apache.cloudstack.engine.datacenter.entity.api.db; + import java.util.Date; import java.util.UUID; @@ -34,42 +34,42 @@ import com.cloud.org.Grouping; import com.cloud.utils.NumbersUtil; import com.cloud.utils.db.GenericDao; import com.cloud.utils.db.StateMachine; - -@Entity -@Table(name = "host_pod_ref") -public class EngineHostPodVO implements EnginePod, Identity { - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - long id; - - @Column(name = "name") - private String name = null; - - @Column(name = "data_center_id") + +@Entity +@Table(name = "host_pod_ref") +public class EngineHostPodVO implements EnginePod, Identity { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + long id; + + @Column(name = "name") + private String name = null; + + @Column(name = "data_center_id") private long dataCenterId; @Column(name = "gateway") - private String gateway; - - @Column(name = "cidr_address") - private String cidrAddress; - - @Column(name = "cidr_size") - private int cidrSize; - - @Column(name = "description") + private String gateway; + + @Column(name = "cidr_address") + private String cidrAddress; + + @Column(name = "cidr_size") + private int cidrSize; + + @Column(name = "description") private String description; @Column(name="allocation_state") @Enumerated(value=EnumType.STRING) - AllocationState allocationState; + AllocationState allocationState; @Column(name = "external_dhcp") private Boolean externalDhcp; @Column(name=GenericDao.REMOVED_COLUMN) private Date removed; - + @Column(name = "uuid") private String uuid; @@ -93,66 +93,66 @@ public class EngineHostPodVO implements EnginePod, Identity { @StateMachine(state=State.class, event=Event.class) @Column(name="engine_state", updatable=true, nullable=false, length=32) protected State engineState = null; - - public EngineHostPodVO(String name, long dcId, String gateway, String cidrAddress, int cidrSize, String description) { - this.name = name; + + public EngineHostPodVO(String name, long dcId, String gateway, String cidrAddress, int cidrSize, String description) { + this.name = name; this.dataCenterId = dcId; - this.gateway = gateway; - this.cidrAddress = cidrAddress; - this.cidrSize = cidrSize; + this.gateway = gateway; + this.cidrAddress = cidrAddress; + this.cidrSize = cidrSize; this.description = description; this.allocationState = Grouping.AllocationState.Enabled; this.externalDhcp = false; this.uuid = UUID.randomUUID().toString(); - this.engineState = State.Disabled; - } - - /* - * public HostPodVO(String name, long dcId) { this(null, name, dcId); } - */ - protected EngineHostPodVO() { + this.engineState = State.Disabled; + } + + /* + * public HostPodVO(String name, long dcId) { this(null, name, dcId); } + */ + protected EngineHostPodVO() { this.uuid = UUID.randomUUID().toString(); - } - + } + @Override - public long getId() { - return id; - } - + public long getId() { + return id; + } + @Override - public long getDataCenterId() { - return dataCenterId; - } - - public void setDataCenterId(long dataCenterId) { - this.dataCenterId = dataCenterId; - } - + public long getDataCenterId() { + return dataCenterId; + } + + public void setDataCenterId(long dataCenterId) { + this.dataCenterId = dataCenterId; + } + @Override - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + @Override - public String getCidrAddress() { - return cidrAddress; - } - - public void setCidrAddress(String cidrAddress) { - this.cidrAddress = cidrAddress; - } - + public String getCidrAddress() { + return cidrAddress; + } + + public void setCidrAddress(String cidrAddress) { + this.cidrAddress = cidrAddress; + } + @Override - public int getCidrSize() { - return cidrSize; - } - - public void setCidrSize(int cidrSize) { - this.cidrSize = cidrSize; + public int getCidrSize() { + return cidrSize; + } + + public void setCidrSize(int cidrSize) { + this.cidrSize = cidrSize; } @Override @@ -162,15 +162,15 @@ public class EngineHostPodVO implements EnginePod, Identity { public void setGateway(String gateway) { this.gateway = gateway; - } - + } + @Override - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; } @Override @@ -241,5 +241,5 @@ public class EngineHostPodVO implements EnginePod, Identity { public State getState() { return engineState; - } -} + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469c4dd1/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EnginePod.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EnginePod.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EnginePod.java index 3983dd9..2adbca3 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EnginePod.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EnginePod.java @@ -1,23 +1,23 @@ -// 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 org.apache.cloudstack.engine.datacenter.entity.api.db; - -import com.cloud.dc.Pod; - -public interface EnginePod extends Pod { - -} +// 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 org.apache.cloudstack.engine.datacenter.entity.api.db; + +import com.cloud.dc.Pod; + +public interface EnginePod extends Pod { + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469c4dd1/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostDao.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostDao.java index a27ed50..3a71fe2 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostDao.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostDao.java @@ -82,4 +82,4 @@ public interface EngineHostDao extends GenericDao, StateDao< * @return */ List listAllUpAndEnabledNonHAHosts(Type type, Long clusterId, Long podId, long dcId, String haTag); -} +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469c4dd1/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostPodDao.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostPodDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostPodDao.java index 48e7773..451723e 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostPodDao.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostPodDao.java @@ -8,10 +8,10 @@ // 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. -// +// // Automatically generated by addcopyright.py at 04/03/2012 -package org.apache.cloudstack.engine.datacenter.entity.api.db.dao; - +package org.apache.cloudstack.engine.datacenter.entity.api.db.dao; + import java.util.HashMap; import java.util.List; @@ -21,13 +21,13 @@ import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostPodVO; import com.cloud.utils.db.GenericDao; import com.cloud.utils.fsm.StateDao; - -public interface EngineHostPodDao extends GenericDao, StateDao { - public List listByDataCenterId(long id); - - public EngineHostPodVO findByName(String name, long dcId); - + +public interface EngineHostPodDao extends GenericDao, StateDao { + public List listByDataCenterId(long id); + + public EngineHostPodVO findByName(String name, long dcId); + public HashMap> getCurrentPodCidrSubnets(long zoneId, long podIdToSkip); public List listDisabledPods(long zoneId); -} +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469c4dd1/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostPodDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostPodDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostPodDaoImpl.java index c5b4bd2..fee083a 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostPodDaoImpl.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostPodDaoImpl.java @@ -8,10 +8,10 @@ // 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. -// +// // Automatically generated by addcopyright.py at 04/03/2012 -package org.apache.cloudstack.engine.datacenter.entity.api.db.dao; - +package org.apache.cloudstack.engine.datacenter.entity.api.db.dao; + import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -39,27 +39,27 @@ import com.cloud.utils.db.UpdateBuilder; import com.cloud.utils.db.SearchCriteria.Op; import com.cloud.utils.db.Transaction; -@Component(value="EngineHostPodDao") -@Local(value={EngineHostPodDao.class}) -public class EngineHostPodDaoImpl extends GenericDaoBase implements EngineHostPodDao { - private static final Logger s_logger = Logger.getLogger(EngineHostPodDaoImpl.class); - - protected SearchBuilder DataCenterAndNameSearch; +@Component(value="EngineHostPodDao") +@Local(value={EngineHostPodDao.class}) +public class EngineHostPodDaoImpl extends GenericDaoBase implements EngineHostPodDao { + private static final Logger s_logger = Logger.getLogger(EngineHostPodDaoImpl.class); + + protected SearchBuilder DataCenterAndNameSearch; protected SearchBuilder DataCenterIdSearch; protected SearchBuilder UUIDSearch; - protected SearchBuilder StateChangeSearch; - - protected EngineHostPodDaoImpl() { - DataCenterAndNameSearch = createSearchBuilder(); - DataCenterAndNameSearch.and("dc", DataCenterAndNameSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); - DataCenterAndNameSearch.and("name", DataCenterAndNameSearch.entity().getName(), SearchCriteria.Op.EQ); - DataCenterAndNameSearch.done(); - - DataCenterIdSearch = createSearchBuilder(); - DataCenterIdSearch.and("dcId", DataCenterIdSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + protected SearchBuilder StateChangeSearch; + + protected EngineHostPodDaoImpl() { + DataCenterAndNameSearch = createSearchBuilder(); + DataCenterAndNameSearch.and("dc", DataCenterAndNameSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + DataCenterAndNameSearch.and("name", DataCenterAndNameSearch.entity().getName(), SearchCriteria.Op.EQ); + DataCenterAndNameSearch.done(); + + DataCenterIdSearch = createSearchBuilder(); + DataCenterIdSearch.and("dcId", DataCenterIdSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); DataCenterIdSearch.done(); - - + + UUIDSearch = createSearchBuilder(); UUIDSearch.and("uuid", UUIDSearch.entity().getUuid(), SearchCriteria.Op.EQ); UUIDSearch.done(); @@ -67,56 +67,56 @@ public class EngineHostPodDaoImpl extends GenericDaoBase StateChangeSearch = createSearchBuilder(); StateChangeSearch.and("id", StateChangeSearch.entity().getId(), SearchCriteria.Op.EQ); StateChangeSearch.and("state", StateChangeSearch.entity().getState(), SearchCriteria.Op.EQ); - StateChangeSearch.done(); - - } - + StateChangeSearch.done(); + + } + @Override - public List listByDataCenterId(long id) { - SearchCriteria sc = DataCenterIdSearch.create(); - sc.setParameters("dcId", id); - - return listBy(sc); - } - + public List listByDataCenterId(long id) { + SearchCriteria sc = DataCenterIdSearch.create(); + sc.setParameters("dcId", id); + + return listBy(sc); + } + + @Override + public EngineHostPodVO findByName(String name, long dcId) { + SearchCriteria sc = DataCenterAndNameSearch.create(); + sc.setParameters("dc", dcId); + sc.setParameters("name", name); + + return findOneBy(sc); + } + @Override - public EngineHostPodVO findByName(String name, long dcId) { - SearchCriteria sc = DataCenterAndNameSearch.create(); - sc.setParameters("dc", dcId); - sc.setParameters("name", name); - - return findOneBy(sc); - } - - @Override - public HashMap> getCurrentPodCidrSubnets(long zoneId, long podIdToSkip) { - HashMap> currentPodCidrSubnets = new HashMap>(); - - String selectSql = "SELECT id, cidr_address, cidr_size FROM host_pod_ref WHERE data_center_id=" + zoneId +" and removed IS NULL"; - Transaction txn = Transaction.currentTxn(); - try { - PreparedStatement stmt = txn.prepareAutoCloseStatement(selectSql); - ResultSet rs = stmt.executeQuery(); - while (rs.next()) { - Long podId = rs.getLong("id"); - if (podId.longValue() == podIdToSkip) { + public HashMap> getCurrentPodCidrSubnets(long zoneId, long podIdToSkip) { + HashMap> currentPodCidrSubnets = new HashMap>(); + + String selectSql = "SELECT id, cidr_address, cidr_size FROM host_pod_ref WHERE data_center_id=" + zoneId +" and removed IS NULL"; + Transaction txn = Transaction.currentTxn(); + try { + PreparedStatement stmt = txn.prepareAutoCloseStatement(selectSql); + ResultSet rs = stmt.executeQuery(); + while (rs.next()) { + Long podId = rs.getLong("id"); + if (podId.longValue() == podIdToSkip) { continue; - } - String cidrAddress = rs.getString("cidr_address"); - long cidrSize = rs.getLong("cidr_size"); - List cidrPair = new ArrayList(); - cidrPair.add(0, cidrAddress); - cidrPair.add(1, new Long(cidrSize)); - currentPodCidrSubnets.put(podId, cidrPair); - } - } catch (SQLException ex) { - s_logger.warn("DB exception " + ex.getMessage(), ex); - return null; - } - - return currentPodCidrSubnets; - } - + } + String cidrAddress = rs.getString("cidr_address"); + long cidrSize = rs.getLong("cidr_size"); + List cidrPair = new ArrayList(); + cidrPair.add(0, cidrAddress); + cidrPair.add(1, new Long(cidrSize)); + currentPodCidrSubnets.put(podId, cidrPair); + } + } catch (SQLException ex) { + s_logger.warn("DB exception " + ex.getMessage(), ex); + return null; + } + + return currentPodCidrSubnets; + } + @Override public boolean remove(Long id) { Transaction txn = Transaction.currentTxn(); @@ -179,6 +179,6 @@ public class EngineHostPodDaoImpl extends GenericDaoBase return rows > 0; } - - -} + + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469c4dd1/engine/orchestration/src/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java index 83e78b4..863c181 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java @@ -1,170 +1,170 @@ -/* - * 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 org.apache.cloudstack.engine.service.api; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import javax.inject.Inject; -import javax.ws.rs.Path; - -import org.apache.cloudstack.engine.datacenter.entity.api.ClusterEntity; -import org.apache.cloudstack.engine.datacenter.entity.api.ClusterEntityImpl; -import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceManager; -import org.apache.cloudstack.engine.datacenter.entity.api.HostEntity; -import org.apache.cloudstack.engine.datacenter.entity.api.HostEntityImpl; -import org.apache.cloudstack.engine.datacenter.entity.api.PodEntity; -import org.apache.cloudstack.engine.datacenter.entity.api.PodEntityImpl; -import org.apache.cloudstack.engine.datacenter.entity.api.StorageEntity; -import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity; -import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntityImpl; -import org.springframework.stereotype.Component; -import org.springframework.stereotype.Service; - -import com.cloud.host.Host; -import com.cloud.host.Status; -import com.cloud.storage.StoragePool; - - -@Component -@Service("provisioningService") -@Path("/provisioning") -public class ProvisioningServiceImpl implements ProvisioningService { - - @Inject - DataCenterResourceManager manager; - - @Override - public StorageEntity registerStorage(String name, List tags, Map details) { - // TODO Auto-generated method stub - return null; - } - - @Override - public ZoneEntity registerZone(String zoneUuid, String name, String owner, List tags, Map details) { - ZoneEntityImpl zoneEntity = new ZoneEntityImpl(zoneUuid, manager); - zoneEntity.setName(name); - zoneEntity.setOwner(owner); - zoneEntity.setDetails(details); - zoneEntity.persist(); - return zoneEntity; - } - - @Override - public PodEntity registerPod(String podUuid, String name, String owner, String zoneUuid, List tags, Map details) { - PodEntityImpl podEntity = new PodEntityImpl(podUuid, manager); - podEntity.setOwner(owner); - podEntity.setName(name); - podEntity.persist(); - return podEntity; - } - - @Override - public ClusterEntity registerCluster(String clusterUuid, String name, String owner, List tags, Map details) { - ClusterEntityImpl clusterEntity = new ClusterEntityImpl(clusterUuid, manager); - clusterEntity.setOwner(owner); - clusterEntity.setName(name); - clusterEntity.persist(); - return clusterEntity; - } - - @Override - public HostEntity registerHost(String hostUuid, String name, String owner, List tags, Map details) { - HostEntityImpl hostEntity = new HostEntityImpl(hostUuid, manager); - hostEntity.setOwner(owner); - hostEntity.setName(name); - hostEntity.setDetails(details); - - hostEntity.persist(); - return hostEntity; - } - - @Override - public void deregisterStorage(String uuid) { - // TODO Auto-generated method stub - - } - - @Override - public void deregisterZone(String uuid) { - ZoneEntityImpl zoneEntity = new ZoneEntityImpl(uuid, manager); - zoneEntity.disable(); - } - - @Override - public void deregisterPod(String uuid) { - PodEntityImpl podEntity = new PodEntityImpl(uuid, manager); - podEntity.disable(); - } - - @Override - public void deregisterCluster(String uuid) { - ClusterEntityImpl clusterEntity = new ClusterEntityImpl(uuid, manager); - clusterEntity.disable(); - - } - - @Override - public void deregisterHost(String uuid) { - HostEntityImpl hostEntity = new HostEntityImpl(uuid, manager); - hostEntity.disable(); - } - - @Override - public void changeState(String type, String entity, Status state) { - // TODO Auto-generated method stub - - } - - @Override - public List listHosts() { - // TODO Auto-generated method stub - return null; - } - - @Override - public List listPods() { - List pods = new ArrayList(); - //pods.add(new PodEntityImpl("pod-uuid-1", "pod1")); - //pods.add(new PodEntityImpl("pod-uuid-2", "pod2")); - return null; - } - - @Override - public List listZones() { - List zones = new ArrayList(); - //zones.add(new ZoneEntityImpl("zone-uuid-1")); - //zones.add(new ZoneEntityImpl("zone-uuid-2")); - return zones; - } - - @Override - public List listStorage() { - // TODO Auto-generated method stub - return null; - } - - @Override - public ZoneEntity getZone(String uuid) { - ZoneEntityImpl impl = new ZoneEntityImpl(uuid, manager); - return impl; - } - -} +/* + * 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 org.apache.cloudstack.engine.service.api; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.inject.Inject; +import javax.ws.rs.Path; + +import org.apache.cloudstack.engine.datacenter.entity.api.ClusterEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.ClusterEntityImpl; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceManager; +import org.apache.cloudstack.engine.datacenter.entity.api.HostEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.HostEntityImpl; +import org.apache.cloudstack.engine.datacenter.entity.api.PodEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.PodEntityImpl; +import org.apache.cloudstack.engine.datacenter.entity.api.StorageEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntityImpl; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +import com.cloud.host.Host; +import com.cloud.host.Status; +import com.cloud.storage.StoragePool; + + +@Component +@Service("provisioningService") +@Path("/provisioning") +public class ProvisioningServiceImpl implements ProvisioningService { + + @Inject + DataCenterResourceManager manager; + + @Override + public StorageEntity registerStorage(String name, List tags, Map details) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ZoneEntity registerZone(String zoneUuid, String name, String owner, List tags, Map details) { + ZoneEntityImpl zoneEntity = new ZoneEntityImpl(zoneUuid, manager); + zoneEntity.setName(name); + zoneEntity.setOwner(owner); + zoneEntity.setDetails(details); + zoneEntity.persist(); + return zoneEntity; + } + + @Override + public PodEntity registerPod(String podUuid, String name, String owner, String zoneUuid, List tags, Map details) { + PodEntityImpl podEntity = new PodEntityImpl(podUuid, manager); + podEntity.setOwner(owner); + podEntity.setName(name); + podEntity.persist(); + return podEntity; + } + + @Override + public ClusterEntity registerCluster(String clusterUuid, String name, String owner, List tags, Map details) { + ClusterEntityImpl clusterEntity = new ClusterEntityImpl(clusterUuid, manager); + clusterEntity.setOwner(owner); + clusterEntity.setName(name); + clusterEntity.persist(); + return clusterEntity; + } + + @Override + public HostEntity registerHost(String hostUuid, String name, String owner, List tags, Map details) { + HostEntityImpl hostEntity = new HostEntityImpl(hostUuid, manager); + hostEntity.setOwner(owner); + hostEntity.setName(name); + hostEntity.setDetails(details); + + hostEntity.persist(); + return hostEntity; + } + + @Override + public void deregisterStorage(String uuid) { + // TODO Auto-generated method stub + + } + + @Override + public void deregisterZone(String uuid) { + ZoneEntityImpl zoneEntity = new ZoneEntityImpl(uuid, manager); + zoneEntity.disable(); + } + + @Override + public void deregisterPod(String uuid) { + PodEntityImpl podEntity = new PodEntityImpl(uuid, manager); + podEntity.disable(); + } + + @Override + public void deregisterCluster(String uuid) { + ClusterEntityImpl clusterEntity = new ClusterEntityImpl(uuid, manager); + clusterEntity.disable(); + + } + + @Override + public void deregisterHost(String uuid) { + HostEntityImpl hostEntity = new HostEntityImpl(uuid, manager); + hostEntity.disable(); + } + + @Override + public void changeState(String type, String entity, Status state) { + // TODO Auto-generated method stub + + } + + @Override + public List listHosts() { + // TODO Auto-generated method stub + return null; + } + + @Override + public List listPods() { + List pods = new ArrayList(); + //pods.add(new PodEntityImpl("pod-uuid-1", "pod1")); + //pods.add(new PodEntityImpl("pod-uuid-2", "pod2")); + return null; + } + + @Override + public List listZones() { + List zones = new ArrayList(); + //zones.add(new ZoneEntityImpl("zone-uuid-1")); + //zones.add(new ZoneEntityImpl("zone-uuid-2")); + return zones; + } + + @Override + public List listStorage() { + // TODO Auto-generated method stub + return null; + } + + @Override + public ZoneEntity getZone(String uuid) { + ZoneEntityImpl impl = new ZoneEntityImpl(uuid, manager); + return impl; + } + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469c4dd1/engine/orchestration/test/org/apache/cloudstack/engine/provisioning/test/ProvisioningTest.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/test/org/apache/cloudstack/engine/provisioning/test/ProvisioningTest.java b/engine/orchestration/test/org/apache/cloudstack/engine/provisioning/test/ProvisioningTest.java index a3ef276..0976f83 100644 --- a/engine/orchestration/test/org/apache/cloudstack/engine/provisioning/test/ProvisioningTest.java +++ b/engine/orchestration/test/org/apache/cloudstack/engine/provisioning/test/ProvisioningTest.java @@ -14,124 +14,124 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -/** - * - */ -package org.apache.cloudstack.engine.provisioning.test; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import javax.inject.Inject; - -import org.apache.cloudstack.engine.datacenter.entity.api.ClusterEntity; -import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State; -import org.apache.cloudstack.engine.datacenter.entity.api.HostEntity; -import org.apache.cloudstack.engine.datacenter.entity.api.PodEntity; -import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity; -import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineClusterDao; -import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineDataCenterDao; -import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineHostDao; -import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineHostPodDao; -import org.apache.cloudstack.engine.service.api.ProvisioningService; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mockito; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineClusterVO; -import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineDataCenterVO; -import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostPodVO; -import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO; - -import com.cloud.dc.DataCenter.NetworkType; - -import junit.framework.TestCase; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations="classpath:/resource/provisioningContext.xml") -public class ProvisioningTest extends TestCase { - - @Inject - ProvisioningService service; - - @Inject - EngineDataCenterDao dcDao; - - @Inject - EngineHostPodDao _podDao; - - @Inject - EngineClusterDao _clusterDao; - - @Inject - EngineHostDao _hostDao; - - @Before - public void setUp() { - EngineDataCenterVO dc = new EngineDataCenterVO(UUID.randomUUID().toString(), "test", "8.8.8.8", null, "10.0.0.1", null, "10.0.0.1/24", - null, null, NetworkType.Basic, null, null, true, true, null, null); - Mockito.when(dcDao.findByUuid(Mockito.anyString())).thenReturn(dc); - Mockito.when(dcDao.persist((EngineDataCenterVO) Mockito.anyObject())).thenReturn(dc); - - EngineHostPodVO pod = new EngineHostPodVO("lab", 123, "10.0.0.1", "10.0.0.1", 24, "test"); - Mockito.when(_podDao.findByUuid(Mockito.anyString())).thenReturn(pod); - Mockito.when(_podDao.persist((EngineHostPodVO) Mockito.anyObject())).thenReturn(pod); - - EngineClusterVO cluster = new EngineClusterVO(); - Mockito.when(_clusterDao.findByUuid(Mockito.anyString())).thenReturn(cluster); - Mockito.when(_clusterDao.persist((EngineClusterVO) Mockito.anyObject())).thenReturn(cluster); - - EngineHostVO host = new EngineHostVO("68765876598"); - Mockito.when(_hostDao.findByUuid(Mockito.anyString())).thenReturn(host); - Mockito.when(_hostDao.persist((EngineHostVO) Mockito.anyObject())).thenReturn(host); - - } - - private void registerAndEnableZone() { - ZoneEntity zone = service.registerZone("47547648", "lab","owner", null, new HashMap()); - State state = zone.getState(); - System.out.println("state:"+state); - boolean result = zone.enable(); - System.out.println("result:"+result); - - } - - private void registerAndEnablePod() { - PodEntity pod = service.registerPod("47547648", "lab","owner", "8709874074", null, new HashMap()); - State state = pod.getState(); - System.out.println("state:"+state); - boolean result = pod.enable(); - System.out.println("result:"+result); - } - - private void registerAndEnableCluster() { - ClusterEntity cluster = service.registerCluster("1265476542", "lab","owner", null, new HashMap()); - State state = cluster.getState(); - System.out.println("state:"+state); - boolean result = cluster.enable(); - System.out.println("result:"+result); - } - - private void registerAndEnableHost() { - HostEntity host = service.registerHost("1265476542", "lab","owner", null, new HashMap()); - State state = host.getState(); - System.out.println("state:"+state); - boolean result = host.enable(); - System.out.println("result:"+result); - } - - @Test - public void testProvisioning() { - registerAndEnableZone(); - registerAndEnablePod(); - registerAndEnableCluster(); - registerAndEnableHost(); - } - - -} +/** + * + */ +package org.apache.cloudstack.engine.provisioning.test; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.datacenter.entity.api.ClusterEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State; +import org.apache.cloudstack.engine.datacenter.entity.api.HostEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.PodEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineClusterDao; +import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineDataCenterDao; +import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineHostDao; +import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineHostPodDao; +import org.apache.cloudstack.engine.service.api.ProvisioningService; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineClusterVO; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineDataCenterVO; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostPodVO; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO; + +import com.cloud.dc.DataCenter.NetworkType; + +import junit.framework.TestCase; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations="classpath:/resource/provisioningContext.xml") +public class ProvisioningTest extends TestCase { + + @Inject + ProvisioningService service; + + @Inject + EngineDataCenterDao dcDao; + + @Inject + EngineHostPodDao _podDao; + + @Inject + EngineClusterDao _clusterDao; + + @Inject + EngineHostDao _hostDao; + + @Before + public void setUp() { + EngineDataCenterVO dc = new EngineDataCenterVO(UUID.randomUUID().toString(), "test", "8.8.8.8", null, "10.0.0.1", null, "10.0.0.1/24", + null, null, NetworkType.Basic, null, null, true, true, null, null); + Mockito.when(dcDao.findByUuid(Mockito.anyString())).thenReturn(dc); + Mockito.when(dcDao.persist((EngineDataCenterVO) Mockito.anyObject())).thenReturn(dc); + + EngineHostPodVO pod = new EngineHostPodVO("lab", 123, "10.0.0.1", "10.0.0.1", 24, "test"); + Mockito.when(_podDao.findByUuid(Mockito.anyString())).thenReturn(pod); + Mockito.when(_podDao.persist((EngineHostPodVO) Mockito.anyObject())).thenReturn(pod); + + EngineClusterVO cluster = new EngineClusterVO(); + Mockito.when(_clusterDao.findByUuid(Mockito.anyString())).thenReturn(cluster); + Mockito.when(_clusterDao.persist((EngineClusterVO) Mockito.anyObject())).thenReturn(cluster); + + EngineHostVO host = new EngineHostVO("68765876598"); + Mockito.when(_hostDao.findByUuid(Mockito.anyString())).thenReturn(host); + Mockito.when(_hostDao.persist((EngineHostVO) Mockito.anyObject())).thenReturn(host); + + } + + private void registerAndEnableZone() { + ZoneEntity zone = service.registerZone("47547648", "lab","owner", null, new HashMap()); + State state = zone.getState(); + System.out.println("state:"+state); + boolean result = zone.enable(); + System.out.println("result:"+result); + + } + + private void registerAndEnablePod() { + PodEntity pod = service.registerPod("47547648", "lab","owner", "8709874074", null, new HashMap()); + State state = pod.getState(); + System.out.println("state:"+state); + boolean result = pod.enable(); + System.out.println("result:"+result); + } + + private void registerAndEnableCluster() { + ClusterEntity cluster = service.registerCluster("1265476542", "lab","owner", null, new HashMap()); + State state = cluster.getState(); + System.out.println("state:"+state); + boolean result = cluster.enable(); + System.out.println("result:"+result); + } + + private void registerAndEnableHost() { + HostEntity host = service.registerHost("1265476542", "lab","owner", null, new HashMap()); + State state = host.getState(); + System.out.println("state:"+state); + boolean result = host.enable(); + System.out.println("result:"+result); + } + + @Test + public void testProvisioning() { + registerAndEnableZone(); + registerAndEnablePod(); + registerAndEnableCluster(); + registerAndEnableHost(); + } + + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469c4dd1/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationIntrospector.java ---------------------------------------------------------------------- diff --git a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationIntrospector.java b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationIntrospector.java index 998bfa0..6a26a6c 100644 --- a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationIntrospector.java +++ b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationIntrospector.java @@ -1,60 +1,60 @@ -/* - * 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 org.apache.cloudstack.framework.ws.jackson; - -import java.lang.reflect.AnnotatedElement; -import java.util.List; - -import com.fasterxml.jackson.core.Version; -import com.fasterxml.jackson.databind.introspect.Annotated; -import com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector; - - -/** - * Adds introspectors for the annotations added specifically for CloudStack - * Web Services. - * - */ -public class CSJacksonAnnotationIntrospector extends NopAnnotationIntrospector { - - private static final long serialVersionUID = 5532727887216652602L; - - @Override - public Version version() { - return new Version(1, 7, 0, "abc", "org.apache.cloudstack", "cloudstack-framework-rest"); - } - - @Override - public Object findSerializer(Annotated a) { - AnnotatedElement ae = a.getAnnotated(); - Url an = ae.getAnnotation(Url.class); - if (an == null) { - return null; - } - - if (an.type() == String.class) { - return new UriSerializer(an); - } else if (an.type() == List.class){ - return new UrisSerializer(an); - } - - throw new UnsupportedOperationException("Unsupported type " + an.type()); - - } -} +/* + * 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 org.apache.cloudstack.framework.ws.jackson; + +import java.lang.reflect.AnnotatedElement; +import java.util.List; + +import com.fasterxml.jackson.core.Version; +import com.fasterxml.jackson.databind.introspect.Annotated; +import com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector; + + +/** + * Adds introspectors for the annotations added specifically for CloudStack + * Web Services. + * + */ +public class CSJacksonAnnotationIntrospector extends NopAnnotationIntrospector { + + private static final long serialVersionUID = 5532727887216652602L; + + @Override + public Version version() { + return new Version(1, 7, 0, "abc", "org.apache.cloudstack", "cloudstack-framework-rest"); + } + + @Override + public Object findSerializer(Annotated a) { + AnnotatedElement ae = a.getAnnotated(); + Url an = ae.getAnnotation(Url.class); + if (an == null) { + return null; + } + + if (an.type() == String.class) { + return new UriSerializer(an); + } else if (an.type() == List.class){ + return new UrisSerializer(an); + } + + throw new UnsupportedOperationException("Unsupported type " + an.type()); + + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469c4dd1/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationModule.java ---------------------------------------------------------------------- diff --git a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationModule.java b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationModule.java index 55debd9..d274b85 100644 --- a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationModule.java +++ b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationModule.java @@ -1,47 +1,47 @@ -/* - * 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 org.apache.cloudstack.framework.ws.jackson; - - -import com.fasterxml.jackson.core.Version; -import com.fasterxml.jackson.databind.Module; - - -/** - * This module extends SimpleModle so that our annotations can be processed. - * - */ -public class CSJacksonAnnotationModule extends Module { - - @Override - public String getModuleName() { - return "CloudStackSupplementalModule"; - } - - @Override - public void setupModule(SetupContext ctx) { - ctx.appendAnnotationIntrospector(new CSJacksonAnnotationIntrospector()); - } - - @Override - public Version version() { - return new Version(1, 0, 0, "", "org.apache.cloudstack", "cloudstack-framework-rest"); - } - -} +/* + * 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 org.apache.cloudstack.framework.ws.jackson; + + +import com.fasterxml.jackson.core.Version; +import com.fasterxml.jackson.databind.Module; + + +/** + * This module extends SimpleModle so that our annotations can be processed. + * + */ +public class CSJacksonAnnotationModule extends Module { + + @Override + public String getModuleName() { + return "CloudStackSupplementalModule"; + } + + @Override + public void setupModule(SetupContext ctx) { + ctx.appendAnnotationIntrospector(new CSJacksonAnnotationIntrospector()); + } + + @Override + public Version version() { + return new Version(1, 0, 0, "", "org.apache.cloudstack", "cloudstack-framework-rest"); + } + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469c4dd1/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UriSerializer.java ---------------------------------------------------------------------- diff --git a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UriSerializer.java b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UriSerializer.java index 074d60f..0795149 100644 --- a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UriSerializer.java +++ b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UriSerializer.java @@ -1,58 +1,58 @@ -/* - * 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 org.apache.cloudstack.framework.ws.jackson; - -import java.io.IOException; - -import javax.ws.rs.core.UriBuilder; - -import org.apache.cxf.jaxrs.impl.tl.ThreadLocalUriInfo; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; - -public class UriSerializer extends JsonSerializer { - - Url _annotation; - - public UriSerializer(Url annotation) { - _annotation = annotation; - } - - protected UriSerializer() { - } - - @Override - public void serialize(String id, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { - jgen.writeStartObject(); - jgen.writeStringField("id", id); - jgen.writeFieldName("uri"); - jgen.writeString(buildUri(_annotation.clazz(), _annotation.method(), id)); - jgen.writeEndObject(); - } - - protected String buildUri(Class clazz, String method, String id) { - ThreadLocalUriInfo uriInfo = new ThreadLocalUriInfo(); - UriBuilder ub = uriInfo.getAbsolutePathBuilder().path(clazz, method); - ub.build(id); - return ub.toString(); - } -} +/* + * 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 org.apache.cloudstack.framework.ws.jackson; + +import java.io.IOException; + +import javax.ws.rs.core.UriBuilder; + +import org.apache.cxf.jaxrs.impl.tl.ThreadLocalUriInfo; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +public class UriSerializer extends JsonSerializer { + + Url _annotation; + + public UriSerializer(Url annotation) { + _annotation = annotation; + } + + protected UriSerializer() { + } + + @Override + public void serialize(String id, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeStartObject(); + jgen.writeStringField("id", id); + jgen.writeFieldName("uri"); + jgen.writeString(buildUri(_annotation.clazz(), _annotation.method(), id)); + jgen.writeEndObject(); + } + + protected String buildUri(Class clazz, String method, String id) { + ThreadLocalUriInfo uriInfo = new ThreadLocalUriInfo(); + UriBuilder ub = uriInfo.getAbsolutePathBuilder().path(clazz, method); + ub.build(id); + return ub.toString(); + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469c4dd1/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UrisSerializer.java ---------------------------------------------------------------------- diff --git a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UrisSerializer.java b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UrisSerializer.java index 8b62212..6ab3ced 100644 --- a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UrisSerializer.java +++ b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UrisSerializer.java @@ -1,71 +1,71 @@ -/* - * 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 org.apache.cloudstack.framework.ws.jackson; - -import java.io.IOException; -import java.util.Iterator; -import java.util.List; - -import javax.ws.rs.core.UriBuilder; - -import org.apache.cxf.jaxrs.impl.tl.ThreadLocalUriInfo; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; - - -/** - * Serializer for a list of ids. - * - */ -public class UrisSerializer extends JsonSerializer> { - Url _annotation; - - public UrisSerializer(Url annotation) { - _annotation = annotation; - } - - protected UrisSerializer() { - } - - @Override - public void serialize(List lst, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { - Iterator it = lst.iterator(); - jgen.writeStartObject(); - while (it.hasNext()) { - Object id = it.next(); - jgen.writeStartObject(); - jgen.writeFieldName("id"); - jgen.writeObject(id); - jgen.writeFieldName("uri"); - jgen.writeString(buildUri(_annotation.clazz(), _annotation.method(), id)); - jgen.writeEndObject(); - } - jgen.writeEndObject(); - } - - protected String buildUri(Class clazz, String method, Object id) { - ThreadLocalUriInfo uriInfo = new ThreadLocalUriInfo(); - UriBuilder ub = uriInfo.getAbsolutePathBuilder().path(clazz, method); - ub.build(id); - return ub.toString(); - } -} +/* + * 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 org.apache.cloudstack.framework.ws.jackson; + +import java.io.IOException; +import java.util.Iterator; +import java.util.List; + +import javax.ws.rs.core.UriBuilder; + +import org.apache.cxf.jaxrs.impl.tl.ThreadLocalUriInfo; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + + +/** + * Serializer for a list of ids. + * + */ +public class UrisSerializer extends JsonSerializer> { + Url _annotation; + + public UrisSerializer(Url annotation) { + _annotation = annotation; + } + + protected UrisSerializer() { + } + + @Override + public void serialize(List lst, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + Iterator it = lst.iterator(); + jgen.writeStartObject(); + while (it.hasNext()) { + Object id = it.next(); + jgen.writeStartObject(); + jgen.writeFieldName("id"); + jgen.writeObject(id); + jgen.writeFieldName("uri"); + jgen.writeString(buildUri(_annotation.clazz(), _annotation.method(), id)); + jgen.writeEndObject(); + } + jgen.writeEndObject(); + } + + protected String buildUri(Class clazz, String method, Object id) { + ThreadLocalUriInfo uriInfo = new ThreadLocalUriInfo(); + UriBuilder ub = uriInfo.getAbsolutePathBuilder().path(clazz, method); + ub.build(id); + return ub.toString(); + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469c4dd1/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/Url.java ---------------------------------------------------------------------- diff --git a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/Url.java b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/Url.java index 7094fb0..9f9537c 100644 --- a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/Url.java +++ b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/Url.java @@ -1,53 +1,53 @@ -/* - * 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 org.apache.cloudstack.framework.ws.jackson; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Url can be placed onto a method to construct an URL from the returned - * results. - * - * This annotation is supplemental to JAX-RS 2.0's annotations. JAX-RS 2.0 - * annotations do not include a way to construct an URL. Of - * course, this only works with how CloudStack works. - * - */ -@Target({FIELD, METHOD}) -@Retention(RUNTIME) -public @interface Url { - /** - * @return the class that the path should belong to. - */ - Class clazz() default Object.class; - - /** - * @return the name of the method that the path should call back to. - */ - String method(); - - String name() default ""; - - Class type() default String.class; -} +/* + * 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 org.apache.cloudstack.framework.ws.jackson; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Url can be placed onto a method to construct an URL from the returned + * results. + * + * This annotation is supplemental to JAX-RS 2.0's annotations. JAX-RS 2.0 + * annotations do not include a way to construct an URL. Of + * course, this only works with how CloudStack works. + * + */ +@Target({FIELD, METHOD}) +@Retention(RUNTIME) +public @interface Url { + /** + * @return the class that the path should belong to. + */ + Class clazz() default Object.class; + + /** + * @return the name of the method that the path should call back to. + */ + String method(); + + String name() default ""; + + Class type() default String.class; +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469c4dd1/framework/rest/test/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationTest.java ---------------------------------------------------------------------- diff --git a/framework/rest/test/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationTest.java b/framework/rest/test/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationTest.java index 8869b21..75e3904 100644 --- a/framework/rest/test/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationTest.java +++ b/framework/rest/test/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationTest.java @@ -14,8 +14,8 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package org.apache.cloudstack.framework.ws.jackson; - +package org.apache.cloudstack.framework.ws.jackson; + import java.io.IOException; import java.io.StringWriter; import java.util.ArrayList; @@ -35,84 +35,84 @@ import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule.Priority; - -public class CSJacksonAnnotationTest { - - @Before - public void setUp() throws Exception { - } - - @Test @Ignore - public void test() { - ObjectMapper mapper = new ObjectMapper(); - JaxbAnnotationModule jaxbModule = new JaxbAnnotationModule(); - jaxbModule.setPriority(Priority.SECONDARY); - mapper.registerModule(jaxbModule); - mapper.registerModule(new CSJacksonAnnotationModule()); - - StringWriter writer = new StringWriter(); - - TestVO vo = new TestVO(1000, "name"); - vo.names = new ArrayList(); - vo.names.add("name1"); - vo.names.add("name2"); - vo.values = new HashMap(); - vo.values.put("key1", 1000l); - vo.values.put("key2", 2000l); - vo.vo2.name = "testvoname2"; - vo.pods="abcde"; - - try { - mapper.writeValue(writer, vo); - } catch (JsonGenerationException e) { - e.printStackTrace(); - } catch (JsonMappingException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - - System.out.print(writer.getBuffer().toString()); - - } - - @XmlRootElement(name="xml-test2") - public class Test2VO { - public String name; - } - - @XmlRootElement(name="abc") - public class TestVO { - public int id; - - public Map values; - - public String name; - - - public List names; - - public String pods; - - - @XmlElement(name="test2") - public Test2VO vo2 = new Test2VO(); - - public TestVO(int id, String name) { - this.id = id; - this.name = name; - } - - @Url(clazz=TestVO.class, method="getName") - public String getName() { - return name; - } - - @Url(clazz=TestVO.class, method="getNames", type=List.class) - public List getNames() { - return names; - } - - } - -} + +public class CSJacksonAnnotationTest { + + @Before + public void setUp() throws Exception { + } + + @Test @Ignore + public void test() { + ObjectMapper mapper = new ObjectMapper(); + JaxbAnnotationModule jaxbModule = new JaxbAnnotationModule(); + jaxbModule.setPriority(Priority.SECONDARY); + mapper.registerModule(jaxbModule); + mapper.registerModule(new CSJacksonAnnotationModule()); + + StringWriter writer = new StringWriter(); + + TestVO vo = new TestVO(1000, "name"); + vo.names = new ArrayList(); + vo.names.add("name1"); + vo.names.add("name2"); + vo.values = new HashMap(); + vo.values.put("key1", 1000l); + vo.values.put("key2", 2000l); + vo.vo2.name = "testvoname2"; + vo.pods="abcde"; + + try { + mapper.writeValue(writer, vo); + } catch (JsonGenerationException e) { + e.printStackTrace(); + } catch (JsonMappingException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + System.out.print(writer.getBuffer().toString()); + + } + + @XmlRootElement(name="xml-test2") + public class Test2VO { + public String name; + } + + @XmlRootElement(name="abc") + public class TestVO { + public int id; + + public Map values; + + public String name; + + + public List names; + + public String pods; + + + @XmlElement(name="test2") + public Test2VO vo2 = new Test2VO(); + + public TestVO(int id, String name) { + this.id = id; + this.name = name; + } + + @Url(clazz=TestVO.class, method="getName") + public String getName() { + return name; + } + + @Url(clazz=TestVO.class, method="getNames", type=List.class) + public List getNames() { + return names; + } + + } + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469c4dd1/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/AddBaremetalHostCmd.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/AddBaremetalHostCmd.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/AddBaremetalHostCmd.java index f07b212..8d45902 100755 --- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/AddBaremetalHostCmd.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/AddBaremetalHostCmd.java @@ -14,35 +14,35 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -// +// // Automatically generated by addcopyright.py at 01/29/2013 -package com.cloud.baremetal.manager; - +package com.cloud.baremetal.manager; + import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.command.admin.host.AddHostCmd; import org.apache.cloudstack.api.response.HostResponse; -@APICommand(name="addBaremetalHost", description="add a baremetal host", responseObject = HostResponse.class) +@APICommand(name="addBaremetalHost", description="add a baremetal host", responseObject = HostResponse.class) public class AddBaremetalHostCmd extends AddHostCmd { - - @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="ip address intentionally allocated to this host after provisioning") - private String vmIpAddress; - - public AddBaremetalHostCmd() { - } - + + @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="ip address intentionally allocated to this host after provisioning") + private String vmIpAddress; + + public AddBaremetalHostCmd() { + } + @Override - public void execute(){ - this.getFullUrlParams().put(ApiConstants.BAREMETAL_DISCOVER_NAME, BareMetalDiscoverer.class.getName()); - super.execute(); - } - - public String getVmIpAddress() { - return vmIpAddress; - } - - public void setVmIpAddress(String vmIpAddress) { - this.vmIpAddress = vmIpAddress; - } -} + public void execute(){ + this.getFullUrlParams().put(ApiConstants.BAREMETAL_DISCOVER_NAME, BareMetalDiscoverer.class.getName()); + super.execute(); + } + + public String getVmIpAddress() { + return vmIpAddress; + } + + public void setVmIpAddress(String vmIpAddress) { + this.vmIpAddress = vmIpAddress; + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469c4dd1/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java index 28c8375..edb5dea 100755 --- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java @@ -202,7 +202,7 @@ public class BareMetalDiscoverer extends DiscovererBase implements Discoverer, R if (vmIp != null) { details.put(ApiConstants.IP_ADDRESS, vmIp); } - String isEchoScAgent = _configDao.getValue(Config.EnableBaremetalSecurityGroupAgentEcho.key()); + String isEchoScAgent = _configDao.getValue(Config.EnableBaremetalSecurityGroupAgentEcho.key()); details.put(BaremetalManager.EchoSecurityGroupAgent, isEchoScAgent); resources.put(resource, details); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469c4dd1/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalManager.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalManager.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalManager.java index 6467c94..60edde3 100755 --- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalManager.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalManager.java @@ -22,7 +22,7 @@ import com.cloud.network.Network.Provider; import com.cloud.utils.component.Manager; import com.cloud.utils.component.PluggableService; -public interface BaremetalManager extends Manager, PluggableService { +public interface BaremetalManager extends Manager, PluggableService { public static final String EchoSecurityGroupAgent = "EchoSecurityGroupAgent"; public static final String ExternalBaremetalSystemUrl = "ExternalBaremetalSystemUrl"; public static final String DO_PXE = "doPxe";