http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/airavata-gfac-stubs/src/main/java/org/apache/airavata/gfac/cpi/gfac_cpi_serviceConstants.java ---------------------------------------------------------------------- diff --git a/modules/gfac/airavata-gfac-stubs/src/main/java/org/apache/airavata/gfac/cpi/gfac_cpi_serviceConstants.java b/modules/gfac/airavata-gfac-stubs/src/main/java/org/apache/airavata/gfac/cpi/gfac_cpi_serviceConstants.java deleted file mode 100644 index 14fd7fe..0000000 --- a/modules/gfac/airavata-gfac-stubs/src/main/java/org/apache/airavata/gfac/cpi/gfac_cpi_serviceConstants.java +++ /dev/null @@ -1,55 +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.1) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package org.apache.airavata.gfac.cpi; - -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 org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings("all") public class gfac_cpi_serviceConstants { - - public static final String GFAC_CPI_VERSION = "0.13.0"; - -}
http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/handlers/AbstractSMSHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/handlers/AbstractSMSHandler.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/handlers/AbstractSMSHandler.java index 77057ee..7b369f7 100644 --- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/handlers/AbstractSMSHandler.java +++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/handlers/AbstractSMSHandler.java @@ -36,7 +36,7 @@ import org.apache.airavata.gfac.bes.utils.StorageCreator; import org.apache.airavata.gfac.core.context.JobExecutionContext; import org.apache.airavata.gfac.core.handler.GFacHandler; import org.apache.airavata.gfac.core.handler.GFacHandlerException; -import org.apache.airavata.gfac.core.utils.GFacUtils; +import org.apache.airavata.gfac.core.GFacUtils; import org.apache.airavata.model.appcatalog.computeresource.*; import org.apache.airavata.model.workspace.experiment.CorrectiveAction; import org.apache.airavata.model.workspace.experiment.ErrorCategory; http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java index bd98835..56d0679 100644 --- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java +++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java @@ -34,14 +34,10 @@ import org.apache.airavata.gfac.bes.utils.JSDLGenerator; import org.apache.airavata.gfac.bes.utils.SecurityUtils; import org.apache.airavata.gfac.bes.utils.StorageCreator; import org.apache.airavata.gfac.core.context.JobExecutionContext; -import org.apache.airavata.gfac.core.monitor.MonitorID; -import org.apache.airavata.gfac.core.notification.events.StartExecutionEvent; -import org.apache.airavata.gfac.core.notification.events.StatusChangeEvent; -import org.apache.airavata.gfac.core.notification.events.UnicoreJobIDEvent; import org.apache.airavata.gfac.core.provider.AbstractProvider; import org.apache.airavata.gfac.core.provider.GFacProvider; import org.apache.airavata.gfac.core.provider.GFacProviderException; -import org.apache.airavata.gfac.core.utils.GFacUtils; +import org.apache.airavata.gfac.core.GFacUtils; import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionInterface; import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol; import org.apache.airavata.model.appcatalog.computeresource.UnicoreJobSubmission; @@ -150,7 +146,6 @@ public class BESProvider extends AbstractProvider implements GFacProvider, log.info(String.format("Activity Submitting to %s ... \n", factoryUrl)); - jobExecutionContext.getMonitorPublisher().publish(new StartExecutionEvent()); CreateActivityResponseDocument response = factory.createActivity(cad); log.info(String.format("Activity Submitted to %s \n", factoryUrl)); http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/SecurityUtils.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/SecurityUtils.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/SecurityUtils.java index 74eefb4..ede44d4 100644 --- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/SecurityUtils.java +++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/SecurityUtils.java @@ -43,7 +43,7 @@ import org.apache.airavata.gfac.RequestData; import org.apache.airavata.gfac.bes.security.UNICORESecurityContext; import org.apache.airavata.gfac.bes.security.X509SecurityContext; import org.apache.airavata.gfac.core.context.JobExecutionContext; -import org.apache.airavata.gfac.core.utils.GFacUtils; +import org.apache.airavata.gfac.core.GFacUtils; import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.x500.X500Name; http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-client/pom.xml ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-client/pom.xml b/modules/gfac/gfac-client/pom.xml new file mode 100644 index 0000000..f94d85b --- /dev/null +++ b/modules/gfac/gfac-client/pom.xml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!--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> + <artifactId>gfac</artifactId> + <groupId>org.apache.airavata</groupId> + <version>0.16-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <name>Airavata Gfac Client SDK</name> + <artifactId>airavata-gfac-stubs</artifactId> + <packaging>jar</packaging> + <url>http://airavata.apache.org/</url> + + <dependencies> + <dependency> + <groupId>org.apache.thrift</groupId> + <artifactId>libthrift</artifactId> + <version>${thrift.version}</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>${org.slf4j.version}</version> + </dependency> + <dependency> + <groupId>org.apache.airavata</groupId> + <artifactId>airavata-data-models</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.airavata</groupId> + <artifactId>airavata-model-utils</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.airavata</groupId> + <artifactId>airavata-client-configuration</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + </properties> + +</project> http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-client/src/main/java/org/apache/airavata/gfac/client/GFACInstance.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-client/src/main/java/org/apache/airavata/gfac/client/GFACInstance.java b/modules/gfac/gfac-client/src/main/java/org/apache/airavata/gfac/client/GFACInstance.java new file mode 100644 index 0000000..0e1aa56 --- /dev/null +++ b/modules/gfac/gfac-client/src/main/java/org/apache/airavata/gfac/client/GFACInstance.java @@ -0,0 +1,62 @@ +/* + * + * 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.gfac.client; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This class represent the data related to gfac instances + * if orchestrator is running on non-embedded mode, + * This information can be used to do better load balancing between + * different gfac instances + */ +public class GFACInstance { + private final static Logger logger = LoggerFactory.getLogger(GFACInstance.class); + + private String gfacURL; + + private int currentLoad; + + private int gfacPort; + + + public GFACInstance(String gfacURL, int gfacPort) { + this.gfacURL = gfacURL; + this.gfacPort = gfacPort; + } + + public String getGfacURL() { + return gfacURL; + } + + public void setGfacURL(String gfacURL) { + this.gfacURL = gfacURL; + } + + public int getCurrentLoad() { + return currentLoad; + } + + public void setCurrentLoad(int currentLoad) { + this.currentLoad = currentLoad; + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-client/src/main/java/org/apache/airavata/gfac/client/GFacClientFactory.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-client/src/main/java/org/apache/airavata/gfac/client/GFacClientFactory.java b/modules/gfac/gfac-client/src/main/java/org/apache/airavata/gfac/client/GFacClientFactory.java new file mode 100644 index 0000000..89f751d --- /dev/null +++ b/modules/gfac/gfac-client/src/main/java/org/apache/airavata/gfac/client/GFacClientFactory.java @@ -0,0 +1,42 @@ +/* + * + * 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.gfac.client; + +import org.apache.airavata.gfac.cpi.GfacService; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.apache.thrift.transport.TTransportException; + +public class GFacClientFactory { + public static GfacService.Client createGFacClient(String serverHost, int serverPort){ + try { + TTransport transport = new TSocket(serverHost, serverPort); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + return new GfacService.Client(protocol); + } catch (TTransportException e) { + e.printStackTrace(); + } + return null; + } +}
