adding data manager service
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/2d9483fd Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/2d9483fd Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/2d9483fd Branch: refs/heads/data-manager Commit: 2d9483fda419797731b1611c59909ee13f2006fb Parents: e7ebb14 Author: scnakandala <[email protected]> Authored: Tue Jan 12 13:08:57 2016 -0500 Committer: scnakandala <[email protected]> Committed: Tue Jan 12 13:08:57 2016 -0500 ---------------------------------------------------------------------- .../data-manager/data-manager-service/pom.xml | 24 + .../data/manager/server/DataManagerServer.java | 159 ++++ .../server/DataManagerServerHandler.java | 39 + .../airavata/data/manager/util/Constants.java | 27 + modules/data-manager/data-manager-stubs/pom.xml | 18 + .../data/manager/cpi/DataManagerService.java | 876 +++++++++++++++++++ .../manager/cpi/data_manager_cpiConstants.java | 57 ++ modules/data-manager/pom.xml | 2 + .../airavata/data/manager/DataManager.java | 57 -- .../data/manager/DataManagerFactory.java | 32 - .../airavata/data/manager/DataManagerImpl.java | 49 -- .../data/manager/DataManagerFactoryTest.java | 36 - .../component-cpis/data-manager-cpi.thrift | 38 + .../component-cpis/generate-cpi-stubs.sh | 8 + 14 files changed, 1248 insertions(+), 174 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/2d9483fd/modules/data-manager/data-manager-service/pom.xml ---------------------------------------------------------------------- diff --git a/modules/data-manager/data-manager-service/pom.xml b/modules/data-manager/data-manager-service/pom.xml new file mode 100644 index 0000000..ff00d83 --- /dev/null +++ b/modules/data-manager/data-manager-service/pom.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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"> + <parent> + <artifactId>data-manager</artifactId> + <groupId>org.apache.airavata</groupId> + <version>0.16-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>data-manager-service</artifactId> + <name>Airavata Data Manager Service</name> + <packaging>jar</packaging> + <url>http://airavata.apache.org/</url> + + <dependencies> + <dependency> + <groupId>org.apache.airavata</groupId> + <artifactId>data-manager-stubs</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/2d9483fd/modules/data-manager/data-manager-service/src/main/java/org/apache/airavata/data/manager/server/DataManagerServer.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/data-manager-service/src/main/java/org/apache/airavata/data/manager/server/DataManagerServer.java b/modules/data-manager/data-manager-service/src/main/java/org/apache/airavata/data/manager/server/DataManagerServer.java new file mode 100644 index 0000000..39b7178 --- /dev/null +++ b/modules/data-manager/data-manager-service/src/main/java/org/apache/airavata/data/manager/server/DataManagerServer.java @@ -0,0 +1,159 @@ +/* + * + * 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.data.manager.server; + +import org.apache.airavata.common.utils.IServer; +import org.apache.airavata.common.utils.ServerSettings; +import org.apache.airavata.data.manager.cpi.DataManagerService; +import org.apache.airavata.data.manager.util.Constants; +import org.apache.thrift.server.TServer; +import org.apache.thrift.server.TThreadPoolServer; +import org.apache.thrift.transport.TServerSocket; +import org.apache.thrift.transport.TServerTransport; +import org.apache.thrift.transport.TTransportException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.net.InetSocketAddress; + +public class DataManagerServer implements IServer { + + private final static Logger logger = LoggerFactory.getLogger(DataManagerServer.class); + private static final String SERVER_NAME = "Data Manager Server"; + private static final String SERVER_VERSION = "1.0"; + + private ServerStatus status; + + private TServer server; + + public DataManagerServer() { + setStatus(ServerStatus.STOPPED); + } + + public void StartDataManagerServer(DataManagerService.Processor<DataManagerServerHandler> orchestratorServerHandlerProcessor) + throws Exception { + try { + final int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.DATA_MANAGER_SERVER_PORT, "8990")); + + final String serverHost = ServerSettings.getSetting(Constants.DATA_MANAGER_SERVER_HOST, "localhost"); + + TServerTransport serverTransport; + + if(serverHost == null){ + serverTransport = new TServerSocket(serverPort); + }else{ + InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort); + serverTransport = new TServerSocket(inetSocketAddress); + } + + //server = new TSimpleServer( + // new TServer.Args(serverTransport).processor(orchestratorServerHandlerProcessor)); + TThreadPoolServer.Args options = new TThreadPoolServer.Args(serverTransport); + options.minWorkerThreads = Integer.parseInt(ServerSettings.getSetting(Constants.DATA_MANAGER_SERVER_MIN_THREADS, "30")); + server = new TThreadPoolServer(options.processor(orchestratorServerHandlerProcessor)); + + new Thread() { + public void run() { + server.serve(); + setStatus(ServerStatus.STOPPED); + logger.info("Data Manager Server Stopped."); + } + }.start(); + new Thread() { + public void run() { + while(!server.isServing()){ + try { + Thread.sleep(500); + } catch (InterruptedException e) { + break; + } + } + if (server.isServing()){ + setStatus(ServerStatus.STARTED); + logger.info("Starting Data Manager Server on Port " + serverPort); + logger.info("Listening to Data Manager Clients ...."); + } + } + }.start(); + } catch (TTransportException e) { + logger.error(e.getMessage()); + setStatus(ServerStatus.FAILED); + } + } + + public static void main(String[] args) { + try { + new DataManagerServer().start(); + } catch (Exception e) { + logger.error(e.getMessage(), e); + } + } + + @Override + public void start() throws Exception { + setStatus(ServerStatus.STARTING); + DataManagerService.Processor<DataManagerServerHandler> orchestratorService = + new DataManagerService.Processor<>(new DataManagerServerHandler()); + StartDataManagerServer(orchestratorService); + } + + @Override + public void stop() throws Exception { + if (server!=null && server.isServing()){ + setStatus(ServerStatus.STOPING); + server.stop(); + } + + } + + @Override + public void restart() throws Exception { + stop(); + start(); + } + + @Override + public void configure() throws Exception { + // TODO Auto-generated method stub + + } + + @Override + public ServerStatus getStatus() throws Exception { + return status; + } + + private void setStatus(ServerStatus stat){ + status=stat; + status.updateTime(); + } + + @Override + public String getName() { + return SERVER_NAME; + } + + @Override + public String getVersion() { + return SERVER_VERSION; + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/2d9483fd/modules/data-manager/data-manager-service/src/main/java/org/apache/airavata/data/manager/server/DataManagerServerHandler.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/data-manager-service/src/main/java/org/apache/airavata/data/manager/server/DataManagerServerHandler.java b/modules/data-manager/data-manager-service/src/main/java/org/apache/airavata/data/manager/server/DataManagerServerHandler.java new file mode 100644 index 0000000..0ac3080 --- /dev/null +++ b/modules/data-manager/data-manager-service/src/main/java/org/apache/airavata/data/manager/server/DataManagerServerHandler.java @@ -0,0 +1,39 @@ +/* + * + * 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.data.manager.server; + +import org.apache.airavata.data.manager.cpi.DataManagerService; +import org.apache.airavata.data.manager.cpi.data_manager_cpiConstants; +import org.apache.thrift.TException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DataManagerServerHandler implements DataManagerService.Iface { + private final static Logger logger = LoggerFactory.getLogger(DataManagerServerHandler.class); + + /** + * Query DM server to fetch the CPI version + */ + @Override + public String getDMServiceVersion() throws TException { + return data_manager_cpiConstants.DM_CPI_VERSION; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/2d9483fd/modules/data-manager/data-manager-service/src/main/java/org/apache/airavata/data/manager/util/Constants.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/data-manager-service/src/main/java/org/apache/airavata/data/manager/util/Constants.java b/modules/data-manager/data-manager-service/src/main/java/org/apache/airavata/data/manager/util/Constants.java new file mode 100644 index 0000000..2e6c25e --- /dev/null +++ b/modules/data-manager/data-manager-service/src/main/java/org/apache/airavata/data/manager/util/Constants.java @@ -0,0 +1,27 @@ +/* + * + * 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.data.manager.util; + +public class Constants { + public static final java.lang.String DATA_MANAGER_SERVER_PORT = "data.manager.port"; + public static final java.lang.String DATA_MANAGER_SERVER_HOST = "data.manager.host"; + public static final java.lang.String DATA_MANAGER_SERVER_MIN_THREADS = "data.manager.min.threads"; +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/2d9483fd/modules/data-manager/data-manager-stubs/pom.xml ---------------------------------------------------------------------- diff --git a/modules/data-manager/data-manager-stubs/pom.xml b/modules/data-manager/data-manager-stubs/pom.xml new file mode 100644 index 0000000..fea58fc --- /dev/null +++ b/modules/data-manager/data-manager-stubs/pom.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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"> + <parent> + <artifactId>data-manager</artifactId> + <groupId>org.apache.airavata</groupId> + <version>0.16-SNAPSHOT</version> + <relativePath>../modules/data-manager/pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + + <name>Airavata Data Manager Stubs</name> + <artifactId>data-manager-stubs</artifactId> + <packaging>jar</packaging> + <url>http://airavata.apache.org/</url> + +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/2d9483fd/modules/data-manager/data-manager-stubs/src/main/java/org/apache/airavata/data/manager/cpi/DataManagerService.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/data-manager-stubs/src/main/java/org/apache/airavata/data/manager/cpi/DataManagerService.java b/modules/data-manager/data-manager-stubs/src/main/java/org/apache/airavata/data/manager/cpi/DataManagerService.java new file mode 100644 index 0000000..dbc06ef --- /dev/null +++ b/modules/data-manager/data-manager-stubs/src/main/java/org/apache/airavata/data/manager/cpi/DataManagerService.java @@ -0,0 +1,876 @@ + /* + * 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.data.manager.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 javax.annotation.Generated; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-01-12") +public class DataManagerService { + + public interface Iface { + + /** + * Query DM server to fetch the CPI version + */ + public String getDMServiceVersion() throws org.apache.thrift.TException; + + } + + public interface AsyncIface { + + public void getDMServiceVersion(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> { + public Factory() {} + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) + { + super(prot, prot); + } + + public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public String getDMServiceVersion() throws org.apache.thrift.TException + { + send_getDMServiceVersion(); + return recv_getDMServiceVersion(); + } + + public void send_getDMServiceVersion() throws org.apache.thrift.TException + { + getDMServiceVersion_args args = new getDMServiceVersion_args(); + sendBase("getDMServiceVersion", args); + } + + public String recv_getDMServiceVersion() throws org.apache.thrift.TException + { + getDMServiceVersion_result result = new getDMServiceVersion_result(); + receiveBase(result, "getDMServiceVersion"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getDMServiceVersion failed: unknown result"); + } + + } + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { + public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void getDMServiceVersion(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + getDMServiceVersion_call method_call = new getDMServiceVersion_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class getDMServiceVersion_call extends org.apache.thrift.async.TAsyncMethodCall { + public getDMServiceVersion_call(org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getDMServiceVersion", org.apache.thrift.protocol.TMessageType.CALL, 0)); + getDMServiceVersion_args args = new getDMServiceVersion_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_getDMServiceVersion(); + } + } + + } + + public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); + public Processor(I iface) { + super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>())); + } + + protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) { + super(iface, getProcessMap(processMap)); + } + + private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) { + processMap.put("getDMServiceVersion", new getDMServiceVersion()); + return processMap; + } + + public static class getDMServiceVersion<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getDMServiceVersion_args> { + public getDMServiceVersion() { + super("getDMServiceVersion"); + } + + public getDMServiceVersion_args getEmptyArgsInstance() { + return new getDMServiceVersion_args(); + } + + protected boolean isOneway() { + return false; + } + + public getDMServiceVersion_result getResult(I iface, getDMServiceVersion_args args) throws org.apache.thrift.TException { + getDMServiceVersion_result result = new getDMServiceVersion_result(); + result.success = iface.getDMServiceVersion(); + return result; + } + } + + } + + public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> { + private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); + public AsyncProcessor(I iface) { + super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor(I iface, Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) { + super(iface, getProcessMap(processMap)); + } + + private static <I extends AsyncIface> Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase,?>> getProcessMap(Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) { + processMap.put("getDMServiceVersion", new getDMServiceVersion()); + return processMap; + } + + public static class getDMServiceVersion<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getDMServiceVersion_args, String> { + public getDMServiceVersion() { + super("getDMServiceVersion"); + } + + public getDMServiceVersion_args getEmptyArgsInstance() { + return new getDMServiceVersion_args(); + } + + public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<String>() { + public void onComplete(String o) { + getDMServiceVersion_result result = new getDMServiceVersion_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + getDMServiceVersion_result result = new getDMServiceVersion_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, getDMServiceVersion_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException { + iface.getDMServiceVersion(resultHandler); + } + } + + } + + public static class getDMServiceVersion_args implements org.apache.thrift.TBase<getDMServiceVersion_args, getDMServiceVersion_args._Fields>, java.io.Serializable, Cloneable, Comparable<getDMServiceVersion_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getDMServiceVersion_args"); + + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getDMServiceVersion_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getDMServiceVersion_argsTupleSchemeFactory()); + } + + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { +; + + 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) { + 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; + } + } + 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); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getDMServiceVersion_args.class, metaDataMap); + } + + public getDMServiceVersion_args() { + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getDMServiceVersion_args(getDMServiceVersion_args other) { + } + + public getDMServiceVersion_args deepCopy() { + return new getDMServiceVersion_args(this); + } + + @Override + public void clear() { + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + 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) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getDMServiceVersion_args) + return this.equals((getDMServiceVersion_args)that); + return false; + } + + public boolean equals(getDMServiceVersion_args that) { + if (that == null) + return false; + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + return list.hashCode(); + } + + @Override + public int compareTo(getDMServiceVersion_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + 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("getDMServiceVersion_args("); + boolean first = true; + + 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 getDMServiceVersion_argsStandardSchemeFactory implements SchemeFactory { + public getDMServiceVersion_argsStandardScheme getScheme() { + return new getDMServiceVersion_argsStandardScheme(); + } + } + + private static class getDMServiceVersion_argsStandardScheme extends StandardScheme<getDMServiceVersion_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getDMServiceVersion_args 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) { + 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, getDMServiceVersion_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getDMServiceVersion_argsTupleSchemeFactory implements SchemeFactory { + public getDMServiceVersion_argsTupleScheme getScheme() { + return new getDMServiceVersion_argsTupleScheme(); + } + } + + private static class getDMServiceVersion_argsTupleScheme extends TupleScheme<getDMServiceVersion_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getDMServiceVersion_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getDMServiceVersion_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + + } + + public static class getDMServiceVersion_result implements org.apache.thrift.TBase<getDMServiceVersion_result, getDMServiceVersion_result._Fields>, java.io.Serializable, Cloneable, Comparable<getDMServiceVersion_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getDMServiceVersion_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getDMServiceVersion_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getDMServiceVersion_resultTupleSchemeFactory()); + } + + public String success; // 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 { + SUCCESS((short)0, "success"); + + 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 0: // SUCCESS + return SUCCESS; + 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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", 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(getDMServiceVersion_result.class, metaDataMap); + } + + public getDMServiceVersion_result() { + } + + public getDMServiceVersion_result( + String success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getDMServiceVersion_result(getDMServiceVersion_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public getDMServiceVersion_result deepCopy() { + return new getDMServiceVersion_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public getDMServiceVersion_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + 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 SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getDMServiceVersion_result) + return this.equals((getDMServiceVersion_result)that); + return false; + } + + public boolean equals(getDMServiceVersion_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) + list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(getDMServiceVersion_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + 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("getDMServiceVersion_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + 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 getDMServiceVersion_resultStandardSchemeFactory implements SchemeFactory { + public getDMServiceVersion_resultStandardScheme getScheme() { + return new getDMServiceVersion_resultStandardScheme(); + } + } + + private static class getDMServiceVersion_resultStandardScheme extends StandardScheme<getDMServiceVersion_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getDMServiceVersion_result 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 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(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, getDMServiceVersion_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getDMServiceVersion_resultTupleSchemeFactory implements SchemeFactory { + public getDMServiceVersion_resultTupleScheme getScheme() { + return new getDMServiceVersion_resultTupleScheme(); + } + } + + private static class getDMServiceVersion_resultTupleScheme extends TupleScheme<getDMServiceVersion_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getDMServiceVersion_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getDMServiceVersion_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + } + +} http://git-wip-us.apache.org/repos/asf/airavata/blob/2d9483fd/modules/data-manager/data-manager-stubs/src/main/java/org/apache/airavata/data/manager/cpi/data_manager_cpiConstants.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/data-manager-stubs/src/main/java/org/apache/airavata/data/manager/cpi/data_manager_cpiConstants.java b/modules/data-manager/data-manager-stubs/src/main/java/org/apache/airavata/data/manager/cpi/data_manager_cpiConstants.java new file mode 100644 index 0000000..6e58187 --- /dev/null +++ b/modules/data-manager/data-manager-stubs/src/main/java/org/apache/airavata/data/manager/cpi/data_manager_cpiConstants.java @@ -0,0 +1,57 @@ + /* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * 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.data.manager.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 javax.annotation.Generated; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +public class data_manager_cpiConstants { + + public static final String DM_CPI_VERSION = "0.16.0"; + +} http://git-wip-us.apache.org/repos/asf/airavata/blob/2d9483fd/modules/data-manager/pom.xml ---------------------------------------------------------------------- diff --git a/modules/data-manager/pom.xml b/modules/data-manager/pom.xml index eb81d40..c501099 100644 --- a/modules/data-manager/pom.xml +++ b/modules/data-manager/pom.xml @@ -18,6 +18,8 @@ <modules> <module>data-manager-cpi</module> <module>data-manager-core</module> + <module>data-manager-service</module> + <module>data-manager-stubs</module> </modules> <dependencies> <dependency> http://git-wip-us.apache.org/repos/asf/airavata/blob/2d9483fd/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManager.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManager.java b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManager.java deleted file mode 100644 index 7451a94..0000000 --- a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManager.java +++ /dev/null @@ -1,57 +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.data.manager; - -import org.apache.airavata.model.data.resource.ResourceModel; - -public interface DataManager { - - /** - * To create a replica entry for an already existing file(s). This is how the system comes to know about already - * existing resources - * @param resource - * @return - */ - boolean publishResource(ResourceModel resource); - - /** - * To remove a resource entry from the replica catalog - * @param resourceId - * @return - */ - boolean removeResource(String resourceId); - - /** - * To copy an already existing resource to a specified location. After successful copying the new location will be - * added to the available replica locations of the resource - * @param resourceId - * @param destLocation - * @return - */ - boolean copyResource(String resourceId, String destLocation); - - /** - * To retrieve a resource object providing the resourceId - * @param resourceId - * @return - */ - ResourceModel getResource(String resourceId); -} http://git-wip-us.apache.org/repos/asf/airavata/blob/2d9483fd/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerFactory.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerFactory.java b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerFactory.java deleted file mode 100644 index e1fb18a..0000000 --- a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerFactory.java +++ /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. - * -*/ -package org.apache.airavata.data.manager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class DataManagerFactory { - private final static Logger logger = LoggerFactory.getLogger(DataManagerFactory.class); - - public static DataManager getDataManager(){ - return new DataManagerImpl(); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/2d9483fd/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerImpl.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerImpl.java b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerImpl.java deleted file mode 100644 index fb92edf..0000000 --- a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerImpl.java +++ /dev/null @@ -1,49 +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.data.manager; - -import org.apache.airavata.model.data.resource.ResourceModel; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class DataManagerImpl implements DataManager{ - private final static Logger logger = LoggerFactory.getLogger(DataManagerImpl.class); - - @Override - public boolean publishResource(ResourceModel resource) { - return false; - } - - @Override - public boolean removeResource(String resourceId) { - return false; - } - - @Override - public boolean copyResource(String resourceId, String destLocation) { - return false; - } - - @Override - public ResourceModel getResource(String resourceId) { - return null; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/2d9483fd/modules/data-manager/src/test/java/org/apache/airavata/data/manager/DataManagerFactoryTest.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/src/test/java/org/apache/airavata/data/manager/DataManagerFactoryTest.java b/modules/data-manager/src/test/java/org/apache/airavata/data/manager/DataManagerFactoryTest.java deleted file mode 100644 index aa10724..0000000 --- a/modules/data-manager/src/test/java/org/apache/airavata/data/manager/DataManagerFactoryTest.java +++ /dev/null @@ -1,36 +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.data.manager; - -import junit.framework.Assert; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class DataManagerFactoryTest { - private final static Logger logger = LoggerFactory.getLogger(DataManagerFactoryTest.class); - - @Test - public void testCreateDataManager(){ - DataManager dataManager = DataManagerFactory.getDataManager(); - Assert.assertNotNull(dataManager); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/2d9483fd/thrift-interface-descriptions/component-cpis/data-manager-cpi.thrift ---------------------------------------------------------------------- diff --git a/thrift-interface-descriptions/component-cpis/data-manager-cpi.thrift b/thrift-interface-descriptions/component-cpis/data-manager-cpi.thrift new file mode 100644 index 0000000..f830033 --- /dev/null +++ b/thrift-interface-descriptions/component-cpis/data-manager-cpi.thrift @@ -0,0 +1,38 @@ +/* + * 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. + * + */ + +/* + * Component Programming Interface definition for Apache Airavata GFac Service. + * +*/ + +include "../data-models/data-manager-models/metadata_models.thrift" +include "../data-models/data-manager-models/replica_models.thrift" + +namespace java org.apache.airavata.data.manager.cpi + +const string DM_CPI_VERSION = "0.16.0" + +service DataManagerService { + + /** Query DM server to fetch the CPI version */ + string getDMServiceVersion(), + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/2d9483fd/thrift-interface-descriptions/component-cpis/generate-cpi-stubs.sh ---------------------------------------------------------------------- diff --git a/thrift-interface-descriptions/component-cpis/generate-cpi-stubs.sh b/thrift-interface-descriptions/component-cpis/generate-cpi-stubs.sh index cdfa67b..c99bd25 100755 --- a/thrift-interface-descriptions/component-cpis/generate-cpi-stubs.sh +++ b/thrift-interface-descriptions/component-cpis/generate-cpi-stubs.sh @@ -24,6 +24,7 @@ show_usage() { echo -e "\tcs Generate/Update Credential Store Stubs" echo -e "\torch Generate/Update Orchestrator Stubs" echo -e "\tgfac Generate/Update GFac Stubs" + echo -e "\tdm Generate/Update Data Manager Stubs" echo -e "\tall Generate/Update all stubs (Credential Store, Orchestrator, GFac)." echo -e "\t-h[elp] Print the usage options of this script" } @@ -63,6 +64,9 @@ BASE_TARGET_DIR='target' CS_THRIFT_FILE='credential-store-cpi.thrift' CS_SRC_DIR='../../modules/credential-store/credential-store-stubs/src/main/java' +DM_THRIFT_FILE='data-manager-cpi.thrift' +DM_SRC_DIR='../../modules/data-manager/data-manager-stubs/src/main/java' + ORCHESTRATOR_THRIFT_FILE='orchestrator-cpi.thrift' ORCHESTRATOR_SRC_DIR='../../modules/orchestrator/orchestrator-client/src/main/java' @@ -171,6 +175,7 @@ do generate_thrift_stubs ${CS_THRIFT_FILE} ${CS_SRC_DIR} generate_thrift_stubs ${ORCHESTRATOR_THRIFT_FILE} ${ORCHESTRATOR_SRC_DIR} generate_thrift_stubs ${GFAC_THRIFT_FILE} ${GFAC_SRC_DIR} + generate_thrift_stubs ${DM_THRIFT_FILE} ${DM_SRC_DIR} ;; cs) echo "Generating Credential Store Stubs" generate_thrift_stubs ${CS_THRIFT_FILE} ${CS_SRC_DIR} @@ -181,6 +186,9 @@ do gfac) echo "Generate GFac Stubs" generate_thrift_stubs ${GFAC_THRIFT_FILE} ${GFAC_SRC_DIR} ;; + dm) echo "Generate Data Manager Stubs" + generate_thrift_stubs ${DM_THRIFT_FILE} ${DM_SRC_DIR} + ;; *) echo "Invalid or unsupported option" show_usage exit 1
