You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2012/09/10 17:34:58 UTC
svn commit: r1382946 - in /incubator/airavata/trunk/modules/gfac-core: ./
src/main/java/org/apache/airavata/core/gfac/
src/main/java/org/apache/airavata/core/gfac/extension/post/
src/main/java/org/apache/airavata/core/gfac/scheduler/impl/ src/main/java...
Author: lahiru
Date: Mon Sep 10 15:34:57 2012
New Revision: 1382946
URL: http://svn.apache.org/viewvc?rev=1382946&view=rev
Log:
using new registry implementation in gfac-core
Modified:
incubator/airavata/trunk/modules/gfac-core/pom.xml
incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/GfacAPI.java
incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/extension/post/OutputRegister.java
incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java
incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/PropertiesBasedServiceImpl.java
Modified: incubator/airavata/trunk/modules/gfac-core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/pom.xml?rev=1382946&r1=1382945&r2=1382946&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/pom.xml (original)
+++ incubator/airavata/trunk/modules/gfac-core/pom.xml Mon Sep 10 15:34:57 2012
@@ -150,6 +150,11 @@
<version>0.2.9</version>
<type>jar</type>
</dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-jpa-registry</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/GfacAPI.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/GfacAPI.java?rev=1382946&r1=1382945&r2=1382946&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/GfacAPI.java (original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/GfacAPI.java Mon Sep 10 15:34:57 2012
@@ -35,14 +35,11 @@ import org.apache.airavata.core.gfac.fac
import org.apache.airavata.core.gfac.notification.impl.LoggingNotification;
import org.apache.airavata.core.gfac.notification.impl.WorkflowTrackingNotification;
import org.apache.airavata.core.gfac.services.GenericService;
-import org.apache.airavata.registry.api.Axis2Registry;
import org.apache.airavata.schemas.gfac.*;
-import org.apache.airavata.schemas.wec.SecurityContextDocument;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.URI;
-import java.util.Map;
public class GfacAPI {
private static final Logger log = LoggerFactory.getLogger(GfacAPI.class +
@@ -81,7 +78,7 @@ public class GfacAPI {
/*
* Add workflow context
*/
- ServiceDescription serviceDescription = gfacConfig.getRegistry().getServiceDescription(jobContext.getServiceName());
+ ServiceDescription serviceDescription = gfacConfig.getRegistry().getServiceDescriptor(jobContext.getServiceName());
if(serviceDescription==null){
throw new RegistryException(new Exception("Service Description not found in registry."));
}
Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/extension/post/OutputRegister.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/extension/post/OutputRegister.java?rev=1382946&r1=1382945&r2=1382946&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/extension/post/OutputRegister.java (original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/extension/post/OutputRegister.java Mon Sep 10 15:34:57 2012
@@ -32,8 +32,8 @@ import org.apache.airavata.core.gfac.con
import org.apache.airavata.core.gfac.context.message.impl.WorkflowContextImpl;
import org.apache.airavata.core.gfac.exception.ExtensionException;
import org.apache.airavata.core.gfac.extension.PostExecuteChain;
+import org.apache.airavata.registry.api.AiravataRegistry2;
import org.apache.airavata.registry.api.DataRegistry;
-import org.apache.airavata.registry.api.AiravataRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,7 +52,7 @@ public class OutputRegister extends Post
MessageContext<String> workflowContext = context.getMessageContext(WorkflowContextImpl.WORKFLOW_CONTEXT_NAME);
// registry
- AiravataRegistry registry = context.getExecutionContext().getRegistryService();
+ AiravataRegistry2 registry = context.getExecutionContext().getRegistryService();
if (outputContext != null && workflowContext != null) {
Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java?rev=1382946&r1=1382945&r2=1382946&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java (original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java Mon Sep 10 15:34:57 2012
@@ -42,7 +42,7 @@ import org.apache.airavata.core.gfac.pro
import org.apache.airavata.core.gfac.provider.impl.LocalProvider;
import org.apache.airavata.core.gfac.scheduler.Scheduler;
import org.apache.airavata.core.gfac.utils.GfacUtils;
-import org.apache.airavata.registry.api.AiravataRegistry;
+import org.apache.airavata.registry.api.AiravataRegistry2;
import org.apache.airavata.schemas.wec.ApplicationSchedulingContextDocument;
import org.apache.airavata.schemas.wec.ContextHeaderDocument;
import org.apache.airavata.schemas.wec.SecurityContextDocument;
@@ -52,7 +52,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * This class selects {@link Provider} based on information in {@link AiravataRegistry}
+ * This class selects {@link Provider} based on information in {@link AiravataRegistry2}
*/
public class SchedulerImpl implements Scheduler {
@@ -61,14 +61,14 @@ public class SchedulerImpl implements Sc
public Provider schedule(InvocationContext context) throws SchedulerException {
- AiravataRegistry registryService = context.getExecutionContext().getRegistryService();
+ AiravataRegistry2 registryService = context.getExecutionContext().getRegistryService();
/*
* Load Service
*/
ServiceDescription serviceDesc = null;
try {
- serviceDesc = registryService.getServiceDescription(context.getServiceName());
+ serviceDesc = registryService.getServiceDescriptor(context.getServiceName());
} catch (RegistryException e2) {
e2.printStackTrace();
}
@@ -91,7 +91,7 @@ public class SchedulerImpl implements Sc
*/
ApplicationDeploymentDescription app = null;
try {
- app = registryService.getDeploymentDescription(context.getServiceName(),
+ app = registryService.getApplicationDescriptors(context.getServiceName(),
getRegisteredHost(registryService,context.getServiceName()).getType().getHostName());
} catch (RegistryException e2) {
e2.printStackTrace();
@@ -159,7 +159,7 @@ public class SchedulerImpl implements Sc
return null;
}
- private HostDescription scheduleToHost(AiravataRegistry regService, String serviceName) {
+ private HostDescription scheduleToHost(AiravataRegistry2 regService, String serviceName) {
// Since xbaya removes the other scheduling configuration here we only have pick the 0th element of the array
String hostName = null;
ContextHeaderDocument.ContextHeader currentContextHeader = WorkflowContextHeaderBuilder.getCurrentContextHeader();
@@ -177,7 +177,7 @@ public class SchedulerImpl implements Sc
if(hostName != null){
HostDescription hostDescription = null;
try {
- hostDescription = regService.getHostDescription(hostName);
+ hostDescription = regService.getHostDescriptor(hostName);
} catch (RegistryException e) {
e.printStackTrace();
log.warn("Wrong host Name provided in WorkflowContext Header");
@@ -205,13 +205,13 @@ public class SchedulerImpl implements Sc
// }
}
- private HostDescription getRegisteredHost(AiravataRegistry regService, String serviceName) {
- Map<HostDescription, List<ApplicationDeploymentDescription>> deploymentDescription;
+ private HostDescription getRegisteredHost(AiravataRegistry2 regService, String serviceName) {
HostDescription result = null;
try {
- deploymentDescription = regService.searchDeploymentDescription(serviceName);
- for (HostDescription hostDesc : deploymentDescription.keySet()) {
- result = hostDesc;
+ Map<String, ApplicationDeploymentDescription> applicationDescriptors = regService.getApplicationDescriptors(serviceName);
+ for (String hostDescName : applicationDescriptors.keySet()) {
+ HostDescription hostDescriptor = regService.getHostDescriptor(hostDescName);
+ result = hostDescriptor;
log.info("Found service on: " + result.getType().getHostAddress());
}
} catch (RegistryException e) {
Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/PropertiesBasedServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/PropertiesBasedServiceImpl.java?rev=1382946&r1=1382945&r2=1382946&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/PropertiesBasedServiceImpl.java (original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/PropertiesBasedServiceImpl.java Mon Sep 10 15:34:57 2012
@@ -42,8 +42,9 @@ import org.apache.airavata.core.gfac.ext
import org.apache.airavata.core.gfac.extension.PreExecuteChain;
import org.apache.airavata.core.gfac.scheduler.Scheduler;
import org.apache.airavata.core.gfac.utils.LogUtils;
-import org.apache.airavata.registry.api.AiravataRegistry;
+import org.apache.airavata.registry.api.AiravataRegistry2;
import org.apache.airavata.registry.api.impl.AiravataJCRRegistry;
+import org.apache.airavata.registry.api.util.RegistryUtils;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
@@ -57,6 +58,8 @@ import org.slf4j.LoggerFactory;
*/
public class PropertiesBasedServiceImpl extends AbstractSimpleService {
+ public static final String REPOSITORY_PROPERTIES = "repository.properties";
+
private static Logger log = LoggerFactory.getLogger(PropertiesBasedServiceImpl.class+
"." + WorkflowContextHeaderBuilder.getCurrentContextHeader().getWorkflowMonitoringContext().getExperimentId());
@@ -105,7 +108,7 @@ public class PropertiesBasedServiceImpl
private PreExecuteChain[] preChain;
private PostExecuteChain[] postChain;
private DataServiceChain[] dataChain;
- private AiravataRegistry registryService;
+ private AiravataRegistry2 registryService;
private String fileName = DEFAULT_FILENAME;
private Configuration config;
@@ -235,12 +238,7 @@ public class PropertiesBasedServiceImpl
if (map.size() == 0)
map = null;
- try {
- // TODO pass the url of the registry as the first parameter
- this.registryService = new AiravataJCRRegistry(null, jcrClass, userName, password, map);
- } catch (RegistryException e) {
- e.printStackTrace(); // To change body of catch statement use File | Settings | File Templates.
- }
+ this.registryService = RegistryUtils.getRegistryFromConfig(this.getClass().getClassLoader().getResource(REPOSITORY_PROPERTIES));
log.info("Default registry service is created");
}
@@ -255,7 +253,7 @@ public class PropertiesBasedServiceImpl
@Override
public void postProcess(InvocationContext context) throws ServiceException {
if(this.registryService != null)
- ((JCRRegistry)this.registryService).closeConnection();
+ ((AiravataRegistry2)this.registryService).closeConnection();
}
/*