Revert "Revert "removing previous airavata client API - AIRAVATA-1371""
This reverts commit 2654424bd1470e11cccc03eb5c027e98561581e5. Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/6e5e336f Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/6e5e336f Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/6e5e336f Branch: refs/heads/gfac-storm Commit: 6e5e336fdc321dc6a38b50528c4aeb12477bcd08 Parents: 2654424 Author: Chathuri Wimalasena <[email protected]> Authored: Thu Jan 22 10:02:16 2015 -0500 Committer: Chathuri Wimalasena <[email protected]> Committed: Thu Jan 22 10:02:16 2015 -0500 ---------------------------------------------------------------------- modules/airavata-client/pom.xml | 88 - .../airavata/client/AiravataAPIFactory.java | 60 - .../airavata/client/AiravataAPIUtils.java | 86 - .../apache/airavata/client/AiravataClient.java | 353 --- .../client/AiravataClientConfiguration.java | 106 - .../client/RegistryServiceCallbackHandler.java | 79 - .../airavata/client/RegistryServiceStub.java | 975 -------- .../apache/airavata/client/api/AiravataAPI.java | 113 - .../airavata/client/api/AiravataManager.java | 137 -- .../client/api/AmazonWebServicesSettings.java | 38 - .../airavata/client/api/ApplicationManager.java | 284 --- .../org/apache/airavata/client/api/BaseAPI.java | 46 - .../client/api/CredentialStoreManager.java | 62 - .../api/CredentialStoreSecuritySettings.java | 69 - .../airavata/client/api/ExecutionManager.java | 207 -- .../client/api/ExperimentAdvanceOptions.java | 160 -- .../api/GridMyProxyRepositorySettings.java | 39 - .../apache/airavata/client/api/HPCSettings.java | 111 - .../client/api/HostSchedulingSettings.java | 71 - .../airavata/client/api/NodeSettings.java | 90 - .../airavata/client/api/OutputDataSettings.java | 90 - .../airavata/client/api/ProvenanceManager.java | 461 ---- .../client/api/SSHAuthenticationSettings.java | 30 - .../airavata/client/api/SecuritySettings.java | 31 - .../apache/airavata/client/api/UserManager.java | 31 - .../airavata/client/api/WorkflowManager.java | 477 ---- .../client/api/WorkflowOutputDataSettings.java | 65 - .../client/api/WorkflowSchedulingSettings.java | 79 - .../client/api/builder/DescriptorBuilder.java | 208 -- .../AiravataAPIInvocationException.java | 44 - .../AiravataAPIUnimplementedException.java | 33 - .../DescriptorAlreadyExistsException.java | 44 - .../WorkflowAlreadyExistsException.java | 43 - .../client/impl/AiravataManagerImpl.java | 310 --- .../impl/AmazonWebServicesSettingsImpl.java | 93 - .../client/impl/ApplicationManagerImpl.java | 497 ---- .../impl/ApplicationOutputDataSettingsImpl.java | 98 - .../client/impl/CredentialStoreManagerImpl.java | 79 - .../CredentialStoreSecuritySettingsImpl.java | 70 - .../client/impl/ExecutionManagerImpl.java | 419 ---- .../client/impl/ExecutionManagerThriftImpl.java | 467 ---- .../airavata/client/impl/HPCSettingsImpl.java | 108 - .../client/impl/HostSchedulingSettingsImpl.java | 71 - .../airavata/client/impl/NodeSettingsImpl.java | 108 - .../client/impl/PasswordCallBackImpl.java | 39 - .../client/impl/ProvenanceManagerImpl.java | 638 ------ .../client/impl/SecuritySettingsImpl.java | 46 - .../airavata/client/impl/UserManagerImpl.java | 45 - .../client/impl/WorkflowManagerImpl.java | 535 ----- .../impl/WorkflowOutputDataSettingsImpl.java | 78 - .../impl/WorkflowSchedulingSettingsImpl.java | 97 - .../client/stub/interpretor/NameValue.java | 559 ----- .../WorkflowInterpretorCallbackHandler.java | 72 - .../interpretor/WorkflowInterpretorStub.java | 2152 ------------------ .../airavata/client/tools/DocumentCreator.java | 898 -------- .../client/tools/DocumentCreatorNew.java | 823 ------- .../client/tools/DocumentCreatorUtils.java | 165 -- .../client/tools/NameValuePairType.java | 48 - .../client/tools/PeriodicExecutorThread.java | 61 - .../client/tools/UltrascanDocumentCreator.java | 444 ---- .../src/main/resources/RegistryService.wsdl | 92 - .../client/airavata/AiravataClientTest.java | 107 - modules/gfac/gfac-bes/pom.xml | 2 +- pom.xml | 2 - 64 files changed, 1 insertion(+), 14032 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/6e5e336f/modules/airavata-client/pom.xml ---------------------------------------------------------------------- diff --git a/modules/airavata-client/pom.xml b/modules/airavata-client/pom.xml deleted file mode 100644 index 72e7997..0000000 --- a/modules/airavata-client/pom.xml +++ /dev/null @@ -1,88 +0,0 @@ -<?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"> - <parent> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata</artifactId> - <version>0.15-SNAPSHOT</version> - <relativePath>../../pom.xml</relativePath> - </parent> - - <modelVersion>4.0.0</modelVersion> - <artifactId>airavata-client-api</artifactId> - <name>Airavata Client</name> - <description>Client API for accessing Airavata Services</description> - <url>http://airavata.apache.org/</url> - - <dependencies> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-api-stubs</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>app-catalog-cpi</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.axis2</groupId> - <artifactId>axis2-codegen</artifactId> - <version>${axis2.version}</version> - </dependency> - <dependency> - <groupId>org.apache.axis2</groupId> - <artifactId>axis2-adb-codegen</artifactId> - <version>${axis2.version}</version> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-workflow-model-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-workflow-execution-context</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>javax.jcr</groupId> - <artifactId>jcr</artifactId> - <version>${jcr.version}</version> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-client-configuration</artifactId> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-jpa-registry</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-message-monitor</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - - <build> - <resources> - <resource> - <directory>${pom.basedir}/target/generated/wsdl2code/resources</directory> - <includes> - <include>**/**</include> - </includes> - </resource> - </resources> - </build> - -</project> http://git-wip-us.apache.org/repos/asf/airavata/blob/6e5e336f/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIFactory.java ---------------------------------------------------------------------- diff --git a/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIFactory.java b/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIFactory.java deleted file mode 100644 index d2f87c0..0000000 --- a/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIFactory.java +++ /dev/null @@ -1,60 +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.client; - -import org.apache.airavata.client.api.AiravataAPI; -import org.apache.airavata.client.api.exception.AiravataAPIInvocationException; -import org.apache.airavata.common.utils.SecurityUtil; - -import java.net.URI; - -public class AiravataAPIFactory { - - public static AiravataAPI getAPI(String gateway, String username) throws AiravataAPIInvocationException{ - return getAPI(null, gateway, username); - } - - public static AiravataAPI getAPI(URI registryURL, String gateway, String username) throws AiravataAPIInvocationException{ - return getAPI(registryURL, gateway, username, username); - } - - public static AiravataAPI getAPI(URI registryURL, String gateway, String username, - String trustStoreFilePath, String trustStorePassword) - throws AiravataAPIInvocationException{ - - SecurityUtil.setTrustStoreParameters(trustStoreFilePath, trustStorePassword); - return getAPI(registryURL, gateway, username, username); - } - - public static AiravataAPI getAPI(URI registryURL, String gateway, String username, String alternateUsername) throws AiravataAPIInvocationException{ - try { - AiravataAPI apiObj = new AiravataClient(); - apiObj.setCurrentUser(alternateUsername); -// apiObj.setCallBack(callback); - apiObj.setRegitryURI(registryURL); - apiObj.setGateway(gateway); - apiObj.initialize(); - return apiObj; - } catch (Exception e) { - throw new AiravataAPIInvocationException(e); - } - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6e5e336f/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIUtils.java ---------------------------------------------------------------------- diff --git a/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIUtils.java b/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIUtils.java deleted file mode 100644 index 3889903..0000000 --- a/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIUtils.java +++ /dev/null @@ -1,86 +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.client; - -import java.util.List; - -import org.apache.airavata.client.api.ExperimentAdvanceOptions; -import org.apache.airavata.client.api.NodeSettings; -import org.apache.airavata.client.api.OutputDataSettings; -import org.apache.airavata.client.api.exception.AiravataAPIInvocationException; -import org.apache.airavata.client.tools.NameValuePairType; -import org.apache.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder; - -public class AiravataAPIUtils { - - //------------------Deprecated Functions---------------------// - - public static WorkflowContextHeaderBuilder createWorkflowContextHeader() - throws AiravataAPIInvocationException { - try { - return new WorkflowContextHeaderBuilder(null, - null,null,null,null,null); - } catch (Exception e) { - throw new AiravataAPIInvocationException(e); - } - } - - //------------------End of Deprecated Functions---------------------// - - public static WorkflowContextHeaderBuilder createWorkflowContextHeaderBuilder( - ExperimentAdvanceOptions options, String executionUser, String submissionUser) - throws AiravataAPIInvocationException { - WorkflowContextHeaderBuilder builder=createWorkflowContextHeader(); - builder.setUserIdentifier(executionUser); - builder.setSubmissionUser(submissionUser); - NodeSettings[] nodeSettingsList = options.getCustomWorkflowSchedulingSettings().getNodeSettingsList(); - for (NodeSettings nodeSettings : nodeSettingsList) { - List<NameValuePairType> nameValuePairTypes = nodeSettings.getNameValuePair(); - for (NameValuePairType nameValuePairType : nameValuePairTypes) { - builder.addApplicationSchedulingKeyPair(nodeSettings.getNodeId(),nameValuePairType.getName(), nameValuePairType.getValue(), nameValuePairType.getDescription()); - } - builder.addApplicationSchedulingContext(nodeSettings.getNodeId(), nodeSettings.getServiceId(), nodeSettings.getHostSettings().getHostId(), nodeSettings.getHostSettings().isWSGRAMPreffered(), nodeSettings.getHostSettings().getGatekeeperEPR(), nodeSettings.getHPCSettings().getJobManager(), nodeSettings.getHPCSettings().getCPUCount(), nodeSettings.getHPCSettings().getNodeCount(), nodeSettings.getHPCSettings().getQueueName(), nodeSettings.getHPCSettings().getMaxWallTime()); - - } - OutputDataSettings[] outputDataSettingsList = options.getCustomWorkflowOutputDataSettings().getOutputDataSettingsList(); - for (OutputDataSettings outputDataSettings : outputDataSettingsList) { - builder.addApplicationOutputDataHandling(outputDataSettings.getNodeId(),outputDataSettings.getOutputDataDirectory(), outputDataSettings.getDataRegistryUrl(), outputDataSettings.isDataPersistent()); - } - - if (options.getCustomSecuritySettings().getAmazonWSSettings().getAccessKeyId() != null) { - builder.setAmazonWebServices(options.getCustomSecuritySettings().getAmazonWSSettings().getAccessKeyId(), - options.getCustomSecuritySettings().getAmazonWSSettings().getSecretAccessKey()); - } - - if (options.getCustomSecuritySettings().getCredentialStoreSecuritySettings() != null) { - builder.setCredentialManagementService(options.getCustomSecuritySettings(). - getCredentialStoreSecuritySettings().getTokenId(), - options.getCustomSecuritySettings(). - getCredentialStoreSecuritySettings().getPortalUser(), - options.getCustomSecuritySettings(). - getCredentialStoreSecuritySettings().getGatewayId()); - } - - - return builder; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6e5e336f/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java ---------------------------------------------------------------------- diff --git a/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java b/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java deleted file mode 100644 index c5809cc..0000000 --- a/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java +++ /dev/null @@ -1,353 +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.client; - -import org.apache.airavata.client.api.*; -import org.apache.airavata.client.api.builder.DescriptorBuilder; -import org.apache.airavata.client.api.exception.AiravataAPIInvocationException; -import org.apache.airavata.client.impl.*; -import org.apache.airavata.common.exception.AiravataConfigurationException; -import org.apache.airavata.common.exception.ApplicationSettingsException; -import org.apache.airavata.common.utils.ServerSettings; -import org.apache.airavata.common.utils.Version; -import org.apache.airavata.workflow.model.wf.WorkflowInput; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.jcr.RepositoryException; -import java.net.MalformedURLException; -import java.net.URI; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Observable; - -public class AiravataClient extends Observable implements AiravataAPI { - - private static final Logger log = LoggerFactory - .getLogger(AiravataClient.class); - public static final String REGISTRY = "JCR"; - public static final String GFAC = "gfac"; - public static final String MSGBOX = "msgbox"; - public static final String BROKER = "broker"; - public static final String WITHLISTENER = "with.Listener"; - public static final String WORKFLOWSERVICEURL = "xbaya.service.url"; - private AiravataClientConfiguration clientConfiguration; - private String currentUser; - private URI regitryURI; - - private Map<String, String> configuration = new HashMap<String, String>(); - private AiravataManagerImpl airavataManagerImpl; -// private ApplicationManagerImpl applicationManagerImpl; - private WorkflowManagerImpl workflowManagerImpl; - private UserManagerImpl userManagerImpl; -// private ExecutionManagerThriftImpl executionManagerImpl; - private ExecutionManager executionManager; - - private CredentialStoreManagerImpl credentialStoreManagerImpl; - private String gateway; - private boolean configCreated = false; - - private static volatile boolean registryServiceStarted = false; - - private static int WAIT_TIME_PERIOD = 4 * 1000; - private static int WAIT_ITERATIONS = 15; - - private static final Version API_VERSION = new Version("Airavata", 0, 11, - null, null, null); - - // FIXME: Need a constructor to set registry URL - protected AiravataClient() { - } - - private static HashMap<String, String> createConfig(URI registryUrl, String gateway, - String username, String password) throws RepositoryException, - AiravataConfigurationException { - HashMap<String, String> config = new HashMap<String, String>(); - if (registryUrl != null) { - config.put(AiravataClient.REGISTRY, registryUrl.toString()); - } -// AiravataRegistry2 registryObject = getRegistry(registryUrl, gateway, -// username, new PasswordCallBackImpl(username, password)); -// if (registryObject != null) { -// URI uri = registryObject.getEventingServiceURI(); -// config.put( -// AiravataClient.BROKER, -// uri == null ? "http://localhost:8080/airavata-server/services/EventingService" -// : uri.toString()); -// uri = registryObject.getMessageBoxURI(); -// config.put( -// AiravataClient.MSGBOX, -// uri == null ? "http://localhost:8080/airavata-server/services/MsgBoxService" -// : uri.toString()); -// List<URI> URLList = registryObject.getWorkflowInterpreterURIs(); -// config.put( -// AiravataClient.WORKFLOWSERVICEURL, -// URLList == null || URLList.size() == 0 ? "http://localhost:8080/airavata-server/services/WorkflowInterpretor?wsdl" -// : URLList.get(0).toString()); -// List<URI> urlList = registryObject.getGFacURIs(); -// config.put( -// AiravataClient.GFAC, -// urlList == null || urlList.size() == 0 ? "http://localhost:8080/airavata-server/services/GFacService" -// : urlList.get(0).toString()); -// config.put(AiravataClient.WITHLISTENER, "true"); -// } - return config; - } - - @Override - public void initialize() throws AiravataAPIInvocationException { - -// if (AiravataUtils.isServer()) { -// waitTillRegistryServiceStarts(); -// } - } - - private String getRegistryWebServiceWSDLUrl() throws AiravataAPIInvocationException { - String registryUrl = null; - try { - registryUrl = ServerSettings.getSetting("registry.service.wsdl"); - } catch (ApplicationSettingsException e) { - String msg = "Configuration registry.service.wsdl is not specified in the configuration file"; - log.warn(msg); - log.debug(msg, e); - } - - if (registryUrl == null) { - String hostName = getRegitryURI().getHost(); - int port = getRegitryURI().getPort(); - String protocol = null; - try { - protocol = getRegitryURI().toURL().getProtocol(); - } catch (MalformedURLException e) { - String msg = "Error retrieving protocol from registry URI - " - + getRegitryURI().toString(); - log.error(msg, e); - throw new AiravataAPIInvocationException(msg, e); - } - - StringBuilder registryServiceUrlString = new StringBuilder(protocol); - registryServiceUrlString.append("://").append(hostName).append(":").append(port); - registryServiceUrlString.append("/axis2/services/RegistryService?wsdl"); - - registryUrl = registryServiceUrlString.toString(); - } - - return registryUrl; - } - - private void waitForRegistryServiceToStart(String url) throws AiravataAPIInvocationException { - - log.info("Registry service URL - " + url); - - int iterations = 0; - Exception exception = null; - - while (!registryServiceStarted) { - try { - RegistryServiceStub stub = - new RegistryServiceStub(url); - registryServiceStarted = stub.isRegistryServiceStarted().get_return(); - } catch (Exception e) { - exception = e; - } - - if (!registryServiceStarted) { - try { - if (iterations == WAIT_ITERATIONS) { - if (exception != null) { - throw new AiravataAPIInvocationException("Unable to connect to RegistryService. " + - "RegistryService may not have started", exception); - } else { - throw new AiravataAPIInvocationException("Unable to connect to RegistryService. " + - "RegistryService may not have started"); - } - - } else { - Thread.sleep(WAIT_TIME_PERIOD); - } - } catch (InterruptedException e1) { - log.info("Received an interrupted exception."); - } - - log.info("Attempting to contact registry service, iteration - " + iterations); - - ++iterations; - } - - } - - - } - -// private void updateClientConfiguration(Map<String, String> configuration) -// throws MalformedURLException { -// AiravataClientConfiguration clientConfiguration = getClientConfiguration(); -// if (configuration.get(GFAC) != null) { -// clientConfiguration.setGfacURL(new URL(configuration.get(GFAC))); -// } -// if (configuration.get(MSGBOX) != null) { -// clientConfiguration.setMessageboxURL(new URL(configuration -// .get(MSGBOX))); -// } -// if (configuration.get(BROKER) != null) { -// clientConfiguration.setMessagebrokerURL(new URL(configuration -// .get(BROKER))); -// } -// if (configuration.get(WORKFLOWSERVICEURL) != null) { -// clientConfiguration.setXbayaServiceURL(new URL(configuration -// .get(WORKFLOWSERVICEURL))); -// } -// if (configuration.get(MSGBOX) != null) { -// clientConfiguration.setMessageboxURL(new URL(configuration -// .get(MSGBOX))); -// } -// -// if (clientConfiguration.getRegistryURL() != null -// && clientConfiguration.getGfacURL() == null) { -// try { -// clientConfiguration.setGfacURL(getRegistryClient() -// .getGFacURIs().get(0).toURL()); -// configuration.put(GFAC, clientConfiguration.getGfacURL() -// .toString()); -// } catch (Exception e) { -// e.printStackTrace(); -// } -// } -// } - -// public AiravataRegistry2 getRegistryClient() -// throws AiravataConfigurationException, RegException { -// if (registry == null) { -// registry = getRegistry(getRegitryURI(), getGateway(), -// getCurrentUser(), getCallBack()); -// } -// return registry; -// } - -// public static AiravataRegistry2 getRegistry(URI registryURI, -// String gateway, String username, PasswordCallback callback) -// throws RegException, AiravataConfigurationException { -// return AiravataRegistryFactory.getRegistry(registryURI, new Gateway( -// gateway), new AiravataUser(username), callback); -// } - - public AiravataClientConfiguration getClientConfiguration() { - if (clientConfiguration == null) { - clientConfiguration = new AiravataClientConfiguration(); - } - return clientConfiguration; - } - - public AiravataManager getAiravataManager() { - if (airavataManagerImpl == null) { - airavataManagerImpl = new AiravataManagerImpl(this); - } - return airavataManagerImpl; - } - -// public ApplicationManager getApplicationManager() { -// if (applicationManagerImpl == null) { -// applicationManagerImpl = new ApplicationManagerImpl(this); -// } -// return applicationManagerImpl; -// } - - public WorkflowManager getWorkflowManager() { - if (workflowManagerImpl == null) { - workflowManagerImpl = new WorkflowManagerImpl(this); - } - return workflowManagerImpl; - } - - public UserManager getUserManager() { - if (userManagerImpl == null) { - userManagerImpl = new UserManagerImpl(this); - } - return userManagerImpl; - } - - public ExecutionManager getExecutionManager() { - if (executionManager == null){ - executionManager = new ExecutionManagerImpl(this); - } - return executionManager; - } - - @Override - public CredentialStoreManager getCredentialStoreManager() { - if(credentialStoreManagerImpl == null) - credentialStoreManagerImpl = new CredentialStoreManagerImpl(this); - return credentialStoreManagerImpl; - } - - private ExecutionManager getExecutionManagerObj(String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException { - Class<?> cls = Class.forName(className); - if (!ExecutionManager.class.isAssignableFrom(cls)) { - throw new IllegalArgumentException(); - } - return (ExecutionManager) cls.newInstance(); - } - - public String getCurrentUser() { - return currentUser; - } - - public Version getVersion() { - return API_VERSION; - } - - @Override - public DescriptorBuilder getDescriptorBuilder() { - return new DescriptorBuilder(); - } - - public void setCurrentUser(String currentUser) { - this.currentUser = currentUser; - } - - public void setRegitryURI(URI regitryURI) { - this.regitryURI = regitryURI; - } - - - public URI getRegitryURI() { - return regitryURI; - } - - public String getGateway() { - return gateway; - } - - public void setGateway(String gateway) { - this.gateway = gateway; - } - - public static void main(String[] args) throws Exception { - AiravataAPI api = AiravataAPIFactory.getAPI(new URI("http://localhost:8080/airavata/services/registry"), "default", "admin"); - ExperimentAdvanceOptions options = api.getExecutionManager().createExperimentAdvanceOptions(); - options.getCustomWorkflowSchedulingSettings().addNewNodeSettings("data1", "comma_app", 1, 1); - String workflow = "Workflow3"; - List<WorkflowInput> inputs = api.getWorkflowManager().getWorkflowInputs(workflow); - System.out.println(api.getExecutionManager().runExperiment(workflow, inputs,options)); - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6e5e336f/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClientConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClientConfiguration.java b/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClientConfiguration.java deleted file mode 100644 index c021c13..0000000 --- a/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClientConfiguration.java +++ /dev/null @@ -1,106 +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.client; - -import java.net.URL; - -public class AiravataClientConfiguration { - private URL gfacURL; - private String myproxyHost="myproxy.teragrid.org"; - private URL messageboxURL; - private URL messagebrokerURL; - private String myproxyUsername="ogce"; - private String myproxyPassword="testpassword"; - private URL xbayaServiceURL; - private URL jcrURL; - private String jcrUsername="admin"; - private String jcrPassword="admin"; - private String echoMessage="Hello World"; - - public URL getGfacURL() { - return gfacURL; - } - public void setGfacURL(URL gfacURL) { - this.gfacURL = gfacURL; - } - public String getMyproxyHost() { - return myproxyHost; - } - public void setMyproxyHost(String myproxyHost) { - this.myproxyHost = myproxyHost; - } - public URL getMessageboxURL() { - return messageboxURL; - } - public void setMessageboxURL(URL messageboxURL) { - this.messageboxURL = messageboxURL; - } - public URL getMessagebrokerURL() { - return messagebrokerURL; - } - public void setMessagebrokerURL(URL messagebrokerURL) { - this.messagebrokerURL = messagebrokerURL; - } - public String getMyproxyUsername() { - return myproxyUsername; - } - public void setMyproxyUsername(String myproxyUsername) { - this.myproxyUsername = myproxyUsername; - } - public String getMyproxyPassword() { - return myproxyPassword; - } - public void setMyproxyPassword(String myproxyPassword) { - this.myproxyPassword = myproxyPassword; - } - public URL getXbayaServiceURL() { - return xbayaServiceURL; - } - public void setXbayaServiceURL(URL xbayaServiceURL) { - this.xbayaServiceURL = xbayaServiceURL; - } - public URL getRegistryURL() { - return jcrURL; - } - public void setRegistryURL(URL jcrURL) { - this.jcrURL = jcrURL; - } - public String getJcrUsername() { - return jcrUsername; - } - public void setJcrUsername(String jcrUsername) { - this.jcrUsername = jcrUsername; - } - public String getJcrPassword() { - return jcrPassword; - } - public void setJcrPassword(String jcrPassword) { - this.jcrPassword = jcrPassword; - } - public String getEchoMessage() { - return echoMessage; - } - public void setEchoMessage(String echoMessage) { - this.echoMessage = echoMessage; - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6e5e336f/modules/airavata-client/src/main/java/org/apache/airavata/client/RegistryServiceCallbackHandler.java ---------------------------------------------------------------------- diff --git a/modules/airavata-client/src/main/java/org/apache/airavata/client/RegistryServiceCallbackHandler.java b/modules/airavata-client/src/main/java/org/apache/airavata/client/RegistryServiceCallbackHandler.java deleted file mode 100644 index 7264ce8..0000000 --- a/modules/airavata-client/src/main/java/org/apache/airavata/client/RegistryServiceCallbackHandler.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.client; - - /** - * RegistryServiceCallbackHandler Callback class, Users can extend this class and implement - * their own receiveResult and receiveError methods. - */ - public abstract class RegistryServiceCallbackHandler{ - - - - protected Object clientData; - - /** - * User can pass in any object that needs to be accessed once the NonBlocking - * Web service call is finished and appropriate method of this CallBack is called. - * @param clientData Object mechanism by which the user can pass in user data - * that will be avilable at the time this callback is called. - */ - public RegistryServiceCallbackHandler(Object clientData){ - this.clientData = clientData; - } - - /** - * Please use this constructor if you don't want to set any clientData - */ - public RegistryServiceCallbackHandler(){ - this.clientData = null; - } - - /** - * Get the client data - */ - - public Object getClientData() { - return clientData; - } - - - /** - * auto generated Axis2 call back method for isRegistryServiceStarted method - * override this method for handling normal response from isRegistryServiceStarted operation - */ - public void receiveResultisRegistryServiceStarted( - org.apache.airavata.client.RegistryServiceStub.IsRegistryServiceStartedResponse result - ) { - } - - /** - * auto generated Axis2 Error handler - * override this method for handling error response from isRegistryServiceStarted operation - */ - public void receiveErrorisRegistryServiceStarted(java.lang.Exception e) { - } - - - - } - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/6e5e336f/modules/airavata-client/src/main/java/org/apache/airavata/client/RegistryServiceStub.java ---------------------------------------------------------------------- diff --git a/modules/airavata-client/src/main/java/org/apache/airavata/client/RegistryServiceStub.java b/modules/airavata-client/src/main/java/org/apache/airavata/client/RegistryServiceStub.java deleted file mode 100644 index 41f569e..0000000 --- a/modules/airavata-client/src/main/java/org/apache/airavata/client/RegistryServiceStub.java +++ /dev/null @@ -1,975 +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. - * -*/ -/** - * RegistryServiceStub.java - * - * This file was auto-generated from WSDL - * by the Apache Axis2 version: 1.5.1 Built on : Oct 19, 2009 (10:59:00 EDT) - */ - package org.apache.airavata.client; - - - - /* - * RegistryServiceStub java implementation - */ - - - public class RegistryServiceStub extends org.apache.axis2.client.Stub - { - protected org.apache.axis2.description.AxisOperation[] _operations; - - //hashmaps to keep the fault mapping - private java.util.HashMap faultExceptionNameMap = new java.util.HashMap(); - private java.util.HashMap faultExceptionClassNameMap = new java.util.HashMap(); - private java.util.HashMap faultMessageMap = new java.util.HashMap(); - - private static int counter = 0; - - private static synchronized java.lang.String getUniqueSuffix(){ - // reset the counter if it is greater than 99999 - if (counter > 99999){ - counter = 0; - } - counter = counter + 1; - return java.lang.Long.toString(System.currentTimeMillis()) + "_" + counter; - } - - - private void populateAxisService() throws org.apache.axis2.AxisFault { - - //creating the Service with a unique name - _service = new org.apache.axis2.description.AxisService("RegistryService" + getUniqueSuffix()); - addAnonymousOperations(); - - //creating the operations - org.apache.axis2.description.AxisOperation __operation; - - _operations = new org.apache.axis2.description.AxisOperation[1]; - - __operation = new org.apache.axis2.description.OutInAxisOperation(); - - - __operation.setName(new javax.xml.namespace.QName("http://services.registry.airavata.apache.org", "isRegistryServiceStarted")); - _service.addOperation(__operation); - - - - - _operations[0]=__operation; - - - } - - //populates the faults - private void populateFaults(){ - - - - } - - /** - *Constructor that takes in a configContext - */ - - public RegistryServiceStub(org.apache.axis2.context.ConfigurationContext configurationContext, - java.lang.String targetEndpoint) - throws org.apache.axis2.AxisFault { - this(configurationContext,targetEndpoint,false); - } - - - /** - * Constructor that takes in a configContext and useseperate listner - */ - public RegistryServiceStub(org.apache.axis2.context.ConfigurationContext configurationContext, - java.lang.String targetEndpoint, boolean useSeparateListener) - throws org.apache.axis2.AxisFault { - //To populate AxisService - populateAxisService(); - populateFaults(); - - _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,_service); - - - _serviceClient.getOptions().setTo(new org.apache.axis2.addressing.EndpointReference( - targetEndpoint)); - _serviceClient.getOptions().setUseSeparateListener(useSeparateListener); - - //Set the soap version - _serviceClient.getOptions().setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); - - - } - - /** - * Default Constructor - */ - public RegistryServiceStub(org.apache.axis2.context.ConfigurationContext configurationContext) throws org.apache.axis2.AxisFault { - - this(configurationContext,"http://localhost:8080/axis2/services/RegistryService.RegistryServiceHttpSoap12Endpoint/" ); - - } - - /** - * Default Constructor - */ - public RegistryServiceStub() throws org.apache.axis2.AxisFault { - - this("http://localhost:8080/axis2/services/RegistryService.RegistryServiceHttpSoap12Endpoint/" ); - - } - - /** - * Constructor taking the target endpoint - */ - public RegistryServiceStub(java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault { - this(null,targetEndpoint); - } - - - - - /** - * Auto generated method signature - * - * @see org.apache.airavata.registry.services.RegistryService#isRegistryServiceStarted - */ - - - - public RegistryServiceStub.IsRegistryServiceStartedResponse isRegistryServiceStarted( - - ) - - - throws java.rmi.RemoteException - - { - org.apache.axis2.context.MessageContext _messageContext = null; - try{ - org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName()); - _operationClient.getOptions().setAction("urn:isRegistryServiceStarted"); - _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true); - - - - addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&"); - - - // create a message context - _messageContext = new org.apache.axis2.context.MessageContext(); - - - - // create SOAP envelope with that payload - org.apache.axiom.soap.SOAPEnvelope env = null; - - //Style is taken to be "document". No input parameters - // according to the WS-Basic profile in this case we have to send an empty soap message - org.apache.axiom.soap.SOAPFactory factory = getFactory(_operationClient.getOptions().getSoapVersionURI()); - env = factory.getDefaultEnvelope(); - - //adding SOAP soap_headers - _serviceClient.addHeadersToEnvelope(env); - // set the message context with that soap envelope - _messageContext.setEnvelope(env); - - // add the message contxt to the operation client - _operationClient.addMessageContext(_messageContext); - - //execute the operation client - _operationClient.execute(true); - - - org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext( - org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE); - org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope(); - - - java.lang.Object object = fromOM( - _returnEnv.getBody().getFirstElement() , - RegistryServiceStub.IsRegistryServiceStartedResponse.class, - getEnvelopeNamespaces(_returnEnv)); - - - return (RegistryServiceStub.IsRegistryServiceStartedResponse)object; - - }catch(org.apache.axis2.AxisFault f){ - - org.apache.axiom.om.OMElement faultElt = f.getDetail(); - if (faultElt!=null){ - if (faultExceptionNameMap.containsKey(faultElt.getQName())){ - //make the fault by reflection - try{ - java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(faultElt.getQName()); - java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName); - java.lang.Exception ex= - (java.lang.Exception) exceptionClass.newInstance(); - //message class - java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(faultElt.getQName()); - java.lang.Class messageClass = java.lang.Class.forName(messageClassName); - java.lang.Object messageObject = fromOM(faultElt,messageClass,null); - java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", - new java.lang.Class[]{messageClass}); - m.invoke(ex,new java.lang.Object[]{messageObject}); - - - throw new java.rmi.RemoteException(ex.getMessage(), ex); - }catch(java.lang.ClassCastException e){ - // we cannot intantiate the class - throw the original Axis fault - throw f; - } catch (java.lang.ClassNotFoundException e) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - }catch (java.lang.NoSuchMethodException e) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } catch (java.lang.reflect.InvocationTargetException e) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } catch (java.lang.IllegalAccessException e) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } catch (java.lang.InstantiationException e) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } - }else{ - throw f; - } - }else{ - throw f; - } - } finally { - _messageContext.getTransportOut().getSender().cleanup(_messageContext); - } - } - - /** - * Auto generated method signature for Asynchronous Invocations - * - * @see org.apache.airavata.registry.services.RegistryService#startisRegistryServiceStarted - */ - public void startisRegistryServiceStarted( - - - - final RegistryServiceCallbackHandler callback) - - throws java.rmi.RemoteException{ - - org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName()); - _operationClient.getOptions().setAction("urn:isRegistryServiceStarted"); - _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true); - - - - addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&"); - - - - // create SOAP envelope with that payload - org.apache.axiom.soap.SOAPEnvelope env=null; - final org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext(); - - - //Style is taken to be "document". No input parameters - // according to the WS-Basic profile in this case we have to send an empty soap message - org.apache.axiom.soap.SOAPFactory factory = getFactory(_operationClient.getOptions().getSoapVersionURI()); - env = factory.getDefaultEnvelope(); - - // adding SOAP soap_headers - _serviceClient.addHeadersToEnvelope(env); - // create message context with that soap envelope - _messageContext.setEnvelope(env); - - // add the message context to the operation client - _operationClient.addMessageContext(_messageContext); - - - - _operationClient.setCallback(new org.apache.axis2.client.async.AxisCallback() { - public void onMessage(org.apache.axis2.context.MessageContext resultContext) { - try { - org.apache.axiom.soap.SOAPEnvelope resultEnv = resultContext.getEnvelope(); - - java.lang.Object object = fromOM(resultEnv.getBody().getFirstElement(), - RegistryServiceStub.IsRegistryServiceStartedResponse.class, - getEnvelopeNamespaces(resultEnv)); - callback.receiveResultisRegistryServiceStarted( - (RegistryServiceStub.IsRegistryServiceStartedResponse)object); - - } catch (org.apache.axis2.AxisFault e) { - callback.receiveErrorisRegistryServiceStarted(e); - } - } - - public void onError(java.lang.Exception error) { - if (error instanceof org.apache.axis2.AxisFault) { - org.apache.axis2.AxisFault f = (org.apache.axis2.AxisFault) error; - org.apache.axiom.om.OMElement faultElt = f.getDetail(); - if (faultElt!=null){ - if (faultExceptionNameMap.containsKey(faultElt.getQName())){ - //make the fault by reflection - try{ - java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(faultElt.getQName()); - java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName); - java.lang.Exception ex= - (java.lang.Exception) exceptionClass.newInstance(); - //message class - java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(faultElt.getQName()); - java.lang.Class messageClass = java.lang.Class.forName(messageClassName); - java.lang.Object messageObject = fromOM(faultElt,messageClass,null); - java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", - new java.lang.Class[]{messageClass}); - m.invoke(ex,new java.lang.Object[]{messageObject}); - - - callback.receiveErrorisRegistryServiceStarted(new java.rmi.RemoteException(ex.getMessage(), ex)); - } catch(java.lang.ClassCastException e){ - // we cannot intantiate the class - throw the original Axis fault - callback.receiveErrorisRegistryServiceStarted(f); - } catch (java.lang.ClassNotFoundException e) { - // we cannot intantiate the class - throw the original Axis fault - callback.receiveErrorisRegistryServiceStarted(f); - } catch (java.lang.NoSuchMethodException e) { - // we cannot intantiate the class - throw the original Axis fault - callback.receiveErrorisRegistryServiceStarted(f); - } catch (java.lang.reflect.InvocationTargetException e) { - // we cannot intantiate the class - throw the original Axis fault - callback.receiveErrorisRegistryServiceStarted(f); - } catch (java.lang.IllegalAccessException e) { - // we cannot intantiate the class - throw the original Axis fault - callback.receiveErrorisRegistryServiceStarted(f); - } catch (java.lang.InstantiationException e) { - // we cannot intantiate the class - throw the original Axis fault - callback.receiveErrorisRegistryServiceStarted(f); - } catch (org.apache.axis2.AxisFault e) { - // we cannot intantiate the class - throw the original Axis fault - callback.receiveErrorisRegistryServiceStarted(f); - } - } else { - callback.receiveErrorisRegistryServiceStarted(f); - } - } else { - callback.receiveErrorisRegistryServiceStarted(f); - } - } else { - callback.receiveErrorisRegistryServiceStarted(error); - } - } - - public void onFault(org.apache.axis2.context.MessageContext faultContext) { - org.apache.axis2.AxisFault fault = org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(faultContext); - onError(fault); - } - - public void onComplete() { - try { - _messageContext.getTransportOut().getSender().cleanup(_messageContext); - } catch (org.apache.axis2.AxisFault axisFault) { - callback.receiveErrorisRegistryServiceStarted(axisFault); - } - } - }); - - - org.apache.axis2.util.CallbackReceiver _callbackReceiver = null; - if ( _operations[0].getMessageReceiver()==null && _operationClient.getOptions().isUseSeparateListener()) { - _callbackReceiver = new org.apache.axis2.util.CallbackReceiver(); - _operations[0].setMessageReceiver( - _callbackReceiver); - } - - //execute the operation client - _operationClient.execute(false); - - } - - - - /** - * A utility method that copies the namepaces from the SOAPEnvelope - */ - private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){ - java.util.Map returnMap = new java.util.HashMap(); - java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces(); - while (namespaceIterator.hasNext()) { - org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next(); - returnMap.put(ns.getPrefix(),ns.getNamespaceURI()); - } - return returnMap; - } - - - - private javax.xml.namespace.QName[] opNameArray = null; - private boolean optimizeContent(javax.xml.namespace.QName opName) { - - - if (opNameArray == null) { - return false; - } - for (int i = 0; i < opNameArray.length; i++) { - if (opName.equals(opNameArray[i])) { - return true; - } - } - return false; - } - //http://localhost:8080/axis2/services/RegistryService.RegistryServiceHttpSoap12Endpoint/ - public static class ExtensionMapper{ - - public static java.lang.Object getTypeObject(java.lang.String namespaceURI, - java.lang.String typeName, - javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ - - - throw new org.apache.axis2.databinding.ADBException("Unsupported type " + namespaceURI + " " + typeName); - } - - } - - public static class IsRegistryServiceStartedResponse - implements org.apache.axis2.databinding.ADBBean{ - - public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName( - "http://services.registry.airavata.apache.org", - "isRegistryServiceStartedResponse", - "ns1"); - - - - private static java.lang.String generatePrefix(java.lang.String namespace) { - if(namespace.equals("http://services.registry.airavata.apache.org")){ - return "ns1"; - } - return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); - } - - - - /** - * field for _return - */ - - - protected boolean local_return ; - - /* This tracker boolean wil be used to detect whether the user called the set method - * for this attribute. It will be used to determine whether to include this field - * in the serialized XML - */ - protected boolean local_returnTracker = false ; - - - /** - * Auto generated getter method - * @return boolean - */ - public boolean get_return(){ - return local_return; - } - - - - /** - * Auto generated setter method - * @param param _return - */ - public void set_return(boolean param){ - - // setting primitive attribute tracker to true - - if (false) { - local_returnTracker = false; - - } else { - local_returnTracker = true; - } - - this.local_return=param; - - - } - - - /** - * isReaderMTOMAware - * @return true if the reader supports MTOM - */ - public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) { - boolean isReaderMTOMAware = false; - - try{ - isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); - }catch(java.lang.IllegalArgumentException e){ - isReaderMTOMAware = false; - } - return isReaderMTOMAware; - } - - - /** - * - * @param parentQName - * @param factory - * @return org.apache.axiom.om.OMElement - */ - public org.apache.axiom.om.OMElement getOMElement ( - final javax.xml.namespace.QName parentQName, - final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ - - - - org.apache.axiom.om.OMDataSource dataSource = - new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME){ - - public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { - IsRegistryServiceStartedResponse.this.serialize(MY_QNAME,factory,xmlWriter); - } - }; - return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( - MY_QNAME,factory,dataSource); - - } - - public void serialize(final javax.xml.namespace.QName parentQName, - final org.apache.axiom.om.OMFactory factory, - org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) - throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ - serialize(parentQName,factory,xmlWriter,false); - } - - public void serialize(final javax.xml.namespace.QName parentQName, - final org.apache.axiom.om.OMFactory factory, - org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, - boolean serializeType) - throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ - - - - - java.lang.String prefix = null; - java.lang.String namespace = null; - - - prefix = parentQName.getPrefix(); - namespace = parentQName.getNamespaceURI(); - - if ((namespace != null) && (namespace.trim().length() > 0)) { - java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); - if (writerPrefix != null) { - xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); - } else { - if (prefix == null) { - prefix = generatePrefix(namespace); - } - - xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); - xmlWriter.writeNamespace(prefix, namespace); - xmlWriter.setPrefix(prefix, namespace); - } - } else { - xmlWriter.writeStartElement(parentQName.getLocalPart()); - } - - if (serializeType){ - - - java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://services.registry.airavata.apache.org"); - if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ - writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", - namespacePrefix+":isRegistryServiceStartedResponse", - xmlWriter); - } else { - writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", - "isRegistryServiceStartedResponse", - xmlWriter); - } - - - } - if (local_returnTracker){ - namespace = "http://services.registry.airavata.apache.org"; - if (! namespace.equals("")) { - prefix = xmlWriter.getPrefix(namespace); - - if (prefix == null) { - prefix = generatePrefix(namespace); - - xmlWriter.writeStartElement(prefix,"return", namespace); - xmlWriter.writeNamespace(prefix, namespace); - xmlWriter.setPrefix(prefix, namespace); - - } else { - xmlWriter.writeStartElement(namespace,"return"); - } - - } else { - xmlWriter.writeStartElement("return"); - } - - if (false) { - - throw new org.apache.axis2.databinding.ADBException("return cannot be null!!"); - - } else { - xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_return)); - } - - xmlWriter.writeEndElement(); - } - xmlWriter.writeEndElement(); - - - } - - /** - * Util method to write an attribute with the ns prefix - */ - private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, - java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ - if (xmlWriter.getPrefix(namespace) == null) { - xmlWriter.writeNamespace(prefix, namespace); - xmlWriter.setPrefix(prefix, namespace); - - } - - xmlWriter.writeAttribute(namespace,attName,attValue); - - } - - /** - * Util method to write an attribute without the ns prefix - */ - private void writeAttribute(java.lang.String namespace,java.lang.String attName, - java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ - if (namespace.equals("")) - { - xmlWriter.writeAttribute(attName,attValue); - } - else - { - registerPrefix(xmlWriter, namespace); - xmlWriter.writeAttribute(namespace,attName,attValue); - } - } - - - /** - * Util method to write an attribute without the ns prefix - */ - private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, - javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { - - java.lang.String attributeNamespace = qname.getNamespaceURI(); - java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); - if (attributePrefix == null) { - attributePrefix = registerPrefix(xmlWriter, attributeNamespace); - } - java.lang.String attributeValue; - if (attributePrefix.trim().length() > 0) { - attributeValue = attributePrefix + ":" + qname.getLocalPart(); - } else { - attributeValue = qname.getLocalPart(); - } - - if (namespace.equals("")) { - xmlWriter.writeAttribute(attName, attributeValue); - } else { - registerPrefix(xmlWriter, namespace); - xmlWriter.writeAttribute(namespace, attName, attributeValue); - } - } - /** - * method to handle Qnames - */ - - private void writeQName(javax.xml.namespace.QName qname, - javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { - java.lang.String namespaceURI = qname.getNamespaceURI(); - if (namespaceURI != null) { - java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); - if (prefix == null) { - prefix = generatePrefix(namespaceURI); - xmlWriter.writeNamespace(prefix, namespaceURI); - xmlWriter.setPrefix(prefix,namespaceURI); - } - - if (prefix.trim().length() > 0){ - xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); - } else { - // i.e this is the default namespace - xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); - } - - } else { - xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); - } - } - - private void writeQNames(javax.xml.namespace.QName[] qnames, - javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { - - if (qnames != null) { - // we have to store this data until last moment since it is not possible to write any - // namespace data after writing the charactor data - java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); - java.lang.String namespaceURI = null; - java.lang.String prefix = null; - - for (int i = 0; i < qnames.length; i++) { - if (i > 0) { - stringToWrite.append(" "); - } - namespaceURI = qnames[i].getNamespaceURI(); - if (namespaceURI != null) { - prefix = xmlWriter.getPrefix(namespaceURI); - if ((prefix == null) || (prefix.length() == 0)) { - prefix = generatePrefix(namespaceURI); - xmlWriter.writeNamespace(prefix, namespaceURI); - xmlWriter.setPrefix(prefix,namespaceURI); - } - - if (prefix.trim().length() > 0){ - stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); - } else { - stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); - } - } else { - stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); - } - } - xmlWriter.writeCharacters(stringToWrite.toString()); - } - - } - - - /** - * Register a namespace prefix - */ - private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { - java.lang.String prefix = xmlWriter.getPrefix(namespace); - - if (prefix == null) { - prefix = generatePrefix(namespace); - - while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { - prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); - } - - xmlWriter.writeNamespace(prefix, namespace); - xmlWriter.setPrefix(prefix, namespace); - } - - return prefix; - } - - - - /** - * databinding method to get an XML representation of this object - * - */ - public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) - throws org.apache.axis2.databinding.ADBException{ - - - - java.util.ArrayList elementList = new java.util.ArrayList(); - java.util.ArrayList attribList = new java.util.ArrayList(); - - if (local_returnTracker){ - elementList.add(new javax.xml.namespace.QName("http://services.registry.airavata.apache.org", - "return")); - - elementList.add( - org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_return)); - } - - return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); - - - - } - - - - /** - * Factory class that keeps the parse method - */ - public static class Factory{ - - - - - /** - * static method to create the object - * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable - * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element - * Postcondition: If this object is an element, the reader is positioned at its end element - * If this object is a complex type, the reader is positioned at the end element of its outer element - */ - public static IsRegistryServiceStartedResponse parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ - IsRegistryServiceStartedResponse object = - new IsRegistryServiceStartedResponse(); - - int event; - java.lang.String nillableValue = null; - java.lang.String prefix =""; - java.lang.String namespaceuri =""; - try { - - while (!reader.isStartElement() && !reader.isEndElement()) - reader.next(); - - - if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ - java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", - "type"); - if (fullTypeName!=null){ - java.lang.String nsPrefix = null; - if (fullTypeName.indexOf(":") > -1){ - nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); - } - nsPrefix = nsPrefix==null?"":nsPrefix; - - java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); - - if (!"isRegistryServiceStartedResponse".equals(type)){ - //find namespace for the prefix - java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); - return (IsRegistryServiceStartedResponse)ExtensionMapper.getTypeObject( - nsUri,type,reader); - } - - - } - - - } - - - - - // Note all attributes that were handled. Used to differ normal attributes - // from anyAttributes. - java.util.Vector handledAttributes = new java.util.Vector(); - - - - - reader.next(); - - - while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); - - if (reader.isStartElement() && new javax.xml.namespace.QName("http://services.registry.airavata.apache.org","return").equals(reader.getName())){ - - java.lang.String content = reader.getElementText(); - - object.set_return( - org.apache.axis2.databinding.utils.ConverterUtil.convertToBoolean(content)); - - reader.next(); - - } // End of if for expected property start element - - else { - - } - - while (!reader.isStartElement() && !reader.isEndElement()) - reader.next(); - - if (reader.isStartElement()) - // A start element we are not expecting indicates a trailing invalid property - throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); - - - - - } catch (javax.xml.stream.XMLStreamException e) { - throw new java.lang.Exception(e); - } - - return object; - } - - }//end of factory class - - - - } - - - private org.apache.axiom.om.OMElement toOM(RegistryServiceStub.IsRegistryServiceStartedResponse param, boolean optimizeContent) - throws org.apache.axis2.AxisFault { - - - try{ - return param.getOMElement(RegistryServiceStub.IsRegistryServiceStartedResponse.MY_QNAME, - org.apache.axiom.om.OMAbstractFactory.getOMFactory()); - } catch(org.apache.axis2.databinding.ADBException e){ - throw org.apache.axis2.AxisFault.makeFault(e); - } - - - } - - - - /** - * get the default envelope - */ - private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory){ - return factory.getDefaultEnvelope(); - } - - - private java.lang.Object fromOM( - org.apache.axiom.om.OMElement param, - java.lang.Class type, - java.util.Map extraNamespaces) throws org.apache.axis2.AxisFault{ - - try { - - if (RegistryServiceStub.IsRegistryServiceStartedResponse.class.equals(type)){ - - return RegistryServiceStub.IsRegistryServiceStartedResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching()); - - - } - - } catch (java.lang.Exception e) { - throw org.apache.axis2.AxisFault.makeFault(e); - } - return null; - } - - - - - } - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/6e5e336f/modules/airavata-client/src/main/java/org/apache/airavata/client/api/AiravataAPI.java ---------------------------------------------------------------------- diff --git a/modules/airavata-client/src/main/java/org/apache/airavata/client/api/AiravataAPI.java b/modules/airavata-client/src/main/java/org/apache/airavata/client/api/AiravataAPI.java deleted file mode 100644 index f4d2300..0000000 --- a/modules/airavata-client/src/main/java/org/apache/airavata/client/api/AiravataAPI.java +++ /dev/null @@ -1,113 +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.client.api; - -import java.net.URI; - -import org.apache.airavata.client.api.builder.DescriptorBuilder; -import org.apache.airavata.client.api.exception.AiravataAPIInvocationException; -import org.apache.airavata.common.utils.Version; - - -/** - * This is the base interface for AiravataAPI which contains all the base methods for Airavata API - */ -public interface AiravataAPI { - - /** - * Returns the AiravataManager - manage Airavata related configurations - * @return - */ - public AiravataManager getAiravataManager(); - - /** - * Returns the ApplicationManager - * @return - */ -// public ApplicationManager getApplicationManager(); - - /** - * Returns the WorkflowManager - * @return - */ - public WorkflowManager getWorkflowManager(); - - /** - * Returns the ProvenanceManager - * @return - */ -// public ProvenanceManager getProvenanceManager(); - - /** - * Returns the UserManager - * @return - */ - public UserManager getUserManager(); - - /** - * Returns the ExecutionManager - * @return - */ - public ExecutionManager getExecutionManager(); - - /** - * Returns the CredentialStoreManager - * @return - */ - public CredentialStoreManager getCredentialStoreManager(); - - /** - * Returns the Current User - * @return - */ - public String getCurrentUser(); - - /** - * Get Airavata API version - * @return - */ - public Version getVersion(); - - /** - * Gets the DescriptorBuilder. DescriptorBuilder is a helper class to create various descriptors. - * E.g :- Build HostDescriptors, ServiceDescriptors etc ... - * @return DescriptorBuilder. - */ - public DescriptorBuilder getDescriptorBuilder(); - - public void setCurrentUser(String alternateUsername); - -// public void setCallBack(PasswordCallback callback); - - public void setRegitryURI(URI registryURL); - - public void initialize() throws AiravataAPIInvocationException; - - public void setGateway(String gateway); - - /** - * Gets the gateway id. - * @return The gateway id. - */ - public String getGateway(); - -} \ No newline at end of file
