removed tmrk-enterprisecloud due to licensing reasons

This commit is contained in:
Adrian Cole 2011-12-21 11:04:47 -08:00
parent 0db26708fe
commit 76fac92b21
227 changed files with 0 additions and 34411 deletions

View File

@ -50,9 +50,6 @@ trmk-vcloudexpress.propertiesbuilder=org.jclouds.trmk.vcloudexpress.TerremarkVCl
trmk-ecloud.contextbuilder=org.jclouds.trmk.ecloud.TerremarkECloudContextBuilder
trmk-ecloud.propertiesbuilder=org.jclouds.trmk.ecloud.TerremarkECloudPropertiesBuilder
tmrk-enterprisecloud.contextbuilder=org.jclouds.tmrk.enterprisecloud.TerremarkEnterpriseCloudContextBuilder
tmrk-enterprisecloud.propertiesbuilder=org.jclouds.tmrk.enterprisecloud.TerremarkEnterpriseCloudPropertiesBuilder
chef.contextbuilder=org.jclouds.chef.ChefContextBuilder
chef.propertiesbuilder=org.jclouds.chef.ChefPropertiesBuilder

View File

@ -1,142 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to jclouds, Inc. (jclouds) under one or more
contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. jclouds licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-project</artifactId>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../project/pom.xml</relativePath>
</parent>
<groupId>org.jclouds.provider</groupId>
<artifactId>tmrk-enterprisecloud</artifactId>
<name>jclouds Terremark Enterprise Cloud core</name>
<description>jclouds components to access Terremark Enterprise Cloud</description>
<packaging>bundle</packaging>
<!-- bootstrapping: need to fetch the project POM -->
<repositories>
<repository>
<id>jclouds-sona-snapshots-nexus</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<properties>
<test.tmrk-enterprisecloud.endpoint>https://services-beta.enterprisecloud.terremark.com/cloudapi/ecloud</test.tmrk-enterprisecloud.endpoint>
<test.tmrk-enterprisecloud.apiversion>2011-07-01</test.tmrk-enterprisecloud.apiversion>
<test.tmrk-enterprisecloud.identity>FIXME</test.tmrk-enterprisecloud.identity>
<test.tmrk-enterprisecloud.credential>FIXME</test.tmrk-enterprisecloud.credential>
<test.tmrk-enterprisecloud.image-id></test.tmrk-enterprisecloud.image-id>
</properties>
<dependencies>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-compute</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.jamesmurty.utils</groupId>
<artifactId>java-xmlbuilder</artifactId>
<version>0.4</version>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-compute</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.driver</groupId>
<artifactId>jclouds-log4j</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.driver</groupId>
<artifactId>jclouds-sshj</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemPropertyVariables>
<test.tmrk-enterprisecloud.endpoint>${test.tmrk-enterprisecloud.endpoint}</test.tmrk-enterprisecloud.endpoint>
<test.tmrk-enterprisecloud.apiversion>${test.tmrk-enterprisecloud.apiversion}</test.tmrk-enterprisecloud.apiversion>
<test.tmrk-enterprisecloud.identity>${test.tmrk-enterprisecloud.identity}</test.tmrk-enterprisecloud.identity>
<test.tmrk-enterprisecloud.credential>${test.tmrk-enterprisecloud.credential}</test.tmrk-enterprisecloud.credential>
<test.tmrk-enterprisecloud.image-id>${test.tmrk-enterprisecloud.image-id}</test.tmrk-enterprisecloud.image-id>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Export-Package>org.jclouds.tmrk.enterprisecloud.*;version="${project.version}"</Export-Package>
<Import-Package>org.jclouds.*;version="${project.version}",*</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,89 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.tmrk.enterprisecloud.features.*;
/**
* Provides asynchronous access to TerremarkEnterpriseCloud via their REST API.
* <p/>
*
* @see TerremarkEnterpriseCloudClient
* @see <a href=
* "http://support.theenterprisecloud.com/kb/default.asp?id=984&Lang=1&SID="
* />
* @author Adrian Cole
*/
public interface TerremarkEnterpriseCloudAsyncClient {
/**
* Provides asynchronous access to Internet Service features.
*/
@Delegate
InternetServiceAsyncClient getInternetServiceClient();
/**
* Provides asynchronous access to Layout features.
*/
@Delegate
LayoutAsyncClient getLayoutClient();
/**
* Provides asynchronous access to Location features.
*/
@Delegate
LocationAsyncClient getLocationClient();
/**
* Provides asynchronous access to Network features.
*/
@Delegate
NetworkAsyncClient getNetworkClient();
/**
* Provides asynchronous access to Resource features.
*/
@Delegate
ResourceAsyncClient getResourceClient();
/**
* Provides asynchronous access to Task features.
*/
@Delegate
TaskAsyncClient getTaskClient();
/**
* Provides asynchronous access to SSH Key features.
*/
@Delegate
SSHKeyAsyncClient getSSHKeyClient();
/**
* Provides asynchronous access to VirtualMachine features.
*/
@Delegate
VirtualMachineAsyncClient getVirtualMachineClient();
/**
* Provides asynchronous access to Template features.
*/
@Delegate
TemplateAsyncClient getTemplateClient();
}

View File

@ -1,93 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.tmrk.enterprisecloud.features.*;
/**
* Provides synchronous access to TerremarkEnterpriseCloud.
* <p/>
*
* @see TerremarkEnterpriseCloudAsyncClient
* @see <a href=
* "http://support.theenterprisecloud.com/kb/default.asp?id=984&Lang=1&SID="
* />
* @author Adrian Cole
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface TerremarkEnterpriseCloudClient {
/**
* Provides synchronous access to Internet Service features.
*/
@Delegate
InternetServiceClient getInternetServiceClient();
/**
* Provides synchronous access to Layout features.
*/
@Delegate
LayoutClient getLayoutClient();
/**
* Provides synchronous access to Location features.
*/
@Delegate
LocationClient getLocationClient();
/**
* Provides synchronous access to Resource features.
*/
@Delegate
ResourceClient getResourceClient();
/**
* Provides synchronous access to Network features.
*/
@Delegate
NetworkClient getNetworkClient();
/**
* Provides synchronous access to SSH Key features.
*/
@Delegate
SSHKeyClient getSSHKeyClient();
/**
* Provides synchronous access to Task features.
*/
@Delegate
TaskClient getTaskClient();
/**
* Provides synchronous access to VirtualMachine features.
*/
@Delegate
VirtualMachineClient getVirtualMachineClient();
/**
* Provides synchronous access to Template features.
*/
@Delegate
TemplateClient getTemplateClient();
}

View File

@ -1,45 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud;
import java.util.List;
import java.util.Properties;
import org.jclouds.rest.RestContextBuilder;
import org.jclouds.tmrk.enterprisecloud.config.TerremarkEnterpriseCloudRestClientModule;
import com.google.inject.Module;
/**
*
* @author Adrian Cole
*/
public class TerremarkEnterpriseCloudContextBuilder extends
RestContextBuilder<TerremarkEnterpriseCloudClient, TerremarkEnterpriseCloudAsyncClient> {
public TerremarkEnterpriseCloudContextBuilder(Properties props) {
super(TerremarkEnterpriseCloudClient.class, TerremarkEnterpriseCloudAsyncClient.class, props);
}
@Override
protected void addClientModule(List<Module> modules) {
modules.add(new TerremarkEnterpriseCloudRestClientModule());
}
}

View File

@ -1,46 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud;
import static org.jclouds.Constants.PROPERTY_API_VERSION;
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
import java.util.Properties;
import org.jclouds.PropertiesBuilder;
/**
* Builds properties used in TerremarkEnterpriseCloud Clients
*
* @author Adrian Cole
*/
public class TerremarkEnterpriseCloudPropertiesBuilder extends PropertiesBuilder {
@Override
protected Properties defaultProperties() {
Properties properties = super.defaultProperties();
properties.setProperty(PROPERTY_ENDPOINT, "https://services-beta.enterprisecloud.terremark.com/cloudapi/ecloud");
properties.setProperty(PROPERTY_API_VERSION, "2011-07-01");
return properties;
}
public TerremarkEnterpriseCloudPropertiesBuilder(Properties properties) {
super(properties);
}
}

View File

@ -1,117 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud;
import java.net.URI;
import java.util.Set;
import org.jclouds.providers.BaseProviderMetadata;
import org.jclouds.providers.ProviderMetadata;
import com.google.common.collect.ImmutableSet;
/**
* Implementation of {@link org.jclouds.types.ProviderMetadata} for Terremark
* Enterprise Cloud.
*
* @author Adrian Cole
*/
public class TerremarkEnterpriseCloudProviderMetadata extends BaseProviderMetadata {
/**
* {@inheritDoc}
*/
@Override
public String getId() {
return "tmrk-enterprisecloud";
}
/**
* {@inheritDoc}
*/
@Override
public String getType() {
return ProviderMetadata.COMPUTE_TYPE;
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return "Terremark Enterprise Cloud";
}
/**
* {@inheritDoc}
*/
@Override
public String getIdentityName() {
return "Email";
}
/**
* {@inheritDoc}
*/
@Override
public String getCredentialName() {
return "Password";
}
/**
* {@inheritDoc}
*/
@Override
public URI getHomepage() {
return URI.create("http://www.terremark.com/services/cloudcomputing/theenterprisecloud.aspx");
}
/**
* {@inheritDoc}
*/
@Override
public URI getConsole() {
return URI.create("https://my-beta.enterprisecloud.terremark.com/");
}
/**
* {@inheritDoc}
*/
@Override
public URI getApiDocumentation() {
return URI.create("http://support.theenterprisecloud.com/kb/default.asp?id=984&Lang=1&SID=");
}
/**
* {@inheritDoc}
*/
@Override
public Set<String> getLinkedServices() {
return ImmutableSet.of("tmrk-enterprisecloud", "tmrk-ecloud", "tmrk-vcloudexpress");
}
/**
* {@inheritDoc}
*/
@Override
public Set<String> getIso3166Codes() {
return ImmutableSet.of("TODO");
}
}

View File

@ -1,37 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.binders;
import org.jclouds.rest.binders.BindToStringPayload;
import javax.inject.Inject;
import javax.inject.Singleton;
/**
* For use with {@see org.jclouds.tmrk.enterprisecloud.features.InternetServiceClient#createInternetService}
* @author Jason King
*/
@Singleton
public class BindCreateInternetServiceToXmlPayload extends BindInternetServiceToXmlPayload {
@Inject
BindCreateInternetServiceToXmlPayload(BindToStringPayload stringBinder) {
super(stringBinder, "CreateInternetService");
}
}

View File

@ -1,78 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.binders;
import com.jamesmurty.utils.XMLBuilder;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.MapBinder;
import org.jclouds.rest.binders.BindToStringPayload;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import java.util.Map;
import java.util.Properties;
import static com.google.common.base.Preconditions.checkNotNull;
/**
*
* @author Jason King
*/
@Singleton
public class BindCreateSSHKeyToXmlPayload implements MapBinder {
private final BindToStringPayload stringBinder;
@Inject
BindCreateSSHKeyToXmlPayload(BindToStringPayload stringBinder) {
this.stringBinder = stringBinder;
}
@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, String> params) {
checkNotNull(request, "request");
checkNotNull(params, "params");
String name = checkNotNull(params.get("name"), "name");
String isDefault = checkNotNull(params.get("isDefault"), "isDefault");
String payload = createXMLPayload(name,isDefault);
return stringBinder.bindToRequest(request, payload);
}
private String createXMLPayload(String name, String isDefault) {
try {
Properties outputProperties = new Properties();
outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
return XMLBuilder.create("CreateSshKey").a("name",name)
.e("Default").t(isDefault)
.asString(outputProperties);
} catch (ParserConfigurationException e) {
throw new RuntimeException(e);
} catch (TransformerException t) {
throw new RuntimeException(t);
}
}
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
throw new IllegalStateException("BindCreateKey needs parameters");
}
}

View File

@ -1,180 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.binders;
import com.jamesmurty.utils.XMLBuilder;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.Binder;
import org.jclouds.rest.binders.BindToStringPayload;
import org.jclouds.tmrk.enterprisecloud.domain.NamedResource;
import org.jclouds.tmrk.enterprisecloud.domain.layout.LayoutRequest;
import org.jclouds.tmrk.enterprisecloud.domain.network.*;
import org.jclouds.tmrk.enterprisecloud.domain.vm.CreateVirtualMachine;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import java.util.Properties;
import java.util.Set;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* For use with {@see VirtualMachineClient#createVirtualMachineFromTemplate}
* @author Jason King
*/
@Singleton
public class BindCreateVirtualMachineKeyToXmlPayload implements Binder {
private final BindToStringPayload stringBinder;
@Inject
BindCreateVirtualMachineKeyToXmlPayload(BindToStringPayload stringBinder) {
this.stringBinder = stringBinder;
}
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object key) {
checkArgument(checkNotNull(key, "key") instanceof CreateVirtualMachine, "this binder is only valid for CreateOsTemplateVirtualMachineRequest instances!");
checkNotNull(request, "request");
CreateVirtualMachine vmData = CreateVirtualMachine.class.cast(key);
String payload = createXMLPayload(vmData);
return stringBinder.bindToRequest(request, payload);
}
private String createXMLPayload(CreateVirtualMachine vmData) {
try {
Properties outputProperties = new Properties();
outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
final String name = vmData.getName();
final String processorCount = Integer.toString(vmData.getProcessorCount());
final String memoryUnit = vmData.getMemory().getUnit();
final int memoryValue = ((Double)(vmData.getMemory().getValue())).intValue();
final Set<String> tags = vmData.getTags();
final String description = vmData.getDescription();
final LayoutRequest layout = vmData.getLayout();
final String poweredOn = Boolean.toString(vmData.isPoweredOn());
final NamedResource template = vmData.getTemplate();
XMLBuilder builder = XMLBuilder.create("CreateVirtualMachine").a("name",name)
.e("ProcessorCount").t(processorCount).up()
.e("Memory").e("Unit").t(memoryUnit).up()
.e("Value").t(Integer.toString(memoryValue)).up().up();
builder = layout(builder,layout);
builder.e("Description").t(description).up();
builder = tags(builder,tags);
builder = linuxCustomization(builder, vmData);
builder = windowsCustomization(builder, vmData);
builder.e("PoweredOn").t(poweredOn).up()
.e("Template").a("href",template.getHref().toString())
.a("type", template.getType()).up();
return builder.asString(outputProperties);
} catch (ParserConfigurationException e) {
throw new RuntimeException(e);
} catch (TransformerException t) {
throw new RuntimeException(t);
}
}
private XMLBuilder layout(XMLBuilder in, LayoutRequest layout) {
in = in.e("Layout");
if(layout.getGroup()!=null) {
in = in.e("Group").a("href",layout.getGroup().getHref().toString())
.a("type",layout.getGroup().getType()).up();
} else if (layout.getRow()!=null) {
checkNotNull(layout.getNewGroup(),"newGroup");
in = in.e("Row").a("href",layout.getRow().getHref().toString())
.a("type", layout.getRow().getType()).up()
.e("NewGroup").t(layout.getNewGroup()).up();
} else {
checkNotNull(layout.getNewRow(),"newRow");
checkNotNull(layout.getNewGroup(), "newGroup");
in = in.e("NewRow").t(layout.getNewRow()).up()
.e("NewGroup").t(layout.getNewGroup()).up();
}
return in.up();
}
private XMLBuilder tags(XMLBuilder in, Set<String> tags ) {
checkNotNull(tags,"tags");
in = in.e("Tags");
for(String tag: tags) {
in = in.e("Tag").t(tag).up();
}
return in.up();
}
private XMLBuilder linuxCustomization(XMLBuilder in, CreateVirtualMachine vmData) {
LinuxCustomization linuxCustomization = vmData.getLinuxCustomization();
if(linuxCustomization==null) return in;
if(vmData.getWindowsCustomization()!=null) throw new IllegalStateException("Cannot have linux and windows customizations");
in = in.e("LinuxCustomization")
.e("NetworkSettings")
.e("NetworkAdapterSettings");
for(NetworkAdapterSetting setting:linuxCustomization.getNetworkSettings().getNetworkAdapterSettings().getNetworkAdapterSettings()) {
in = networkAdapterSetting(in,setting);
}
in = in.up();
in = dnsSettings(in, linuxCustomization.getNetworkSettings().getDnsSettings());
String href = linuxCustomization.getSshKey().getHref().toString();
String type = linuxCustomization.getSshKey().getType();
return in.up().e("SshKey").a("href",href).a("type",type).up().up();
}
private XMLBuilder networkAdapterSetting(XMLBuilder builder, NetworkAdapterSetting setting) {
String href = setting.getNetwork().getHref().toString();
String name = setting.getNetwork().getName();
String type = setting.getNetwork().getType();
builder.e("NetworkAdapter")
.e("Network").a("href",href).a("name",name).a("type",type).up()
.e("IpAddress").t(setting.getIpAddress()).up();
return builder;
}
private XMLBuilder dnsSettings(XMLBuilder in, DnsSettings dnsSettings) {
if(dnsSettings==null)return in;
final String primary = dnsSettings.getPrimaryDns();
final String secondary = dnsSettings.getSecondaryDns();
in = in.e("DnsSettings").e("PrimaryDns").t(primary).up();
if(secondary!=null && !secondary.isEmpty()) {
in = in.e("SecondaryDns").t(secondary).up();
}
return in.up();
}
private XMLBuilder windowsCustomization(XMLBuilder builder, CreateVirtualMachine vmData) {
WindowsCustomization windowsCustomization = vmData.getWindowsCustomization();
if(windowsCustomization==null) return builder;
if(vmData.getLinuxCustomization()!=null) throw new IllegalStateException("Cannot have linux and windows customizations");
//TODO: Not implemented yet
throw new UnsupportedOperationException("windowsCustomization has not been implemented yet");
//return builder;
}
}

View File

@ -1,55 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.binders;
import org.jclouds.date.DateService;
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.utils.ModifyRequest;
import org.jclouds.rest.Binder;
import javax.inject.Provider;
import javax.ws.rs.core.UriBuilder;
import java.util.Date;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* @author Jason King
*/
abstract class BindDateToQueryParam implements Binder {
private final Provider<UriBuilder> uriBuilderProvider;
private final DateService dateService;
private final String key;
public BindDateToQueryParam(Provider<UriBuilder> uriBuilderProvider, String key) {
this.uriBuilderProvider = checkNotNull(uriBuilderProvider, "uriBuilderProvider");
this.dateService = new SimpleDateFormatDateService();
this.key = key;
}
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
if(input==null) return request;
Date date = Date.class.cast(input);
String dateString = dateService.iso8601SecondsDateFormat(date);
return ModifyRequest.addQueryParam(request, key, dateString, uriBuilderProvider.get());
}
}

View File

@ -1,36 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.binders;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.inject.Singleton;
import javax.ws.rs.core.UriBuilder;
/**
* @author Jason King
*/
@Singleton
public class BindEndTimeQueryParam extends BindDateToQueryParam {
@Inject
public BindEndTimeQueryParam(Provider<UriBuilder> uriBuilderProvider) {
super(uriBuilderProvider,"endtime");
}
}

View File

@ -1,144 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.binders;
import com.jamesmurty.utils.XMLBuilder;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.Binder;
import org.jclouds.rest.binders.BindToStringPayload;
import org.jclouds.tmrk.enterprisecloud.domain.NamedResource;
import org.jclouds.tmrk.enterprisecloud.domain.service.Protocol;
import org.jclouds.tmrk.enterprisecloud.domain.service.internet.InternetService;
import org.jclouds.tmrk.enterprisecloud.domain.service.internet.InternetServicePersistenceType;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import java.util.Properties;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* For use with {@see org.jclouds.tmrk.enterprisecloud.features.InternetServiceClient#editInternetService}
* @author Jason King
*/
@Singleton
public class BindInternetServiceToXmlPayload implements Binder {
private final BindToStringPayload stringBinder;
private final String rootElement;
@Inject
BindInternetServiceToXmlPayload(BindToStringPayload stringBinder) {
this(stringBinder,"InternetService");
}
protected BindInternetServiceToXmlPayload(BindToStringPayload stringBinder, String rootElement) {
this.stringBinder = stringBinder;
this.rootElement = rootElement;
}
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object key) {
checkArgument(checkNotNull(key, "key") instanceof InternetService, "this binder is only valid for InternetService instances");
checkNotNull(request, "request");
InternetService data = InternetService.class.cast(key);
String payload = createXMLPayload(data);
return stringBinder.bindToRequest(request, payload);
}
private String createXMLPayload(InternetService data) {
try {
Properties outputProperties = new Properties();
outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
final String name = checkNotNull(data.getName(), "name");
final Protocol protocol = data.getProtocol();
final int port = data.getPort();
final String enabled = Boolean.toString(data.isEnabled());
final String description = data.getDescription();
final InternetServicePersistenceType persistence = data.getPersistence();
final String redirectUrl = data.getRedirectUrl();
final NamedResource trustedNetworkGroup = data.getTrustedNetworkGroup();
final NamedResource backupInternetService = data.getBackupInternetService();
XMLBuilder builder = XMLBuilder.create(rootElement).a("name", name);
if(protocol!=null) {
builder = builder.e("Protocol").t(protocol.value()).up();
}
if(port>0) {
builder = builder.e("Port").t(Integer.toString(port)).up();
}
builder = builder.e("Enabled").t(enabled).up();
if(description!=null) {
builder = builder.e("Description").t(description).up();
}
//TODO: Public IP
builder = persistence(builder,persistence);
if(redirectUrl!=null) {
builder = builder.e("RedirectUrl").t(redirectUrl);
}
//TODO: Monitor
if(trustedNetworkGroup!=null) {
final String href = trustedNetworkGroup.getHref().toString();
String groupName = trustedNetworkGroup.getName();
String type = trustedNetworkGroup.getType();
builder = builder.e("TrustedNetworkGroup").a("href",href).a("name",groupName).a("type", type).up();
}
if(backupInternetService!=null) {
final String href = backupInternetService.getHref().toString();
String groupName = backupInternetService.getName();
String type = backupInternetService.getType();
builder = builder.e("BackupInternetService").a("href",href).a("name",groupName).a("type",type).up();
}
//TODO: NodeServices
return builder.asString(outputProperties);
} catch (ParserConfigurationException e) {
throw new RuntimeException(e);
} catch (TransformerException t) {
throw new RuntimeException(t);
}
}
private XMLBuilder persistence(XMLBuilder in, InternetServicePersistenceType persistenceType) {
checkNotNull(persistenceType,"persistenceType");
final InternetServicePersistenceType.PersistenceType type = persistenceType.getPersistenceType();
final int timeout = persistenceType.getTimeout();
in = in.e("Persistence").e("Type").t(type.value()).up();
if(!type.equals(InternetServicePersistenceType.PersistenceType.NONE) && timeout > -1 ) {
in = in.e("Timeout").t(Integer.toString(timeout)).up();
}
return in.up();
}
}

View File

@ -1,78 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.binders;
import com.jamesmurty.utils.XMLBuilder;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.Binder;
import org.jclouds.rest.binders.BindToStringPayload;
import org.jclouds.tmrk.enterprisecloud.domain.keys.SSHKey;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import java.util.Properties;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
/**
*
* @author Jason King
*/
@Singleton
public class BindSSHKeyToXmlPayload implements Binder {
private final BindToStringPayload stringBinder;
@Inject
BindSSHKeyToXmlPayload(BindToStringPayload stringBinder) {
this.stringBinder = stringBinder;
}
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object key) {
checkArgument(checkNotNull(key, "key") instanceof SSHKey, "this binder is only valid for SSHKey instances!");
checkNotNull(request, "request");
SSHKey sshKey = SSHKey.class.cast(key);
String name = sshKey.getName();
String isDefault = Boolean.toString(sshKey.isDefaultKey());
String fingerPrint = sshKey.getFingerPrint();
String payload = createXMLPayload(name,isDefault,fingerPrint);
return stringBinder.bindToRequest(request, payload);
}
private String createXMLPayload(String name, String isDefault, String fingerPrint) {
try {
Properties outputProperties = new Properties();
outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
return XMLBuilder.create("SshKey").a("name",name)
.e("Default").t(isDefault).up()
.e("FingerPrint").t(fingerPrint)
.asString(outputProperties);
} catch (ParserConfigurationException e) {
throw new RuntimeException(e);
} catch (TransformerException t) {
throw new RuntimeException(t);
}
}
}

View File

@ -1,36 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.binders;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.inject.Singleton;
import javax.ws.rs.core.UriBuilder;
/**
* @author Jason King
*/
@Singleton
public class BindStartTimeQueryParam extends BindDateToQueryParam {
@Inject
public BindStartTimeQueryParam(Provider<UriBuilder> uriBuilderProvider) {
super(uriBuilderProvider,"starttime");
}
}

View File

@ -1,80 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.config;
import com.google.common.collect.ImmutableMap;
import org.jclouds.http.HttpErrorHandler;
import org.jclouds.http.HttpRetryHandler;
import org.jclouds.http.RequiresHttp;
import org.jclouds.http.annotation.ClientError;
import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError;
import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.config.RestClientModule;
import org.jclouds.tmrk.enterprisecloud.TerremarkEnterpriseCloudAsyncClient;
import org.jclouds.tmrk.enterprisecloud.TerremarkEnterpriseCloudClient;
import org.jclouds.tmrk.enterprisecloud.features.*;
import org.jclouds.tmrk.enterprisecloud.handlers.TerremarkEnterpriseCloudErrorHandler;
import java.util.Map;
/**
* Configures the TerremarkEnterpriseCloud connection.
*
* @author Adrian Cole
*/
@RequiresHttp
@ConfiguresRestClient
public class TerremarkEnterpriseCloudRestClientModule extends
RestClientModule<TerremarkEnterpriseCloudClient, TerremarkEnterpriseCloudAsyncClient> {
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()
.put(InternetServiceClient.class, InternetServiceAsyncClient.class)
.put(LayoutClient.class, LayoutAsyncClient.class)
.put(LocationClient.class, LocationAsyncClient.class)
.put(NetworkClient.class, NetworkAsyncClient.class)
.put(ResourceClient.class, ResourceAsyncClient.class)
.put(TaskClient.class, TaskAsyncClient.class)
.put(SSHKeyClient.class, SSHKeyAsyncClient.class)
.put(VirtualMachineClient.class, VirtualMachineAsyncClient.class)
.put(TemplateClient.class, TemplateAsyncClient.class)
.build();
public TerremarkEnterpriseCloudRestClientModule() {
super(TerremarkEnterpriseCloudClient.class, TerremarkEnterpriseCloudAsyncClient.class, DELEGATE_MAP);
}
@Override
protected void configure() {
super.configure();
}
@Override
protected void bindErrorHandlers() {
bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(TerremarkEnterpriseCloudErrorHandler.class);
bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(TerremarkEnterpriseCloudErrorHandler.class);
bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(TerremarkEnterpriseCloudErrorHandler.class);
}
@Override
protected void bindRetryHandlers() {
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(BackoffLimitedRetryHandler.class);
}
}

View File

@ -1,218 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseNamedResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import java.net.URI;
import java.util.Map;
import static com.google.common.base.CaseFormat.LOWER_CAMEL;
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* <xs:complexType name="Action">
* @author Adrian Cole
*
*/
public class Action extends BaseNamedResource<Action> {
@XmlEnum
public static enum ActionDisabled {
/**
* The actionDisabled attribute will have a value of noAccess when a user
* does not have permission to perform the action. For example, for a user
* with read-only access, all actions have actionDisabled="noAccess" set.
*/
@XmlEnumValue("noAccess")
NO_ACCESS,
/**
* The attribute will have a value of disabled when the action is contrary
* to business rules. For example, the action virtual machine with
* name="power:powerOff" has actionDisabled="disabled" when the virtual
* machine is currently powered off; a virtual machine, which is currently
* off, may not be powered off; it may only be powered on. If both
* conditions apply, actions have actionDisabled="noAccess" set. If
* neither condition applies, the attribute will not appear.
*/
@XmlEnumValue("disabled")
DISABLED,
/**
* ActionDisabled was not parsed by jclouds.
*/
UNRECOGNIZED;
public String value() {
return UPPER_UNDERSCORE.to(LOWER_CAMEL, name());
}
@Override
public String toString() {
return value();
}
public static ActionDisabled fromValue(String actionDisabled) {
try {
return valueOf(LOWER_CAMEL.to(UPPER_UNDERSCORE, checkNotNull(actionDisabled, "actionDisabled")));
} catch (IllegalArgumentException e) {
return UNRECOGNIZED;
}
}
}
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromAction(this);
}
public static class Builder extends BaseNamedResource.Builder<Action> {
protected ActionDisabled actionDisabled;
/**
* @see Action#getActionDisabled
*/
public Builder actionDisabled(ActionDisabled actionDisabled) {
this.actionDisabled = actionDisabled;
return this;
}
@Override
public Action build() {
return new Action(href, type, name, actionDisabled);
}
public Builder fromAction(Action in) {
return fromNamedResource(in).actionDisabled(in.getActionDisabled());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<Action> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromNamedResource(BaseNamedResource<Action> in) {
return Builder.class.cast(super.fromNamedResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
super.fromAttributes(attributes);
if (attributes.containsKey("actionDisabled"))
actionDisabled(ActionDisabled.fromValue(attributes.get("actionDisabled")));
return this;
}
}
@XmlAttribute
protected ActionDisabled actionDisabled;
private Action(URI href, String type, String name, @Nullable ActionDisabled actionDisabled) {
super(href, type, name);
this.actionDisabled = actionDisabled;
}
private Action() {
//For JAXB
}
/**
* The attribute actionDisabled appears only when the example has an action
* disabled for business rules.
*
* @return
*/
@Nullable
public ActionDisabled getActionDisabled() {
return actionDisabled;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
Action action = (Action) o;
if (actionDisabled != action.actionDisabled) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (actionDisabled != null ? actionDisabled.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", actionDisabled="+actionDisabled;
}
}

View File

@ -1,106 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import java.util.Collections;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Wraps individual Action elements.
* Needed because parsing is done with JAXB and it does not handle Generic collections
* @author Jason King
*/
public class Actions {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromActions(this);
}
public static class Builder {
private Set<Action> actions = Sets.newLinkedHashSet();
/**
* @see Actions#getActions
*/
public Builder actions(Set<Action> actions) {
this.actions = Sets.newLinkedHashSet(checkNotNull(actions, "actions"));
return this;
}
public Builder addAction(Action action) {
actions.add(checkNotNull(action,"action"));
return this;
}
public Actions build() {
return new Actions(actions);
}
public Builder fromActions(Actions in) {
return actions(in.getActions());
}
}
private Actions() {
//For JAXB and builder use
}
private Actions(Set<Action> actions) {
this.actions = Sets.newLinkedHashSet(actions);
}
@XmlElement(name = "Action")
private Set<Action> actions = Sets.newLinkedHashSet();
public Set<Action> getActions() {
return Collections.unmodifiableSet(actions);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Actions actions1 = (Actions) o;
if (!actions.equals(actions1.actions)) return false;
return true;
}
@Override
public int hashCode() {
return actions.hashCode();
}
public String toString() {
return "["+ actions.toString()+"]";
}
}

View File

@ -1,134 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain;
import javax.xml.bind.annotation.XmlElement;
/**
* <xs:complexType name="ConfigurationOptionRange">
* @author Jason King
*/
public class ConfigurationOptionRange {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromConfigurationOptionRange(this);
}
public static class Builder {
private int minimum;
private int maximum;
private int stepFactor;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.ConfigurationOptionRange#getMinimum
*/
public Builder minimum(int minimum) {
this.minimum = minimum;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.ConfigurationOptionRange#getMaximum
*/
public Builder maximum(int maximum) {
this.maximum = maximum;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.ConfigurationOptionRange#getStepFactor
*/
public Builder stepFactor(int stepFactor) {
this.stepFactor = stepFactor;
return this;
}
public ConfigurationOptionRange build() {
return new ConfigurationOptionRange(minimum, maximum,stepFactor);
}
public Builder fromConfigurationOptionRange(ConfigurationOptionRange in) {
return minimum(in.getMinimum()).maximum(in.getMaximum()).stepFactor(in.getStepFactor());
}
}
@XmlElement(name = "Minimum")
private int minimum;
@XmlElement(name = "Maximum")
private int maximum;
@XmlElement(name = "StepFactor")
private int stepFactor;
private ConfigurationOptionRange(int minimum, int maximum, int stepFactor) {
this.minimum = minimum;
this.maximum = maximum;
this.stepFactor = stepFactor;
}
private ConfigurationOptionRange() {
//For JAXB
}
public int getMinimum() {
return minimum;
}
public int getMaximum() {
return maximum;
}
public int getStepFactor() {
return stepFactor;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ConfigurationOptionRange that = (ConfigurationOptionRange) o;
if (maximum != that.maximum) return false;
if (minimum != that.minimum) return false;
if (stepFactor != that.stepFactor) return false;
return true;
}
@Override
public int hashCode() {
int result = minimum;
result = 31 * result + maximum;
result = 31 * result + stepFactor;
return result;
}
@Override
public String toString() {
return "[minimum="+ minimum +", maximum="+ maximum +", stepFactor="+stepFactor+"]";
}
}

View File

@ -1,167 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* <xs:complexType name="CustomizationOption">
* @author Jason King
*/
public class CustomizationOption {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromConfigurationOptionRange(this);
}
public static class Builder {
private CustomizationType type;
private boolean canPowerOn;
private boolean passwordRequired;
private boolean sshKeyRequired;
/**
* @see CustomizationOption#getType
*/
public Builder type(CustomizationType type) {
this.type = type;
return this;
}
/**
* @see CustomizationOption#canPowerOn
*/
public Builder canPowerOn(boolean canPowerOn) {
this.canPowerOn = canPowerOn;
return this;
}
/**
* @see CustomizationOption#isPasswordRequired()
*/
public Builder passwordRequired(boolean passwordRequired) {
this.passwordRequired = passwordRequired;
return this;
}
/**
* @see CustomizationOption#isSshKeyRequired()
*/
public Builder sshKeyRequired(boolean sshKeyRequired) {
this.sshKeyRequired = sshKeyRequired;
return this;
}
public CustomizationOption build() {
return new CustomizationOption(type, canPowerOn, passwordRequired,sshKeyRequired);
}
public Builder fromConfigurationOptionRange(CustomizationOption in) {
return type(in.getType()).canPowerOn(in.canPowerOn()).passwordRequired(in.isPasswordRequired()).sshKeyRequired(in.isSshKeyRequired());
}
}
@XmlElement(name = "Type")
private CustomizationType type;
@XmlElement(name = "CanPowerOn")
private boolean canPowerOn;
@XmlElement(name = "PasswordRequired")
private boolean passwordRequired;
@XmlElement(name = "SshKeyRequired")
private boolean sshKeyRequired;
private CustomizationOption(CustomizationType type, boolean canPowerOn, boolean passwordRequired, boolean sshKeyRequired) {
this.type = checkNotNull(type,"type");
this.canPowerOn = canPowerOn;
this.passwordRequired = passwordRequired;
this.sshKeyRequired = sshKeyRequired;
}
private CustomizationOption() {
//For JAXB
}
public CustomizationType getType() {
return type;
}
public boolean canPowerOn() {
return canPowerOn;
}
public boolean isPasswordRequired() {
return passwordRequired;
}
public boolean isSshKeyRequired() {
return sshKeyRequired;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CustomizationOption that = (CustomizationOption) o;
if (canPowerOn != that.canPowerOn) return false;
if (passwordRequired != that.passwordRequired) return false;
if (sshKeyRequired != that.sshKeyRequired) return false;
if (type != that.type) return false;
return true;
}
@Override
public int hashCode() {
int result = type.hashCode();
result = 31 * result + (canPowerOn ? 1 : 0);
result = 31 * result + (passwordRequired ? 1 : 0);
result = 31 * result + (sshKeyRequired ? 1 : 0);
return result;
}
@Override
public String toString() {
return "[type="+type+", canPowerOn="+ canPowerOn +", passwordRequired="+ passwordRequired +", sshKeyRequired="+sshKeyRequired+"]";
}
@XmlEnum
public enum CustomizationType {
@XmlEnumValue("Linux")
LINUX,
@XmlEnumValue("Windows")
WINDOWS;
}
}

View File

@ -1,231 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain;
import com.google.common.collect.Sets;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseNamedResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import java.net.URI;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* <xs:complexType name="Link">
* @author Adrian Cole
*
*/
public class Link extends BaseNamedResource<Link> {
@XmlEnum
public static enum Relationship {
/**
* The entity in the link owns the entity in the response
*/
@XmlEnumValue("up")
UP,
/**
* The entity in the response owns the entity in the link
*/
@XmlEnumValue("down")
DOWN,
/**
* The entity in the link is an alternate view of the entity in the
* response
*/
@XmlEnumValue("alternate")
ALTERNATE,
/**
* The link is a path to the first page in the pages of responses
*/
@XmlEnumValue("first")
FIRST,
/**
* The link is a path to the previous page in the pages of responses
*/
@XmlEnumValue("previous")
PREVIOUS,
/**
* The link is a path to the next page in the pages of responses
*/
@XmlEnumValue("next")
NEXT,
/**
* The link is a path to the last page in the pages of responses
*/
@XmlEnumValue("last")
LAST,
/**
* Relationship was not parsed by jclouds.
*/
UNRECOGNIZED;
public String value() {
return name().toLowerCase();
}
@Override
public String toString() {
return value();
}
public static Relationship fromValue(String rel) {
try {
return valueOf(checkNotNull(rel, "rel").toUpperCase());
} catch (IllegalArgumentException e) {
return UNRECOGNIZED;
}
}
}
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromLink(this);
}
public static class Builder extends BaseNamedResource.Builder<Link> {
protected Relationship rel;
/**
* @see Link#getRelationship
*/
public Builder rel(Relationship rel) {
this.rel = rel;
return this;
}
@Override
public Link build() {
return new Link(href, type, name, rel);
}
public Builder fromLink(Link in) {
return fromNamedResource(in).rel(in.getRelationship());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<Link> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromNamedResource(BaseNamedResource<Link> in) {
return Builder.class.cast(super.fromNamedResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
super.fromAttributes(attributes);
if (attributes.containsKey("rel"))
rel(Relationship.fromValue(attributes.get("rel")));
return this;
}
}
@XmlAttribute
protected Relationship rel;
private Link(URI href, String type, String name, Relationship rel) {
super(href, type, name);
this.rel = checkNotNull(rel, "rel");
}
private Link() {
//For JAXB
}
/**
*
* @return
*/
public Relationship getRelationship() {
return rel;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
Link link = (Link) o;
if (rel != link.rel) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + rel.hashCode();
return result;
}
@Override
public String string() {
return super.string()+", rel="+rel;
}
}

View File

@ -1,108 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Wraps individual Link elements.
* Needed because parsing is done with JAXB and it does not handle Generic collections
* @author Jason King
*/
public class Links {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromLinks(this);
}
public static class Builder {
private Set<Link> links = Sets.newLinkedHashSet();
/**
* @see Links#getLinks
*/
public Builder links(Set<Link> links) {
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
return this;
}
public Builder addLink(Link link) {
links.add(checkNotNull(link,"link"));
return this;
}
public Links build() {
return new Links(links);
}
public Builder fromLinks(Links in) {
return links(in.getLinks());
}
}
@XmlElement(name = "Link")
private LinkedHashSet<Link> links = Sets.newLinkedHashSet();
private Links() {
//For JAXB
}
private Links(Set<Link> links) {
this.links = Sets.newLinkedHashSet(links);
}
public Set<Link> getLinks() {
return Collections.unmodifiableSet(links);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Links links1 = (Links) o;
if (!links.equals(links1.links)) return false;
return true;
}
@Override
public int hashCode() {
return links.hashCode();
}
public String toString() {
return "["+ links.toString()+"]";
}
}

View File

@ -1,221 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Map;
import java.util.Set;
/**
* <xs:complexType name="Location">
* @author Jason King
*
*/
@XmlRootElement(name = "Location")
public class Location extends Resource<Location> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromLocation(this);
}
public static class Builder extends Resource.Builder<Location> {
private String friendlyName;
private String locode;
private String iso3166;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.Location#getFriendlyName
*/
public Builder friendlyName(String friendlyName) {
this.friendlyName = friendlyName;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.Location#getLocode
*/
public Builder locode(String locode) {
this.locode = locode;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.Location#getIso3166
*/
public Builder iso3166(String iso3166) {
this.iso3166 = iso3166;
return this;
}
@Override
public Location build() {
return new Location(href, type, name, links,
actions, friendlyName, locode, iso3166);
}
public Builder fromLocation(Location in) {
return fromResource(in).friendlyName(in.getFriendlyName()).locode(in.getLocode()).iso3166(in.getIso3166());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<Location> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<Location> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "FriendlyName", required = true)
private String friendlyName;
@XmlElement(name = "Locode", required = false)
private String locode;
@XmlElement(name = "ISO3166", required = false)
private String iso3166;
private Location(URI href, String type, String name, Set<Link> links, Set<Action> actions, @Nullable String friendlyName, @Nullable String locode, @Nullable String iso3166) {
super(href, type, name, links, actions);
this.friendlyName = friendlyName;
this.locode = locode;
this.iso3166 = iso3166;
}
private Location() {
//For JAXB
}
public String getFriendlyName() {
return friendlyName;
}
public String getLocode() {
return locode;
}
public String getIso3166() {
return iso3166;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
Location location = (Location) o;
if (friendlyName != null ? !friendlyName.equals(location.friendlyName) : location.friendlyName != null)
return false;
if (iso3166 != null ? !iso3166.equals(location.iso3166) : location.iso3166 != null)
return false;
if (locode != null ? !locode.equals(location.locode) : location.locode != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (friendlyName != null ? friendlyName.hashCode() : 0);
result = 31 * result + (locode != null ? locode.hashCode() : 0);
result = 31 * result + (iso3166 != null ? iso3166.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", friendlyName="+friendlyName+", locode="+locode+", iso3166="+iso3166;
}
}

View File

@ -1,115 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain;
import java.net.URI;
import java.util.Map;
import java.util.Set;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseNamedResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
/**
*
* @author Adrian Cole
*
*/
public class NamedResource extends BaseNamedResource<NamedResource> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromNamedResource(this);
}
public static class Builder extends BaseNamedResource.Builder<NamedResource> {
/**
* {@inheritDoc}
*/
@Override
public NamedResource build() {
return new NamedResource(href, type, name);
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<NamedResource> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromNamedResource(BaseNamedResource<NamedResource> in) {
return Builder.class.cast(super.fromNamedResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> in) {
return Builder.class.cast(super.fromAttributes(in));
}
}
private NamedResource(URI href, String type, String name) {
super(href, type, name);
}
protected NamedResource() {
//For JAXB
}
}

View File

@ -1,140 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
import javax.xml.bind.annotation.XmlElement;
/**
* <xs:complexType name="ResourceCapacityRange">
* @author Jason King
*/
public class ResourceCapacityRange {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromResourceCapacityRange(this);
}
public static class Builder {
private ResourceCapacity minimumSize;
private ResourceCapacity maximumSize;
private ResourceCapacity stepFactor;
/**
* @see ResourceCapacityRange#getMinimumSize
*/
public Builder minimumSize(ResourceCapacity minimumSize) {
this.minimumSize = minimumSize;
return this;
}
/**
* @see ResourceCapacityRange#getMaximumSize
*/
public Builder maximumSize(ResourceCapacity maximumSize) {
this.maximumSize = maximumSize;
return this;
}
/**
* @see ResourceCapacityRange#getStepFactor
*/
public Builder stepFactor(ResourceCapacity stepFactor) {
this.stepFactor = stepFactor;
return this;
}
public ResourceCapacityRange build() {
return new ResourceCapacityRange(minimumSize,maximumSize,stepFactor);
}
public Builder fromResourceCapacityRange(ResourceCapacityRange in) {
return minimumSize(in.getMinimumSize()).maximumSize(in.getMaximumSize()).stepFactor(in.getStepFactor());
}
}
@XmlElement(name = "MinimumSize", required = false)
private ResourceCapacity minimumSize;
@XmlElement(name = "MaximumSize", required = false)
private ResourceCapacity maximumSize;
@XmlElement(name = "StepFactor", required = false)
private ResourceCapacity stepFactor;
private ResourceCapacityRange(@Nullable ResourceCapacity minimumSize, @Nullable ResourceCapacity maximumSize, @Nullable ResourceCapacity stepFactor) {
this.minimumSize = minimumSize;
this.maximumSize = maximumSize;
this.stepFactor = stepFactor;
}
private ResourceCapacityRange() {
//For JAXB
}
public ResourceCapacity getMinimumSize() {
return minimumSize;
}
public ResourceCapacity getMaximumSize() {
return maximumSize;
}
public ResourceCapacity getStepFactor() {
return stepFactor;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ResourceCapacityRange that = (ResourceCapacityRange) o;
if (maximumSize != null ? !maximumSize.equals(that.maximumSize) : that.maximumSize != null)
return false;
if (minimumSize != null ? !minimumSize.equals(that.minimumSize) : that.minimumSize != null)
return false;
if (stepFactor != null ? !stepFactor.equals(that.stepFactor) : that.stepFactor != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = minimumSize != null ? minimumSize.hashCode() : 0;
result = 31 * result + (maximumSize != null ? maximumSize.hashCode() : 0);
result = 31 * result + (stepFactor != null ? stepFactor.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "[minimumSize="+ minimumSize +", maximumSize="+maximumSize+", stepFactor="+stepFactor+"]";
}
}

View File

@ -1,416 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.CaseFormat.UPPER_CAMEL;
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* <xs:complexType name="Task">
* @author Adrian Cole
*
*/
@XmlRootElement(name = "Task")
public class Task extends Resource<Task> {
@XmlEnum
public static enum Status {
/**
* the task is queued for execution.
*/
@XmlEnumValue("Queued")
QUEUED,
/**
* the task is running.
*/
@XmlEnumValue("Running")
RUNNING,
/**
* the task failed.
*/
@XmlEnumValue("Failed")
FAILED,
/**
* the task completed successfully.
*/
@XmlEnumValue("Success")
SUCCESS,
/**
* the task completed successfully.
*/
@XmlEnumValue("Complete")
COMPLETE,
/**
* the task failed with an error.
*/
@XmlEnumValue("Error")
ERROR,
/**
* Status was not parsed by jclouds.
*/
UNRECOGNIZED;
public String value() {
return UPPER_UNDERSCORE.to(UPPER_CAMEL, name());
}
@Override
public String toString() {
return value();
}
public static Status fromValue(String status) {
try {
return valueOf(UPPER_CAMEL.to(UPPER_UNDERSCORE, checkNotNull(status, "status")));
} catch (IllegalArgumentException e) {
return UNRECOGNIZED;
}
}
}
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromTask(this);
}
public static class Builder extends Resource.Builder<Task> {
//TODO There are additional fields
protected String operation;
protected Status status;
protected NamedResource impactedItem;
protected Date startTime;
protected Date completedTime;
protected String notes;
protected String errorMessage;
protected NamedResource initiatedBy;
/**
* @see Task#getOperation
*/
public Builder operation(String operation) {
this.operation = operation;
return this;
}
/**
* @see Task#getStatus
*/
public Builder status(Status status) {
this.status = status;
return this;
}
/**
* @see Task#getImpactedItem
*/
public Builder impactedItem(NamedResource impactedItem) {
this.impactedItem = impactedItem;
return this;
}
/**
* @see Task#getStartTime
*/
public Builder startTime(Date startTime) {
this.startTime = startTime;
return this;
}
/**
* @see Task#getCompletedTime
*/
public Builder completedTime(Date completedTime) {
this.completedTime = completedTime;
return this;
}
/**
* @see Task#getNotes
*/
public Builder notes(String notes) {
this.notes = notes;
return this;
}
/**
* @see Task#getErrorMessage
*/
public Builder errorMessage(String errorMessage) {
this.errorMessage = errorMessage;
return this;
}
/**
* @see Task#getInitiatedBy
*/
public Builder initiatedBy(NamedResource initiatedBy) {
this.initiatedBy = initiatedBy;
return this;
}
@Override
public Task build() {
return new Task(href, type, name, links,
actions, operation, status, impactedItem, startTime, completedTime, notes, errorMessage, initiatedBy);
}
public Builder fromTask(Task in) {
return fromResource(in).operation(in.getOperation()).status(in.getStatus()).impactedItem(in.getImpactedItem())
.startTime(in.getStartTime()).completedTime(in.getCompletedTime()).notes(in.getNotes())
.errorMessage(in.getErrorMessage()).initiatedBy(in.getInitiatedBy());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<Task> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<Task> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "Operation", required = true)
protected String operation;
@XmlElement(name = "Status", required = true)
protected Status status;
@XmlElement(name = "ImpactedItem", required = true)
protected NamedResource impactedItem;
@XmlElement(name = "StartTime", required = true)
protected Date startTime;
@XmlElement(name = "CompletedTime", required = false)
protected Date completedTime;
@XmlElement(name = "Notes", required = false)
protected String notes;
@XmlElement(name = "ErrorMessage", required = false)
protected String errorMessage;
@XmlElement(name = "InitiatedBy", required = true)
protected NamedResource initiatedBy;
private Task(URI href, String type, String name, Set<Link> links, Set<Action> actions, String operation, Status status, NamedResource impactedItem, Date startTime,
@Nullable Date completedTime, @Nullable String notes, @Nullable String errorMessage, NamedResource initiatedBy) {
super(href, type, name, links, actions);
this.operation = checkNotNull(operation, "operation");
this.status = checkNotNull(status, "status");
this.impactedItem = checkNotNull(impactedItem, "impactedItem");
this.startTime = checkNotNull(startTime, "startTime");
this.completedTime = completedTime;// null if Queued or Running
this.notes = notes;
this.errorMessage = errorMessage;
this.initiatedBy = checkNotNull(initiatedBy, "initiatedBy");
}
private Task() {
//For JAXB
}
/**
*
*
* @return name of action performed
*/
public String getOperation() {
return operation;
}
/**
*
*
* @return the status of the task
*/
public Status getStatus() {
return status;
}
/**
*
* @return the item acted upon
*/
public NamedResource getImpactedItem() {
return impactedItem;
}
/**
*
* @return time action started
*/
public Date getStartTime() {
return startTime;
}
/**
*
* @return time action completed, or null if Queued or Running
*/
@Nullable
public Date getCompletedTime() {
return completedTime;
}
/**
* @return notes on action
*/
public String getNotes() {
return notes;
}
/**
* @return error message
*/
public String getErrorMessage() {
return errorMessage;
}
/**
*
* @return the item acted upon
*/
public NamedResource getInitiatedBy() {
return initiatedBy;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
Task task = (Task) o;
if (completedTime != null ? !completedTime.equals(task.completedTime) : task.completedTime != null)
return false;
if (errorMessage != null ? !errorMessage.equals(task.errorMessage) : task.errorMessage != null)
return false;
if (!impactedItem.equals(task.impactedItem)) return false;
if (!initiatedBy.equals(task.initiatedBy)) return false;
if (notes != null ? !notes.equals(task.notes) : task.notes != null)
return false;
if (!operation.equals(task.operation)) return false;
if (!startTime.equals(task.startTime)) return false;
if (status != task.status) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + operation.hashCode();
result = 31 * result + status.hashCode();
result = 31 * result + impactedItem.hashCode();
result = 31 * result + startTime.hashCode();
result = 31 * result + (completedTime != null ? completedTime.hashCode() : 0);
result = 31 * result + (notes != null ? notes.hashCode() : 0);
result = 31 * result + (errorMessage != null ? errorMessage.hashCode() : 0);
result = 31 * result + initiatedBy.hashCode();
return result;
}
@Override
public String string() {
return super.string()+", operation="+operation+", status="+status+
", impactedItem="+impactedItem+", startTime="+startTime+", completedTime="+completedTime+
", notes="+notes+", errorMessage="+errorMessage+", initiatedBy="+initiatedBy;
}
}

View File

@ -1,112 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Wraps individual Task elements.
* Needed because parsing is done with JAXB and it does not handle Generic collections
* <xs:complexType name="Tasks">
* @author Jason King
*/
@XmlRootElement(name = "Tasks")
public class Tasks {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromTasks(this);
}
public static class Builder {
private Set<Task> tasks = Sets.newLinkedHashSet();
/**
* @see Tasks#getTasks
*/
public Builder tasks(Set<Task> tasks) {
this.tasks = Sets.newLinkedHashSet(checkNotNull(tasks, "tasks"));
return this;
}
public Builder addTask(Task task) {
tasks.add(checkNotNull(task,"task"));
return this;
}
public Tasks build() {
return new Tasks(tasks);
}
public Builder fromTasks(Tasks in) {
return tasks(in.getTasks());
}
}
private Tasks() {
//For JAXB and builder use
}
private Tasks(Set<Task> tasks) {
this.tasks = Sets.newLinkedHashSet(tasks);
}
//TODO: There is a total count field
@XmlElement(name = "Task")
private LinkedHashSet<Task> tasks = Sets.newLinkedHashSet();
public Set<Task> getTasks() {
return Collections.unmodifiableSet(tasks);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Tasks tasks1 = (Tasks) o;
if (!tasks.equals(tasks1.tasks)) return false;
return true;
}
@Override
public int hashCode() {
return tasks.hashCode();
}
public String toString() {
return "["+tasks.toString()+"]";
}
}

View File

@ -1,156 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.hardware;
import javax.xml.bind.annotation.XmlElement;
/**
* <xs:complexType name="DiskConfigurationOption">
* @author Jason King
*/
public class DiskConfigurationOption {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromConfigurationOptionRange(this);
}
public static class Builder {
private int minimum;
private int maximum;
private DiskConfigurationOptionRange systemDisk;
private DiskConfigurationOptionRange dataDisk;
/**
* @see DiskConfigurationOption#getMinimum()
*/
public Builder minimum(int minimum) {
this.minimum = minimum;
return this;
}
/**
* @see DiskConfigurationOption#getMaximum()
*/
public Builder maximum(int maximum) {
this.maximum = maximum;
return this;
}
/**
* @see DiskConfigurationOption#getSystemDisk()
*/
public Builder systemDisk(DiskConfigurationOptionRange systemDisk) {
this.systemDisk = systemDisk;
return this;
}
/**
* @see DiskConfigurationOption#getDataDisk()
*/
public Builder dataDisk(DiskConfigurationOptionRange dataDisk) {
this.dataDisk = dataDisk;
return this;
}
public DiskConfigurationOption build() {
return new DiskConfigurationOption(minimum, maximum, systemDisk, dataDisk);
}
public Builder fromConfigurationOptionRange(DiskConfigurationOption in) {
return minimum(in.getMinimum()).maximum(in.getMaximum()).systemDisk(in.getSystemDisk()).dataDisk(in.getDataDisk());
}
}
@XmlElement(name = "Minimum")
private int minimum;
@XmlElement(name = "Maximum")
private int maximum;
@XmlElement(name = "SystemDisk")
private DiskConfigurationOptionRange systemDisk;
@XmlElement(name = "DataDisk")
private DiskConfigurationOptionRange dataDisk;
private DiskConfigurationOption(int minimum, int maximum, DiskConfigurationOptionRange systemDisk, DiskConfigurationOptionRange dataDisk) {
this.minimum = minimum;
this.maximum = maximum;
this.systemDisk = systemDisk;
this.dataDisk = dataDisk;
}
private DiskConfigurationOption() {
//For JAXB
}
public int getMinimum() {
return minimum;
}
public int getMaximum() {
return maximum;
}
public DiskConfigurationOptionRange getSystemDisk() {
return systemDisk;
}
public DiskConfigurationOptionRange getDataDisk() {
return dataDisk;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DiskConfigurationOption that = (DiskConfigurationOption) o;
if (maximum != that.maximum) return false;
if (minimum != that.minimum) return false;
if (dataDisk != null ? !dataDisk.equals(that.dataDisk) : that.dataDisk != null)
return false;
if (systemDisk != null ? !systemDisk.equals(that.systemDisk) : that.systemDisk != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = minimum;
result = 31 * result + maximum;
result = 31 * result + (systemDisk != null ? systemDisk.hashCode() : 0);
result = 31 * result + (dataDisk != null ? dataDisk.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "[minimum="+minimum+", maximum="+ maximum +", systemDisk="+ systemDisk +", dataDisk="+dataDisk+"]";
}
}

View File

@ -1,122 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.hardware;
import org.jclouds.tmrk.enterprisecloud.domain.ResourceCapacityRange;
import javax.xml.bind.annotation.XmlElement;
/**
* <xs:complexType name="DiskConfigurationOptionRange">
* @author Jason King
*/
public class DiskConfigurationOptionRange {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromConfigurationOptionRange(this);
}
public static class Builder {
private ResourceCapacityRange resourceCapacityRange;
private double monthlyCost;
/**
* @see DiskConfigurationOptionRange#getResourceCapacityRange
*/
public Builder resourceCapacityRange(ResourceCapacityRange resourceCapacityRange) {
this.resourceCapacityRange = resourceCapacityRange;
return this;
}
/**
* @see DiskConfigurationOptionRange#getMonthlyCost()
*/
public Builder monthlyCost(double monthlyCost) {
this.monthlyCost = monthlyCost;
return this;
}
public DiskConfigurationOptionRange build() {
return new DiskConfigurationOptionRange(resourceCapacityRange, monthlyCost);
}
public Builder fromConfigurationOptionRange(DiskConfigurationOptionRange in) {
return resourceCapacityRange(in.getResourceCapacityRange()).monthlyCost(in.getMonthlyCost());
}
}
@XmlElement(name = "ResourceCapacityRange")
private ResourceCapacityRange resourceCapacityRange;
@XmlElement(name = "MonthlyCost")
private double monthlyCost;
private DiskConfigurationOptionRange(ResourceCapacityRange resourceCapacityRange, double monthlyCost) {
this.resourceCapacityRange = resourceCapacityRange;
this.monthlyCost = monthlyCost;
}
private DiskConfigurationOptionRange() {
//For JAXB
}
public ResourceCapacityRange getResourceCapacityRange() {
return resourceCapacityRange;
}
public double getMonthlyCost() {
return monthlyCost;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DiskConfigurationOptionRange that = (DiskConfigurationOptionRange) o;
if (Double.compare(that.monthlyCost, monthlyCost) != 0) return false;
if (resourceCapacityRange != null ? !resourceCapacityRange.equals(that.resourceCapacityRange) : that.resourceCapacityRange != null)
return false;
return true;
}
@Override
public int hashCode() {
int result;
long temp;
result = resourceCapacityRange != null ? resourceCapacityRange.hashCode() : 0;
temp = monthlyCost != +0.0d ? Double.doubleToLongBits(monthlyCost) : 0L;
result = 31 * result + (int) (temp ^ (temp >>> 32));
return result;
}
@Override
public String toString() {
return "[resourceCapacityRange="+resourceCapacityRange+", monthlyCost="+monthlyCost+"]";
}
}

View File

@ -1,109 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.hardware;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Wraps individual Disk elements.
* Needed because parsing is done with JAXB and it does not handle Generic collections
* <xs:complexType name="Disks">
* @author Jason King
*/
public class Disks {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromDisks(this);
}
public static class Builder {
private Set<VirtualDisk> disks = Sets.newLinkedHashSet();
/**
* @see Disks#getVirtualDisks()
*/
public Builder disks(Set<VirtualDisk> disks) {
this.disks = Sets.newLinkedHashSet(checkNotNull(disks, "disks"));
return this;
}
public Builder addDisk(VirtualDisk disk) {
disks.add(checkNotNull(disk,"disk"));
return this;
}
public Disks build() {
return new Disks(disks);
}
public Builder fromDisks(Disks in) {
return disks(in.getVirtualDisks());
}
}
@XmlElement(name = "Disk")
private LinkedHashSet<VirtualDisk> disks = Sets.newLinkedHashSet();
private Disks() {
//For JAXB and builder use
}
private Disks(Set<VirtualDisk> disks) {
this.disks = Sets.newLinkedHashSet(disks);
}
public Set<VirtualDisk> getVirtualDisks() {
return Collections.unmodifiableSet(disks);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Disks disks1 = (Disks) o;
if (!disks.equals(disks1.disks)) return false;
return true;
}
@Override
public int hashCode() {
return disks.hashCode();
}
public String toString() {
return "["+ disks.toString()+"]";
}
}

View File

@ -1,249 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.hardware;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
import org.jclouds.tmrk.enterprisecloud.domain.network.Nics;
import org.jclouds.tmrk.enterprisecloud.domain.network.VirtualNic;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* <xs:complexType name="HardwareConfiguration">
* @author Jason King
*/
@XmlRootElement(name = "HardwareConfiguration")
public class HardwareConfiguration extends Resource<HardwareConfiguration> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromHardwareConfiguration(this);
}
public static class Builder extends Resource.Builder<HardwareConfiguration> {
private int processorCount;
private ResourceCapacity memory;
private Set<VirtualDisk> virtualDisks = Sets.newLinkedHashSet();
private Set<VirtualNic> virtualNics = Sets.newLinkedHashSet();
/**
* @see HardwareConfiguration#getProcessorCount
*/
public Builder processorCount(int processorCount) {
this.processorCount = processorCount;
return this;
}
/**
* @see HardwareConfiguration#getMemory
*/
public Builder memory(ResourceCapacity memory) {
this.memory = memory;
return this;
}
/**
* @see HardwareConfiguration#getVirtualDisks
*/
public Builder disks(Set<VirtualDisk> virtualDisks) {
this.virtualDisks = ImmutableSet.<VirtualDisk> copyOf(checkNotNull(virtualDisks, "virtualDisks"));
return this;
}
/**
* @see HardwareConfiguration#getVirtualNics
*/
public Builder nics(Set<VirtualNic> virtualNics) {
this.virtualNics = ImmutableSet.<VirtualNic> copyOf(checkNotNull(virtualNics, "virtualNics"));
return this;
}
@Override
public HardwareConfiguration build() {
return new HardwareConfiguration(processorCount, memory, virtualDisks, virtualNics);
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<HardwareConfiguration> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<HardwareConfiguration> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
public Builder fromHardwareConfiguration(HardwareConfiguration in) {
return fromResource(in).processorCount(in.getProcessorCount())
.memory(in.getMemory())
.disks(in.getVirtualDisks())
.nics(in.getVirtualNics());
}
}
@XmlElement(name = "ProcessorCount", required = true)
private int processorCount;
@XmlElement(name = "Memory", required = false)
private ResourceCapacity memory;
@XmlElement(name = "Disks", required = false)
private Disks virtualDisks = Disks.builder().build();
@XmlElement(name = "Nics", required = false)
private Nics virtualNics = Nics.builder().build();
private HardwareConfiguration(int processorCount, @Nullable ResourceCapacity memory, Set<VirtualDisk> virtualDisks, Set<VirtualNic> virtualNics) {
this.virtualDisks = Disks.builder().disks(checkNotNull(virtualDisks,"virtualDisks")).build();
this.virtualNics = Nics.builder().nics(checkNotNull(virtualNics, "virtualNics")).build();
this.processorCount = processorCount;
this.memory = memory;
}
private HardwareConfiguration() {
//For JAXB
}
public int getProcessorCount() {
return processorCount;
}
public ResourceCapacity getMemory() {
return memory;
}
public Set<VirtualDisk> getVirtualDisks() {
return Collections.unmodifiableSet(virtualDisks.getVirtualDisks());
}
public Set<VirtualNic> getVirtualNics() {
return Collections.unmodifiableSet(virtualNics.getVirtualNics());
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
HardwareConfiguration that = (HardwareConfiguration) o;
if (processorCount != that.processorCount) return false;
if (!virtualDisks.equals(that.virtualDisks)) return false;
if (memory != null ? !memory.equals(that.memory) : that.memory != null)
return false;
if (!virtualNics.equals(that.virtualNics)) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + processorCount;
result = 31 * result + (memory != null ? memory.hashCode() : 0);
result = 31 * result + virtualDisks.hashCode();
result = 31 * result + virtualNics.hashCode();
return result;
}
@Override
public String string() {
return super.string()+", processorCount="+processorCount+
", memory="+memory+", disks="+ virtualDisks +", nics="+ virtualNics;
}
}

View File

@ -1,144 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.hardware;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
import javax.xml.bind.annotation.XmlElement;
/**
* <xs:complexType name="VirtualDisk">
* @author Jason King
*/
public class VirtualDisk {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
public Builder toBuilder() {
return new Builder().fromVirtualDisk(this);
}
public static class Builder {
private String name;
private ResourceCapacity size;
private int index;
/**
* @see VirtualDisk#getName
*/
public Builder name(String name) {
this.name = name;
return this;
}
/**
* @see VirtualDisk#getSize
*/
public Builder size(ResourceCapacity size) {
this.size = size;
return this;
}
/**
* @see VirtualDisk#getIndex
*/
public Builder index(int index) {
this.index = index;
return this;
}
public VirtualDisk build() {
return new VirtualDisk(name, size, index);
}
public Builder fromVirtualDisk(VirtualDisk in) {
return name(in.getName())
.size(in.getSize())
.index(in.getIndex());
}
}
@XmlElement(name = "Name", required = false)
private String name;
@XmlElement(name = "Size", required = false)
private ResourceCapacity size;
@XmlElement(name = "Index", required = false)
private int index;
public VirtualDisk(@Nullable String name, @Nullable ResourceCapacity size, int index) {
this.name = name;
this.size = size;
this.index = index;
}
protected VirtualDisk() {
//For JAXB
}
public String getName() {
return name;
}
public ResourceCapacity getSize() {
return size;
}
public int getIndex() {
return index;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
VirtualDisk disk = (VirtualDisk) o;
if (index != disk.index) return false;
if (name != null ? !name.equals(disk.name) : disk.name != null)
return false;
if (size != null ? !size.equals(disk.size) : disk.size != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (size != null ? size.hashCode() : 0);
result = 31 * result + index;
return result;
}
@Override
public String toString() {
return "[name="+name+", size="+size+", index="+index+"]";
}
}

View File

@ -1,122 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.internal;
import javax.xml.bind.annotation.XmlAttribute;
import java.net.URI;
import java.util.Map;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Location of a Rest resource
*
* @author Adrian Cole
*
*/
public class BaseNamedResource<T extends BaseNamedResource<T>> extends BaseResource<T> {
public static <T extends BaseNamedResource<T>> Builder<T> builder() {
return new Builder<T>();
}
public Builder<T> toBuilder() {
return new Builder<T>().fromNamedResource(this);
}
public static class Builder<T extends BaseNamedResource<T>> extends BaseResource.Builder<T> {
protected String name;
/**
* @see BaseNamedResource#getName
*/
public Builder<T> name(String name) {
this.name = name;
return this;
}
public BaseNamedResource<T> build() {
return new BaseNamedResource<T>(href, type, name);
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public Builder<T> fromBaseResource(BaseResource<T> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
public Builder<T> fromNamedResource(BaseNamedResource<T> in) {
return fromBaseResource(in).name(in.getName());
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
public Builder<T> fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes)).name(attributes.get("name"));
}
}
@XmlAttribute
protected String name;
protected BaseNamedResource(URI href, String type, String name) {
super(href, type);
this.name = name;
}
protected BaseNamedResource() {
//For JAXB
}
public String getName() {
return name;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
BaseNamedResource that = (BaseNamedResource) o;
if (name != null ? !name.equals(that.name) : that.name != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (name != null ? name.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", name="+name;
}
}

View File

@ -1,148 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.internal;
import org.jclouds.tmrk.enterprisecloud.functions.URISource;
import javax.xml.bind.annotation.XmlAttribute;
import java.net.URI;
import java.util.Map;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Location of a Rest resource
*
* @author Adrian Cole
*
*/
public class BaseResource<T extends BaseResource<T>> implements URISource {
public static <T extends BaseResource<T>> Builder<T> builder() {
return new Builder<T>();
}
public Builder<T> toBuilder() {
return new Builder<T>().fromBaseResource(this);
}
public static class Builder<T extends BaseResource<T>> {
protected String type;
protected URI href;
/**
* @see BaseResource#getType
*/
public Builder<T> type(String type) {
this.type = type;
return this;
}
/**
* @see BaseResource#getHref
*/
public Builder<T> href(URI href) {
this.href = href;
return this;
}
public BaseResource<T> build() {
return new BaseResource<T>(href, type);
}
protected Builder<T> fromBaseResource(BaseResource<T> in) {
return type(in.getType()).href(in.getHref());
}
protected Builder<T> fromAttributes(Map<String, String> attributes) {
return href(URI.create(attributes.get("href"))).type(attributes.get("type"));
}
}
@XmlAttribute
protected String type;
@XmlAttribute
protected URI href;
protected BaseResource(URI href, String type) {
this.type = type;
this.href = checkNotNull(href, "href");
}
protected BaseResource() {
//For JAXB
}
/**
*
* @return type definition, type, expressed as an HTTP Content-Type
*/
public String getType() {
return type;
}
/**
*
* @return an opaque reference and should never be parsed
*/
public URI getHref() {
return href;
}
/**
* @see #getHref
*/
public URI getURI() {
return getHref();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BaseResource that = (BaseResource) o;
if (href != null ? !href.equals(that.href) : that.href != null)
return false;
if (type != null ? !type.equals(that.type) : that.type != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = type != null ? type.hashCode() : 0;
result = 31 * result + (href != null ? href.hashCode() : 0);
return result;
}
@Override
public String toString() {
return String.format("[%s]",string());
}
protected String string() {
return "href="+href+", type="+type;
}
}

View File

@ -1,158 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.internal;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.Task;
import org.jclouds.tmrk.enterprisecloud.domain.Tasks;
import javax.xml.bind.annotation.XmlElement;
import java.net.URI;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Base Entity class. Extends Resource with Tasks
* <xs:complexType name="EntityType">
* @author Jason King
*
*/
public class Entity<T extends Entity<T>> extends Resource<T> {
public static <T extends Entity<T>> Builder<T> builder() {
return new Builder<T>();
}
public Builder<T> toBuilder() {
return new Builder<T>().fromResource(this);
}
public static class Builder<T extends Entity<T>> extends Resource.Builder<T> {
protected Set<Task> tasks = Sets.newLinkedHashSet();
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.internal.Entity#getTasks
*/
public Builder<T> tasks(Set<Task> tasks) {
this.tasks = ImmutableSet.<Task> copyOf(checkNotNull(tasks, "tasks"));
return this;
}
/**
* @see Resource#getLinks
*/
public Builder<T> links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* @see Resource#getActions
*/
public Builder<T> actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* @see Resource#getActions
*/
public Builder<T> name(String name) {
return Builder.class.cast(super.name(name));
}
public Entity<T> build() {
return new Entity<T>(href, type, name, links, actions, tasks);
}
/**
* {@inheritDoc}
*/
public Builder<T> fromBaseResource(BaseResource<T> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
public Builder<T> fromResource(Resource<T> in) {
return Builder.class.cast(super.fromResource(in));
}
public Builder<T> fromEntity(Entity<T> in) {
return fromResource(in).links(in.getLinks()).actions(in.getActions()).name(in.getName())
.tasks(in.getTasks());
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
public Builder<T> fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "Tasks", required = false)
private Tasks tasks = Tasks.builder().build();
protected Entity(URI href, String type, @Nullable String name, Set<Link> links, Set<Action> actions, Set<Task> tasks) {
super(href, type, name, links, actions);
this.tasks = Tasks.builder().tasks(checkNotNull(tasks,"tasks")).build();
}
protected Entity() {
//For JAXB
}
public Set<Task> getTasks() {
return Collections.unmodifiableSet(tasks.getTasks());
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
Entity entity = (Entity) o;
if (!tasks.equals(entity.tasks)) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + tasks.hashCode();
return result;
}
@Override
public String string() {
return super.string()+", tasks="+tasks;
}
}

View File

@ -1,173 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.internal;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Actions;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.Links;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import java.net.URI;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Base Resource class.
* has Links and Actions and name (plus href and type are inherited)
* <xs:complexType name="Resource">
* @author Jason King
*
*/
public class Resource<T extends Resource<T>> extends BaseResource<T> {
public static <T extends Resource<T>> Builder<T> builder() {
return new Builder<T>();
}
public Builder<T> toBuilder() {
return new Builder<T>().fromResource(this);
}
public static class Builder<T extends Resource<T>> extends BaseResource.Builder<T> {
protected Set<Link> links = Sets.newLinkedHashSet();
protected Set<Action> actions = Sets.newLinkedHashSet();
protected String name;
/**
* @see Resource#getLinks
*/
public Builder<T> links(Set<Link> links) {
this.links = ImmutableSet.<Link> copyOf(checkNotNull(links, "links"));
return this;
}
/**
* @see Resource#getActions
*/
public Builder<T> actions(Set<Action> actions) {
this.actions = ImmutableSet.<Action> copyOf(checkNotNull(actions, "actions"));
return this;
}
/**
* @see Resource#getActions
*/
public Builder<T> name(String name) {
this.name = checkNotNull(name, "name");
return this;
}
public Resource<T> build() {
return new Resource<T>(href, type, name, links, actions);
}
/**
* {@inheritDoc}
*/
public Builder<T> fromBaseResource(BaseResource<T> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
public Builder<T> fromResource(Resource<T> in) {
return fromBaseResource(in).links(in.getLinks())
.actions(in.getActions()).name(in.getName());
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
public Builder<T> fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "Links", required = false)
protected Links links = Links.builder().build();
@XmlElement(name = "Actions", required = false)
protected Actions actions = Actions.builder().build();
@XmlAttribute(required = false)
protected String name;
protected Resource(URI href, String type, @Nullable String name, Set<Link> links, Set<Action> actions) {
super(href, type);
this.name = name;
this.links = Links.builder().links(checkNotNull(links,"links")).build();
this.actions = Actions.builder().actions(checkNotNull(actions, "actions")).build();
}
protected Resource() {
//For JAXB
}
public Set<Link> getLinks() {
return Collections.unmodifiableSet(links.getLinks());
}
public Set<Action> getActions() {
return Collections.unmodifiableSet(actions.getActions());
}
public String getName() {
return name;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
Resource resource = (Resource) o;
if (actions != null ? !actions.equals(resource.actions) : resource.actions != null)
return false;
if (links != null ? !links.equals(resource.links) : resource.links != null)
return false;
if (name != null ? !name.equals(resource.name) : resource.name != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (links != null ? links.hashCode() : 0);
result = 31 * result + (actions != null ? actions.hashCode() : 0);
result = 31 * result + (name != null ? name.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", name="+name+", links="+links+", actions="+actions;
}
}

View File

@ -1,122 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.internal;
import org.jclouds.javax.annotation.Nullable;
import javax.xml.bind.annotation.XmlElement;
/**
* @author Jason King
*/
public class ResourceCapacity {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromResource(this);
}
public static class Builder {
protected double value; //mandatory
protected String unit; //optional
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity#getValue
*/
public Builder value(double value) {
this.value = value;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity#getUnit
*/
public Builder unit(String unit) {
this.unit = unit;
return this;
}
public ResourceCapacity build() {
return new ResourceCapacity(value, unit);
}
public Builder fromResource(ResourceCapacity in) {
return value(in.getValue()).unit(in.getUnit());
}
}
@XmlElement(name = "Value")
protected double value;
@XmlElement(name = "Unit")
protected String unit;
public ResourceCapacity(double value, @Nullable String unit) {
this.value = value;
this.unit = unit;
}
protected ResourceCapacity() {
//For JAXB
}
public double getValue() {
return value;
}
/**
* Optional. May be null
*/
public String getUnit() {
return unit;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ResourceCapacity that = (ResourceCapacity) o;
if (Double.compare(that.value, value) != 0) return false;
if (unit != null ? !unit.equals(that.unit) : that.unit != null)
return false;
return true;
}
@Override
public int hashCode() {
int result;
long temp;
temp = value != +0.0d ? Double.doubleToLongBits(value) : 0L;
result = (int) (temp ^ (temp >>> 32));
result = 31 * result + (unit != null ? unit.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "[value="+value+", unit="+unit+"]";
}
}

View File

@ -1,239 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.keys;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.Task;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Entity;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Map;
import java.util.Set;
/**
* <xs:complexType name="SshKeyType">
* @author Jason King
*/
@XmlRootElement(name = "SshKey")
public class SSHKey extends Entity<SSHKey> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromSshKey(this);
}
public static class Builder extends Entity.Builder<SSHKey> {
private boolean defaultKey;
private String fingerPrint;
private String privateKey;
/**
* @see SSHKey#isDefaultKey
*/
public Builder defaultKey(boolean defaultKey) {
this.defaultKey = defaultKey;
return this;
}
/**
* @see SSHKey#getFingerPrint
*/
public Builder fingerPrint(String fingerPrint) {
this.fingerPrint = fingerPrint;
return this;
}
/**
* @see SSHKey#getPrivateKey
*/
public Builder privateKey(String privateKey) {
this.privateKey = privateKey;
return this;
}
@Override
public SSHKey build() {
return new SSHKey(href, type, name, links, actions, tasks, defaultKey, fingerPrint, privateKey);
}
public Builder fromSshKey(SSHKey in) {
return fromEntity(in).defaultKey(in.isDefaultKey()).fingerPrint(in.getFingerPrint()).privateKey(in.getPrivateKey());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<SSHKey> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<SSHKey> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromEntity(Entity<SSHKey> in) {
return Builder.class.cast(super.fromEntity(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder tasks(Set<Task> tasks) {
return Builder.class.cast(super.tasks(tasks));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "Default", required = false)
private boolean defaultKey;
@XmlElement(name = "FingerPrint", required = false)
private String fingerPrint;
@XmlElement(name = "PrivateKey", required = false)
private String privateKey;
private SSHKey(URI href, String type, String name, Set<Link> links, Set<Action> actions, Set<Task> tasks,
boolean defaultKey, @Nullable String fingerPrint, @Nullable String privateKey) {
super(href, type, name, links, actions, tasks);
this.defaultKey = defaultKey;
this.fingerPrint = fingerPrint;
this.privateKey = privateKey;
}
private SSHKey() {
//For JAXB
}
public boolean isDefaultKey() {
return defaultKey;
}
public String getFingerPrint() {
return fingerPrint;
}
public String getPrivateKey() {
return privateKey;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
SSHKey sshKey = (SSHKey) o;
if (defaultKey != sshKey.defaultKey) return false;
if (fingerPrint != null ? !fingerPrint.equals(sshKey.fingerPrint) : sshKey.fingerPrint != null)
return false;
if (privateKey != null ? !privateKey.equals(sshKey.privateKey) : sshKey.privateKey != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (defaultKey ? 1 : 0);
result = 31 * result + (fingerPrint != null ? fingerPrint.hashCode() : 0);
result = 31 * result + (privateKey != null ? privateKey.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", defaultKey="+defaultKey+", fingerPrint="+fingerPrint+", privateKey="+privateKey;
}
}

View File

@ -1,182 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.keys;
import com.google.common.collect.Sets;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* SshKeys is more than a simple wrapper as it extends Resource.
* @author Jason King
*
*/
@XmlRootElement(name = "SshKeys")
public class SSHKeys extends Resource<SSHKeys> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromTemplates(this);
}
public static class Builder extends Resource.Builder<SSHKeys> {
private Set<SSHKey> sshKeys = Sets.newLinkedHashSet();
/**
* @see SSHKeys#getSSHKeys
*/
public Builder sshKeys(Set<SSHKey> sshKeys) {
this.sshKeys =(checkNotNull(sshKeys,"sshKeys"));
return this;
}
@Override
public SSHKeys build() {
return new SSHKeys(href, type, name, links, actions, sshKeys);
}
public Builder fromTemplates(SSHKeys in) {
return fromResource(in).sshKeys(in.getSSHKeys());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<SSHKeys> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<SSHKeys> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "SshKey", required = false)
private Set<SSHKey> sshKeys = Sets.newLinkedHashSet();
private SSHKeys(URI href, String type, String name, Set<Link> links, Set<Action> actions, Set<SSHKey> sshKeys) {
super(href, type, name, links, actions);
this.sshKeys = checkNotNull(sshKeys,"sshKeys");
}
private SSHKeys() {
//For JAXB
}
public Set<SSHKey> getSSHKeys() {
return sshKeys;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
SSHKeys networks1 = (SSHKeys) o;
if (!sshKeys.equals(networks1.sshKeys)) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + sshKeys.hashCode();
return result;
}
@Override
public String string() {
return super.string()+", sshKeys="+sshKeys;
}
}

View File

@ -1,183 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.layout;
import com.google.common.collect.Sets;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* DeviceLayout is more than a simple wrapper as it extends Resource.
* <xs:complexType name="DeviceLayoutType">
* @author Jason King
*
*/
@XmlRootElement(name = "DeviceLayout")
public class DeviceLayout extends Resource<DeviceLayout> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromTemplates(this);
}
public static class Builder extends Resource.Builder<DeviceLayout> {
private Set<LayoutRow> rows = Sets.newLinkedHashSet();
/**
* @see DeviceLayout#getRows
*/
public Builder rows(Set<LayoutRow> rows) {
this.rows =(checkNotNull(rows,"rows"));
return this;
}
@Override
public DeviceLayout build() {
return new DeviceLayout(href, type, name, links, actions, rows);
}
public Builder fromTemplates(DeviceLayout in) {
return fromResource(in).rows(in.getRows());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<DeviceLayout> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<DeviceLayout> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "Rows", required = false)
private Rows rows = Rows.builder().build();
private DeviceLayout(URI href, String type, String name, Set<Link> links, Set<Action> actions, Set<LayoutRow> rows) {
super(href, type, name, links, actions);
this.rows = Rows.builder().rows(checkNotNull(rows,"rows")).build();
}
private DeviceLayout() {
//For JAXB
}
public Set<LayoutRow> getRows() {
return rows.getRows();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
DeviceLayout that = (DeviceLayout) o;
if (!rows.equals(that.rows)) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + rows.hashCode();
return result;
}
@Override
public String string() {
return super.string()+", rows="+rows;
}
}

View File

@ -1,106 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.layout;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import java.util.Collections;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Wraps individual LayoutGroup elements.
* <xs:complexType name="GroupsType">
* @author Jason King
*/
public class Groups {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromGroups(this);
}
public static class Builder {
private Set<LayoutGroup> groups = Sets.newLinkedHashSet();
/**
* @see Groups#getGroups
*/
public Builder groups(Set<LayoutGroup> groups) {
this.groups = Sets.newLinkedHashSet(checkNotNull(groups, "groups"));
return this;
}
public Builder addGroup(LayoutGroup group) {
groups.add(checkNotNull(group, "group"));
return this;
}
public Groups build() {
return new Groups(groups);
}
public Builder fromGroups(Groups in) {
return groups(in.getGroups());
}
}
private Groups() {
//For JAXB and builder use
}
private Groups(Set<LayoutGroup> entries) {
this.groups = Sets.newLinkedHashSet(entries);
}
@XmlElement(name = "Group", required=false)
private Set<LayoutGroup> groups = Sets.newLinkedHashSet();
public Set<LayoutGroup> getGroups() {
return Collections.unmodifiableSet(groups);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Groups tasks1 = (Groups) o;
if (!groups.equals(tasks1.groups)) return false;
return true;
}
@Override
public int hashCode() {
return groups.hashCode();
}
public String toString() {
return "["+ groups.toString()+"]";
}
}

View File

@ -1,86 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.layout;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.NamedResource;
import javax.xml.bind.annotation.XmlElement;
/**
* Layout is a logical aggregation of virtual machines and physical devices defined by the organization.
* Layout is an environment concept but visible from both the environment and the compute pool.
* From the environment, all rows, groups, virtual machines, and physical devices are visible.
* From the compute pool, only a subset is visible.
* To appear in a compute pool layout, virtual machines in the rows and groups must be allocated from the compute pool.
* As physical devices are not allocated from the compute pool, they do not appear on compute pool layouts.
* <xs:complexType name="LayoutReference">
* @author Jason King
*/
public class Layout {
@XmlElement(name = "Group")
private NamedResource group;
@XmlElement(name = "Row")
private NamedResource row;
public Layout(@Nullable NamedResource group, @Nullable NamedResource row) {
this.group = group;
this.row = row;
}
public Layout() {
//For JAXB
}
public NamedResource getGroup() {
return group;
}
public NamedResource getRow() {
return row;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Layout layout = (Layout) o;
if (group != null ? !group.equals(layout.group) : layout.group != null)
return false;
if (row != null ? !row.equals(layout.row) : layout.row != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = group != null ? group.hashCode() : 0;
result = 31 * result + (row != null ? row.hashCode() : 0);
return result;
}
public String toString() {
return "[group="+group+", row="+row+"]";
}
}

View File

@ -1,206 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.layout;
import com.google.common.collect.Sets;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import org.jclouds.tmrk.enterprisecloud.domain.vm.VirtualMachineReference;
import org.jclouds.tmrk.enterprisecloud.domain.vm.VirtualMachineReferences;
import javax.xml.bind.annotation.XmlElement;
import java.net.URI;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* LayoutGroup is more than a simple wrapper as it extends Resource.
* <xs:complexType name="LayoutGroupType">
* @author Jason King
*
*/
public class LayoutGroup extends Resource<LayoutGroup> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromLayoutGroup(this);
}
public static class Builder extends Resource.Builder<LayoutGroup> {
private int index;
private Set<VirtualMachineReference> virtualMachineReferences = Sets.newLinkedHashSet();
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.layout.LayoutGroup#getIndex
*/
public Builder index(int index) {
this.index = index;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.layout.LayoutGroup#getVirtualMachineReferences()
*/
public Builder virtualMachineReferences(Set<VirtualMachineReference> virtualMachineReferences) {
this.virtualMachineReferences = Sets.newLinkedHashSet(checkNotNull(virtualMachineReferences, "virtualMachineReferences"));
return this;
}
@Override
public LayoutGroup build() {
return new LayoutGroup(href, type, name, links, actions, index,virtualMachineReferences);
}
public Builder fromLayoutGroup(LayoutGroup in) {
return fromResource(in).index(in.getIndex());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<LayoutGroup> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<LayoutGroup> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "Index", required = false)
private int index;
@XmlElement(name = "VirtualMachines", required = false)
private VirtualMachineReferences virtualMachineReferences;
//TODO: PhysicalDevices
private LayoutGroup(URI href, String type, String name, Set<Link> links, Set<Action> actions,
int index, Set<VirtualMachineReference> virtualMachineReferences) {
super(href, type, name, links, actions);
this.index = index;
this.virtualMachineReferences = VirtualMachineReferences.builder().virtualMachineReferences(virtualMachineReferences).build();
}
private LayoutGroup() {
//For JAXB
}
public int getIndex() {
return index;
}
public Set<VirtualMachineReference> getVirtualMachineReferences() {
return virtualMachineReferences.getVirtualMachineReferences();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
LayoutGroup that = (LayoutGroup) o;
if (index != that.index) return false;
if (!virtualMachineReferences.equals(that.virtualMachineReferences))
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + index;
result = 31 * result + virtualMachineReferences.hashCode();
return result;
}
@Override
public String string() {
return super.string()+", index="+index+", virtualMachineReferences="+virtualMachineReferences;
}
}

View File

@ -1,181 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.layout;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.NamedResource;
import javax.xml.bind.annotation.XmlElement;
/**
* LayoutRequest has three variations. Only one of the three variations is permitted in a call:
*
* 1. Use an existing group.
* Group is required and the href attribute on the element is required to identify
* the group to use.
*
* 2. Use a newly created group in an existing row.
* Row is required and the href attribute on the element is required to identify
* the row in which the new group will be created.
* NewGroup is required to provide the required name,
* which may not exceed fifty characters,
* and to create the group to use.
*
* 3. Move to a newly created group in a newly created row.
* NewRow is required to provide the required name,
* which may not exceed fifty characters,
* and to create the row in which the new group will be created.
* NewGroup is required to provide the required name,
* which may not exceed fifty characters,
* and to create the group to use.
*
* <xs:complexType name="LayoutRequest">
* @author Jason King
*
*/
public class LayoutRequest {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromLayoutRequest(this);
}
public static class Builder {
private NamedResource row;
private NamedResource group;
private String newRow;
private String newGroup;
/**
* @see LayoutRequest#getRow
*/
public Builder row(NamedResource row) {
this.row = row;
return this;
}
/**
* @see LayoutRequest#getGroup
*/
public Builder group(NamedResource group) {
this.group = group;
return this;
}
/**
* @see LayoutRequest#getNewRow
*/
public Builder newRow(String newRow) {
this.newRow = newRow;
return this;
}
/**
* @see LayoutRequest#getNewGroup
*/
public Builder newGroup(String newGroup) {
this.newGroup = newGroup;
return this;
}
public LayoutRequest build() {
return new LayoutRequest(row, group, newRow, newGroup);
}
public Builder fromLayoutRequest(LayoutRequest in) {
return row(in.getRow()).group(in.getGroup()).newRow(in.getNewRow()).newGroup(in.getNewGroup());
}
}
@XmlElement(name = "Row", required = false)
private NamedResource row;
@XmlElement(name = "Group", required = false)
private NamedResource group;
@XmlElement(name = "NewRow", required = false)
private String newRow;
@XmlElement(name = "NewGroup", required = false)
private String newGroup;
private LayoutRequest(@Nullable NamedResource row, @Nullable NamedResource group, @Nullable String newRow, @Nullable String newGroup) {
this.row = row;
this.group = group;
this.newRow = newRow;
this.newGroup = newGroup;
}
private LayoutRequest() {
//For JAXB
}
public NamedResource getRow() {
return row;
}
public NamedResource getGroup() {
return group;
}
public String getNewRow() {
return newRow;
}
public String getNewGroup() {
return newGroup;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LayoutRequest that = (LayoutRequest) o;
if (group != null ? !group.equals(that.group) : that.group != null)
return false;
if (newGroup != null ? !newGroup.equals(that.newGroup) : that.newGroup != null)
return false;
if (newRow != null ? !newRow.equals(that.newRow) : that.newRow != null)
return false;
if (row != null ? !row.equals(that.row) : that.row != null) return false;
return true;
}
@Override
public int hashCode() {
int result = row != null ? row.hashCode() : 0;
result = 31 * result + (group != null ? group.hashCode() : 0);
result = 31 * result + (newRow != null ? newRow.hashCode() : 0);
result = 31 * result + (newGroup != null ? newGroup.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "row="+row+", group="+group+", newRow="+newRow+", newGroup="+newGroup;
}
}

View File

@ -1,200 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.layout;
import com.google.common.collect.Sets;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement;
import java.net.URI;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* LayoutRow is more than a simple wrapper as it extends Resource.
* <xs:complexType name="LayoutRowType">
* @author Jason King
*
*/
public class LayoutRow extends Resource<LayoutRow> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromLayoutRow(this);
}
public static class Builder extends Resource.Builder<LayoutRow> {
private int index;
private Set<LayoutGroup> groups = Sets.newLinkedHashSet();
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.layout.LayoutRow#getIndex
*/
public Builder index(int index) {
this.index = index;
return this;
}
/**
* @see Groups#getGroups
*/
public Builder groups(Set<LayoutGroup> groups) {
this.groups = Sets.newLinkedHashSet(checkNotNull(groups, "groups"));
return this;
}
@Override
public LayoutRow build() {
return new LayoutRow(href, type, name, links, actions, index, groups);
}
public Builder fromLayoutRow(LayoutRow in) {
return fromResource(in).index(in.getIndex()).groups(in.getGroups());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<LayoutRow> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<LayoutRow> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "Index", required = false)
private int index;
@XmlElement(name = "Groups", required = false)
private Groups groups = Groups.builder().build();
private LayoutRow(URI href, String type, String name, Set<Link> links, Set<Action> actions, int index, Set<LayoutGroup> groups) {
super(href, type, name, links, actions);
this.index = index;
this.groups = Groups.builder().groups(groups).build();
}
private LayoutRow() {
//For JAXB
}
public int getIndex() {
return index;
}
public Set<LayoutGroup> getGroups() {
return groups.getGroups();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
LayoutRow layoutRow = (LayoutRow) o;
if (index != layoutRow.index) return false;
if (!groups.equals(layoutRow.groups)) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + index;
result = 31 * result + groups.hashCode();
return result;
}
@Override
public String string() {
return super.string()+", index="+index+", groups="+groups;
}
}

View File

@ -1,106 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.layout;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import java.util.Collections;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Wraps individual LayoutRow elements.
* <xs:complexType name="RowsType">
* @author Jason King
*/
public class Rows {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromRows(this);
}
public static class Builder {
private Set<LayoutRow> rows = Sets.newLinkedHashSet();
/**
* @see Rows#getRows
*/
public Builder rows(Set<LayoutRow> rows) {
this.rows = Sets.newLinkedHashSet(checkNotNull(rows, "rows"));
return this;
}
public Builder addRow(LayoutRow row) {
rows.add(checkNotNull(row,"row"));
return this;
}
public Rows build() {
return new Rows(rows);
}
public Builder fromRows(Rows in) {
return rows(in.getRows());
}
}
private Rows() {
//For JAXB and builder use
}
private Rows(Set<LayoutRow> entries) {
this.rows = Sets.newLinkedHashSet(entries);
}
@XmlElement(name = "Row", required=false)
private Set<LayoutRow> rows = Sets.newLinkedHashSet();
public Set<LayoutRow> getRows() {
return Collections.unmodifiableSet(rows);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Rows tasks1 = (Rows) o;
if (!rows.equals(tasks1.rows)) return false;
return true;
}
@Override
public int hashCode() {
return rows.hashCode();
}
public String toString() {
return "["+ rows.toString()+"]";
}
}

View File

@ -1,80 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.network;
import com.google.common.collect.Sets;
import org.jclouds.tmrk.enterprisecloud.domain.Actions;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* <xs:complexType name="AssignedIpAddresses">
* @author Jason King
*/
@XmlRootElement(name="AssignedIpAddresses")
public class AssignedIpAddresses extends Resource<AssignedIpAddresses> {
@XmlElement(name = "Networks", required = true)
private DeviceNetworks networks = new DeviceNetworks();
public AssignedIpAddresses(URI href, String type, String name, Actions actions, DeviceNetworks networks) {
super(href, type, name, Sets.<Link>newIdentityHashSet(), actions.getActions());
this.networks = checkNotNull(networks,"networks");
}
public AssignedIpAddresses() {
//For JAXB
}
public DeviceNetworks getNetworks() {
return networks;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
AssignedIpAddresses that = (AssignedIpAddresses) o;
if (!networks.equals(that.networks)) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + networks.hashCode();
return result;
}
@Override
public String string() {
return super.string()+", networks="+networks;
}
}

View File

@ -1,76 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.network;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.util.Preconditions2.checkNotEmpty;
/**
* <xs:complexType name="DeviceIps">
* Wraps individual IpAddresses
* @author Jason King
*/
public class DeviceIps {
private LinkedHashSet<String> ipAddresses = Sets.newLinkedHashSet();
protected DeviceIps() {
// For JAXB
}
@XmlElement(name = "IpAddress")
void setIpAddress(String ipAddress) {
checkNotNull(ipAddress,"ipAddress");
checkNotEmpty(ipAddress, "ipAddress");
this.ipAddresses.add(ipAddress);
}
public Set<String> getIpAddresses() {
return Collections.unmodifiableSet(ipAddresses);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DeviceIps deviceIps = (DeviceIps) o;
if (!ipAddresses.equals(deviceIps.ipAddresses)) return false;
return true;
}
@Override
public int hashCode() {
return ipAddresses.hashCode();
}
public String toString() {
return "["+ ipAddresses.toString()+"]";
}
}

View File

@ -1,49 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.network;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement;
/**
* Container for DeviceIps (ipAddresses)
* <xs:complexType name="DeviceNetwork">
* @author Jason King
*/
public class DeviceNetwork extends Resource<DeviceNetwork> {
//TODO: Builder
@XmlElement(name = "IpAddresses")
private DeviceIps ipAddresses = new DeviceIps();
private DeviceNetwork() {
//For JAXB
}
public DeviceIps getIpAddresses() {
return ipAddresses;
}
@Override
public String string() {
return super.string()+"ipAddresses="+ ipAddresses;
}
}

View File

@ -1,57 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.network;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Container for DeviceNetwork items
* <xs:complexType name="DeviceNetworks">
* @author Jason King
*/
public class DeviceNetworks {
private LinkedHashSet<DeviceNetwork> deviceNetworks = Sets.newLinkedHashSet();
protected DeviceNetworks() {
//For JAXB
}
@XmlElement(name = "Network")
void setDeviceNetwork(DeviceNetwork deviceNetwork) {
checkNotNull(deviceNetwork,"deviceNetwork");
this.deviceNetworks.add(deviceNetwork);
}
public Set<DeviceNetwork> getDeviceNetworks() {
return Collections.unmodifiableSet(deviceNetworks);
}
@Override
public String toString() {
return "[deviceNetworks="+deviceNetworks+"]";
}
}

View File

@ -1,121 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.network;
import org.jclouds.javax.annotation.Nullable;
import javax.xml.bind.annotation.XmlElement;
/**
* <xs:complexType name="DnsSettingsType">
* @author Jason King
*/
public class DnsSettings {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromDnsSettings(this);
}
public static class Builder {
private String primaryDns;
private String secondaryDns;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.network.DnsSettings#getPrimaryDns
*/
public Builder primaryDns(String primaryDns) {
this.primaryDns = primaryDns;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.network.DnsSettings#getSecondaryDns
*/
public Builder secondaryDns(String secondaryDns) {
this.secondaryDns = secondaryDns;
return this;
}
public DnsSettings build() {
return new DnsSettings(primaryDns, secondaryDns);
}
public Builder fromDnsSettings(DnsSettings in) {
return primaryDns(in.getPrimaryDns()).secondaryDns(in.getSecondaryDns());
}
}
@XmlElement(name = "PrimaryDns", required = false)
private String primaryDns;
@XmlElement(name = "SecondaryDns", required = false)
private String secondaryDns;
public DnsSettings(@Nullable String primaryDns, @Nullable String secondaryDns) {
this.primaryDns = primaryDns;
this.secondaryDns = secondaryDns;
}
protected DnsSettings() {
//For JAXB
}
@Nullable
public String getPrimaryDns() {
return primaryDns;
}
@Nullable
public String getSecondaryDns() {
return secondaryDns;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DnsSettings that = (DnsSettings) o;
if (primaryDns != null ? !primaryDns.equals(that.primaryDns) : that.primaryDns != null)
return false;
if (secondaryDns != null ? !secondaryDns.equals(that.secondaryDns) : that.secondaryDns != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = primaryDns != null ? primaryDns.hashCode() : 0;
result = 31 * result + (secondaryDns != null ? secondaryDns.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "[primaryDns="+ primaryDns +",secondaryDns="+ secondaryDns +"]";
}
}

View File

@ -1,221 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.network;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.NamedResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement;
import java.net.URI;
import java.util.Map;
import java.util.Set;
/**
* <xs:complexType name="IpAddressType">
* @author Jason King
*/
public class IpAddress extends Resource<IpAddress> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromIpAddress(this);
}
public static class Builder extends Resource.Builder<IpAddress> {
private NamedResource host;
private NamedResource detectedOn;
private NamedResource rnatAddress;
/**
* @see IpAddress#getHost
*/
public Builder host(NamedResource host) {
this.host = host;
return this;
}
/**
* @see IpAddress#getDetectedOn
*/
public Builder detectedOn(NamedResource detectedOn) {
this.detectedOn = detectedOn;
return this;
}
/**
* @see IpAddress#getRnatAddress
*/
public Builder rnatAddress(NamedResource rnatAddress) {
this.rnatAddress = rnatAddress;
return this;
}
@Override
public IpAddress build() {
return new IpAddress(href, type, name, links, actions, host, detectedOn, rnatAddress);
}
public Builder fromIpAddress(IpAddress in) {
return fromResource(in).host(in.getHost()).detectedOn(in.getDetectedOn()).rnatAddress(in.getRnatAddress());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<IpAddress> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<IpAddress> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "Host", required = false)
private NamedResource host;
@XmlElement(name = "DetectedOn", required = false)
private NamedResource detectedOn;
@XmlElement(name = "RnatAddress", required = false)
private NamedResource rnatAddress;
private IpAddress(URI href, String type, String name, Set<Link> links,Set<Action> actions,
@Nullable NamedResource host,@Nullable NamedResource detectedOn,@Nullable NamedResource rnatAddress) {
super(href, type, name, links, actions);
this.host = host;
this.detectedOn = detectedOn;
this.rnatAddress = rnatAddress;
}
private IpAddress() {
//For JAXB
}
public NamedResource getHost() {
return host;
}
public NamedResource getDetectedOn() {
return detectedOn;
}
public NamedResource getRnatAddress() {
return rnatAddress;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
IpAddress ipAddress = (IpAddress) o;
if (detectedOn != null ? !detectedOn.equals(ipAddress.detectedOn) : ipAddress.detectedOn != null)
return false;
if (host != null ? !host.equals(ipAddress.host) : ipAddress.host != null)
return false;
if (rnatAddress != null ? !rnatAddress.equals(ipAddress.rnatAddress) : ipAddress.rnatAddress != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (host != null ? host.hashCode() : 0);
result = 31 * result + (detectedOn != null ? detectedOn.hashCode() : 0);
result = 31 * result + (rnatAddress != null ? rnatAddress.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", host="+host+", detectedOn="+detectedOn+", rnatAddress="+rnatAddress;
}
}

View File

@ -1,182 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.network;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.NamedResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseNamedResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import javax.xml.bind.annotation.XmlElement;
import java.net.URI;
import java.util.Map;
/**
* <xs:complexType name="IpAddressReferenceType">
* @author Jason King
*
*/
public class IpAddressReference extends BaseNamedResource<IpAddressReference> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromNetworkReference(this);
}
public static class Builder extends BaseNamedResource.Builder<IpAddressReference> {
private NamedResource network;
private NamedResource host;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.network.IpAddressReference#getNetwork
*/
public Builder network(NamedResource network) {
this.network = network;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.network.IpAddressReference#getHost
*/
public Builder host(NamedResource host) {
this.host = host;
return this;
}
@Override
public IpAddressReference build() {
return new IpAddressReference(href, type, name, network, host);
}
public Builder fromNetworkReference(IpAddressReference in) {
return fromNamedResource(in).network(in.getNetwork()).host(in.getHost());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<IpAddressReference> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromNamedResource(BaseNamedResource<IpAddressReference> in) {
return Builder.class.cast(super.fromNamedResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "Network", required = false)
private NamedResource network;
@XmlElement(name = "Host", required = false)
private NamedResource host;
private IpAddressReference(URI href, String type, String name,
@Nullable NamedResource network, @Nullable NamedResource host) {
super(href, type, name);
this.network = network;
this.host = host;
}
private IpAddressReference() {
//For JAXB
}
public NamedResource getNetwork() {
return network;
}
public NamedResource getHost() {
return host;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
IpAddressReference that = (IpAddressReference) o;
if (host != null ? !host.equals(that.host) : that.host != null)
return false;
if (network != null ? !network.equals(that.network) : that.network != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (network != null ? network.hashCode() : 0);
result = 31 * result + (host != null ? host.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", network="+network+", host="+host;
}
}

View File

@ -1,105 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.network;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import java.util.Collections;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* <xs:complexType name="IpAddressesType">
* @author Jason King
*/
public class IpAddresses {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromIpAddresses(this);
}
public static class Builder {
private Set<IpAddress> addresses = Sets.newLinkedHashSet();
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.network.IpAddresses#getIpAddresses
*/
public Builder addresses(Set<IpAddress> addresses) {
this.addresses = Sets.newLinkedHashSet(checkNotNull(addresses, "addresses"));
return this;
}
public Builder addIpAddress(IpAddress address) {
addresses.add(checkNotNull(address, "address"));
return this;
}
public IpAddresses build() {
return new IpAddresses(addresses);
}
public Builder fromIpAddresses(IpAddresses in) {
return addresses(in.getIpAddresses());
}
}
private IpAddresses() {
//For JAXB and builder use
}
private IpAddresses(Set<IpAddress> addresses) {
this.addresses = Sets.newLinkedHashSet(addresses);
}
@XmlElement(name = "IpAddress")
private Set<IpAddress> addresses = Sets.newLinkedHashSet();
public Set<IpAddress> getIpAddresses() {
return Collections.unmodifiableSet(addresses);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
IpAddresses that = (IpAddresses) o;
if (!addresses.equals(that.addresses)) return false;
return true;
}
@Override
public int hashCode() {
return addresses.hashCode();
}
public String toString() {
return "["+ addresses.toString()+"]";
}
}

View File

@ -1,120 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.network;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.NamedResource;
import javax.xml.bind.annotation.XmlElement;
/**
* <xs:complexType name="LinuxCustomizationType">
* @author Jason King
*/
public class LinuxCustomization {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromLinuxCustomization(this);
}
public static class Builder {
private NetworkSettings networkSettings = NetworkSettings.builder().build();
private NamedResource sshKey;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.network.LinuxCustomization#getNetworkSettings
*/
public Builder networkSettings(NetworkSettings networkSettings) {
this.networkSettings = networkSettings;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.network.LinuxCustomization#getSshKey
*/
public Builder sshKey(NamedResource sshKey) {
this.sshKey = sshKey;
return this;
}
public LinuxCustomization build() {
return new LinuxCustomization(networkSettings, sshKey);
}
public Builder fromLinuxCustomization(LinuxCustomization in) {
return networkSettings(in.getNetworkSettings()).sshKey(in.getSshKey());
}
}
@XmlElement(name = "NetworkSettings", required = false)
private NetworkSettings networkSettings;
@XmlElement(name = "SshKey", required = false)
private NamedResource sshKey;
public LinuxCustomization(@Nullable NetworkSettings networkSettings, @Nullable NamedResource sshKey) {
this.networkSettings = networkSettings;
this.sshKey = sshKey;
}
private LinuxCustomization() {
//For JAXB
}
public NetworkSettings getNetworkSettings() {
return networkSettings;
}
public NamedResource getSshKey() {
return sshKey;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LinuxCustomization that = (LinuxCustomization) o;
if (networkSettings != null ? !networkSettings.equals(that.networkSettings) : that.networkSettings != null)
return false;
if (sshKey != null ? !sshKey.equals(that.sshKey) : that.sshKey != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = networkSettings != null ? networkSettings.hashCode() : 0;
result = 31 * result + (sshKey != null ? sshKey.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "[networkSettings="+ networkSettings +",sshKey="+ sshKey +"]";
}
}

View File

@ -1,122 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.network;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.NamedResource;
import javax.xml.bind.annotation.XmlElement;
/**
* <xs:complexType name="NetworkAdapterSettingType">
* @author Jason King
*/
public class NetworkAdapterSetting {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromNetworkAdapterSetting(this);
}
public static class Builder {
private NamedResource network;
private String ipAddress;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.network.NetworkAdapterSetting#getNetwork
*/
public Builder network(NamedResource network) {
this.network = network;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.network.NetworkAdapterSetting#getIpAddress
*/
public Builder ipAddress(String ipAddress) {
this.ipAddress = ipAddress;
return this;
}
public NetworkAdapterSetting build() {
return new NetworkAdapterSetting(ipAddress, network);
}
public Builder fromNetworkAdapterSetting(NetworkAdapterSetting in) {
return ipAddress(in.getIpAddress()).network(in.getNetwork());
}
}
@XmlElement(name = "Network", required = false)
private NamedResource network;
@XmlElement(name = "IpAddress", required = false)
private String ipAddress;
public NetworkAdapterSetting(@Nullable String ipAddress, @Nullable NamedResource network) {
this.ipAddress = ipAddress;
this.network = network;
}
protected NetworkAdapterSetting() {
//For JAXB
}
@Nullable
public String getIpAddress() {
return ipAddress;
}
@Nullable
public NamedResource getNetwork() {
return network;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
NetworkAdapterSetting that = (NetworkAdapterSetting) o;
if (ipAddress != null ? !ipAddress.equals(that.ipAddress) : that.ipAddress != null)
return false;
if (network != null ? !network.equals(that.network) : that.network != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = network != null ? network.hashCode() : 0;
result = 31 * result + (ipAddress != null ? ipAddress.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "[ipAddress="+ ipAddress +",network="+ network +"]";
}
}

View File

@ -1,105 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.network;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import java.util.Collections;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* <xs:complexType name="NetworkAdapterSettingsType">
* @author Jason King
*/
public class NetworkAdapterSettings {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromNetworkAdapterSettings(this);
}
public static class Builder {
private Set<NetworkAdapterSetting> adapters = Sets.newLinkedHashSet();
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.network.NetworkAdapterSettings#getNetworkAdapterSettings()
*/
public Builder adapters(Set<NetworkAdapterSetting> adapters) {
this.adapters = Sets.newLinkedHashSet(checkNotNull(adapters, "adapters"));
return this;
}
public Builder addNetworkAdapterSetting(NetworkAdapterSetting adapter) {
adapters.add(checkNotNull(adapter, "adapter"));
return this;
}
public NetworkAdapterSettings build() {
return new NetworkAdapterSettings(adapters);
}
public Builder fromNetworkAdapterSettings(NetworkAdapterSettings in) {
return adapters(in.getNetworkAdapterSettings());
}
}
private NetworkAdapterSettings() {
//For JAXB and builder use
}
private NetworkAdapterSettings(Set<NetworkAdapterSetting> adapters) {
this.adapters = Sets.newLinkedHashSet(adapters);
}
@XmlElement(name = "NetworkAdapter")
private Set<NetworkAdapterSetting> adapters = Sets.newLinkedHashSet();
public Set<NetworkAdapterSetting> getNetworkAdapterSettings() {
return Collections.unmodifiableSet(adapters);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
NetworkAdapterSettings that = (NetworkAdapterSettings) o;
if (!adapters.equals(that.adapters)) return false;
return true;
}
@Override
public int hashCode() {
return adapters.hashCode();
}
public String toString() {
return "["+ adapters.toString()+"]";
}
}

View File

@ -1,292 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.network;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.NamedResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseNamedResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Map;
import static com.google.common.base.CaseFormat.LOWER_CAMEL;
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* <xs:complexType name="NetworkReference">
* @author Jason King
*
*/
@XmlRootElement(name = "Network")
public class NetworkReference extends BaseNamedResource<NetworkReference> {
@XmlEnum
public static enum NetworkType {
@XmlEnumValue("Dmz")
DMZ,
@XmlEnumValue("Internal")
INTERNAL;
public String value() {
return UPPER_UNDERSCORE.to(LOWER_CAMEL, name());
}
@Override
public String toString() {
return value();
}
}
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromNetworkReference(this);
}
public static class Builder extends BaseNamedResource.Builder<NetworkReference> {
private String address;
private NetworkType networkType;
private String broadcastAddress;
private String gatewayAddress;
private NamedResource rnatAddress;
private IpAddresses ipAddresses;
/**
* @see NetworkReference#getAddress
*/
public Builder address(String address) {
this.address = address;
return this;
}
/**
* @see NetworkReference#getNetworkType
*/
public Builder networkType(NetworkType networkType) {
this.networkType = networkType;
return this;
}
/**
* @see NetworkReference#getBroadcastAddress
*/
public Builder broadcastAddress(String broadcastAddress) {
this.broadcastAddress = broadcastAddress;
return this;
}
/**
* @see NetworkReference#getGatewayAddress
*/
public Builder gatewayAddress(String gatewayAddress) {
this.gatewayAddress = gatewayAddress;
return this;
}
/**
* @see NetworkReference#getRnatAddress
*/
public Builder rnatAddress(NamedResource rnatAddress) {
this.rnatAddress = rnatAddress;
return this;
}
/**
* @see NetworkReference#getIpAddresses
*/
public Builder ipAddresses(IpAddresses ipAddresses) {
this.ipAddresses = ipAddresses;
return this;
}
@Override
public NetworkReference build() {
return new NetworkReference(href, type, name, address, networkType, broadcastAddress, gatewayAddress, rnatAddress, ipAddresses);
}
public Builder fromNetworkReference(NetworkReference in) {
return fromNamedResource(in).address(in.getAddress())
.networkType(in.getNetworkType())
.broadcastAddress(in.getBroadcastAddress())
.gatewayAddress(in.getGatewayAddress())
.rnatAddress(in.getRnatAddress())
.ipAddresses(in.getIpAddresses());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<NetworkReference> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromNamedResource(BaseNamedResource<NetworkReference> in) {
return Builder.class.cast(super.fromNamedResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "Address", required = false)
private String address;
@XmlElement(name = "NetworkType", required = true)
private NetworkType networkType;
@XmlElement(name = "BroadcastAddress", required = false)
private String broadcastAddress;
@XmlElement(name = "GatewayAddress", required = false)
private String gatewayAddress;
@XmlElement(name = "RnatAddress", required = false)
private NamedResource rnatAddress;
@XmlElement(name = "IpAddresses", required = false)
private IpAddresses ipAddresses;
private NetworkReference(URI href, String type, String name,@Nullable String address, NetworkType networkType,
@Nullable String broadcastAddress, @Nullable String gatewayAddress, @Nullable NamedResource rnatAddress, @Nullable IpAddresses ipAddresses) {
super(href, type, name);
this.address = address;
this.networkType = checkNotNull(networkType,"networkType");
this.broadcastAddress = broadcastAddress;
this.gatewayAddress = gatewayAddress;
this.rnatAddress = rnatAddress;
this.ipAddresses = ipAddresses;
}
private NetworkReference() {
//For JAXB
}
public String getAddress() {
return address;
}
public NetworkType getNetworkType() {
return networkType;
}
public String getBroadcastAddress() {
return broadcastAddress;
}
public String getGatewayAddress() {
return gatewayAddress;
}
public NamedResource getRnatAddress() {
return rnatAddress;
}
public IpAddresses getIpAddresses() {
return ipAddresses;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
NetworkReference that = (NetworkReference) o;
if (address != null ? !address.equals(that.address) : that.address != null)
return false;
if (broadcastAddress != null ? !broadcastAddress.equals(that.broadcastAddress) : that.broadcastAddress != null)
return false;
if (gatewayAddress != null ? !gatewayAddress.equals(that.gatewayAddress) : that.gatewayAddress != null)
return false;
if (ipAddresses != null ? !ipAddresses.equals(that.ipAddresses) : that.ipAddresses != null)
return false;
if (networkType != that.networkType) return false;
if (rnatAddress != null ? !rnatAddress.equals(that.rnatAddress) : that.rnatAddress != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (address != null ? address.hashCode() : 0);
result = 31 * result + networkType.hashCode();
result = 31 * result + (broadcastAddress != null ? broadcastAddress.hashCode() : 0);
result = 31 * result + (gatewayAddress != null ? gatewayAddress.hashCode() : 0);
result = 31 * result + (rnatAddress != null ? rnatAddress.hashCode() : 0);
result = 31 * result + (ipAddresses != null ? ipAddresses.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", address="+address+", networkType="+networkType+", broadcastAddress="+broadcastAddress+", gatewayAddress="+gatewayAddress+", rnatAddress="+rnatAddress+", ipAddresses="+ipAddresses;
}
}

View File

@ -1,125 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.network;
import org.jclouds.javax.annotation.Nullable;
import javax.xml.bind.annotation.XmlElement;
/**
* <xs:complexType name="NetworkSettingsType">
* @author Jason King
*/
public class NetworkSettings {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromNetworkAdapterSetting(this);
}
public static class Builder {
private NetworkAdapterSettings networkAdapterSettings = NetworkAdapterSettings.builder().build();
private DnsSettings dnsSettings;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.network.NetworkSettings#getNetworkAdapterSettings
*/
public Builder networkAdapterSettings(NetworkAdapterSettings networkAdapterSettings) {
this.networkAdapterSettings = networkAdapterSettings;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.network.NetworkSettings#getDnsSettings
*/
public Builder dnsSettings(DnsSettings dnsSettings) {
this.dnsSettings = dnsSettings;
return this;
}
public NetworkSettings build() {
return new NetworkSettings(networkAdapterSettings, dnsSettings);
}
public Builder fromNetworkAdapterSetting(NetworkSettings in) {
return networkAdapterSettings(in.getNetworkAdapterSettings()).dnsSettings(in.getDnsSettings());
}
}
@XmlElement(name = "NetworkAdapterSettings", required = false)
private NetworkAdapterSettings networkAdapterSettings;
@XmlElement(name = "DnsSettings", required = false)
private DnsSettings dnsSettings;
public NetworkSettings(@Nullable NetworkAdapterSettings networkAdapterSettings, @Nullable DnsSettings dnsSettings) {
this.networkAdapterSettings = networkAdapterSettings;
this.dnsSettings = dnsSettings;
}
protected NetworkSettings() {
//For JAXB
}
public NetworkAdapterSettings getNetworkAdapterSettings() {
return networkAdapterSettings;
}
/**
* DnsSettings is optional.
* If not included, defaults to DNS for the data center.
* PrimaryDns is required if DnsSettings is included.
* @return
*/
public DnsSettings getDnsSettings() {
return dnsSettings;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
NetworkSettings that = (NetworkSettings) o;
if (dnsSettings != null ? !dnsSettings.equals(that.dnsSettings) : that.dnsSettings != null)
return false;
if (networkAdapterSettings != null ? !networkAdapterSettings.equals(that.networkAdapterSettings) : that.networkAdapterSettings != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = networkAdapterSettings != null ? networkAdapterSettings.hashCode() : 0;
result = 31 * result + (dnsSettings != null ? dnsSettings.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "[networkAdapterSettings="+ networkAdapterSettings +",dnsSettings="+ dnsSettings +"]";
}
}

View File

@ -1,182 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.network;
import com.google.common.collect.Sets;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Networks is more than a simple wrapper as it extends Resource.
* @author Jason King
*
*/
@XmlRootElement(name = "Networks")
public class Networks extends Resource<Networks> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromTemplates(this);
}
public static class Builder extends Resource.Builder<Networks> {
private Set<NetworkReference> networks = Sets.newLinkedHashSet();
/**
* @see Networks#getNetworks
*/
public Builder networks(Set<NetworkReference> networks) {
this.networks =(checkNotNull(networks,"networks"));
return this;
}
@Override
public Networks build() {
return new Networks(href, type, name, links, actions, networks);
}
public Builder fromTemplates(Networks in) {
return fromResource(in).networks(in.getNetworks());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<Networks> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<Networks> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "Network", required = false)
private Set<NetworkReference> networks = Sets.newLinkedHashSet();
private Networks(URI href, String type, String name, Set<Link> links, Set<Action> actions, Set<NetworkReference> networks) {
super(href, type, name, links, actions);
this.networks = checkNotNull(networks,"networks");
}
private Networks() {
//For JAXB
}
public Set<NetworkReference> getNetworks() {
return networks;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
Networks networks1 = (Networks) o;
if (!networks.equals(networks1.networks)) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + networks.hashCode();
return result;
}
@Override
public String string() {
return super.string()+", networks="+networks;
}
}

View File

@ -1,108 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.network;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Wraps individual VirtualNic elements.
* Needed because parsing is done with JAXB and it does not handle Generic collections
* <xs:complexType name="Nics">
* @author Jason King
*/
public class Nics {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromNics(this);
}
public static class Builder {
private Set<VirtualNic> nics = Sets.newLinkedHashSet();
/**
* @see Nics#getVirtualNics()
*/
public Builder nics(Set<VirtualNic> nics) {
this.nics = Sets.newLinkedHashSet(checkNotNull(nics, "nics"));
return this;
}
public Builder addVirtualNic(VirtualNic nic) {
nics.add(checkNotNull(nic,"nic"));
return this;
}
public Nics build() {
return new Nics(nics);
}
public Builder fromNics(Nics in) {
return nics(in.getVirtualNics());
}
}
private Nics() {
//For JAXB and builder use
}
private Nics(Set<VirtualNic> nics) {
this.nics = Sets.newLinkedHashSet(nics);
}
@XmlElement(name = "Nic")
private LinkedHashSet<VirtualNic> nics = Sets.newLinkedHashSet();
public Set<VirtualNic> getVirtualNics() {
return Collections.unmodifiableSet(nics);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Nics nics1 = (Nics) o;
if (!nics.equals(nics1.nics)) return false;
return true;
}
@Override
public int hashCode() {
return nics.hashCode();
}
public String toString() {
return "["+ nics.toString()+"]";
}
}

View File

@ -1,164 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.network;
import org.jclouds.javax.annotation.Nullable;
import javax.xml.bind.annotation.XmlElement;
/**
* <xs:complexType name="VirtualNic">
* @author Jason King
*/
public class VirtualNic {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromVirtualNic(this);
}
public static class Builder {
private String name;
private String macAddress;
private int unitNumber;
private NetworkReference network;
/**
* @see VirtualNic#getName
*/
public Builder name(String name) {
this.name = name;
return this;
}
/**
* @see VirtualNic#getMacAddress
*/
public Builder macAddress(String macAddress) {
this.macAddress = macAddress;
return this;
}
/**
* @see VirtualNic#getUnitNumber
*/
public Builder unitNumber(int unitNumber) {
this.unitNumber = unitNumber;
return this;
}
/**
* @see VirtualNic#getNetwork
*/
public Builder network(NetworkReference network) {
this.network = network;
return this;
}
public VirtualNic build() {
return new VirtualNic(name, macAddress, unitNumber, network);
}
public Builder fromVirtualNic(VirtualNic in) {
return name(in.getName())
.macAddress(in.getMacAddress())
.unitNumber(in.getUnitNumber())
.network(in.getNetwork());
}
}
@XmlElement(name = "Name")
private String name;
@XmlElement(name = "MacAddress")
private String macAddress;
@XmlElement(name = "UnitNumber")
private int unitNumber;
@XmlElement(name = "Network")
private NetworkReference network;
public VirtualNic(@Nullable String name, @Nullable String macAddress, int unitNumber, @Nullable NetworkReference network) {
this.name = name;
this.macAddress = macAddress;
this.unitNumber = unitNumber;
this.network = network;
}
protected VirtualNic() {
//For JAXB
}
@Nullable
public String getName() {
return name;
}
@Nullable
public String getMacAddress() {
return macAddress;
}
public int getUnitNumber() {
return unitNumber;
}
@Nullable
public NetworkReference getNetwork() {
return network;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
VirtualNic that = (VirtualNic) o;
if (unitNumber != that.unitNumber) return false;
if (macAddress != null ? !macAddress.equals(that.macAddress) : that.macAddress != null)
return false;
if (name != null ? !name.equals(that.name) : that.name != null)
return false;
if (network != null ? !network.equals(that.network) : that.network != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (macAddress != null ? macAddress.hashCode() : 0);
result = 31 * result + unitNumber;
result = 31 * result + (network != null ? network.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "[name="+name+",macAddress="+macAddress+",unitNumber="+unitNumber+",network="+network+"]";
}
}

View File

@ -1,141 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.network;
import org.jclouds.javax.annotation.Nullable;
import javax.xml.bind.annotation.XmlElement;
/**
* <xs:complexType name="WindowsCustomizationType">
* @author Jason King
*/
public class WindowsCustomization {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromLinuxCustomization(this);
}
public static class Builder {
private NetworkSettings networkSettings;
private String password;
private String licenseKey;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.network.WindowsCustomization#getNetworkSettings
*/
public Builder networkSettings(NetworkSettings networkSettings) {
this.networkSettings = networkSettings;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.network.WindowsCustomization#getPassword
*/
public Builder password(String password) {
this.password = password;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.network.WindowsCustomization#getLicenseKey
*/
public Builder licenseKey(String licenseKey) {
this.licenseKey = licenseKey;
return this;
}
public WindowsCustomization build() {
return new WindowsCustomization(networkSettings, password, licenseKey);
}
public Builder fromLinuxCustomization(WindowsCustomization in) {
return networkSettings(in.getNetworkSettings()).password(in.getPassword()).licenseKey(in.getLicenseKey());
}
}
@XmlElement(name = "NetworkSettings", required = false)
private NetworkSettings networkSettings;
@XmlElement(name = "Password", required = false)
private String password;
@XmlElement(name = "LicenseKey", required = false)
private String licenseKey;
public WindowsCustomization(@Nullable NetworkSettings networkSettings, @Nullable String password, @Nullable String licenseKey) {
this.networkSettings = networkSettings;
this.password = password;
this.licenseKey = licenseKey;
}
private WindowsCustomization() {
//For JAXB
}
public NetworkSettings getNetworkSettings() {
return networkSettings;
}
public String getPassword() {
return password;
}
public String getLicenseKey() {
return licenseKey;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
WindowsCustomization that = (WindowsCustomization) o;
if (licenseKey != null ? !licenseKey.equals(that.licenseKey) : that.licenseKey != null)
return false;
if (networkSettings != null ? !networkSettings.equals(that.networkSettings) : that.networkSettings != null)
return false;
if (password != null ? !password.equals(that.password) : that.password != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = networkSettings != null ? networkSettings.hashCode() : 0;
result = 31 * result + (password != null ? password.hashCode() : 0);
result = 31 * result + (licenseKey != null ? licenseKey.hashCode() : 0);
return result;
}
@Override
public String toString() {
final String pw = password==null ? null : "*******";
final String lic = licenseKey==null ? null : "*******";
return "[networkSettings="+networkSettings+",password="+pw+",licenseKey="+lic+"]";
}
}

View File

@ -1,98 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.NamedResource;
import javax.xml.bind.annotation.XmlElement;
/**
* <xs:complexType name="ComputePoolPerformanceStatistic">
* @author Jason King
*
*/
public class ComputePoolPerformanceStatistic {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromComputePoolPerformanceStatistic(this);
}
public static class Builder {
private NamedResource cpu;
private NamedResource memory;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolPerformanceStatistic#getCpu
*/
public Builder cpu(NamedResource cpu) {
this.cpu = cpu;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolPerformanceStatistic#getMemory
*/
public Builder memory(NamedResource memory) {
this.memory = memory;
return this;
}
public ComputePoolPerformanceStatistic build() {
return new ComputePoolPerformanceStatistic(cpu, memory);
}
public Builder fromComputePoolPerformanceStatistic(ComputePoolPerformanceStatistic in) {
return cpu(in.getCpu()).memory(in.getMemory());
}
}
@XmlElement(name = "Cpu", required = false)
private NamedResource cpu;
@XmlElement(name = "Memory", required = false)
private NamedResource memory;
private ComputePoolPerformanceStatistic(@Nullable NamedResource cpu, @Nullable NamedResource memory) {
this.cpu = cpu;
this.memory = memory;
}
private ComputePoolPerformanceStatistic() {
//For JAXB
}
public NamedResource getCpu() {
return cpu;
}
public NamedResource getMemory() {
return memory;
}
@Override
public String toString() {
return "cpu="+cpu+", memory="+memory;
}
}

View File

@ -1,202 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Map;
import java.util.Set;
/**
* <xs:complexType name="ComputePoolPerformanceStatistics">
* @author Jason King
*
*/
@XmlRootElement(name = "ComputePoolPerformanceStatistics")
public class ComputePoolPerformanceStatistics extends Resource<ComputePoolPerformanceStatistics> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromComputePoolResourceSummary(this);
}
public static class Builder extends Resource.Builder<ComputePoolPerformanceStatistics> {
ComputePoolPerformanceStatistic hourly;
ComputePoolPerformanceStatistic daily;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolPerformanceStatistics#getHourly
*/
public Builder hourly(ComputePoolPerformanceStatistic hourly) {
this.hourly = hourly;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolPerformanceStatistics#getDaily
*/
public Builder daily(ComputePoolPerformanceStatistic daily) {
this.daily = daily;
return this;
}
@Override
public ComputePoolPerformanceStatistics build() {
return new ComputePoolPerformanceStatistics(href, type, name, links, actions, hourly, daily);
}
public Builder fromComputePoolResourceSummary(ComputePoolPerformanceStatistics in) {
return fromResource(in).hourly(in.getHourly()).daily(in.getDaily());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<ComputePoolPerformanceStatistics> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<ComputePoolPerformanceStatistics> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "Hourly", required = false)
ComputePoolPerformanceStatistic hourly;
@XmlElement(name = "Daily", required = false)
ComputePoolPerformanceStatistic daily;
private ComputePoolPerformanceStatistics(URI href, String type, String name, Set<Link> links, Set<Action> actions,
@Nullable ComputePoolPerformanceStatistic hourly, @Nullable ComputePoolPerformanceStatistic daily) {
super(href, type, name, links, actions);
this.hourly = hourly;
this.daily = daily;
}
private ComputePoolPerformanceStatistics() {
//For JAXB
}
public ComputePoolPerformanceStatistic getHourly() {
return hourly;
}
public ComputePoolPerformanceStatistic getDaily() {
return daily;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
ComputePoolPerformanceStatistics that = (ComputePoolPerformanceStatistics) o;
if (daily != null ? !daily.equals(that.daily) : that.daily != null)
return false;
if (hourly != null ? !hourly.equals(that.hourly) : that.hourly != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (hourly != null ? hourly.hashCode() : 0);
result = 31 * result + (daily != null ? daily.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", hourly="+hourly+", daily="+daily;
}
}

View File

@ -1,286 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.CpuComputeResourceSummary;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* <xs:complexType name="ComputePoolResourceSummary">
* @author Jason King
*
*/
@XmlRootElement(name = "ComputePoolResourceSummary")
public class ComputePoolResourceSummary extends Resource<ComputePoolResourceSummary> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromComputePoolResourceSummary(this);
}
public static class Builder extends Resource.Builder<ComputePoolResourceSummary> {
private Date startTime;
private Date endTime;
private CpuComputeResourceSummary cpu;
private MemoryComputeResourceSummary memory;
private StorageResourceSummary storage;
private VirtualMachineResourceSummary virtualMachines;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummary#getStartTime
*/
public Builder startTime(Date startTime) {
this.startTime = startTime;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummary#getEndTime
*/
public Builder endTime(Date endTime) {
this.endTime = endTime;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummary#getCpu
*/
public Builder cpu(CpuComputeResourceSummary cpu) {
this.cpu = cpu;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummary#getMemory
*/
public Builder memory(MemoryComputeResourceSummary memory) {
this.memory = memory;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummary#getStorage
*/
public Builder storage(StorageResourceSummary storage) {
this.storage = storage;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummary#getVirtualMachines
*/
public Builder virtualMachines(VirtualMachineResourceSummary virtualMachines) {
this.virtualMachines = virtualMachines;
return this;
}
@Override
public ComputePoolResourceSummary build() {
return new ComputePoolResourceSummary(href, type, name, links, actions,
startTime, endTime, cpu, memory, storage, virtualMachines);
}
public Builder fromComputePoolResourceSummary(ComputePoolResourceSummary in) {
return fromResource(in).startTime(in.getStartTime()).endTime(in.getEndTime());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<ComputePoolResourceSummary> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<ComputePoolResourceSummary> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "StartTime", required = true)
private Date startTime;
@XmlElement(name = "EndTime", required = true)
private Date endTime;
@XmlElement(name = "Cpu", required = false)
private CpuComputeResourceSummary cpu;
@XmlElement(name = "Memory", required = false)
private MemoryComputeResourceSummary memory;
@XmlElement(name = "Storage", required = false)
private StorageResourceSummary storage;
@XmlElement(name = "VirtualMachines", required = false)
private VirtualMachineResourceSummary virtualMachines;
private ComputePoolResourceSummary(URI href, String type, String name, Set<Link> links, Set<Action> actions, Date startTime, Date completedTime,
@Nullable CpuComputeResourceSummary cpu, @Nullable MemoryComputeResourceSummary memory, @Nullable StorageResourceSummary storage, @Nullable VirtualMachineResourceSummary virtualMachines) {
super(href, type, name, links, actions);
this.startTime = checkNotNull(startTime, "startTime");
this.endTime = checkNotNull(endTime, "endTime");
this.cpu = cpu;
this.memory = memory;
this.storage = storage;
this.virtualMachines = virtualMachines;
}
private ComputePoolResourceSummary() {
//For JAXB
}
public Date getStartTime() {
return startTime;
}
public Date getEndTime() {
return endTime;
}
public CpuComputeResourceSummary getCpu() {
return cpu;
}
public MemoryComputeResourceSummary getMemory() {
return memory;
}
public StorageResourceSummary getStorage() {
return storage;
}
public VirtualMachineResourceSummary getVirtualMachines() {
return virtualMachines;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
ComputePoolResourceSummary that = (ComputePoolResourceSummary) o;
if (cpu != null ? !cpu.equals(that.cpu) : that.cpu != null) return false;
if (!endTime.equals(that.endTime)) return false;
if (memory != null ? !memory.equals(that.memory) : that.memory != null)
return false;
if (!startTime.equals(that.startTime)) return false;
if (storage != null ? !storage.equals(that.storage) : that.storage != null)
return false;
if (virtualMachines != null ? !virtualMachines.equals(that.virtualMachines) : that.virtualMachines != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + startTime.hashCode();
result = 31 * result + endTime.hashCode();
result = 31 * result + (cpu != null ? cpu.hashCode() : 0);
result = 31 * result + (memory != null ? memory.hashCode() : 0);
result = 31 * result + (storage != null ? storage.hashCode() : 0);
result = 31 * result + (virtualMachines != null ? virtualMachines.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", startTime="+startTime+", endTime="+endTime+", cpu="+cpu+", memory="+memory+", storage="+storage+", virtualMachines="+virtualMachines;
}
}

View File

@ -1,184 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource;
import com.google.common.collect.Sets;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* ComputePoolResourceSummaryList is more than a simple wrapper as it extends Resource.
* <xs:complexType name="ComputePoolResourceSummaryList">
* @author Jason King
*
*/
@XmlRootElement(name = "ComputePoolResourceSummaryList")
public class ComputePoolResourceSummaryList extends Resource<ComputePoolResourceSummaryList> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromSummaryList(this);
}
public static class Builder extends Resource.Builder<ComputePoolResourceSummaryList> {
private Set<ComputePoolResourceSummary> summaries = Sets.newLinkedHashSet();
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummaryList#getComputePoolResourceSummaries
*/
public Builder summaries(Set<ComputePoolResourceSummary> summaries) {
this.summaries =(checkNotNull(summaries,"summaries"));
return this;
}
@Override
public ComputePoolResourceSummaryList build() {
return new ComputePoolResourceSummaryList(href, type, name, links, actions, summaries);
}
public Builder fromSummaryList(ComputePoolResourceSummaryList in) {
return fromResource(in).summaries(in.getComputePoolResourceSummaries());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<ComputePoolResourceSummaryList> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<ComputePoolResourceSummaryList> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "ComputePoolResourceSummary")
private Set<ComputePoolResourceSummary> summaries = Sets.newLinkedHashSet();
private ComputePoolResourceSummaryList(URI href, String type, String name, Set<Link> links, Set<Action> actions, Set<ComputePoolResourceSummary> summaries) {
super(href, type, name, links, actions);
this.summaries = checkNotNull(summaries,"summaries");
}
private ComputePoolResourceSummaryList() {
//For JAXB
}
public Set<ComputePoolResourceSummary> getComputePoolResourceSummaries() {
return summaries;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
ComputePoolResourceSummaryList that = (ComputePoolResourceSummaryList) o;
if (!summaries.equals(that.summaries)) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + summaries.hashCode();
return result;
}
@Override
public String string() {
return super.string()+", summaries="+summaries;
}
}

View File

@ -1,162 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
import javax.xml.bind.annotation.XmlElement;
/**
* <xs:complexType name="ComputeResourceSummary">
* @author Jason King
*/
public class ComputeResourceSummary {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromComputeResourceSummary(this);
}
public static class Builder {
protected ResourceCapacity allocated;
protected ResourceCapacity consumed;
protected ResourceCapacity purchased;
protected int utilization;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.ComputeResourceSummary#getAllocated
*/
public Builder allocated(ResourceCapacity allocated) {
this.allocated = allocated;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.ComputeResourceSummary#getConsumed
*/
public Builder consumed(ResourceCapacity consumed) {
this.consumed = consumed;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.ComputeResourceSummary#getPurchased
*/
public Builder purchased(ResourceCapacity purchased) {
this.purchased = purchased;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.ComputeResourceSummary#getUtilization
*/
public Builder utilization(int utilization) {
this.utilization = utilization;
return this;
}
public ComputeResourceSummary build() {
return new ComputeResourceSummary(allocated,consumed,purchased,utilization);
}
public Builder fromComputeResourceSummary(ComputeResourceSummary in) {
return allocated(in.getAllocated()).consumed(in.getConsumed()).purchased(in.getPurchased()).utilization(in.getUtilization());
}
}
@XmlElement(name = "Allocated", required = false)
private ResourceCapacity allocated;
@XmlElement(name = "Consumed", required = false)
private ResourceCapacity consumed;
@XmlElement(name = "Purchased", required = false)
private ResourceCapacity purchased;
@XmlElement(name = "Utilization", required = false)
private int utilization;
protected ComputeResourceSummary(@Nullable ResourceCapacity allocated, @Nullable ResourceCapacity consumed, @Nullable ResourceCapacity purchased, int utilization) {
this.allocated = allocated;
this.consumed = consumed;
this.purchased = purchased;
this.utilization = utilization;
}
protected ComputeResourceSummary() {
//For JAXB
}
public ResourceCapacity getAllocated() {
return allocated;
}
public ResourceCapacity getConsumed() {
return consumed;
}
public ResourceCapacity getPurchased() {
return purchased;
}
public int getUtilization() {
return utilization;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ComputeResourceSummary that = (ComputeResourceSummary) o;
if (utilization != that.utilization) return false;
if (allocated != null ? !allocated.equals(that.allocated) : that.allocated != null)
return false;
if (consumed != null ? !consumed.equals(that.consumed) : that.consumed != null)
return false;
if (purchased != null ? !purchased.equals(that.purchased) : that.purchased != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = allocated != null ? allocated.hashCode() : 0;
result = 31 * result + (consumed != null ? consumed.hashCode() : 0);
result = 31 * result + (purchased != null ? purchased.hashCode() : 0);
result = 31 * result + utilization;
return result;
}
@Override
public String toString() {
return String.format("[%s]",string());
}
protected String string() {
return "allocated="+ allocated +", consumed="+consumed+", purchased="+purchased+", utilization="+utilization;
}
}

View File

@ -1,73 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
/**
* <xs:complexType name="MemoryComputeResourceSummary">
* @author Jason King
*/
public class MemoryComputeResourceSummary extends ComputeResourceSummary {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromMemoryComputeResourceSummary(this);
}
public static class Builder extends ComputeResourceSummary.Builder {
public Builder allocated(ResourceCapacity allocated) {
return Builder.class.cast(super.allocated(allocated));
}
public Builder consumed(ResourceCapacity consumed) {
return Builder.class.cast(super.consumed(consumed));
}
public Builder purchased(ResourceCapacity purchased) {
return Builder.class.cast(super.purchased(purchased));
}
public Builder utilization(int utilization) {
return Builder.class.cast(super.utilization(utilization));
}
public MemoryComputeResourceSummary build() {
return new MemoryComputeResourceSummary(allocated,consumed,purchased,utilization);
}
public Builder fromMemoryComputeResourceSummary(MemoryComputeResourceSummary in) {
return allocated(in.getAllocated()).consumed(in.getConsumed()).purchased(in.getPurchased()).utilization(in.getUtilization());
}
}
private MemoryComputeResourceSummary(@Nullable ResourceCapacity allocated, @Nullable ResourceCapacity consumed, @Nullable ResourceCapacity purchased, int utilization) {
super(allocated,consumed,purchased,utilization);
}
private MemoryComputeResourceSummary() {
//For JAXB
}
}

View File

@ -1,123 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Date;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* <xs:complexType name="PerformanceStatistic">
* @author Jason King
*
*/
@XmlRootElement(name = "PerformanceStatistic")
public class PerformanceStatistic {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromPerformanceStatistic(this);
}
public static class Builder {
private Date time;
private ResourceCapacity used;
/**
* @see PerformanceStatistic#getTime
*/
public Builder time(Date time) {
this.time =(checkNotNull(time,"time"));
return this;
}
/**
* @see PerformanceStatistic#getUsed
*/
public Builder used(ResourceCapacity used) {
this.used =(checkNotNull(used,"used"));
return this;
}
public PerformanceStatistic build() {
return new PerformanceStatistic(time,used);
}
public Builder fromPerformanceStatistic(PerformanceStatistic in) {
return time(in.getTime()).used(in.getUsed());
}
}
@XmlElement(name = "Time", required = true)
private Date time;
@XmlElement(name = "Used", required = false)
private ResourceCapacity used;
private PerformanceStatistic(Date time, ResourceCapacity used) {
this.time = checkNotNull(time, "time");
this.used = used;
}
private PerformanceStatistic() {
//For JAXB
}
public Date getTime() {
return time;
}
public ResourceCapacity getUsed() {
return used;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PerformanceStatistic that = (PerformanceStatistic) o;
if (!time.equals(that.time)) return false;
if (used != null ? !used.equals(that.used) : that.used != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = time.hashCode();
result = 31 * result + (used != null ? used.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "[time="+time+", used="+used+"]";
}
}

View File

@ -1,224 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* PerformanceStatistics is more than a simple wrapper as it extends BaseResource.
* <xs:complexType name="PerformanceStatistics">
* @author Jason King
*
*/
@XmlRootElement(name = "PerformanceStatistics")
public class PerformanceStatistics extends Resource<PerformanceStatistics> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromPerformanceStatistics(this);
}
public static class Builder extends Resource.Builder<PerformanceStatistics> {
private Date startTime;
private Date endTime;
private VirtualMachinePerformanceStatistics statistics;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.PerformanceStatistics#getStartTime
*/
public Builder startTime(Date startTime) {
this.startTime =(checkNotNull(startTime,"startTime"));
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.PerformanceStatistics#getEndTime
*/
public Builder endTime(Date endTime) {
this.endTime =(checkNotNull(endTime,"endTime"));
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.PerformanceStatistics#getStatistics
*/
public Builder statistics(VirtualMachinePerformanceStatistics statistics) {
this.statistics =(checkNotNull(statistics,"statistics"));
return this;
}
@Override
public PerformanceStatistics build() {
return new PerformanceStatistics(href, type, name, links, actions, startTime, endTime, statistics);
}
public Builder fromPerformanceStatistics(PerformanceStatistics in) {
return fromResource(in).startTime(in.getStartTime()).endTime(in.getEndTime()).statistics(in.getStatistics());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<PerformanceStatistics> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<PerformanceStatistics> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "StartTime", required = true)
private Date startTime;
@XmlElement(name = "EndTime", required = true)
private Date endTime;
@XmlElement(name = "VirtualMachines", required = false)
private VirtualMachinePerformanceStatistics statistics;
private PerformanceStatistics(URI href, String type, String name, Set<Link> links, Set<Action> actions,
Date startTime, Date endTime, @Nullable VirtualMachinePerformanceStatistics statistics) {
super(href, type, name, links, actions);
this.startTime = startTime;
this.endTime = endTime;
this.statistics = statistics;
}
private PerformanceStatistics() {
//For JAXB
}
public Date getStartTime() {
return startTime;
}
public Date getEndTime() {
return endTime;
}
public VirtualMachinePerformanceStatistics getStatistics() {
return statistics;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
PerformanceStatistics that = (PerformanceStatistics) o;
if (!endTime.equals(that.endTime)) return false;
if (!startTime.equals(that.startTime)) return false;
if (statistics != null ? !statistics.equals(that.statistics) : that.statistics != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + startTime.hashCode();
result = 31 * result + endTime.hashCode();
result = 31 * result + (statistics != null ? statistics.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", startTime="+ startTime+", endTime="+ endTime+", statistics="+ statistics;
}
}

View File

@ -1,123 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
import javax.xml.bind.annotation.XmlElement;
/**
* <xs:complexType name="StorageResourceSummary">
* @author Jason King
*/
public class StorageResourceSummary {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromStorageResourceSummary(this);
}
public static class Builder {
private ResourceCapacity purchased;
private ResourceCapacity used;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.StorageResourceSummary#getPurchased
*/
public Builder purchased(ResourceCapacity purchased) {
this.purchased = purchased;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.StorageResourceSummary#getUsed
*/
public Builder used(ResourceCapacity used) {
this.used = used;
return this;
}
public StorageResourceSummary build() {
return new StorageResourceSummary(purchased,used);
}
public Builder fromStorageResourceSummary(StorageResourceSummary in) {
return purchased(in.getPurchased()).used(in.getUsed());
}
}
@XmlElement(name = "Purchased", required = false)
private ResourceCapacity purchased;
@XmlElement(name = "Used", required = false)
private ResourceCapacity used;
protected StorageResourceSummary(@Nullable ResourceCapacity purchased, @Nullable ResourceCapacity used) {
this.purchased = purchased;
this.used = used;
}
protected StorageResourceSummary() {
//For JAXB
}
public ResourceCapacity getPurchased() {
return purchased;
}
public ResourceCapacity getUsed() {
return used;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
StorageResourceSummary that = (StorageResourceSummary) o;
if (purchased != null ? !purchased.equals(that.purchased) : that.purchased != null)
return false;
if (used != null ? !used.equals(that.used) : that.used != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = purchased != null ? purchased.hashCode() : 0;
result = 31 * result + (used != null ? used.hashCode() : 0);
return result;
}
@Override
public String toString() {
return String.format("[%s]",string());
}
protected String string() {
return "purchased="+purchased+", used="+ used;
}
}

View File

@ -1,184 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement;
import java.net.URI;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* VirtualMachinePerformanceStatistic is more than a simple wrapper as it extends BaseResource.
* <xs:complexType name="VirtualMachinePerformanceStatistic">
* @author Jason King
*
*/
public class VirtualMachinePerformanceStatistic extends Resource<VirtualMachinePerformanceStatistic> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromVirtualMachinePerformanceStatistic(this);
}
public static class Builder extends Resource.Builder<VirtualMachinePerformanceStatistic> {
private Set<PerformanceStatistic> statistics = Sets.newLinkedHashSet();
/**
* @see VirtualMachinePerformanceStatistic#getStatistics
*/
public Builder statistics(Set<PerformanceStatistic> statistics) {
this.statistics =(checkNotNull(statistics,"statistics"));
return this;
}
@Override
public VirtualMachinePerformanceStatistic build() {
return new VirtualMachinePerformanceStatistic(href, type, name, links, actions, statistics);
}
public Builder fromVirtualMachinePerformanceStatistic(VirtualMachinePerformanceStatistic in) {
return fromResource(in).statistics(in.getStatistics());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<VirtualMachinePerformanceStatistic> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<VirtualMachinePerformanceStatistic> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "PerformanceStatistic", required = false)
private Set<PerformanceStatistic> statistics = Sets.newLinkedHashSet();
private VirtualMachinePerformanceStatistic(URI href, String type, String name, Set<Link> links, Set<Action> actions, Set<PerformanceStatistic> statistics) {
super(href, type, name, links, actions);
this.statistics = ImmutableSet.copyOf(statistics);
}
private VirtualMachinePerformanceStatistic() {
//For JAXB
}
public Set<PerformanceStatistic> getStatistics() {
return Collections.unmodifiableSet(statistics);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
VirtualMachinePerformanceStatistic templates = (VirtualMachinePerformanceStatistic) o;
if (statistics != null ? !statistics.equals(templates.statistics) : templates.statistics != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (statistics != null ? statistics.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", statistics="+ statistics;
}
}

View File

@ -1,102 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import java.util.Collections;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Wraps individual VirtualMachinePerformanceStatistic elements.
* Needed because parsing is done with JAXB and it does not handle Generic collections
* @author Jason King
*/
public class VirtualMachinePerformanceStatistics {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromVirtualMachinePerformanceStatistics(this);
}
public static class Builder {
private Set<VirtualMachinePerformanceStatistic> virtualMachines = Sets.newLinkedHashSet();
/**
* @see VirtualMachinePerformanceStatistics#getVirtualMachinesPerformanceStatistics
*/
public Builder virtualMachines(Set<VirtualMachinePerformanceStatistic> virtualMachines) {
this.virtualMachines = Sets.newLinkedHashSet(checkNotNull(virtualMachines, "virtualMachines"));
return this;
}
public VirtualMachinePerformanceStatistics build() {
return new VirtualMachinePerformanceStatistics(virtualMachines);
}
public Builder fromVirtualMachinePerformanceStatistics(VirtualMachinePerformanceStatistics in) {
return virtualMachines(in.getVirtualMachinesPerformanceStatistics());
}
}
@XmlElement(name = "VirtualMachine", required = false)
private Set<VirtualMachinePerformanceStatistic> virtualMachines = Sets.newLinkedHashSet();
private VirtualMachinePerformanceStatistics() {
//For JAXB
}
private VirtualMachinePerformanceStatistics(Set<VirtualMachinePerformanceStatistic> virtualMachines) {
this.virtualMachines = ImmutableSet.copyOf(virtualMachines);
}
public Set<VirtualMachinePerformanceStatistic> getVirtualMachinesPerformanceStatistics() {
return Collections.unmodifiableSet(virtualMachines);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
VirtualMachinePerformanceStatistics links1 = (VirtualMachinePerformanceStatistics) o;
if (!virtualMachines.equals(links1.virtualMachines)) return false;
return true;
}
@Override
public int hashCode() {
return virtualMachines.hashCode();
}
public String toString() {
return "["+ virtualMachines.toString()+"]";
}
}

View File

@ -1,132 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
import javax.xml.bind.annotation.XmlElement;
/**
* <xs:complexType name="VirtualMachineResourceSummary">
* @author Jason King
*/
public class VirtualMachineResourceSummary extends ComputeResourceSummary {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromVirtualMachineResourceSummary(this);
}
public static class Builder extends ComputeResourceSummary.Builder {
protected int count;
protected int poweredOnCount;
public Builder allocated(ResourceCapacity allocated) {
return Builder.class.cast(super.allocated(allocated));
}
public Builder consumed(ResourceCapacity consumed) {
return Builder.class.cast(super.consumed(consumed));
}
public Builder purchased(ResourceCapacity purchased) {
return Builder.class.cast(super.purchased(purchased));
}
public Builder utilization(int utilization) {
return Builder.class.cast(super.utilization(utilization));
}
public Builder count(int count) {
this.count = count;
return this;
}
public Builder poweredOnCount(int poweredOnCount) {
this.poweredOnCount = poweredOnCount;
return this;
}
public VirtualMachineResourceSummary build() {
return new VirtualMachineResourceSummary(allocated,consumed,purchased,utilization,count,poweredOnCount);
}
public Builder fromVirtualMachineResourceSummary(VirtualMachineResourceSummary in) {
return allocated(in.getAllocated()).consumed(in.getConsumed()).purchased(in.getPurchased()).utilization(in.getUtilization())
.count(in.getCount()).poweredOnCount(in.getPoweredOnCount());
}
}
@XmlElement(name = "Count", required = false)
private int count;
@XmlElement(name = "PoweredOnCount", required = false)
private int poweredOnCount;
private VirtualMachineResourceSummary(@Nullable ResourceCapacity allocated, @Nullable ResourceCapacity consumed, @Nullable ResourceCapacity purchased, int utilization, int count, int poweredOnCount) {
super(allocated,consumed,purchased,utilization);
this.count = count;
this.poweredOnCount = poweredOnCount;
}
private VirtualMachineResourceSummary() {
//For JAXB
}
public int getCount() {
return count;
}
public int getPoweredOnCount() {
return poweredOnCount;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
VirtualMachineResourceSummary that = (VirtualMachineResourceSummary) o;
if (count != that.count) return false;
if (poweredOnCount != that.poweredOnCount) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + count;
result = 31 * result + poweredOnCount;
return result;
}
@Override
public String string() {
return super.string()+", count="+count+", poweredOnCount="+poweredOnCount;
}
}

View File

@ -1,223 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource.cpu;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* ComputePoolCpuUsage is more than a simple wrapper as it extends Resource.
* <xs:complexType name="ComputePoolCpuUsage">
* @author Jason King
*
*/
@XmlRootElement(name = "ComputePoolCpuUsage")
public class ComputePoolCpuUsage extends Resource<ComputePoolCpuUsage> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromComputePoolCpuUsage(this);
}
public static class Builder extends Resource.Builder<ComputePoolCpuUsage> {
private Date startTime;
private Date endTime;
private CpuUsageDetails details;
/**
* @see ComputePoolCpuUsage#getStartTime
*/
public Builder startTime(Date startTime) {
this.startTime =(checkNotNull(startTime,"startTime"));
return this;
}
/**
* @see ComputePoolCpuUsage#getEndTime
*/
public Builder endTime(Date endTime) {
this.endTime =(checkNotNull(endTime,"endTime"));
return this;
}
/**
* @see ComputePoolCpuUsage#getDetails
*/
public Builder details(CpuUsageDetails details) {
this.details =(checkNotNull(details,"details"));
return this;
}
@Override
public ComputePoolCpuUsage build() {
return new ComputePoolCpuUsage(href, type, name, links, actions, startTime, endTime, details);
}
public Builder fromComputePoolCpuUsage(ComputePoolCpuUsage in) {
return fromResource(in).startTime(in.getStartTime()).endTime(in.getEndTime()).details(in.getDetails());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<ComputePoolCpuUsage> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<ComputePoolCpuUsage> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "StartTime", required = true)
private Date startTime;
@XmlElement(name = "EndTime", required = true)
private Date endTime;
@XmlElement(name = "CpuUsageDetailSummary", required = false)
private CpuUsageDetails details;
private ComputePoolCpuUsage(URI href, String type, String name, Set<Link> links, Set<Action> actions, Date startTime, Date endTime, @Nullable CpuUsageDetails details) {
super(href, type, name, links, actions);
this.startTime = checkNotNull(startTime, "startTime");
this.endTime = checkNotNull(endTime, "endTime");
this.details = details;
}
private ComputePoolCpuUsage() {
//For JAXB
}
public Date getStartTime() {
return startTime;
}
public Date getEndTime() {
return endTime;
}
public CpuUsageDetails getDetails() {
return details;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
ComputePoolCpuUsage that = (ComputePoolCpuUsage) o;
if (details != null ? !details.equals(that.details) : that.details != null)
return false;
if (!endTime.equals(that.endTime)) return false;
if (!startTime.equals(that.startTime)) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + startTime.hashCode();
result = 31 * result + endTime.hashCode();
result = 31 * result + (details != null ? details.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", startTime="+startTime+", endTime="+endTime+", details="+details;
}
}

View File

@ -1,225 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource.cpu;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* ComputePoolCpuUsageDetail is more than a simple wrapper as it extends Resource.
* <xs:complexType name="ComputePoolCpuUsageDetail">
* @author Jason King
*
*/
@XmlRootElement(name = "ComputePoolCpuUsageDetail")
public class ComputePoolCpuUsageDetail extends Resource<ComputePoolCpuUsageDetail> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromComputePoolCpuUsage(this);
}
public static class Builder extends Resource.Builder<ComputePoolCpuUsageDetail> {
private Date time;
private ResourceCapacity value;
private VirtualMachinesCpuUsage virtualMachinesCpuUsage;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsageDetail#getTime
*/
public Builder time(Date time) {
this.time =(checkNotNull(time,"time"));
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsageDetail#getValue
*/
public Builder value(ResourceCapacity value) {
this.value =(checkNotNull(value,"value"));
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsageDetail#getVirtualMachinesCpuUsage
*/
public Builder virtualMachines(VirtualMachinesCpuUsage virtualMachinesCpuUsage) {
this.virtualMachinesCpuUsage =(checkNotNull(virtualMachinesCpuUsage,"virtualMachinesCpuUsage"));
return this;
}
@Override
public ComputePoolCpuUsageDetail build() {
return new ComputePoolCpuUsageDetail(href, type, name, links, actions, time, value, virtualMachinesCpuUsage);
}
public Builder fromComputePoolCpuUsage(ComputePoolCpuUsageDetail in) {
return fromResource(in).time(in.getTime()).value(in.getValue()).virtualMachines(in.getVirtualMachinesCpuUsage());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<ComputePoolCpuUsageDetail> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<ComputePoolCpuUsageDetail> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "Time", required = true)
private Date time;
@XmlElement(name = "Value", required = false)
private ResourceCapacity value;
@XmlElement(name = "VirtualMachines", required = false)
private VirtualMachinesCpuUsage virtualMachinesCpuUsage;
private ComputePoolCpuUsageDetail(URI href, String type, String name, Set<Link> links, Set<Action> actions, Date time, @Nullable ResourceCapacity value, @Nullable VirtualMachinesCpuUsage virtualMachinesCpuUsage) {
super(href, type, name, links, actions);
this.time = checkNotNull(time, "time");
this.value = value;
this.virtualMachinesCpuUsage = virtualMachinesCpuUsage;
}
private ComputePoolCpuUsageDetail() {
//For JAXB
}
public Date getTime() {
return time;
}
public ResourceCapacity getValue() {
return value;
}
public VirtualMachinesCpuUsage getVirtualMachinesCpuUsage() {
return virtualMachinesCpuUsage;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
ComputePoolCpuUsageDetail that = (ComputePoolCpuUsageDetail) o;
if (!time.equals(that.time)) return false;
if (value != null ? !value.equals(that.value) : that.value != null)
return false;
if (virtualMachinesCpuUsage != null ? !virtualMachinesCpuUsage.equals(that.virtualMachinesCpuUsage) : that.virtualMachinesCpuUsage != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + time.hashCode();
result = 31 * result + (value != null ? value.hashCode() : 0);
result = 31 * result + (virtualMachinesCpuUsage != null ? virtualMachinesCpuUsage.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", time="+ time +", value="+value+", virtualMachinesCpuUsage="+ virtualMachinesCpuUsage;
}
}

View File

@ -1,127 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource.cpu;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
import javax.xml.bind.annotation.XmlElement;
import java.util.Date;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* <xs:complexType name="ComputePoolCpuUsageDetailSummaryEntry">
* @author Jason King
*
*/
public class ComputePoolCpuUsageDetailSummaryEntry {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
public Builder toBuilder() {
return new Builder().ComputePoolCpuUsageDetailSummaryEntry(this);
}
public static class Builder {
private Date time;
private ResourceCapacity value;
/**
* @see ComputePoolCpuUsageDetailSummaryEntry#getTime
*/
public Builder time(Date time) {
this.time = time;
return this;
}
/**
* @see ComputePoolCpuUsageDetailSummaryEntry#getValue
*/
public Builder value(ResourceCapacity value) {
this.value = value;
return this;
}
public ComputePoolCpuUsageDetailSummaryEntry build() {
return new ComputePoolCpuUsageDetailSummaryEntry(time,value);
}
public Builder ComputePoolCpuUsageDetailSummaryEntry(ComputePoolCpuUsageDetailSummaryEntry in) {
return time(in.getTime()).value(in.getValue());
}
}
@XmlElement(name = "Time", required = true)
private Date time;
@XmlElement(name = "Value", required = false)
private ResourceCapacity value;
private ComputePoolCpuUsageDetailSummaryEntry(Date time,@Nullable ResourceCapacity value) {
this.time = checkNotNull(time, "time");
this.value = value;
}
private ComputePoolCpuUsageDetailSummaryEntry() {
//For JAXB
}
public Date getTime() {
return time;
}
public ResourceCapacity getValue() {
return value;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ComputePoolCpuUsageDetailSummaryEntry that = (ComputePoolCpuUsageDetailSummaryEntry) o;
if (!time.equals(that.time)) return false;
if (value != null ? !value.equals(that.value) : that.value != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = time.hashCode();
result = 31 * result + (value != null ? value.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "[time="+ time +", value="+value+"]";
}
}

View File

@ -1,133 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource.cpu;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
import org.jclouds.tmrk.enterprisecloud.domain.resource.ComputeResourceSummary;
import javax.xml.bind.annotation.XmlElement;
/**
* <xs:complexType name="CpuComputeResourceSummary">
* @author Jason King
*/
public class CpuComputeResourceSummary extends ComputeResourceSummary {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromCpuComputeResourceSummary(this);
}
public static class Builder extends ComputeResourceSummary.Builder {
protected int count;
protected int poweredOnCount;
public Builder allocated(ResourceCapacity allocated) {
return Builder.class.cast(super.allocated(allocated));
}
public Builder consumed(ResourceCapacity consumed) {
return Builder.class.cast(super.consumed(consumed));
}
public Builder purchased(ResourceCapacity purchased) {
return Builder.class.cast(super.purchased(purchased));
}
public Builder utilization(int utilization) {
return Builder.class.cast(super.utilization(utilization));
}
public Builder count(int count) {
this.count = count;
return this;
}
public Builder poweredOnCount(int poweredOnCount) {
this.poweredOnCount = poweredOnCount;
return this;
}
public CpuComputeResourceSummary build() {
return new CpuComputeResourceSummary(allocated,consumed,purchased,utilization,count,poweredOnCount);
}
public Builder fromCpuComputeResourceSummary(CpuComputeResourceSummary in) {
return allocated(in.getAllocated()).consumed(in.getConsumed()).purchased(in.getPurchased()).utilization(in.getUtilization())
.count(in.getCount()).poweredOnCount(in.getPoweredOnCount());
}
}
@XmlElement(name = "Count", required = false)
private int count;
@XmlElement(name = "PoweredOnCount", required = false)
private int poweredOnCount;
private CpuComputeResourceSummary(@Nullable ResourceCapacity allocated, @Nullable ResourceCapacity consumed, @Nullable ResourceCapacity purchased, int utilization, int count, int poweredOnCount) {
super(allocated,consumed,purchased,utilization);
this.count = count;
this.poweredOnCount = poweredOnCount;
}
private CpuComputeResourceSummary() {
//For JAXB
}
public int getCount() {
return count;
}
public int getPoweredOnCount() {
return poweredOnCount;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
CpuComputeResourceSummary that = (CpuComputeResourceSummary) o;
if (count != that.count) return false;
if (poweredOnCount != that.poweredOnCount) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + count;
result = 31 * result + poweredOnCount;
return result;
}
@Override
public String string() {
return super.string()+", count="+count+", poweredOnCount="+poweredOnCount;
}
}

View File

@ -1,106 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource.cpu;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import java.util.Collections;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Wraps individual ComputePoolCpuUsageDetailSummaryEntry elements.
* <xs:complexType name="CpuUsageDetails">
* @author Jason King
*/
public class CpuUsageDetails {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromCpuUsageDetails(this);
}
public static class Builder {
private Set<ComputePoolCpuUsageDetailSummaryEntry> entries = Sets.newLinkedHashSet();
/**
* @see CpuUsageDetails#getEntries
*/
public Builder entries(Set<ComputePoolCpuUsageDetailSummaryEntry> entries) {
this.entries = Sets.newLinkedHashSet(checkNotNull(entries, "entries"));
return this;
}
public Builder addEntry(ComputePoolCpuUsageDetailSummaryEntry entry) {
entries.add(checkNotNull(entry,"entry"));
return this;
}
public CpuUsageDetails build() {
return new CpuUsageDetails(entries);
}
public Builder fromCpuUsageDetails(CpuUsageDetails in) {
return entries(in.getEntries());
}
}
private CpuUsageDetails() {
//For JAXB and builder use
}
private CpuUsageDetails(Set<ComputePoolCpuUsageDetailSummaryEntry> entries) {
this.entries = Sets.newLinkedHashSet(entries);
}
@XmlElement(name = "CpuUsageDetail", required=false)
private Set<ComputePoolCpuUsageDetailSummaryEntry> entries = Sets.newLinkedHashSet();
public Set<ComputePoolCpuUsageDetailSummaryEntry> getEntries() {
return Collections.unmodifiableSet(entries);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CpuUsageDetails tasks1 = (CpuUsageDetails) o;
if (!entries.equals(tasks1.entries)) return false;
return true;
}
@Override
public int hashCode() {
return entries.hashCode();
}
public String toString() {
return "["+ entries.toString()+"]";
}
}

View File

@ -1,199 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource.cpu;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseNamedResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
import javax.xml.bind.annotation.XmlElement;
import java.net.URI;
import java.util.Map;
/**
* <xs:complexType name="VirtualMachineCpuUsageDetail">
* @author Jason King
*
*/
public class VirtualMachineCpuUsageDetail extends BaseNamedResource<VirtualMachineCpuUsageDetail> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromVirtualMachineCpuUsageDetai(this);
}
public static class Builder extends BaseNamedResource.Builder<VirtualMachineCpuUsageDetail> {
private ResourceCapacity usage;
private int utilization;
private boolean deleted;
/**
* @see VirtualMachineCpuUsageDetail#getUsage
*/
public Builder usage(ResourceCapacity usage) {
this.usage = usage;
return this;
}
/**
* @see VirtualMachineCpuUsageDetail#getUtilization
*/
public Builder utilization(int utilization) {
this.utilization = utilization;
return this;
}
/**
* @see VirtualMachineCpuUsageDetail#isDeleted
*/
public Builder deleted(boolean deleted) {
this.deleted = deleted;
return this;
}
@Override
public VirtualMachineCpuUsageDetail build() {
return new VirtualMachineCpuUsageDetail(href, type, name, usage, utilization, deleted);
}
public Builder fromVirtualMachineCpuUsageDetai(VirtualMachineCpuUsageDetail in) {
return fromNamedResource(in).usage(in.getUsage());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<VirtualMachineCpuUsageDetail> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromNamedResource(BaseNamedResource<VirtualMachineCpuUsageDetail> in) {
return Builder.class.cast(super.fromNamedResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "Usage", required = false)
private ResourceCapacity usage;
@XmlElement(name = "Utilization", required = true)
private int utilization;
@XmlElement(name = "Deleted", required = false)
private boolean deleted;
private VirtualMachineCpuUsageDetail(URI href, String type, String name,
@Nullable ResourceCapacity usage, int utilization, boolean deleted) {
super(href, type, name);
this.usage = usage;
this.utilization = utilization;
this.deleted = deleted;
}
private VirtualMachineCpuUsageDetail() {
//For JAXB
}
public ResourceCapacity getUsage() {
return usage;
}
public int getUtilization() {
return utilization;
}
public boolean isDeleted() {
return deleted;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
VirtualMachineCpuUsageDetail that = (VirtualMachineCpuUsageDetail) o;
if (deleted != that.deleted) return false;
if (utilization != that.utilization) return false;
if (usage != null ? !usage.equals(that.usage) : that.usage != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (usage != null ? usage.hashCode() : 0);
result = 31 * result + utilization;
result = 31 * result + (deleted ? 1 : 0);
return result;
}
@Override
public String string() {
return super.string()+", usage="+usage+", utilization="+utilization+", deleted="+deleted;
}
}

View File

@ -1,107 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource.cpu;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import java.util.Collections;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Wraps individual VirtualMachineCpuUsageDetail elements.
* <xs:complexType name="CpuUsage_VirtualMachines">
* @author Jason King
*/
public class VirtualMachinesCpuUsage {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromCpuUsageDetails(this);
}
public static class Builder {
private Set<VirtualMachineCpuUsageDetail> virtualMachinesCpuUsageDetail = Sets.newLinkedHashSet();
/**
* @see VirtualMachinesCpuUsage#getVirtualMachinesCpuUsageDetail
*/
public Builder vmCpuUsageDetails(Set<VirtualMachineCpuUsageDetail> vmCpuUsageDetails) {
this.virtualMachinesCpuUsageDetail = Sets.newLinkedHashSet(checkNotNull(vmCpuUsageDetails, "vmCpuUsageDetails"));
return this;
}
public Builder addVmCpuUsageDetail(VirtualMachineCpuUsageDetail vmCpuUsageDetail) {
virtualMachinesCpuUsageDetail.add(checkNotNull(vmCpuUsageDetail,"vmCpuUsageDetail"));
return this;
}
public VirtualMachinesCpuUsage build() {
return new VirtualMachinesCpuUsage(virtualMachinesCpuUsageDetail);
}
public Builder fromCpuUsageDetails(VirtualMachinesCpuUsage in) {
return vmCpuUsageDetails(in.getVirtualMachinesCpuUsageDetail());
}
}
private VirtualMachinesCpuUsage() {
//For JAXB and builder use
}
private VirtualMachinesCpuUsage(Set<VirtualMachineCpuUsageDetail> virtualMachinesCpuUsageDetail) {
this.virtualMachinesCpuUsageDetail = Sets.newLinkedHashSet(virtualMachinesCpuUsageDetail);
}
@XmlElement(name = "VirtualMachine", required=false)
private Set<VirtualMachineCpuUsageDetail> virtualMachinesCpuUsageDetail = Sets.newLinkedHashSet();
public Set<VirtualMachineCpuUsageDetail> getVirtualMachinesCpuUsageDetail() {
return Collections.unmodifiableSet(virtualMachinesCpuUsageDetail);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
VirtualMachinesCpuUsage that = (VirtualMachinesCpuUsage) o;
if (virtualMachinesCpuUsageDetail != null ? !virtualMachinesCpuUsageDetail.equals(that.virtualMachinesCpuUsageDetail) : that.virtualMachinesCpuUsageDetail != null)
return false;
return true;
}
@Override
public int hashCode() {
return virtualMachinesCpuUsageDetail != null ? virtualMachinesCpuUsageDetail.hashCode() : 0;
}
public String toString() {
return "["+ virtualMachinesCpuUsageDetail.toString()+"]";
}
}

View File

@ -1,223 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource.memory;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* ComputePoolMemoryUsage is more than a simple wrapper as it extends Resource.
* <xs:complexType name="ComputePoolMemoryUsage">
* @author Jason King
*
*/
@XmlRootElement(name = "ComputePoolMemoryUsage")
public class ComputePoolMemoryUsage extends Resource<ComputePoolMemoryUsage> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromComputePoolCpuUsage(this);
}
public static class Builder extends Resource.Builder<ComputePoolMemoryUsage> {
private Date startTime;
private Date endTime;
private MemoryUsageDetails details;
/**
* @see ComputePoolMemoryUsage#getStartTime
*/
public Builder startTime(Date startTime) {
this.startTime =(checkNotNull(startTime,"startTime"));
return this;
}
/**
* @see ComputePoolMemoryUsage#getEndTime
*/
public Builder endTime(Date endTime) {
this.endTime =(checkNotNull(endTime,"endTime"));
return this;
}
/**
* @see ComputePoolMemoryUsage#getDetails
*/
public Builder details(MemoryUsageDetails details) {
this.details =(checkNotNull(details,"details"));
return this;
}
@Override
public ComputePoolMemoryUsage build() {
return new ComputePoolMemoryUsage(href, type, name, links, actions, startTime, endTime, details);
}
public Builder fromComputePoolCpuUsage(ComputePoolMemoryUsage in) {
return fromResource(in).startTime(in.getStartTime()).endTime(in.getEndTime()).details(in.getDetails());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<ComputePoolMemoryUsage> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<ComputePoolMemoryUsage> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "StartTime", required = true)
private Date startTime;
@XmlElement(name = "EndTime", required = true)
private Date endTime;
@XmlElement(name = "MemoryUsageDetailSummary", required = false)
private MemoryUsageDetails details;
private ComputePoolMemoryUsage(URI href, String type, String name, Set<Link> links, Set<Action> actions, Date startTime, Date endTime, @Nullable MemoryUsageDetails details) {
super(href, type, name, links, actions);
this.startTime = checkNotNull(startTime, "startTime");
this.endTime = checkNotNull(endTime, "endTime");
this.details = details;
}
private ComputePoolMemoryUsage() {
//For JAXB
}
public Date getStartTime() {
return startTime;
}
public Date getEndTime() {
return endTime;
}
public MemoryUsageDetails getDetails() {
return details;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
ComputePoolMemoryUsage that = (ComputePoolMemoryUsage) o;
if (details != null ? !details.equals(that.details) : that.details != null)
return false;
if (!endTime.equals(that.endTime)) return false;
if (!startTime.equals(that.startTime)) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + startTime.hashCode();
result = 31 * result + endTime.hashCode();
result = 31 * result + (details != null ? details.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", startTime="+startTime+", endTime="+endTime+", details="+details;
}
}

View File

@ -1,225 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource.memory;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* ComputePoolMemoryUsageDetail is more than a simple wrapper as it extends Resource.
* <xs:complexType name="ComputePoolMemoryUsageDetail">
* @author Jason King
*
*/
@XmlRootElement(name = "ComputePoolMemoryUsageDetail")
public class ComputePoolMemoryUsageDetail extends Resource<ComputePoolMemoryUsageDetail> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromComputePoolMemoryUsage(this);
}
public static class Builder extends Resource.Builder<ComputePoolMemoryUsageDetail> {
private Date time;
private ResourceCapacity value;
private VirtualMachinesMemoryUsage virtualMachinesMemoryUsage;
/**
* @see ComputePoolMemoryUsageDetail#getTime
*/
public Builder time(Date time) {
this.time =(checkNotNull(time,"time"));
return this;
}
/**
* @see ComputePoolMemoryUsageDetail#getValue
*/
public Builder value(ResourceCapacity value) {
this.value =(checkNotNull(value,"value"));
return this;
}
/**
* @see ComputePoolMemoryUsageDetail#getVirtualMachinesMemoryUsage
*/
public Builder virtualMachines(VirtualMachinesMemoryUsage virtualMachinesMemoryUsage) {
this.virtualMachinesMemoryUsage =(checkNotNull(virtualMachinesMemoryUsage,"virtualMachinesMemoryUsage"));
return this;
}
@Override
public ComputePoolMemoryUsageDetail build() {
return new ComputePoolMemoryUsageDetail(href, type, name, links, actions, time, value, virtualMachinesMemoryUsage);
}
public Builder fromComputePoolMemoryUsage(ComputePoolMemoryUsageDetail in) {
return fromResource(in).time(in.getTime()).value(in.getValue()).virtualMachines(in.getVirtualMachinesMemoryUsage());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<ComputePoolMemoryUsageDetail> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<ComputePoolMemoryUsageDetail> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "Time", required = true)
private Date time;
@XmlElement(name = "Value", required = false)
private ResourceCapacity value;
@XmlElement(name = "VirtualMachines", required = false)
private VirtualMachinesMemoryUsage virtualMachinesMemoryUsage;
private ComputePoolMemoryUsageDetail(URI href, String type, String name, Set<Link> links, Set<Action> actions, Date time, @Nullable ResourceCapacity value, @Nullable VirtualMachinesMemoryUsage virtualMachinesMemoryUsage) {
super(href, type, name, links, actions);
this.time = checkNotNull(time, "time");
this.value = value;
this.virtualMachinesMemoryUsage = virtualMachinesMemoryUsage;
}
private ComputePoolMemoryUsageDetail() {
//For JAXB
}
public Date getTime() {
return time;
}
public ResourceCapacity getValue() {
return value;
}
public VirtualMachinesMemoryUsage getVirtualMachinesMemoryUsage() {
return virtualMachinesMemoryUsage;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
ComputePoolMemoryUsageDetail that = (ComputePoolMemoryUsageDetail) o;
if (!time.equals(that.time)) return false;
if (value != null ? !value.equals(that.value) : that.value != null)
return false;
if (virtualMachinesMemoryUsage != null ? !virtualMachinesMemoryUsage.equals(that.virtualMachinesMemoryUsage) : that.virtualMachinesMemoryUsage != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + time.hashCode();
result = 31 * result + (value != null ? value.hashCode() : 0);
result = 31 * result + (virtualMachinesMemoryUsage != null ? virtualMachinesMemoryUsage.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", time="+ time +", value="+value+", virtualMachinesMemoryUsage="+ virtualMachinesMemoryUsage;
}
}

View File

@ -1,127 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource.memory;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
import javax.xml.bind.annotation.XmlElement;
import java.util.Date;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* <xs:complexType name="ComputePoolMemoryUsageDetailSummaryEntry">
* @author Jason King
*
*/
public class ComputePoolMemoryUsageDetailSummaryEntry {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
public Builder toBuilder() {
return new Builder().ComputePoolCpuUsageDetailSummaryEntry(this);
}
public static class Builder {
private Date time;
private ResourceCapacity value;
/**
* @see ComputePoolMemoryUsageDetailSummaryEntry#getTime
*/
public Builder time(Date time) {
this.time = time;
return this;
}
/**
* @see ComputePoolMemoryUsageDetailSummaryEntry#getValue
*/
public Builder value(ResourceCapacity value) {
this.value = value;
return this;
}
public ComputePoolMemoryUsageDetailSummaryEntry build() {
return new ComputePoolMemoryUsageDetailSummaryEntry(time,value);
}
public Builder ComputePoolCpuUsageDetailSummaryEntry(ComputePoolMemoryUsageDetailSummaryEntry in) {
return time(in.getTime()).value(in.getValue());
}
}
@XmlElement(name = "Time", required = true)
private Date time;
@XmlElement(name = "Value", required = false)
private ResourceCapacity value;
private ComputePoolMemoryUsageDetailSummaryEntry(Date time, @Nullable ResourceCapacity value) {
this.time = checkNotNull(time, "time");
this.value = value;
}
private ComputePoolMemoryUsageDetailSummaryEntry() {
//For JAXB
}
public Date getTime() {
return time;
}
public ResourceCapacity getValue() {
return value;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ComputePoolMemoryUsageDetailSummaryEntry that = (ComputePoolMemoryUsageDetailSummaryEntry) o;
if (!time.equals(that.time)) return false;
if (value != null ? !value.equals(that.value) : that.value != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = time.hashCode();
result = 31 * result + (value != null ? value.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "[time="+ time +", value="+value+"]";
}
}

View File

@ -1,106 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource.memory;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import java.util.Collections;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Wraps individual ComputePoolMemoryUsageDetailSummaryEntry elements.
* <xs:complexType name="MemoryUsageDetails">
* @author Jason King
*/
public class MemoryUsageDetails {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromMemoryUsageDetails(this);
}
public static class Builder {
private Set<ComputePoolMemoryUsageDetailSummaryEntry> entries = Sets.newLinkedHashSet();
/**
* @see MemoryUsageDetails#getEntries
*/
public Builder entries(Set<ComputePoolMemoryUsageDetailSummaryEntry> entries) {
this.entries = Sets.newLinkedHashSet(checkNotNull(entries, "entries"));
return this;
}
public Builder addEntry(ComputePoolMemoryUsageDetailSummaryEntry entry) {
entries.add(checkNotNull(entry,"entry"));
return this;
}
public MemoryUsageDetails build() {
return new MemoryUsageDetails(entries);
}
public Builder fromMemoryUsageDetails(MemoryUsageDetails in) {
return entries(in.getEntries());
}
}
private MemoryUsageDetails() {
//For JAXB and builder use
}
private MemoryUsageDetails(Set<ComputePoolMemoryUsageDetailSummaryEntry> entries) {
this.entries = Sets.newLinkedHashSet(entries);
}
@XmlElement(name = "MemoryUsageDetail", required=false)
private Set<ComputePoolMemoryUsageDetailSummaryEntry> entries = Sets.newLinkedHashSet();
public Set<ComputePoolMemoryUsageDetailSummaryEntry> getEntries() {
return Collections.unmodifiableSet(entries);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MemoryUsageDetails tasks1 = (MemoryUsageDetails) o;
if (!entries.equals(tasks1.entries)) return false;
return true;
}
@Override
public int hashCode() {
return entries.hashCode();
}
public String toString() {
return "["+ entries.toString()+"]";
}
}

View File

@ -1,199 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource.memory;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseNamedResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
import javax.xml.bind.annotation.XmlElement;
import java.net.URI;
import java.util.Map;
/**
* <xs:complexType name="VirtualMachineMemoryUsageDetail">
* @author Jason King
*
*/
public class VirtualMachineMemoryUsageDetail extends BaseNamedResource<VirtualMachineMemoryUsageDetail> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromVirtualMachineMemoryUsageDetail(this);
}
public static class Builder extends BaseNamedResource.Builder<VirtualMachineMemoryUsageDetail> {
private ResourceCapacity usage;
private int utilization;
private boolean deleted;
/**
* @see VirtualMachineMemoryUsageDetail#getUsage
*/
public Builder usage(ResourceCapacity usage) {
this.usage = usage;
return this;
}
/**
* @see VirtualMachineMemoryUsageDetail#getUtilization
*/
public Builder utilization(int utilization) {
this.utilization = utilization;
return this;
}
/**
* @see VirtualMachineMemoryUsageDetail#isDeleted
*/
public Builder deleted(boolean deleted) {
this.deleted = deleted;
return this;
}
@Override
public VirtualMachineMemoryUsageDetail build() {
return new VirtualMachineMemoryUsageDetail(href, type, name, usage, utilization, deleted);
}
public Builder fromVirtualMachineMemoryUsageDetail(VirtualMachineMemoryUsageDetail in) {
return fromNamedResource(in).usage(in.getUsage());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<VirtualMachineMemoryUsageDetail> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromNamedResource(BaseNamedResource<VirtualMachineMemoryUsageDetail> in) {
return Builder.class.cast(super.fromNamedResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "Usage", required = false)
private ResourceCapacity usage;
@XmlElement(name = "Utilization", required = true)
private int utilization;
@XmlElement(name = "Deleted", required = false)
private boolean deleted;
private VirtualMachineMemoryUsageDetail(URI href, String type, String name,
@Nullable ResourceCapacity usage, int utilization, boolean deleted) {
super(href, type, name);
this.usage = usage;
this.utilization = utilization;
this.deleted = deleted;
}
private VirtualMachineMemoryUsageDetail() {
//For JAXB
}
public ResourceCapacity getUsage() {
return usage;
}
public int getUtilization() {
return utilization;
}
public boolean isDeleted() {
return deleted;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
VirtualMachineMemoryUsageDetail that = (VirtualMachineMemoryUsageDetail) o;
if (deleted != that.deleted) return false;
if (utilization != that.utilization) return false;
if (usage != null ? !usage.equals(that.usage) : that.usage != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (usage != null ? usage.hashCode() : 0);
result = 31 * result + utilization;
result = 31 * result + (deleted ? 1 : 0);
return result;
}
@Override
public String string() {
return super.string()+", usage="+usage+", utilization="+utilization+", deleted="+deleted;
}
}

View File

@ -1,107 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource.memory;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import java.util.Collections;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Wraps individual VirtualMachineMemoryUsageDetail elements.
* <xs:complexType name="MemoryUsage_VirtualMachines">
* @author Jason King
*/
public class VirtualMachinesMemoryUsage {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromMemoryUsageDetails(this);
}
public static class Builder {
private Set<VirtualMachineMemoryUsageDetail> virtualMachinesMemoryUsageDetail = Sets.newLinkedHashSet();
/**
* @see VirtualMachinesMemoryUsage#getVirtualMachinesMemoryUsageDetail
*/
public Builder vmMemoryUsageDetails(Set<VirtualMachineMemoryUsageDetail> vmMemoryUsageDetails) {
this.virtualMachinesMemoryUsageDetail = Sets.newLinkedHashSet(checkNotNull(vmMemoryUsageDetails, "vmMemoryUsageDetails"));
return this;
}
public Builder addVmMemoryUsageDetail(VirtualMachineMemoryUsageDetail vmMemoryUsageDetail) {
virtualMachinesMemoryUsageDetail.add(checkNotNull(vmMemoryUsageDetail,"vmMemoryUsageDetail"));
return this;
}
public VirtualMachinesMemoryUsage build() {
return new VirtualMachinesMemoryUsage(virtualMachinesMemoryUsageDetail);
}
public Builder fromMemoryUsageDetails(VirtualMachinesMemoryUsage in) {
return vmMemoryUsageDetails(in.getVirtualMachinesMemoryUsageDetail());
}
}
private VirtualMachinesMemoryUsage() {
//For JAXB and builder use
}
private VirtualMachinesMemoryUsage(Set<VirtualMachineMemoryUsageDetail> virtualMachinesMemoryUsageDetail) {
this.virtualMachinesMemoryUsageDetail = Sets.newLinkedHashSet(virtualMachinesMemoryUsageDetail);
}
@XmlElement(name = "VirtualMachine", required=false)
private Set<VirtualMachineMemoryUsageDetail> virtualMachinesMemoryUsageDetail = Sets.newLinkedHashSet();
public Set<VirtualMachineMemoryUsageDetail> getVirtualMachinesMemoryUsageDetail() {
return Collections.unmodifiableSet(virtualMachinesMemoryUsageDetail);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
VirtualMachinesMemoryUsage that = (VirtualMachinesMemoryUsage) o;
if (virtualMachinesMemoryUsageDetail != null ? !virtualMachinesMemoryUsageDetail.equals(that.virtualMachinesMemoryUsageDetail) : that.virtualMachinesMemoryUsageDetail != null)
return false;
return true;
}
@Override
public int hashCode() {
return virtualMachinesMemoryUsageDetail != null ? virtualMachinesMemoryUsageDetail.hashCode() : 0;
}
public String toString() {
return "["+ virtualMachinesMemoryUsageDetail.toString()+"]";
}
}

View File

@ -1,183 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource.storage;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* ComputePoolStorageUsageDetail is more than a simple wrapper as it extends Resource.
* <xs:complexType name="ComputePoolStorageUsageDetail">
* @author Jason King
*
*/
@XmlRootElement(name = "ComputePoolStorageUsageDetail")
public class ComputePoolStorageUsageDetail extends Resource<ComputePoolStorageUsageDetail> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromComputePoolStorageUsageDetail(this);
}
public static class Builder extends Resource.Builder<ComputePoolStorageUsageDetail> {
private ResourceCapacity allocated;
private VirtualMachinesStorageDetails virtualMachinesStorageDetails;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.storage.ComputePoolStorageUsageDetail#getAllocated
*/
public Builder allocated(ResourceCapacity allocated) {
this.allocated =(checkNotNull(allocated,"allocated"));
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.storage.ComputePoolStorageUsageDetail#getVirtualMachinesStorageDetails
*/
public Builder virtualMachines(VirtualMachinesStorageDetails virtualMachinesStorageDetails) {
this.virtualMachinesStorageDetails =(checkNotNull(virtualMachinesStorageDetails,"virtualMachinesStorageDetails"));
return this;
}
@Override
public ComputePoolStorageUsageDetail build() {
return new ComputePoolStorageUsageDetail(href, type, name, links, actions, allocated, virtualMachinesStorageDetails);
}
public Builder fromComputePoolStorageUsageDetail(ComputePoolStorageUsageDetail in) {
return fromResource(in).allocated(in.getAllocated()).virtualMachines(in.getVirtualMachinesStorageDetails());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<ComputePoolStorageUsageDetail> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<ComputePoolStorageUsageDetail> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "Allocated", required = false)
private ResourceCapacity allocated;
@XmlElement(name = "VirtualMachines", required = false)
private VirtualMachinesStorageDetails virtualMachinesStorageDetails;
private ComputePoolStorageUsageDetail(URI href, String type, String name, Set<Link> links, Set<Action> actions, @Nullable ResourceCapacity allocated, @Nullable VirtualMachinesStorageDetails virtualMachinesStorageDetails) {
super(href, type, name, links, actions);
this.allocated = allocated;
this.virtualMachinesStorageDetails = virtualMachinesStorageDetails;
}
private ComputePoolStorageUsageDetail() {
//For JAXB
}
public ResourceCapacity getAllocated() {
return allocated;
}
public VirtualMachinesStorageDetails getVirtualMachinesStorageDetails() {
return virtualMachinesStorageDetails;
}
@Override
public String string() {
return super.string()+", allocated="+ allocated +", virtualMachinesStorageDetails="+ virtualMachinesStorageDetails;
}
}

View File

@ -1,204 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource.storage;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* VirtualMachineStorageUsageDetail is more than a simple wrapper as it extends Resource.
* <xs:complexType name="VirtualMachineStorageUsageDetail">
* @author Jason King
*
*/
@XmlRootElement(name = "VirtualMachineStorageUsageDetail")
public class VirtualMachineStorageUsageDetail extends Resource<VirtualMachineStorageUsageDetail> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromVirtualMachineStorageUsageDetail(this);
}
public static class Builder extends Resource.Builder<VirtualMachineStorageUsageDetail> {
private int diskCount;
private ResourceCapacity allocated;
/**
* @see VirtualMachineStorageUsageDetail#getDiskCount
*/
public Builder diskCount(int diskCount) {
this.diskCount =(checkNotNull(diskCount,"diskCount"));
return this;
}
/**
* @see VirtualMachineStorageUsageDetail#getAllocated
*/
public Builder allocated(ResourceCapacity allocated) {
this.allocated =(checkNotNull(allocated,"allocated"));
return this;
}
@Override
public VirtualMachineStorageUsageDetail build() {
return new VirtualMachineStorageUsageDetail(href, type, name, links, actions, diskCount, allocated);
}
public Builder fromVirtualMachineStorageUsageDetail(VirtualMachineStorageUsageDetail in) {
return fromResource(in).diskCount(in.getDiskCount()).allocated(in.getAllocated());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<VirtualMachineStorageUsageDetail> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<VirtualMachineStorageUsageDetail> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "DiskCount", required = true)
private int diskCount;
@XmlElement(name = "Allocated", required = false)
private ResourceCapacity allocated;
private VirtualMachineStorageUsageDetail(URI href, String type, String name, Set<Link> links, Set<Action> actions, int diskCount, @Nullable ResourceCapacity allocated) {
super(href, type, name, links, actions);
this.diskCount = diskCount;
this.allocated = allocated;
}
private VirtualMachineStorageUsageDetail() {
//For JAXB
}
public int getDiskCount() {
return diskCount;
}
public ResourceCapacity getAllocated() {
return allocated;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
VirtualMachineStorageUsageDetail that = (VirtualMachineStorageUsageDetail) o;
if (diskCount != that.diskCount) return false;
if (allocated != null ? !allocated.equals(that.allocated) : that.allocated != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + diskCount;
result = 31 * result + (allocated != null ? allocated.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", diskCount="+ diskCount +", allocated="+ allocated;
}
}

View File

@ -1,107 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.resource.storage;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import java.util.Collections;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Wraps individual VirtualMachineStorageUsageDetail elements.
* <xs:complexType name="StorageDetails_VirtualMachines">
* @author Jason King
*/
public class VirtualMachinesStorageDetails {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromStorageUsageDetails(this);
}
public static class Builder {
private Set<VirtualMachineStorageUsageDetail> virtualMachinesStorageUsageDetail = Sets.newLinkedHashSet();
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.resource.storage.VirtualMachinesStorageDetails#getVirtualMachinesStorageUsageDetail
*/
public Builder vmStorageUsageDetails(Set<VirtualMachineStorageUsageDetail> vmStorageUsageDetails) {
this.virtualMachinesStorageUsageDetail = Sets.newLinkedHashSet(checkNotNull(vmStorageUsageDetails, "vmStorageUsageDetails"));
return this;
}
public Builder addVmStorageUsageDetail(VirtualMachineStorageUsageDetail vmStorageUsageDetails) {
virtualMachinesStorageUsageDetail.add(checkNotNull(vmStorageUsageDetails,"vmStorageUsageDetails"));
return this;
}
public VirtualMachinesStorageDetails build() {
return new VirtualMachinesStorageDetails(virtualMachinesStorageUsageDetail);
}
public Builder fromStorageUsageDetails(VirtualMachinesStorageDetails in) {
return vmStorageUsageDetails(in.getVirtualMachinesStorageUsageDetail());
}
}
private VirtualMachinesStorageDetails() {
//For JAXB and builder use
}
private VirtualMachinesStorageDetails(Set<VirtualMachineStorageUsageDetail> virtualMachinesStorageUsageDetail) {
this.virtualMachinesStorageUsageDetail = Sets.newLinkedHashSet(virtualMachinesStorageUsageDetail);
}
@XmlElement(name = "VirtualMachine", required=false)
private Set<VirtualMachineStorageUsageDetail> virtualMachinesStorageUsageDetail = Sets.newLinkedHashSet();
public Set<VirtualMachineStorageUsageDetail> getVirtualMachinesStorageUsageDetail() {
return Collections.unmodifiableSet(virtualMachinesStorageUsageDetail);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
VirtualMachinesStorageDetails that = (VirtualMachinesStorageDetails) o;
if (virtualMachinesStorageUsageDetail != null ? !virtualMachinesStorageUsageDetail.equals(that.virtualMachinesStorageUsageDetail) : that.virtualMachinesStorageUsageDetail != null)
return false;
return true;
}
@Override
public int hashCode() {
return virtualMachinesStorageUsageDetail != null ? virtualMachinesStorageUsageDetail.hashCode() : 0;
}
public String toString() {
return "["+ virtualMachinesStorageUsageDetail.toString()+"]";
}
}

View File

@ -1,56 +0,0 @@
package org.jclouds.tmrk.enterprisecloud.domain.service;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
@XmlEnum
public enum Protocol {
/**
* HyperText Transfer Protocol
*/
@XmlEnumValue("HTTP")
HTTP,
/**
* HyperText Transfer Protocol Secure
*/
@XmlEnumValue("HTTPS")
HTTPS,
/**
* Transmission Control Protocol
*/
@XmlEnumValue("TCP")
TCP,
/**
* User Datagram Protocol
*/
@XmlEnumValue("UDP")
UDP,
/**
* Internet Protocol security
*/
@XmlEnumValue("IPSEC")
IPSEC,
/**
* File Transfer Protocol
*/
@XmlEnumValue("FTP")
FTP,
@XmlEnumValue("Any")
Any;
@Override
public String toString() {
return name();
}
public String value() {
return name();
}
}

View File

@ -1,419 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.service.internet;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.NamedResource;
import org.jclouds.tmrk.enterprisecloud.domain.Task;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Entity;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import org.jclouds.tmrk.enterprisecloud.domain.service.Protocol;
import org.jclouds.tmrk.enterprisecloud.domain.service.node.NodeServices;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Map;
import java.util.Set;
/**
* <xs:complexType name="InternetServiceType">
* @author Jason King
*/
@XmlRootElement(name="InternetService")
public class InternetService extends Entity<InternetService> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromSshKey(this);
}
public static class Builder extends Entity.Builder<InternetService> {
private Protocol protocol;
private int port;
private boolean enabled;
private String description;
private NamedResource publicIp;
private InternetServicePersistenceType persistence;
private String redirectUrl;
private NamedResource monitor;
private NamedResource trustedNetworkGroup;
private NamedResource backupInternetService;
private NodeServices nodeServices;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.service.internet.InternetService#getProtocol
*/
public Builder protocol(Protocol protocol) {
this.protocol = protocol;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.service.internet.InternetService#getPort
*/
public Builder port(int port) {
this.port = port;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.service.internet.InternetService#isEnabled
*/
public Builder enabled(boolean enabled) {
this.enabled = enabled;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.service.internet.InternetService#getDescription
*/
public Builder description(String description) {
this.description = description;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.service.internet.InternetService#getPersistence
*/
public Builder persistence(InternetServicePersistenceType persistence) {
this.persistence = persistence;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.service.internet.InternetService#getPublicIp
*/
public Builder publicIp(NamedResource publicIp) {
this.publicIp = publicIp;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.service.internet.InternetService#getRedirectUrl
*/
public Builder redirectUrl(String redirectUrl) {
this.redirectUrl = redirectUrl;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.service.internet.InternetService#getMonitor
*/
public Builder monitor(NamedResource monitor) {
this.monitor = monitor;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.service.internet.InternetService#getTrustedNetworkGroup
*/
public Builder trustedNetworkGroup(NamedResource trustedNetworkGroup) {
this.trustedNetworkGroup = trustedNetworkGroup;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.service.internet.InternetService#getBackupInternetService
*/
public Builder backupInternetService(NamedResource backupInternetService) {
this.backupInternetService = backupInternetService;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.service.internet.InternetService#getNodeServices
*/
public Builder nodeServices(NodeServices nodeServices) {
this.nodeServices = nodeServices;
return this;
}
@Override
public InternetService build() {
return new InternetService(href, type, name, links, actions, tasks,
protocol, port, enabled, description,publicIp,persistence,
redirectUrl, monitor, trustedNetworkGroup, backupInternetService, nodeServices);
}
public Builder fromSshKey(InternetService in) {
return fromEntity(in).protocol(in.getProtocol())
.port(in.getPort())
.enabled(in.isEnabled())
.description(in.getDescription())
.publicIp(in.getPublicIp())
.persistence(in.getPersistence())
.redirectUrl(in.getRedirectUrl())
.monitor(in.getMonitor())
.trustedNetworkGroup(in.getTrustedNetworkGroup())
.backupInternetService(in.getBackupInternetService())
.nodeServices(in.getNodeServices());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<InternetService> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<InternetService> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromEntity(Entity<InternetService> in) {
return Builder.class.cast(super.fromEntity(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder tasks(Set<Task> tasks) {
return Builder.class.cast(super.tasks(tasks));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "Protocol", required = false)
private Protocol protocol;
@XmlElement(name = "Port", required = false)
private int port;
@XmlElement(name = "Enabled", required = true)
private boolean enabled;
@XmlElement(name = "PrivateKey", required = false)
private String description;
@XmlElement(name = "PublicIp", required = false)
private NamedResource publicIp;
@XmlElement(name = "Persistence", required = false)
private InternetServicePersistenceType persistence;
@XmlElement(name = "RedirectUrl", required = false)
private String redirectUrl;
@XmlElement(name = "Monitor", required = false)
private NamedResource monitor;
@XmlElement(name = "TrustedNetworkGroup", required = false)
private NamedResource trustedNetworkGroup;
@XmlElement(name = "BackupInternetService", required = false)
private NamedResource backupInternetService;
@XmlElement(name = "NodeServices", required = false)
private NodeServices nodeServices;
private InternetService(URI href, String type, String name, Set<Link> links, Set<Action> actions, Set<Task> tasks,
@Nullable Protocol protocol, int port, boolean enabled, @Nullable String description,
@Nullable NamedResource publicIp, @Nullable InternetServicePersistenceType persistence, @Nullable String redirectUrl, @Nullable NamedResource monitor,
@Nullable NamedResource trustedNetworkGroup, @Nullable NamedResource backupInternetService, @Nullable NodeServices nodeServices) {
super(href, type, name, links, actions, tasks);
this.protocol = protocol;
this.port = port;
this.enabled = enabled;
this.description = description;
this.publicIp = publicIp;
this.persistence = persistence;
this.redirectUrl = redirectUrl;
this.monitor = monitor;
this.trustedNetworkGroup = trustedNetworkGroup;
this.backupInternetService = backupInternetService;
this.nodeServices = nodeServices;
}
private InternetService() {
//For JAXB
}
public Protocol getProtocol() {
return protocol;
}
public int getPort() {
return port;
}
public boolean isEnabled() {
return enabled;
}
public String getDescription() {
return description;
}
public NamedResource getPublicIp() {
return publicIp;
}
public InternetServicePersistenceType getPersistence() {
return persistence;
}
public String getRedirectUrl() {
return redirectUrl;
}
public NamedResource getMonitor() {
return monitor;
}
public NamedResource getTrustedNetworkGroup() {
return trustedNetworkGroup;
}
public NamedResource getBackupInternetService() {
return backupInternetService;
}
public NodeServices getNodeServices() {
return nodeServices;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
InternetService that = (InternetService) o;
if (enabled != that.enabled) return false;
if (port != that.port) return false;
if (backupInternetService != null ? !backupInternetService.equals(that.backupInternetService) : that.backupInternetService != null)
return false;
if (description != null ? !description.equals(that.description) : that.description != null)
return false;
if (monitor != null ? !monitor.equals(that.monitor) : that.monitor != null)
return false;
if (nodeServices != null ? !nodeServices.equals(that.nodeServices) : that.nodeServices != null)
return false;
if (persistence != null ? !persistence.equals(that.persistence) : that.persistence != null)
return false;
if (protocol != that.protocol) return false;
if (publicIp != null ? !publicIp.equals(that.publicIp) : that.publicIp != null)
return false;
if (redirectUrl != null ? !redirectUrl.equals(that.redirectUrl) : that.redirectUrl != null)
return false;
if (trustedNetworkGroup != null ? !trustedNetworkGroup.equals(that.trustedNetworkGroup) : that.trustedNetworkGroup != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (protocol != null ? protocol.hashCode() : 0);
result = 31 * result + port;
result = 31 * result + (enabled ? 1 : 0);
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (publicIp != null ? publicIp.hashCode() : 0);
result = 31 * result + (persistence != null ? persistence.hashCode() : 0);
result = 31 * result + (redirectUrl != null ? redirectUrl.hashCode() : 0);
result = 31 * result + (monitor != null ? monitor.hashCode() : 0);
result = 31 * result + (trustedNetworkGroup != null ? trustedNetworkGroup.hashCode() : 0);
result = 31 * result + (backupInternetService != null ? backupInternetService.hashCode() : 0);
result = 31 * result + (nodeServices != null ? nodeServices.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+
", protocol="+protocol+", port="+port+", enabled="+enabled+", description="+description+
", publicIp="+publicIp+" persistence="+persistence+", redirectUrl="+redirectUrl+
", monitor="+monitor+", trustedNetworkGroup="+trustedNetworkGroup+
", backupInternetService="+backupInternetService+", nodeServices="+nodeServices;
}
}

View File

@ -1,135 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.service.internet;
import org.jclouds.javax.annotation.Nullable;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import static com.google.common.base.CaseFormat.*;
/**
* <xs:complexType name="InternetServiceType">
* @author Jason King
*/
public class InternetServicePersistenceType {
@XmlEnum
public static enum PersistenceType {
@XmlEnumValue("None")
NONE,
@XmlEnumValue("SourceIp")
SOURCE_IP;
public String value() {
String lower = UPPER_UNDERSCORE.to(LOWER_CAMEL,name());
return LOWER_CAMEL.to(UPPER_CAMEL,lower);
}
}
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromNodeServices(this);
}
public static class Builder {
private PersistenceType persistenceType;
private int timeout = -1;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.service.internet.InternetServicePersistenceType#getPersistenceType
*/
public Builder persistenceType(PersistenceType persistenceType) {
this.persistenceType = persistenceType;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.service.internet.InternetServicePersistenceType#getTimeout
*/
public Builder timeout(int timeout) {
this.timeout = timeout;
return this;
}
public InternetServicePersistenceType build() {
return new InternetServicePersistenceType(persistenceType,timeout);
}
public Builder fromNodeServices(InternetServicePersistenceType in) {
return persistenceType(in.getPersistenceType()).timeout(in.getTimeout());
}
}
private InternetServicePersistenceType() {
//For JAXB and builder use
}
private InternetServicePersistenceType(@Nullable PersistenceType persistenceType, int timeout ) {
this.persistenceType = persistenceType;
this.timeout = timeout;
}
@XmlElement(name = "Type")
private PersistenceType persistenceType;
@XmlElement(name = "Timeout")
private int timeout = -1;
public PersistenceType getPersistenceType() {
return persistenceType;
}
public int getTimeout() {
return timeout;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
InternetServicePersistenceType that = (InternetServicePersistenceType) o;
if (timeout != that.timeout) return false;
if (persistenceType != that.persistenceType) return false;
return true;
}
@Override
public int hashCode() {
int result = persistenceType != null ? persistenceType.hashCode() : 0;
result = 31 * result + timeout;
return result;
}
public String toString() {
return "[persistenceType="+persistenceType+", timeout="+timeout+"]";
}
}

View File

@ -1,281 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.service.node;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.Task;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Entity;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import org.jclouds.tmrk.enterprisecloud.domain.network.IpAddressReference;
import org.jclouds.tmrk.enterprisecloud.domain.service.Protocol;
import javax.xml.bind.annotation.XmlElement;
import java.net.URI;
import java.util.Map;
import java.util.Set;
/**
* <xs:complexType name="NodeServiceType">
* @author Jason King
*/
public class NodeService extends Entity<NodeService> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromSshKey(this);
}
public static class Builder extends Entity.Builder<NodeService> {
private IpAddressReference ipAddress;
private Protocol protocol;
private int port;
private boolean enabled;
private String description;
/**
* @see NodeService#getIpAddress
*/
public Builder ipAddress(IpAddressReference ipAddress) {
this.ipAddress = ipAddress;
return this;
}
/**
* @see NodeService#getProtocol
*/
public Builder protocol(Protocol protocol) {
this.protocol = protocol;
return this;
}
/**
* @see NodeService#getPort
*/
public Builder port(int port) {
this.port = port;
return this;
}
/**
* @see NodeService#isEnabled
*/
public Builder enabled(boolean enabled) {
this.enabled = enabled;
return this;
}
/**
* @see NodeService#getDescription
*/
public Builder description(String description) {
this.description = description;
return this;
}
@Override
public NodeService build() {
return new NodeService(href, type, name, links, actions, tasks, ipAddress, protocol, port, enabled, description);
}
public Builder fromSshKey(NodeService in) {
return fromEntity(in).ipAddress(in.getIpAddress())
.protocol(in.getProtocol())
.port(in.getPort())
.enabled(in.isEnabled())
.description(in.getDescription());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<NodeService> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<NodeService> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromEntity(Entity<NodeService> in) {
return Builder.class.cast(super.fromEntity(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder tasks(Set<Task> tasks) {
return Builder.class.cast(super.tasks(tasks));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "IpAddress", required = false)
private IpAddressReference ipAddress;
@XmlElement(name = "Protocol", required = false)
private Protocol protocol;
@XmlElement(name = "Port", required = false)
private int port;
@XmlElement(name = "Enabled", required = false)
private boolean enabled;
@XmlElement(name = "PrivateKey", required = false)
private String description;
private NodeService(URI href, String type, String name, Set<Link> links, Set<Action> actions, Set<Task> tasks,
@Nullable IpAddressReference ipAddress, @Nullable Protocol protocol, int port, boolean enabled, @Nullable String description) {
super(href, type, name, links, actions, tasks);
this.ipAddress = ipAddress;
this.protocol = protocol;
this.port = port;
this.enabled = enabled;
this.description = description;
}
private NodeService() {
//For JAXB
}
public IpAddressReference getIpAddress() {
return ipAddress;
}
public Protocol getProtocol() {
return protocol;
}
public int getPort() {
return port;
}
public boolean isEnabled() {
return enabled;
}
public String getDescription() {
return description;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
NodeService that = (NodeService) o;
if (enabled != that.enabled) return false;
if (port != that.port) return false;
if (description != null ? !description.equals(that.description) : that.description != null)
return false;
if (ipAddress != null ? !ipAddress.equals(that.ipAddress) : that.ipAddress != null)
return false;
if (protocol != that.protocol) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (ipAddress != null ? ipAddress.hashCode() : 0);
result = 31 * result + (protocol != null ? protocol.hashCode() : 0);
result = 31 * result + port;
result = 31 * result + (enabled ? 1 : 0);
result = 31 * result + (description != null ? description.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", ipAddress="+ipAddress+", protocol="+protocol+", port="+port+", enabled="+enabled+", description="+description;
}
}

View File

@ -1,104 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.service.node;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import java.util.Collections;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* @author Jason King
*/
public class NodeServices {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromNodeServices(this);
}
public static class Builder {
private Set<NodeService> services = Sets.newLinkedHashSet();
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.service.node.NodeServices#getNodeServices()
*/
public Builder services(Set<NodeService> services) {
this.services = Sets.newLinkedHashSet(checkNotNull(services, "services"));
return this;
}
public Builder addNodeService(NodeService service) {
services.add(checkNotNull(service, "service"));
return this;
}
public NodeServices build() {
return new NodeServices(services);
}
public Builder fromNodeServices(NodeServices in) {
return services(in.getNodeServices());
}
}
private NodeServices() {
//For JAXB and builder use
}
private NodeServices(Set<NodeService> services) {
this.services = Sets.newLinkedHashSet(services);
}
@XmlElement(name = "NodeService")
private Set<NodeService> services = Sets.newLinkedHashSet();
public Set<NodeService> getNodeServices() {
return Collections.unmodifiableSet(services);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
NodeServices that = (NodeServices) o;
if (!services.equals(that.services)) return false;
return true;
}
@Override
public int hashCode() {
return services.hashCode();
}
public String toString() {
return "["+ services.toString()+"]";
}
}

View File

@ -1,139 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.software;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import java.net.URI;
import java.util.Map;
import java.util.Set;
/**
* <xs:complexType name="OperatingSystem">
* @author Jason King
*
*/
public class OperatingSystem extends Resource<OperatingSystem> {
//TODO There are other fields
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromOperatingSystem(this);
}
public static class Builder extends Resource.Builder<OperatingSystem> {
/**
* {@inheritDoc}
*/
@Override
public OperatingSystem build() {
return new OperatingSystem(href, type, links, actions, name);
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<OperatingSystem> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<OperatingSystem> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
public Builder fromOperatingSystem(OperatingSystem in) {
return fromResource(in);
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> in) {
return Builder.class.cast(super.fromAttributes(in));
}
}
private OperatingSystem(URI href, String type, Set<Link> links, Set<Action> actions, String name) {
super(href, type, name, links, actions);
}
private OperatingSystem() {
//For JAXB
}
}

View File

@ -1,50 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.software;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import static com.google.common.base.CaseFormat.LOWER_CAMEL;
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
/**
* <xs:simpleType name="ToolsStatus">
* @author Jason King
*/
@XmlEnum
public enum ToolsStatus {
@XmlEnumValue("NotInstalled")
NOT_INSTALLED,
@XmlEnumValue("NotRunning")
NOT_RUNNING,
@XmlEnumValue("OutOfDate")
OUT_OF_DATE,
@XmlEnumValue("Current")
CURRENT;
public String value() {
return UPPER_UNDERSCORE.to(LOWER_CAMEL, name());
}
@Override
public String toString() {
return value();
}
}

View File

@ -1,315 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.template;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.*;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import org.jclouds.tmrk.enterprisecloud.domain.software.OperatingSystem;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Map;
import java.util.Set;
/**
* <xs:complexType name="Template">
* @author Jason King
*
*/
@XmlRootElement(name = "Template")
public class Template extends Resource<Template> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromTask(this);
}
public static class Builder extends Resource.Builder<Template> {
//TODO There are additional fields
protected OperatingSystem operatingSystem;
protected String description;
//protected ComputeMatrix computeMatrix;
protected ConfigurationOptionRange processor;
protected ResourceCapacityRange memory;
protected TemplateStorage storage;
protected int networkAdapters;
protected CustomizationOption customization;
//protected DeviceLicensedSoftware licensedSoftware;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.template.Template#getOperatingSystem
*/
public Builder operatingSystem(OperatingSystem operatingSystem) {
this.operatingSystem = operatingSystem;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.template.Template#getDescription
*/
public Builder description(String description) {
this.description = description;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.template.Template#getProcessor
*/
public Builder processor(ConfigurationOptionRange processor) {
this.processor = processor;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.template.Template#getMemory
*/
public Builder memory(ResourceCapacityRange memory) {
this.memory = memory;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.template.Template#getStorage
*/
public Builder storage(TemplateStorage storage) {
this.storage = storage;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.template.Template#getNetworkAdapters
*/
public Builder networkAdapters(int networkAdapters) {
this.networkAdapters = networkAdapters;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.template.Template#getCustomization
*/
public Builder customization(CustomizationOption customization) {
this.customization = customization;
return this;
}
@Override
public Template build() {
return new Template(href, type, links, actions, name, operatingSystem, description, processor, memory, storage, networkAdapters, customization);
}
public Builder fromTask(Template in) {
return fromResource(in).description(in.getDescription())
.operatingSystem(in.getOperatingSystem()).processor(in.getProcessor())
.memory(in.getMemory()).storage(in.getStorage()).networkAdapters(in.getNetworkAdapters())
.customization(in.getCustomization());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<Template> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<Template> in) {
return Builder.class.cast(super.fromResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.type(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder type(String type) {
return Builder.class.cast(super.type(type));
}
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/**
* {@inheritDoc}
*/
@Override
public Builder href(URI href) {
return Builder.class.cast(super.href(href));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "OperatingSystem", required = false)
protected OperatingSystem operatingSystem;
@XmlElement(name = "Description", required = false)
protected String description;
//protected ComputeMatrix computeMatrix;
@XmlElement(name = "Processor", required = false)
protected ConfigurationOptionRange processor;
@XmlElement(name = "Memory", required = false)
protected ResourceCapacityRange memory;
@XmlElement(name = "Storage", required = false)
protected TemplateStorage storage;
@XmlElement(name = "NetworkAdapters", required = false)
protected int networkAdapters;
@XmlElement(name = "Customization", required = false)
protected CustomizationOption customization;
//protected DeviceLicensedSoftware licensedSoftware;
private Template(URI href, String type, Set<Link> links, Set<Action> actions, String name, @Nullable OperatingSystem operatingSystem, @Nullable String description,
@Nullable ConfigurationOptionRange processor, @Nullable ResourceCapacityRange memory,
@Nullable TemplateStorage storage, @Nullable int networkAdapters, @Nullable CustomizationOption customization) {
super(href, type, name, links, actions);
this.operatingSystem = operatingSystem;
this.description = description;
this.processor = processor;
this.memory = memory;
this.storage = storage;
this.networkAdapters = networkAdapters;
this.customization = customization;
}
private Template() {
//For JAXB
}
public String getDescription() {
return description;
}
public ConfigurationOptionRange getProcessor() {
return processor;
}
public ResourceCapacityRange getMemory() {
return memory;
}
public TemplateStorage getStorage() {
return storage;
}
public int getNetworkAdapters() {
return networkAdapters;
}
public CustomizationOption getCustomization() {
return customization;
}
public OperatingSystem getOperatingSystem() {
return operatingSystem;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
Template template = (Template) o;
if (networkAdapters != template.networkAdapters) return false;
if (customization != null ? !customization.equals(template.customization) : template.customization != null)
return false;
if (description != null ? !description.equals(template.description) : template.description != null)
return false;
if (memory != null ? !memory.equals(template.memory) : template.memory != null)
return false;
if (operatingSystem != null ? !operatingSystem.equals(template.operatingSystem) : template.operatingSystem != null)
return false;
if (processor != null ? !processor.equals(template.processor) : template.processor != null)
return false;
if (storage != null ? !storage.equals(template.storage) : template.storage != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (operatingSystem != null ? operatingSystem.hashCode() : 0);
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (processor != null ? processor.hashCode() : 0);
result = 31 * result + (memory != null ? memory.hashCode() : 0);
result = 31 * result + (storage != null ? storage.hashCode() : 0);
result = 31 * result + networkAdapters;
result = 31 * result + (customization != null ? customization.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", operatingSystem="+ operatingSystem+
", description="+ description+", processor="+ processor+
", memory="+ memory+", storage="+ storage+
", networkAdapters="+ networkAdapters+", customization="+ customization;
}
}

View File

@ -1,108 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.tmrk.enterprisecloud.domain.template;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import java.util.Collections;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Wraps individual TemplateCategory elements.
* Needed because parsing is done with JAXB and it does not handle Generic collections
* <xs:complexType name="TemplateCategories">
* @author Jason King
*/
public class TemplateCategories {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromTemplateCategories(this);
}
public static class Builder {
private Set<TemplateCategory> categories = Sets.newLinkedHashSet();
/**
* @see TemplateCategories#getTemplateCategories()
*/
public Builder categories(Set<TemplateCategory> categories) {
this.categories = Sets.newLinkedHashSet(checkNotNull(categories, "categories"));
return this;
}
public Builder addCategory(TemplateCategory category) {
categories.add(checkNotNull(category,"category"));
return this;
}
public TemplateCategories build() {
return new TemplateCategories(categories);
}
public Builder fromTemplateCategories(TemplateCategories in) {
return categories(in.getTemplateCategories());
}
}
private TemplateCategories() {
//For JAXB and builder use
}
private TemplateCategories(Set<TemplateCategory> categories) {
this.categories = Sets.newLinkedHashSet(categories);
}
@XmlElement(name = "Category")
private Set<TemplateCategory> categories = Sets.newLinkedHashSet();
public Set<TemplateCategory> getTemplateCategories() {
return Collections.unmodifiableSet(categories);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TemplateCategories that = (TemplateCategories) o;
if (categories != null ? !categories.equals(that.categories) : that.categories != null)
return false;
return true;
}
@Override
public int hashCode() {
return categories != null ? categories.hashCode() : 0;
}
public String toString() {
return "["+ categories.toString()+"]";
}
}

Some files were not shown because too many files have changed in this diff Show More