[Swift-commit] cog r3444
swift at ci.uchicago.edu
swift at ci.uchicago.edu
Thu Aug 2 01:50:03 CDT 2012
------------------------------------------------------------------------
r3444 | hategan | 2012-08-02 01:46:31 -0500 (Thu, 02 Aug 2012) | 1 line
new security context stuff
------------------------------------------------------------------------
Index: modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/ServiceNode.java
===================================================================
--- modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/ServiceNode.java (revision 3443)
+++ modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/ServiceNode.java (working copy)
@@ -12,6 +12,7 @@
import org.apache.log4j.Logger;
import org.globus.cog.abstraction.impl.common.AbstractionFactory;
import org.globus.cog.abstraction.impl.common.AbstractionProperties;
+import org.globus.cog.abstraction.impl.common.InteractivePasswordSecurityContextImpl;
import org.globus.cog.abstraction.impl.common.task.ExecutionServiceImpl;
import org.globus.cog.abstraction.impl.common.task.ServiceContactImpl;
import org.globus.cog.abstraction.impl.common.task.ServiceImpl;
@@ -88,6 +89,15 @@
if (A_PROJECT.isPresent(stack)) {
service.setAttribute("project", TypeUtil.toString(A_PROJECT.getValue(stack)));
}
+
+ String uri = null;
+ uri = TypeUtil.toString(A_URI.getValue(stack));
+ if (uri == null) {
+ uri = TypeUtil.toString(A_URL.getValue(stack));
+ }
+ if (uri != null) {
+ service.setServiceContact(new ServiceContactImpl(uri));
+ }
SecurityContext sc = (SecurityContext) A_SECURITY_CONTEXT.getValue(stack);
if (sc == null) {
@@ -101,7 +111,7 @@
}
if (sc == null) {
try {
- sc = AbstractionFactory.newSecurityContext(provider);
+ sc = AbstractionFactory.getSecurityContext(provider, service.getServiceContact());
stack.setGlobal(scName, sc);
}
catch (Exception e1) {
@@ -112,16 +122,13 @@
}
}
}
+ else {
+ if (sc instanceof InteractivePasswordSecurityContextImpl) {
+ ((InteractivePasswordSecurityContextImpl) sc).setHostName(uri);
+ }
+ }
service.setSecurityContext(sc);
service.setType(itype);
- String uri = null;
- uri = TypeUtil.toString(A_URI.getValue(stack));
- if (uri == null) {
- uri = TypeUtil.toString(A_URL.getValue(stack));
- }
- if (uri != null) {
- service.setServiceContact(new ServiceContactImpl(uri));
- }
return service;
}
}
\ No newline at end of file
Index: modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/AbstractGridNode.java
===================================================================
--- modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/AbstractGridNode.java (revision 3443)
+++ modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/AbstractGridNode.java (working copy)
@@ -25,6 +25,7 @@
import org.globus.cog.abstraction.impl.common.task.ServiceImpl;
import org.globus.cog.abstraction.interfaces.SecurityContext;
import org.globus.cog.abstraction.interfaces.Service;
+import org.globus.cog.abstraction.interfaces.ServiceContact;
import org.globus.cog.abstraction.interfaces.Status;
import org.globus.cog.abstraction.interfaces.StatusListener;
import org.globus.cog.abstraction.interfaces.Task;
@@ -118,22 +119,21 @@
private void addDefaultServices(BoundContact bc, String contact, String provider)
throws ExecutionException {
+
+ ServiceContact serviceContact = new ServiceContactImpl(contact);
SecurityContext sc = null;
if (provider != null) {
try {
- sc = AbstractionFactory.newSecurityContext(provider);
+ sc = AbstractionFactory.getSecurityContext(provider, serviceContact);
}
catch (Exception e) {
throw new ExecutionException("Could not get default security context for provider "
+ provider, e);
}
}
- bc.addService(new ServiceImpl(provider, Service.EXECUTION, new ServiceContactImpl(contact),
- sc));
- bc.addService(new ServiceImpl(provider, Service.FILE_OPERATION, new ServiceContactImpl(
- contact), sc));
- bc.addService(new ServiceImpl(provider, Service.FILE_TRANSFER, new ServiceContactImpl(
- contact), sc));
+ bc.addService(new ServiceImpl(provider, Service.EXECUTION, serviceContact, sc));
+ bc.addService(new ServiceImpl(provider, Service.FILE_OPERATION, serviceContact, sc));
+ bc.addService(new ServiceImpl(provider, Service.FILE_TRANSFER, serviceContact, sc));
}
public static final Arg A_SECURITY_CONTEXT = new Arg.TypedPositional("securityContext",
@@ -334,7 +334,7 @@
}
}
- protected SecurityContext getSecurityContext(VariableStack stack, String provider)
+ protected SecurityContext getSecurityContext(VariableStack stack, String provider, ServiceContact serviceContact)
throws InvalidProviderException, ProviderMethodException, ExecutionException {
if (A_SECURITY_CONTEXT.isPresent(stack)) {
return (SecurityContext) A_SECURITY_CONTEXT.getValue(stack);
@@ -344,7 +344,7 @@
SecurityContext.class, "Security Context");
}
else {
- return AbstractionFactory.newSecurityContext(provider);
+ return AbstractionFactory.getSecurityContext(provider, serviceContact);
}
}
}
\ No newline at end of file
Index: modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/SecurityContextNode.java
===================================================================
--- modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/SecurityContextNode.java (revision 3443)
+++ modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/SecurityContextNode.java (working copy)
@@ -32,7 +32,7 @@
if (context == null) {
String provider = TypeUtil.toString(A_PROVIDER.getValue(stack));
try {
- context = AbstractionFactory.newSecurityContext(provider);
+ context = AbstractionFactory.getSecurityContext(provider, null);
}
catch (Exception e) {
throw new ExecutionException("Unsupported security context type: " + provider, e);
Index: modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/AbstractFileOperation.java
===================================================================
--- modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/AbstractFileOperation.java (revision 3443)
+++ modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/AbstractFileOperation.java (working copy)
@@ -56,8 +56,9 @@
}
if (scheduler == null) {
- task.setService(0, getService((BoundContact) host, provider));
- SecurityContext sc = getSecurityContext(stack, provider);
+ Service service = getService((BoundContact) host, provider);
+ task.setService(0, service);
+ SecurityContext sc = getSecurityContext(stack, provider, service.getServiceContact());
setSecurityContextIfNotLocal(task.getService(0), sc);
synchronized (this.getClass()) {
if (handler == null) {
Index: modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/GridTransfer.java
===================================================================
--- modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/GridTransfer.java (revision 3443)
+++ modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/GridTransfer.java (working copy)
@@ -164,8 +164,8 @@
+ destinationContact);
}
- setSecurityContextIfNotLocal(s, getSecurityContext(stack, s.getProvider()));
- setSecurityContextIfNotLocal(d, getSecurityContext(stack, d.getProvider()));
+ setSecurityContextIfNotLocal(s, getSecurityContext(stack, s.getProvider(), s.getServiceContact()));
+ setSecurityContextIfNotLocal(d, getSecurityContext(stack, d.getProvider(), d.getServiceContact()));
task.setService(Service.FILE_TRANSFER_SOURCE_SERVICE, s);
task.setService(Service.FILE_TRANSFER_DESTINATION_SERVICE, d);
More information about the Swift-commit
mailing list