Add some skeleton of infrastructure entities and UserVm entity.

This commit is contained in:
Min Chen 2013-03-20 18:03:35 -07:00
parent 485bcf26a2
commit f89f086a71
15 changed files with 568 additions and 23 deletions

View File

@ -14,7 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.entity.cloud;
package org.apache.cloudstack.entity;
import java.util.Date;
@ -24,6 +24,8 @@ import java.util.Date;
* Base class for cloud resources.
*/
public abstract class CloudResource {
protected long id;
protected String uuid;
protected Date removed;
protected Date created;
@ -41,5 +43,19 @@ public abstract class CloudResource {
this.created = created;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
}

View File

@ -0,0 +1,26 @@
// 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.entity.cloud;
import org.apache.cloudstack.entity.CloudResource;
/**
*
*/
public class ComputeOfferingResource extends CloudResource {
}

View File

@ -0,0 +1,26 @@
// 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.entity.cloud;
import org.apache.cloudstack.entity.CloudResource;
/**
*
*/
public class DiskOfferingResource extends CloudResource {
}

View File

@ -19,6 +19,7 @@ package org.apache.cloudstack.entity.cloud;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.cloudstack.entity.CloudResource;
import org.apache.cloudstack.entity.identity.AccountResource;
@ -29,30 +30,13 @@ import org.apache.cloudstack.entity.identity.AccountResource;
public class InstanceGroupResource extends CloudResource {
// attributes
private long id;
private String uuid;
private String name;
// relationships
private AccountResource account;
private List<VirtualMachineResource> vms;
private List<UserVmResource> vms;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getName() {
return name;
@ -70,11 +54,11 @@ public class InstanceGroupResource extends CloudResource {
this.account = account;
}
public List<VirtualMachineResource> getVms() {
public List<UserVmResource> getVms() {
return vms;
}
public void setVms(List<VirtualMachineResource> vms) {
public void setVms(List<UserVmResource> vms) {
this.vms = vms;
}

View File

@ -0,0 +1,26 @@
// 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.entity.cloud;
import org.apache.cloudstack.entity.CloudResource;
/**
*
*/
public class NicResource extends CloudResource {
}

View File

@ -0,0 +1,26 @@
// 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.entity.cloud;
import org.apache.cloudstack.entity.CloudResource;
/**
*
*/
public class TemplateResource extends CloudResource {
}

View File

@ -0,0 +1,57 @@
// 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.entity.cloud;
import java.util.Map;
/**
* User VM resource.
*/
public class UserVmResource extends VirtualMachineResource {
private Map<String, String> userData;
private String displayName;
// relationship
private InstanceGroupResource vmGroup;
public Map<String, String> getUserData() {
return userData;
}
public void setUserData(Map<String, String> userData) {
this.userData = userData;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public InstanceGroupResource getVmGroup() {
return vmGroup;
}
public void setVmGroup(InstanceGroupResource vmGroup) {
this.vmGroup = vmGroup;
}
}

View File

@ -16,9 +16,117 @@
// under the License.
package org.apache.cloudstack.entity.cloud;
import java.util.List;
import org.apache.cloudstack.entity.CloudResource;
import org.apache.cloudstack.entity.identity.AccountResource;
import org.apache.cloudstack.entity.infrastructure.HostResource;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.vm.VirtualMachine.State;
/**
*
* VirtualMachine entity resource
*/
public class VirtualMachineResource extends CloudResource {
//attributes
protected String name;
protected State state = null;
protected HypervisorType hypervisorType;
protected long guestOsId;
protected String vncPassword;
protected boolean haEnabled;
protected boolean limitCpuUse;
//relationships
protected HostResource host;
protected AccountResource account;
protected TemplateResource template;
protected ComputeOfferingResource computeOffering;
protected DiskOfferingResource diskOffering;
protected List<NicResource> nics;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public State getState() {
return state;
}
public void setState(State state) {
this.state = state;
}
public HypervisorType getHypervisorType() {
return hypervisorType;
}
public void setHypervisorType(HypervisorType hypervisorType) {
this.hypervisorType = hypervisorType;
}
public long getGuestOsId() {
return guestOsId;
}
public void setGuestOsId(long guestOsId) {
this.guestOsId = guestOsId;
}
public String getVncPassword() {
return vncPassword;
}
public void setVncPassword(String vncPassword) {
this.vncPassword = vncPassword;
}
public boolean isHaEnabled() {
return haEnabled;
}
public void setHaEnabled(boolean haEnabled) {
this.haEnabled = haEnabled;
}
public boolean isLimitCpuUse() {
return limitCpuUse;
}
public void setLimitCpuUse(boolean limitCpuUse) {
this.limitCpuUse = limitCpuUse;
}
public HostResource getHost() {
return host;
}
public void setHost(HostResource host) {
this.host = host;
}
public AccountResource getAccount() {
return account;
}
public void setAccount(AccountResource account) {
this.account = account;
}
public TemplateResource getTemplate() {
return template;
}
public void setTemplate(TemplateResource template) {
this.template = template;
}
public ComputeOfferingResource getComputeOffering() {
return computeOffering;
}
public void setComputeOffering(ComputeOfferingResource computeOffering) {
this.computeOffering = computeOffering;
}
public DiskOfferingResource getDiskOffering() {
return diskOffering;
}
public void setDiskOffering(DiskOfferingResource diskOffering) {
this.diskOffering = diskOffering;
}
public List<NicResource> getNics() {
return nics;
}
public void setNics(List<NicResource> nics) {
this.nics = nics;
}
}

View File

@ -16,9 +16,85 @@
// under the License.
package org.apache.cloudstack.entity.identity;
import java.util.Map;
import org.apache.cloudstack.entity.CloudResource;
import com.cloud.user.Account.State;
/**
* Account Identity
*/
public class AccountResource {
public class AccountResource extends CloudResource {
// attributes
private String name;
private short type;
private State state;
private String networkDomain;
private Long defaultZoneId;
private Map<String, String> details;
// relation
private DomainResource domain;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public short getType() {
return type;
}
public void setType(short type) {
this.type = type;
}
public State getState() {
return state;
}
public void setState(State state) {
this.state = state;
}
public String getNetworkDomain() {
return networkDomain;
}
public void setNetworkDomain(String networkDomain) {
this.networkDomain = networkDomain;
}
public Long getDefaultZoneId() {
return defaultZoneId;
}
public void setDefaultZoneId(Long defaultZoneId) {
this.defaultZoneId = defaultZoneId;
}
public Map<String, String> getDetails() {
return details;
}
public void setDetails(Map<String, String> details) {
this.details = details;
}
public DomainResource getDomain() {
return domain;
}
public void setDomain(DomainResource domain) {
this.domain = domain;
}
}

View File

@ -0,0 +1,80 @@
// 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.entity.identity;
import java.util.List;
import com.cloud.domain.Domain.State;
/**
* Domain Resource
*/
public class DomainResource {
// attributes
private String name;
private String path;
private State state;
private String networkDomain;
// relationship
private DomainResource parent;
private List<DomainResource> children;
public DomainResource getParent() {
return parent;
}
public void setParent(DomainResource parent) {
this.parent = parent;
}
public List<DomainResource> getChildren() {
return children;
}
public void setChildren(List<DomainResource> children) {
this.children = children;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public State getState() {
return state;
}
public void setState(State state) {
this.state = state;
}
public String getNetworkDomain() {
return networkDomain;
}
public void setNetworkDomain(String networkDomain) {
this.networkDomain = networkDomain;
}
}

View File

@ -0,0 +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.entity.infrastructure;
/**
*
*/
public class ClusterResource extends InfrastructureResource {
}

View File

@ -0,0 +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.entity.infrastructure;
/**
*
*/
public class DataCenterResource extends InfrastructureResource {
}

View File

@ -0,0 +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.entity.infrastructure;
/**
*
*/
public class HostResource extends InfrastructureResource {
}

View File

@ -0,0 +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.entity.infrastructure;
/**
* Base class for Infrastructure resource.
*/
public abstract class InfrastructureResource {
}

View File

@ -0,0 +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.entity.infrastructure;
/**
*
*/
public class PodResource extends InfrastructureResource {
}