http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/ansible-playbooks/roles/openstack/vars/openstack-credentials.yml ---------------------------------------------------------------------- diff --git a/modules/cloud/ansible-playbooks/roles/openstack/vars/openstack-credentials.yml b/modules/cloud/ansible-playbooks/roles/openstack/vars/openstack-credentials.yml deleted file mode 100644 index 5b7272f..0000000 --- a/modules/cloud/ansible-playbooks/roles/openstack/vars/openstack-credentials.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - ---- - -os_username: xxxx -os_password: xxxx - -os_project_name: xxxx - -os_auth_url: xxxx - -os_region_name: xxxx
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/ansible-playbooks/roles/test/tasks/main.yml ---------------------------------------------------------------------- diff --git a/modules/cloud/ansible-playbooks/roles/test/tasks/main.yml b/modules/cloud/ansible-playbooks/roles/test/tasks/main.yml deleted file mode 100644 index a0b108f..0000000 --- a/modules/cloud/ansible-playbooks/roles/test/tasks/main.yml +++ /dev/null @@ -1,23 +0,0 @@ -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -- debug: msg="ding {{ inventory_hostname }}" - -- debug: msg="{{ inventory }}" http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/ansible-playbooks/roles/zookeeper/handlers/main.yml ---------------------------------------------------------------------- diff --git a/modules/cloud/ansible-playbooks/roles/zookeeper/handlers/main.yml b/modules/cloud/ansible-playbooks/roles/zookeeper/handlers/main.yml deleted file mode 100644 index a4445c8..0000000 --- a/modules/cloud/ansible-playbooks/roles/zookeeper/handlers/main.yml +++ /dev/null @@ -1,35 +0,0 @@ -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - ---- -- name: start zookeeper - command: bin/zkServer.sh start - args: - chdir: "{{zookeeper_dir}}" - -- name: restart zookeeper - command: bin/zkServer.sh restart - args: - chdir: "{{zookeeper_dir}}" - -- name: stop zookeeper - command: bin/zkServer.sh stop - args: - chdir: "{{zookeeper_dir}}" http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/ansible-playbooks/roles/zookeeper/tasks/main.yml ---------------------------------------------------------------------- diff --git a/modules/cloud/ansible-playbooks/roles/zookeeper/tasks/main.yml b/modules/cloud/ansible-playbooks/roles/zookeeper/tasks/main.yml deleted file mode 100644 index 6ce800d..0000000 --- a/modules/cloud/ansible-playbooks/roles/zookeeper/tasks/main.yml +++ /dev/null @@ -1,118 +0,0 @@ -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - ---- -- name: install pre-requities - yum: - name: "{{item}}" - state: latest - with_items: - - firewalld - - vim - become: yes - -- name: start firewalld - service: - name: firewalld - state: started - become: yes - -- name: open zookeeper port - firewalld: - port: "{{item}}" - zone: public - permanent: true - state: enabled - immediate: yes - with_items: - - "{{zookeeper_client_port}}/tcp" - - 2888/tcp - - 3888/tcp - become: yes - -# - name: get ip4 address -# command: hostname -i -# register: _ip4 -# tags: ttt - -# - debug: -# msg: "{{_ip4.stdout}}" -# tags: ttt - -###################### -- name: Download and unarchive zookeeper - unarchive: - src: "{{ zookeeper_url }}" - dest: /opt - copy: no - creates: /opt/zookeeper-{{ zookeeper_version }} - owner: "{{ user }}" - group: "{{ group }}" - become: yes - -- name: Link to Zookeeper Directory - file: - src: "/opt/zookeeper-{{ zookeeper_version }}" - dest: "{{zookeeper_dir}}" - state: link - force: yes - become: yes - -- name: Create Zookeeper Log Dir - file: - path: "{{zookeeper_log_dir}}" - owner: "{{ user }}" - group: "{{ group }}" - recurse: yes - state: directory - mode: 0644 - become: yes - -- name: Create Zookeeper DataStore Dir - file: - path: "{{zookeeper_datastore_dir}}" - owner: "{{ user }}" - group: "{{ group }}" - recurse: yes - state: directory - mode: 0755 - become: yes - -- name: Copy zoo.cfg file - template: - src: zoo.cfg.j2 - # dest: "{{zookeeper_conf_dir}}/zoo.cfg" - dest: "{{zookeeper_dir}}/conf/zoo.cfg" - owner: "{{ user }}" - group: "{{ group }}" - mode: "u=rw,g=r,o=r" - notify: - - restart zookeeper - - -- name: Copy myid file - template: - src: myid.j2 - dest: "{{zookeeper_datastore_dir}}/myid" - owner: "{{ user }}" - group: "{{ group }}" - mode: "u=rw,g=r,o=r" - notify: - - restart zookeeper http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/ansible-playbooks/roles/zookeeper/templates/myid.j2 ---------------------------------------------------------------------- diff --git a/modules/cloud/ansible-playbooks/roles/zookeeper/templates/myid.j2 b/modules/cloud/ansible-playbooks/roles/zookeeper/templates/myid.j2 deleted file mode 100644 index 78a0bd7..0000000 --- a/modules/cloud/ansible-playbooks/roles/zookeeper/templates/myid.j2 +++ /dev/null @@ -1 +0,0 @@ -{{ my_id }} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/ansible-playbooks/roles/zookeeper/templates/zoo.cfg.j2 ---------------------------------------------------------------------- diff --git a/modules/cloud/ansible-playbooks/roles/zookeeper/templates/zoo.cfg.j2 b/modules/cloud/ansible-playbooks/roles/zookeeper/templates/zoo.cfg.j2 deleted file mode 100644 index 4845a71..0000000 --- a/modules/cloud/ansible-playbooks/roles/zookeeper/templates/zoo.cfg.j2 +++ /dev/null @@ -1,32 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -maxClientCnxns=50 -# The number of milliseconds of each tick -tickTime=2000 -# The number of ticks that the initial -# synchronization phase can take -initLimit=10 -# The number of ticks that can pass between -# sending a request and getting an acknowledgement -syncLimit=5 -# the directory where the snapshot is stored. -dataDir={{zookeeper_datastore_dir}} -# the port at which the clients will connect -clientPort={{zookeeper_client_port}} - -{% for server in zookeeper_servers %} -server.{{ server.id }}={{ server.ip }}:2888:3888 -{% endfor %} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/ansible-playbooks/roles/zookeeper/vars/main.yml ---------------------------------------------------------------------- diff --git a/modules/cloud/ansible-playbooks/roles/zookeeper/vars/main.yml b/modules/cloud/ansible-playbooks/roles/zookeeper/vars/main.yml deleted file mode 100644 index 6ec2045..0000000 --- a/modules/cloud/ansible-playbooks/roles/zookeeper/vars/main.yml +++ /dev/null @@ -1,35 +0,0 @@ -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - ---- -zookeeper_version: 3.4.8 -#zookeeper_conf_dir: /etc/zookeeper/conf -zookeeper_log_dir: /var/log/zookeeper -zookeeper_datastore_dir: /var/lib/zookeeper -zookeeper_url: http://www.us.apache.org/dist/zookeeper/zookeeper-{{zookeeper_version}}/zookeeper-{{zookeeper_version}}.tar.gz -zookeeper_dir: /opt/zookeeper -#zookeeper_client_port: 2181 - -zookeeper_servers: - - {id: "1", ip: "172.31.24.149"} - - {id: "2", ip: "172.31.19.49"} - - {id: "3", ip: "172.31.25.80"} -#exhibitor_version: 1.5.5 -#exhibitor_install_dir: /opt/exhibitor http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/ansible-playbooks/site.yml ---------------------------------------------------------------------- diff --git a/modules/cloud/ansible-playbooks/site.yml b/modules/cloud/ansible-playbooks/site.yml deleted file mode 100644 index 61303b6..0000000 --- a/modules/cloud/ansible-playbooks/site.yml +++ /dev/null @@ -1,44 +0,0 @@ -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - ---- -- hosts: localhost - tags: ec2 - roles: - - ec2 - -- hosts: localhost - tags: openstack - roles: - - openstack - -- hosts: mesos-master - tags: mesos, mesos-master - roles: - - java - - zookeeper - - mesos-master - -- hosts: mesos-slave - tags: mesos, mesos-slave - roles: - - mesos-slave - -... http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/aurora-client/README.md ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/README.md b/modules/cloud/aurora-client/README.md deleted file mode 100644 index 70acab9..0000000 --- a/modules/cloud/aurora-client/README.md +++ /dev/null @@ -1,49 +0,0 @@ -# Aurora Thrift Client -This project implements a Thrift based Java client for Apache Aurora scheduler, running on a Mesos cluster. This client has been developed with a focus of being integrated with Apache Airavata for job submission & monitoring - -## Requirements - -In order to use this client, you must have the following: - -* A Mesos cluster - running on any public cloud (eg: AWS) - We have written ansible scripts to deploy a Mesos-Marathon cluster on any given cloud infrastructure. - The scripts can be found in the ```modules/cloud/ansible-playbooks``` directory, with necessary steps. - -* Aurora scheduler installed on this Mesos cluster. Follow instructions at: ```http://aurora.apache.org/documentation/latest/operations/installation/``` to install Aurora components in the cluster - including the scheduler, and worker components. - -## Configuration - -Please update the __aurora-scheduler.properties__ file in __src/main/resources__ directory with the following properties: - - ``` - # aurora scheduler host-name - aurora.scheduler.host=mesos-master-1 - - # aurora scheduler port (http) - aurora.scheduler.port=8081 - - # aurora executor name - aurora.executor.name=AuroraExecutor - - # mesos cluster name - mesos.cluster.name=example - ``` - -Default values for some of the parameters are added to the properties file. - -## Operations supported - -Currently the following operations are supported, but more will be added progressively. - -* Submit a job to the Aurora scheduler - Job can be AdHoc(one time) or a Service (long running) - -* Get job details - -* Get pending jobs & reason for why it is pending - -* Kill tasks in a Job, or kill all tasks in a Job - -## Sample Code - -The __AuroraClientSample.java__ contains sample code on how to use the Client. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/aurora-client/pom.xml ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/pom.xml b/modules/cloud/aurora-client/pom.xml deleted file mode 100644 index f8c41a4..0000000 --- a/modules/cloud/aurora-client/pom.xml +++ /dev/null @@ -1,83 +0,0 @@ -<!-- - - - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - ---> -<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/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-cloud</artifactId> - <version>0.17-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> - - <artifactId>aurora-client</artifactId> - <packaging>jar</packaging> - <name>Thrift client for Apache Aurora</name> - <url>http://airavata.apache.org/</url> - - <dependencies> - <dependency> - <groupId>org.apache.thrift</groupId> - <artifactId>libthrift</artifactId> - <version>0.9.3</version> - </dependency> - <dependency> - <groupId>org.json</groupId> - <artifactId>json</artifactId> - <version>${json.version}</version> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-commons</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - - <build> - <directory>target</directory> - <outputDirectory>target/classes</outputDirectory> - <finalName>${project.artifactId}-${project.version}</finalName> - <testOutputDirectory>target/test-classes</testOutputDirectory> - <sourceDirectory>src/main/java</sourceDirectory> - <testSourceDirectory>src/test/java</testSourceDirectory> - <resources> - <resource> - <directory>src/main/resources</directory> - </resource> - </resources> - <testResources> - <testResource> - <directory>src/test/resources</directory> - </testResource> - </testResources> - - <plugins> - <plugin> - <groupId>com.mycila</groupId> - <artifactId>license-maven-plugin</artifactId> - <configuration> - <header>../../../apache-license-header.txt</header> - </configuration> - </plugin> - </plugins> - </build> -</project> http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/AuroraSchedulerClientFactory.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/AuroraSchedulerClientFactory.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/AuroraSchedulerClientFactory.java deleted file mode 100644 index 1a5d3fa..0000000 --- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/AuroraSchedulerClientFactory.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.airavata.cloud.aurora.client; - -import org.apache.airavata.cloud.aurora.client.sdk.AuroraSchedulerManager; -import org.apache.airavata.cloud.aurora.client.sdk.ReadOnlyScheduler; -import org.apache.thrift.protocol.TJSONProtocol; -import org.apache.thrift.protocol.TProtocol; -import org.apache.thrift.transport.THttpClient; -import org.apache.thrift.transport.TTransport; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * A factory for creating AuroraSchedulerClient objects. - */ -public class AuroraSchedulerClientFactory { - - /** The Constant logger. */ - private final static Logger logger = LoggerFactory.getLogger(AuroraSchedulerClientFactory.class); - - - /** - * Creates a new AuroraSchedulerClient object. - * - * @param connectionUrl the connection url - * @param connectionTimeout the connection timeout - * @return the client - * @throws Exception the exception - */ - public static ReadOnlyScheduler.Client createReadOnlySchedulerClient(String connectionUrl, int connectionTimeout) throws Exception { - try { - return new ReadOnlyScheduler.Client( - getTProtocol(connectionUrl, connectionTimeout)); - } catch(Exception ex) { - logger.error(ex.getMessage(), ex); - throw ex; - } - } - - /** - * Creates a new AuroraSchedulerClient object. - * - * @param connectionUrl the connection url - * @param connectionTimeout the connection timeout - * @return the client - * @throws Exception the exception - */ - public static AuroraSchedulerManager.Client createSchedulerManagerClient(String connectionUrl, int connectionTimeout) throws Exception { - try { - return new AuroraSchedulerManager.Client( - getTProtocol(connectionUrl, connectionTimeout)); - } catch(Exception ex) { - logger.error(ex.getMessage(), ex); - throw ex; - } - } - - /** - * Gets the t protocol. - * - * @param connectionUrl the connection url - * @param connectionTimeout the connection timeout - * @return the t protocol - * @throws Exception the exception - */ - private static TProtocol getTProtocol(String connectionUrl, int connectionTimeout) throws Exception { - try { - THttpClient client = new THttpClient(connectionUrl); - client.setConnectTimeout(connectionTimeout); - - TTransport transport = client; - transport.open(); - TProtocol protocol = new TJSONProtocol(transport); - return protocol; - } catch(Exception ex) { - logger.error(ex.getMessage(), ex); - throw ex; - } - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/AuroraThriftClient.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/AuroraThriftClient.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/AuroraThriftClient.java deleted file mode 100644 index fc03fdf..0000000 --- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/AuroraThriftClient.java +++ /dev/null @@ -1,335 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.airavata.cloud.aurora.client; - -import java.util.HashSet; -import java.util.Set; - -import org.apache.airavata.cloud.aurora.client.bean.GetJobsResponseBean; -import org.apache.airavata.cloud.aurora.client.bean.JobConfigBean; -import org.apache.airavata.cloud.aurora.client.bean.JobDetailsResponseBean; -import org.apache.airavata.cloud.aurora.client.bean.JobKeyBean; -import org.apache.airavata.cloud.aurora.client.bean.PendingJobReasonBean; -import org.apache.airavata.cloud.aurora.client.bean.ResponseBean; -import org.apache.airavata.cloud.aurora.client.sdk.AuroraSchedulerManager; -import org.apache.airavata.cloud.aurora.client.sdk.JobConfiguration; -import org.apache.airavata.cloud.aurora.client.sdk.JobKey; -import org.apache.airavata.cloud.aurora.client.sdk.ReadOnlyScheduler; -import org.apache.airavata.cloud.aurora.client.sdk.Response; -import org.apache.airavata.cloud.aurora.client.sdk.TaskQuery; -import org.apache.airavata.cloud.aurora.util.AuroraThriftClientUtil; -import org.apache.airavata.cloud.aurora.util.Constants; -import org.apache.airavata.cloud.aurora.util.ResponseResultType; -import org.apache.airavata.common.utils.ServerSettings; -import org.apache.thrift.transport.TTransportException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The Class AuroraThriftClient. - */ -public class AuroraThriftClient { - - /** The Constant logger. */ - private final static Logger logger = LoggerFactory.getLogger(AuroraThriftClient.class); - - /** The read only scheduler client. */ - private ReadOnlyScheduler.Client readOnlySchedulerClient = null; - - /** The aurora scheduler manager client. */ - private AuroraSchedulerManager.Client auroraSchedulerManagerClient = null; - - /** The thrift client. */ - private static AuroraThriftClient thriftClient = null; - - /** - * Instantiates a new aurora thrift client. - */ - private AuroraThriftClient() {} - - /** - * Gets the aurora thrift client. - * - * @return the aurora thrift client - * @throws Exception the exception - */ - public static AuroraThriftClient getAuroraThriftClient() throws Exception { - try { - if(thriftClient == null) { - synchronized(AuroraThriftClient.class) { - if(thriftClient == null) { - thriftClient = new AuroraThriftClient(); - - // construct connection url for scheduler - String auroraHosts = ServerSettings.getAuroraSchedulerHosts(); - Integer connectTimeout = ServerSettings.getAuroraSchedulerTimeout(); - - // check reachable scheduler host - if(auroraHosts != null && !auroraHosts.trim().isEmpty()) { - auroraHosts = auroraHosts.trim(); - for(String auroraHost : auroraHosts.split(",")) { - // malformed host string, should be of form <host:port> - if(auroraHost.split(":").length != 2) { - throw new Exception("Scheduler Host String: " + auroraHost + ", is malformed. Should be of form <hostname:port>!"); - } - - // read hostname, port & construct connection-url - String hostname = auroraHost.split(":")[0]; - String port = auroraHost.split(":")[1]; - String connectionUrl = String.format(Constants.AURORA_SCHEDULER_CONNECTION_URL, hostname, port); - - // verify if connection succeeds - if(AuroraThriftClientUtil.isSchedulerHostReachable(connectionUrl, connectTimeout)) { - thriftClient.readOnlySchedulerClient = AuroraSchedulerClientFactory.createReadOnlySchedulerClient(connectionUrl, connectTimeout); - thriftClient.auroraSchedulerManagerClient = AuroraSchedulerClientFactory.createSchedulerManagerClient(connectionUrl, connectTimeout); - break; - } - } - - // check if scheduler connection successful - if(thriftClient.auroraSchedulerManagerClient == null || - thriftClient.readOnlySchedulerClient == null) { - throw new Exception("None of the Aurora scheduler hosts : <" + auroraHosts + "> were reachable, hence connection not established!"); - } - } else { - // aurora hosts not defined in the properties file - throw new Exception("Aurora hosts not specified in airavata-server.properties file."); - } - } - } - } - } catch(Exception ex) { - logger.error("Couldn't initialize Aurora thrift client", ex); - throw ex; - } - return thriftClient; - } - - - /** - * Reconnect with aurora scheduler. - * - * @return true, if successful - */ - private boolean reconnectWithAuroraScheduler() { - boolean connectionSuccess = false; - - try { - // construct connection url for scheduler - String auroraHosts = ServerSettings.getAuroraSchedulerHosts(); - Integer connectTimeout = ServerSettings.getAuroraSchedulerTimeout(); - - // check reachable scheduler host - if(auroraHosts != null) { - for(String auroraHost : auroraHosts.split(",")) { - // malformed host string, should be of form <host:port> - if(auroraHost.split(":").length != 2) { - throw new Exception("Scheduler Host String: " + auroraHost + ", is malformed. Should be of form <hostname:port>!"); - } - - // read hostname, port & construct connection-url - String hostname = auroraHost.split(":")[0]; - String port = auroraHost.split(":")[1]; - String connectionUrl = String.format(Constants.AURORA_SCHEDULER_CONNECTION_URL, hostname, port); - - // verify if connection succeeds - if(AuroraThriftClientUtil.isSchedulerHostReachable(connectionUrl, connectTimeout)) { - thriftClient.readOnlySchedulerClient = AuroraSchedulerClientFactory.createReadOnlySchedulerClient(connectionUrl, connectTimeout); - thriftClient.auroraSchedulerManagerClient = AuroraSchedulerClientFactory.createSchedulerManagerClient(connectionUrl, connectTimeout); - - // set connection-success flag - connectionSuccess = true; - } - } - } else { - // aurora hosts not defined in the properties file - throw new Exception("Aurora hosts not specified in airavata-server.properties file."); - } - } catch(Exception ex) { - logger.error(ex.getMessage(), ex); - } - return connectionSuccess; - } - - - /** - * Creates the job. - * - * @param jobConfigBean the job config bean - * @return the response bean - * @throws Exception the exception - */ - public ResponseBean createJob(JobConfigBean jobConfigBean) throws Exception { - ResponseBean response = null; - // try till we get response or scheduler connection not found - while(response == null) { - try { - if(jobConfigBean != null) { - JobConfiguration jobConfig = AuroraThriftClientUtil.getAuroraJobConfig(jobConfigBean); - Response createJobResponse = this.auroraSchedulerManagerClient.createJob(jobConfig); - response = AuroraThriftClientUtil.getResponseBean(createJobResponse, ResponseResultType.CREATE_JOB); - } - } catch(Exception ex) { - if (ex instanceof TTransportException) { - // if re-connection success, retry command - if (this.reconnectWithAuroraScheduler()) { - continue; - } - } - logger.error(ex.getMessage(), ex); - throw ex; - } - } - - return response; - } - - /** - * Kill tasks. - * - * @param jobKeyBean the job key bean - * @param instances the instances - * @return the response bean - * @throws Exception the exception - */ - public ResponseBean killTasks(JobKeyBean jobKeyBean, Set<Integer> instances) throws Exception { - ResponseBean response = null; - // try till we get response or scheduler connection not found - while(response == null) { - try { - if(jobKeyBean != null) { - JobKey jobKey = AuroraThriftClientUtil.getAuroraJobKey(jobKeyBean); - Response killTaskResponse = this.auroraSchedulerManagerClient.killTasks(jobKey, instances); - response = AuroraThriftClientUtil.getResponseBean(killTaskResponse, ResponseResultType.KILL_TASKS); - } - } catch(Exception ex) { - if (ex instanceof TTransportException) { - // if re-connection success, retry command - if (this.reconnectWithAuroraScheduler()) { - continue; - } - } - logger.error(ex.getMessage(), ex); - throw ex; - } - } - return response; - } - - /** - * Gets the job list. - * - * @param ownerRole the owner role - * @return the job list - * @throws Exception the exception - */ - public GetJobsResponseBean getJobList(String ownerRole) throws Exception { - GetJobsResponseBean response = null; - // try till we get response or scheduler connection not found - while(response == null) { - try { - Response jobListResponse = this.readOnlySchedulerClient.getJobs(ownerRole); - response = (GetJobsResponseBean) AuroraThriftClientUtil.getResponseBean(jobListResponse, ResponseResultType.GET_JOBS); - } catch(Exception ex) { - if (ex instanceof TTransportException) { - // if re-connection success, retry command - if (this.reconnectWithAuroraScheduler()) { - continue; - } - } - logger.error(ex.getMessage(), ex); - throw ex; - } - } - return response; - } - - /** - * Gets the pending reason for job. - * - * @param jobKeyBean the job key bean - * @return the pending reason for job - * @throws Exception the exception - */ - public PendingJobReasonBean getPendingReasonForJob(JobKeyBean jobKeyBean) throws Exception { - PendingJobReasonBean response = null; - // try till we get response or scheduler connection not found - while(response == null) { - try { - JobKey jobKey = AuroraThriftClientUtil.getAuroraJobKey(jobKeyBean); - Set<JobKey> jobKeySet = new HashSet<>(); - jobKeySet.add(jobKey); - - TaskQuery query = new TaskQuery(); - query.setJobKeys(jobKeySet); - - Response pendingReasonResponse = this.readOnlySchedulerClient.getPendingReason(query); - response = (PendingJobReasonBean) AuroraThriftClientUtil.getResponseBean(pendingReasonResponse, ResponseResultType.GET_PENDING_JOB_REASON); - } catch(Exception ex) { - if (ex instanceof TTransportException) { - // if re-connection success, retry command - if (this.reconnectWithAuroraScheduler()) { - continue; - } - } - logger.error(ex.getMessage(), ex); - throw ex; - } - } - return response; - } - - /** - * Gets the job details. - * - * @param jobKeyBean the job key bean - * @return the job details - * @throws Exception the exception - */ - public JobDetailsResponseBean getJobDetails(JobKeyBean jobKeyBean) throws Exception { - JobDetailsResponseBean response = null; - // try till we get response or scheduler connection not found - while(response == null) { - try { - if(jobKeyBean != null) { - JobKey jobKey = AuroraThriftClientUtil.getAuroraJobKey(jobKeyBean); - Set<JobKey> jobKeySet = new HashSet<>(); - jobKeySet.add(jobKey); - - TaskQuery query = new TaskQuery(); - query.setJobKeys(jobKeySet); - - Response jobDetailsResponse = this.readOnlySchedulerClient.getTasksStatus(query); - response = (JobDetailsResponseBean) AuroraThriftClientUtil.getResponseBean(jobDetailsResponse, ResponseResultType.GET_JOB_DETAILS); - } - } catch(Exception ex) { - if (ex instanceof TTransportException) { - // if re-connection success, retry command - if (this.reconnectWithAuroraScheduler()) { - continue; - } - } - logger.error(ex.getMessage(), ex); - throw ex; - } - } - return response; - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/GetJobsResponseBean.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/GetJobsResponseBean.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/GetJobsResponseBean.java deleted file mode 100644 index 71786a0..0000000 --- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/GetJobsResponseBean.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.airavata.cloud.aurora.client.bean; - -import java.util.HashSet; -import java.util.Set; - -/** - * The Class GetJobsResponseBean. - */ -public class GetJobsResponseBean extends ResponseBean { - - /** The job configs. */ - private Set<JobConfigBean> jobConfigs; - - /** - * Instantiates a new gets the jobs response bean. - * - * @param responseBean the response bean - */ - public GetJobsResponseBean(ResponseBean responseBean) { - this.setResponseCode(responseBean.getResponseCode()); - this.setServerInfo(responseBean.getServerInfo()); - } - - /** - * Gets the job configs. - * - * @return the job configs - */ - public Set<JobConfigBean> getJobConfigs() { - if(jobConfigs == null) { - jobConfigs = new HashSet<>(); - } - return jobConfigs; - } - - /** - * Sets the job configs. - * - * @param jobConfigs the new job configs - */ - public void setJobConfigs(Set<JobConfigBean> jobConfigs) { - this.jobConfigs = jobConfigs; - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/IdentityBean.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/IdentityBean.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/IdentityBean.java deleted file mode 100644 index 07ace7e..0000000 --- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/IdentityBean.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.airavata.cloud.aurora.client.bean; - -// TODO: Auto-generated Javadoc -/** - * The Class IdentityBean. - */ -public class IdentityBean { - - /** The user. */ - private String user; - - /** - * Instantiates a new identity bean. - * - * @param user the user - */ - public IdentityBean(String user) { - this.user = user; - } - - /** - * Gets the user. - * - * @return the user - */ - public String getUser() { - return user; - } - - /** - * Sets the user. - * - * @param user the new user - */ - public void setUser(String user) { - this.user = user; - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/JobConfigBean.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/JobConfigBean.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/JobConfigBean.java deleted file mode 100644 index 2a06073..0000000 --- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/JobConfigBean.java +++ /dev/null @@ -1,236 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.airavata.cloud.aurora.client.bean; - -// TODO: Auto-generated Javadoc -/** - * The Class JobConfigBean. - */ -public class JobConfigBean { - - /** The job. */ - private JobKeyBean job; - - /** The owner. */ - private IdentityBean owner; - - /** The task config. */ - private TaskConfigBean taskConfig; - - /** The is service. */ - private boolean isService; - - /** The priority. */ - private int priority; - - /** The production. */ - private boolean production; - - /** The max task failures. */ - private int maxTaskFailures; - - /** The instances. */ - private int instances; - - /** The cluster. */ - private String cluster; - - /** - * Instantiates a new job config bean. - * - * @param job the job - * @param owner the owner - * @param taskConfig the task config - * @param cluster the cluster - */ - public JobConfigBean(JobKeyBean job, IdentityBean owner, TaskConfigBean taskConfig, String cluster) { - this.job = job; - this.owner = owner; - this.taskConfig = taskConfig; - this.cluster = cluster; - - // set defaults - this.isService = false; - this.maxTaskFailures = 1; - this.instances = 1; - } - - /** - * Gets the job. - * - * @return the job - */ - public JobKeyBean getJob() { - return job; - } - - /** - * Sets the job. - * - * @param job the new job - */ - public void setJob(JobKeyBean job) { - this.job = job; - } - - /** - * Gets the owner. - * - * @return the owner - */ - public IdentityBean getOwner() { - return owner; - } - - /** - * Sets the owner. - * - * @param owner the new owner - */ - public void setOwner(IdentityBean owner) { - this.owner = owner; - } - - /** - * Checks if is service. - * - * @return true, if is service - */ - public boolean isService() { - return isService; - } - - /** - * Sets the service. - * - * @param isService the new service - */ - public void setService(boolean isService) { - this.isService = isService; - } - - /** - * Gets the priority. - * - * @return the priority - */ - public int getPriority() { - return priority; - } - - /** - * Sets the priority. - * - * @param priority the new priority - */ - public void setPriority(int priority) { - this.priority = priority; - } - - /** - * Checks if is production. - * - * @return true, if is production - */ - public boolean isProduction() { - return production; - } - - /** - * Sets the production. - * - * @param production the new production - */ - public void setProduction(boolean production) { - this.production = production; - } - - /** - * Gets the task config. - * - * @return the task config - */ - public TaskConfigBean getTaskConfig() { - return taskConfig; - } - - /** - * Sets the task config. - * - * @param taskConfig the new task config - */ - public void setTaskConfig(TaskConfigBean taskConfig) { - this.taskConfig = taskConfig; - } - - /** - * Gets the max task failures. - * - * @return the max task failures - */ - public int getMaxTaskFailures() { - return maxTaskFailures; - } - - /** - * Sets the max task failures. - * - * @param maxTaskFailures the new max task failures - */ - public void setMaxTaskFailures(int maxTaskFailures) { - this.maxTaskFailures = maxTaskFailures; - } - - /** - * Gets the instances. - * - * @return the instances - */ - public int getInstances() { - return instances; - } - - /** - * Sets the instances. - * - * @param instances the new instances - */ - public void setInstances(int instances) { - this.instances = instances; - } - - /** - * Gets the cluster. - * - * @return the cluster - */ - public String getCluster() { - return cluster; - } - - /** - * Sets the cluster. - * - * @param cluster the new cluster - */ - public void setCluster(String cluster) { - this.cluster = cluster; - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/JobDetailsResponseBean.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/JobDetailsResponseBean.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/JobDetailsResponseBean.java deleted file mode 100644 index 473155a..0000000 --- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/JobDetailsResponseBean.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.airavata.cloud.aurora.client.bean; - -import java.util.List; - -import org.apache.airavata.cloud.aurora.client.sdk.ScheduledTask; - -/** - * The Class JobDetailsResponseBean. - */ -public class JobDetailsResponseBean extends ResponseBean { - - /** - * Instantiates a new job details response bean. - * - * @param responseBean the response bean - */ - public JobDetailsResponseBean(ResponseBean responseBean) { - this.setResponseCode(responseBean.getResponseCode()); - this.setServerInfo(responseBean.getServerInfo()); - } - - /** The tasks. */ - private List<ScheduledTask> tasks; - - /** - * Gets the tasks. - * - * @return the tasks - */ - public List<ScheduledTask> getTasks() { - return tasks; - } - - /** - * Sets the tasks. - * - * @param tasks the new tasks - */ - public void setTasks(List<ScheduledTask> tasks) { - this.tasks = tasks; - } - - /* (non-Javadoc) - * @see org.apache.airavata.cloud.aurora.client.bean.ResponseBean#toString() - */ - @Override - public String toString() { - return "JobDetailsResponseBean [tasks=" + tasks + "]"; - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/JobKeyBean.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/JobKeyBean.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/JobKeyBean.java deleted file mode 100644 index 994b88f..0000000 --- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/JobKeyBean.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.airavata.cloud.aurora.client.bean; - -// TODO: Auto-generated Javadoc -/** - * The Class JobKeyBean. - */ -public class JobKeyBean { - - /** The environment. */ - private String environment; - - /** The role. */ - private String role; - - /** The name. */ - private String name; - - /** - * Instantiates a new job key bean. - * - * @param environment the environment - * @param role the role - * @param name the name - */ - public JobKeyBean(String environment, String role, String name) { - this.environment = environment; - this.role = role; - this.name = name; - } - - /** - * Gets the environment. - * - * @return the environment - */ - public String getEnvironment() { - return environment; - } - - /** - * Sets the environment. - * - * @param environment the new environment - */ - public void setEnvironment(String environment) { - this.environment = environment; - } - - /** - * Gets the role. - * - * @return the role - */ - public String getRole() { - return role; - } - - /** - * Sets the role. - * - * @param role the new role - */ - public void setRole(String role) { - this.role = role; - } - - /** - * Gets the name. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Sets the name. - * - * @param name the new name - */ - public void setName(String name) { - this.name = name; - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/PendingJobReasonBean.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/PendingJobReasonBean.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/PendingJobReasonBean.java deleted file mode 100644 index 319308c..0000000 --- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/PendingJobReasonBean.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.airavata.cloud.aurora.client.bean; - -import java.util.Set; - -import org.apache.airavata.cloud.aurora.client.sdk.PendingReason; - -/** - * The Class PendingJobResponseBean. - */ -public class PendingJobReasonBean extends ResponseBean { - - /** The reasons. */ - private Set<PendingReason> reasons; - - /** - * Instantiates a new pending job response bean. - * - * @param responseBean the response bean - */ - public PendingJobReasonBean(ResponseBean responseBean) { - this.setResponseCode(responseBean.getResponseCode()); - this.setServerInfo(responseBean.getServerInfo()); - } - - /** - * Gets the reasons. - * - * @return the reasons - */ - public Set<PendingReason> getReasons() { - return reasons; - } - - /** - * Sets the reasons. - * - * @param reasons the new reasons - */ - public void setReasons(Set<PendingReason> reasons) { - this.reasons = reasons; - } - - /* (non-Javadoc) - * @see org.apache.airavata.cloud.aurora.client.bean.ResponseBean#toString() - */ - @Override - public String toString() { - return "PendingJobResponseBean [reasons=" + reasons + "]"; - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/ProcessBean.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/ProcessBean.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/ProcessBean.java deleted file mode 100644 index 0cf6095..0000000 --- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/ProcessBean.java +++ /dev/null @@ -1,193 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.airavata.cloud.aurora.client.bean; - -/** - * The Class ProcessBean. - */ -public class ProcessBean { - - /** The name. */ - private String name; - - /** The cmd line. */ - private String cmdLine; - - /** The is daemon. */ - private boolean isDaemon; - - /** The is ephemeral. */ - private boolean isEphemeral; - - /** The is final. */ - private boolean isFinal; - - /** The max failures. */ - private int max_failures; - - /** The min duration. */ - private int min_duration; - - /** - * Instantiates a new process bean. - * - * @param name the name - * @param cmdLine the cmd line - * @param isDaemon the is daemon - */ - public ProcessBean(String name, String cmdLine, boolean isDaemon) { - this.name = name; - this.cmdLine = cmdLine; - this.isDaemon = isDaemon; - - // set defaults - this.isEphemeral = false; - this.isFinal = false; - this.max_failures = 1; - this.min_duration = 5; - } - - /** - * Gets the name. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Sets the name. - * - * @param name the new name - */ - public void setName(String name) { - this.name = name; - } - - /** - * Gets the cmd line. - * - * @return the cmd line - */ - public String getCmdLine() { - return cmdLine; - } - - /** - * Sets the cmd line. - * - * @param cmdLine the new cmd line - */ - public void setCmdLine(String cmdLine) { - this.cmdLine = cmdLine; - } - - /** - * Checks if is daemon. - * - * @return true, if is daemon - */ - public boolean isDaemon() { - return isDaemon; - } - - /** - * Sets the daemon. - * - * @param isDaemon the new daemon - */ - public void setDaemon(boolean isDaemon) { - this.isDaemon = isDaemon; - } - - /** - * Checks if is ephemeral. - * - * @return true, if is ephemeral - */ - public boolean isEphemeral() { - return isEphemeral; - } - - /** - * Sets the ephemeral. - * - * @param isEphemeral the new ephemeral - */ - public void setEphemeral(boolean isEphemeral) { - this.isEphemeral = isEphemeral; - } - - /** - * Checks if is final. - * - * @return true, if is final - */ - public boolean isFinal() { - return isFinal; - } - - /** - * Sets the final. - * - * @param isFinal the new final - */ - public void setFinal(boolean isFinal) { - this.isFinal = isFinal; - } - - /** - * Gets the max failures. - * - * @return the max failures - */ - public int getMax_failures() { - return max_failures; - } - - /** - * Sets the max failures. - * - * @param max_failures the new max failures - */ - public void setMax_failures(int max_failures) { - this.max_failures = max_failures; - } - - /** - * Gets the min duration. - * - * @return the min duration - */ - public int getMin_duration() { - return min_duration; - } - - /** - * Sets the min duration. - * - * @param min_duration the new min duration - */ - public void setMin_duration(int min_duration) { - this.min_duration = min_duration; - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/ResourceBean.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/ResourceBean.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/ResourceBean.java deleted file mode 100644 index c60bc6f..0000000 --- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/ResourceBean.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.airavata.cloud.aurora.client.bean; - -/** - * The Class ResourceBean. - */ -public class ResourceBean { - - /** The num cpus. */ - private double numCpus; - - /** The disk mb. */ - private long diskMb; - - /** The ram mb. */ - private long ramMb; - - /** - * Instantiates a new resource bean. - * - * @param numCpus the num cpus - * @param diskMb the disk mb - * @param ramMb the ram mb - */ - public ResourceBean(double numCpus, long diskMb, long ramMb) { - this.numCpus = numCpus; - this.diskMb = diskMb; - this.ramMb = ramMb; - } - - /** - * Gets the num cpus. - * - * @return the num cpus - */ - public double getNumCpus() { - return numCpus; - } - - /** - * Sets the num cpus. - * - * @param numCpus the new num cpus - */ - public void setNumCpus(double numCpus) { - this.numCpus = numCpus; - } - - /** - * Gets the disk mb. - * - * @return the disk mb - */ - public long getDiskMb() { - return diskMb; - } - - /** - * Sets the disk mb. - * - * @param diskMb the new disk mb - */ - public void setDiskMb(long diskMb) { - this.diskMb = diskMb; - } - - /** - * Gets the ram mb. - * - * @return the ram mb - */ - public long getRamMb() { - return ramMb; - } - - /** - * Sets the ram mb. - * - * @param ramMb the new ram mb - */ - public void setRamMb(long ramMb) { - this.ramMb = ramMb; - } - - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/ResponseBean.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/ResponseBean.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/ResponseBean.java deleted file mode 100644 index e26afa9..0000000 --- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/ResponseBean.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.airavata.cloud.aurora.client.bean; - -import org.apache.airavata.cloud.aurora.util.ResponseCodeEnum; - -/** - * The Class ResponseBean. - */ -public class ResponseBean { - - /** The response code. */ - private ResponseCodeEnum responseCode; - - /** The server info. */ - private ServerInfoBean serverInfo; - - /** - * Gets the response code. - * - * @return the response code - */ - public ResponseCodeEnum getResponseCode() { - return responseCode; - } - - /** - * Sets the response code. - * - * @param responseCode the new response code - */ - public void setResponseCode(ResponseCodeEnum responseCode) { - this.responseCode = responseCode; - } - - /** - * Gets the server info. - * - * @return the server info - */ - public ServerInfoBean getServerInfo() { - return serverInfo; - } - - /** - * Sets the server info. - * - * @param serverInfo the new server info - */ - public void setServerInfo(ServerInfoBean serverInfo) { - this.serverInfo = serverInfo; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "ResponseBean [responseCode=" + responseCode + ", serverInfo=" + serverInfo + "]"; - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/ServerInfoBean.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/ServerInfoBean.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/ServerInfoBean.java deleted file mode 100644 index 56641c2..0000000 --- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/ServerInfoBean.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.airavata.cloud.aurora.client.bean; - -/** - * The Class ServerInfoBean. - */ -public class ServerInfoBean { - - /** The cluster name. */ - private String clusterName; - - /** The stats url prefix. */ - private String statsUrlPrefix; - - /** - * Instantiates a new server info bean. - * - * @param clusterName the cluster name - * @param statsUrlPrefix the stats url prefix - */ - public ServerInfoBean(String clusterName, String statsUrlPrefix) { - this.clusterName = clusterName; - this.statsUrlPrefix = statsUrlPrefix; - } - - /** - * Gets the cluster name. - * - * @return the cluster name - */ - public String getClusterName() { - return clusterName; - } - - /** - * Sets the cluster name. - * - * @param clusterName the new cluster name - */ - public void setClusterName(String clusterName) { - this.clusterName = clusterName; - } - - /** - * Gets the stats url prefix. - * - * @return the stats url prefix - */ - public String getStatsUrlPrefix() { - return statsUrlPrefix; - } - - /** - * Sets the stats url prefix. - * - * @param statsUrlPrefix the new stats url prefix - */ - public void setStatsUrlPrefix(String statsUrlPrefix) { - this.statsUrlPrefix = statsUrlPrefix; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "ServerInfoBean [clusterName=" + clusterName + ", statsUrlPrefix=" + statsUrlPrefix + "]"; - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/TaskConfigBean.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/TaskConfigBean.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/TaskConfigBean.java deleted file mode 100644 index aaced00..0000000 --- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/bean/TaskConfigBean.java +++ /dev/null @@ -1,136 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.airavata.cloud.aurora.client.bean; - -import java.util.HashSet; -import java.util.Set; - -/** - * The Class TaskConfigBean. - */ -public class TaskConfigBean { - - /** The task name. */ - private String taskName; - - /** The resources. */ - private ResourceBean resources; - - /** The max failures. */ - private int maxFailures; - - /** The processes. */ - private Set<ProcessBean> processes; - - /** - * Instantiates a new task config bean. - * - * @param taskName the task name - * @param processes the processes - * @param resources the resources - */ - public TaskConfigBean(String taskName, Set<ProcessBean> processes, ResourceBean resources) { - this.taskName = taskName; - this.processes = processes; - this.resources = resources; - - // set default value - this.maxFailures = 1; - } - - /** - * Gets the task name. - * - * @return the task name - */ - public String getTaskName() { - return taskName; - } - - /** - * Sets the task name. - * - * @param taskName the new task name - */ - public void setTaskName(String taskName) { - this.taskName = taskName; - } - - - - /** - * Gets the resources. - * - * @return the resources - */ - public ResourceBean getResources() { - return resources; - } - - /** - * Sets the resources. - * - * @param resources the new resources - */ - public void setResources(ResourceBean resources) { - this.resources = resources; - } - - /** - * Gets the max failures. - * - * @return the max failures - */ - public int getMaxFailures() { - return maxFailures; - } - - /** - * Sets the max failures. - * - * @param maxFailures the new max failures - */ - public void setMaxFailures(int maxFailures) { - this.maxFailures = maxFailures; - } - - /** - * Gets the processes. - * - * @return the processes - */ - public Set<ProcessBean> getProcesses() { - if(processes == null) { - processes = new HashSet<>(); - } - - return processes; - } - - /** - * Sets the processes. - * - * @param processes the new processes - */ - public void setProcesses(Set<ProcessBean> processes) { - this.processes = processes; - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/488b772f/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/AppcImage.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/AppcImage.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/AppcImage.java deleted file mode 100644 index af06944..0000000 --- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/AppcImage.java +++ /dev/null @@ -1,549 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/** - * Autogenerated by Thrift Compiler (0.9.3) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package org.apache.airavata.cloud.aurora.client.sdk; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -/** - * Describes an image for use with the Mesos unified containerizer in the AppC format - */ -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-21") -public class AppcImage implements org.apache.thrift.TBase<AppcImage, AppcImage._Fields>, java.io.Serializable, Cloneable, Comparable<AppcImage> { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AppcImage"); - - private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField IMAGE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("imageId", org.apache.thrift.protocol.TType.STRING, (short)2); - - private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new AppcImageStandardSchemeFactory()); - schemes.put(TupleScheme.class, new AppcImageTupleSchemeFactory()); - } - - /** - * The name of the image to run - */ - public String name; // required - /** - * The appc image id identifying the image - */ - public String imageId; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - /** - * The name of the image to run - */ - NAME((short)1, "name"), - /** - * The appc image id identifying the image - */ - IMAGE_ID((short)2, "imageId"); - - private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // NAME - return NAME; - case 2: // IMAGE_ID - return IMAGE_ID; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.IMAGE_ID, new org.apache.thrift.meta_data.FieldMetaData("imageId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AppcImage.class, metaDataMap); - } - - public AppcImage() { - } - - public AppcImage( - String name, - String imageId) - { - this(); - this.name = name; - this.imageId = imageId; - } - - /** - * Performs a deep copy on <i>other</i>. - */ - public AppcImage(AppcImage other) { - if (other.isSetName()) { - this.name = other.name; - } - if (other.isSetImageId()) { - this.imageId = other.imageId; - } - } - - public AppcImage deepCopy() { - return new AppcImage(this); - } - - @Override - public void clear() { - this.name = null; - this.imageId = null; - } - - /** - * The name of the image to run - */ - public String getName() { - return this.name; - } - - /** - * The name of the image to run - */ - public AppcImage setName(String name) { - this.name = name; - return this; - } - - public void unsetName() { - this.name = null; - } - - /** Returns true if field name is set (has been assigned a value) and false otherwise */ - public boolean isSetName() { - return this.name != null; - } - - public void setNameIsSet(boolean value) { - if (!value) { - this.name = null; - } - } - - /** - * The appc image id identifying the image - */ - public String getImageId() { - return this.imageId; - } - - /** - * The appc image id identifying the image - */ - public AppcImage setImageId(String imageId) { - this.imageId = imageId; - return this; - } - - public void unsetImageId() { - this.imageId = null; - } - - /** Returns true if field imageId is set (has been assigned a value) and false otherwise */ - public boolean isSetImageId() { - return this.imageId != null; - } - - public void setImageIdIsSet(boolean value) { - if (!value) { - this.imageId = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case NAME: - if (value == null) { - unsetName(); - } else { - setName((String)value); - } - break; - - case IMAGE_ID: - if (value == null) { - unsetImageId(); - } else { - setImageId((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case NAME: - return getName(); - - case IMAGE_ID: - return getImageId(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case NAME: - return isSetName(); - case IMAGE_ID: - return isSetImageId(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof AppcImage) - return this.equals((AppcImage)that); - return false; - } - - public boolean equals(AppcImage that) { - if (that == null) - return false; - - boolean this_present_name = true && this.isSetName(); - boolean that_present_name = true && that.isSetName(); - if (this_present_name || that_present_name) { - if (!(this_present_name && that_present_name)) - return false; - if (!this.name.equals(that.name)) - return false; - } - - boolean this_present_imageId = true && this.isSetImageId(); - boolean that_present_imageId = true && that.isSetImageId(); - if (this_present_imageId || that_present_imageId) { - if (!(this_present_imageId && that_present_imageId)) - return false; - if (!this.imageId.equals(that.imageId)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - List<Object> list = new ArrayList<Object>(); - - boolean present_name = true && (isSetName()); - list.add(present_name); - if (present_name) - list.add(name); - - boolean present_imageId = true && (isSetImageId()); - list.add(present_imageId); - if (present_imageId) - list.add(imageId); - - return list.hashCode(); - } - - @Override - public int compareTo(AppcImage other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetName()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetImageId()).compareTo(other.isSetImageId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetImageId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imageId, other.imageId); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("AppcImage("); - boolean first = true; - - sb.append("name:"); - if (this.name == null) { - sb.append("null"); - } else { - sb.append(this.name); - } - first = false; - if (!first) sb.append(", "); - sb.append("imageId:"); - if (this.imageId == null) { - sb.append("null"); - } else { - sb.append(this.imageId); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class AppcImageStandardSchemeFactory implements SchemeFactory { - public AppcImageStandardScheme getScheme() { - return new AppcImageStandardScheme(); - } - } - - private static class AppcImageStandardScheme extends StandardScheme<AppcImage> { - - public void read(org.apache.thrift.protocol.TProtocol iprot, AppcImage struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // NAME - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.name = iprot.readString(); - struct.setNameIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // IMAGE_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.imageId = iprot.readString(); - struct.setImageIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, AppcImage struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.name != null) { - oprot.writeFieldBegin(NAME_FIELD_DESC); - oprot.writeString(struct.name); - oprot.writeFieldEnd(); - } - if (struct.imageId != null) { - oprot.writeFieldBegin(IMAGE_ID_FIELD_DESC); - oprot.writeString(struct.imageId); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class AppcImageTupleSchemeFactory implements SchemeFactory { - public AppcImageTupleScheme getScheme() { - return new AppcImageTupleScheme(); - } - } - - private static class AppcImageTupleScheme extends TupleScheme<AppcImage> { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, AppcImage struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetName()) { - optionals.set(0); - } - if (struct.isSetImageId()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetName()) { - oprot.writeString(struct.name); - } - if (struct.isSetImageId()) { - oprot.writeString(struct.imageId); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, AppcImage struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); - if (incoming.get(0)) { - struct.name = iprot.readString(); - struct.setNameIsSet(true); - } - if (incoming.get(1)) { - struct.imageId = iprot.readString(); - struct.setImageIdIsSet(true); - } - } - } - -} -
