Trying to solve transaction issue on context creation/removal

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@131099 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2016-09-05 07:05:48 +00:00
parent 1666affe61
commit deb3727baf
3 changed files with 10 additions and 4 deletions

View File

@ -110,7 +110,8 @@ public class SecurityContext {
DatabaseEnvironment.DEFAULT_PASSWORDS.get(SecurityContextMapper.PermissionMode.READER),
readerRole);
orientGraph.commit();
// Commit MUST BE invoked in caller method
//orientGraph.commit();
}
public static void deleteSecurityContext(OrientGraph orientGraph,
@ -134,7 +135,8 @@ public class SecurityContext {
SecurityContextMapper.PermissionMode.WRITER,
SecurityContextMapper.SecurityType.ROLE, contextID));
orientGraph.commit();
// Commit MUST BE invoked in caller method
//orientGraph.commit();
logger.trace("Security Context (roles and users) with UUID {} successfully removed", contextID);

View File

@ -9,6 +9,7 @@ import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.tinkerpop.blueprints.impls.orient.OrientGraph;
import com.tinkerpop.blueprints.impls.orient.OrientGraphFactory;
/**
@ -47,10 +48,13 @@ public abstract class SecurityContextMapper {
}
if(created){
SecurityContext.createSecurityContext(factory.getTx(), MANAGEMENT_SECURITY_CONTEXT);
OrientGraph orientGraph = factory.getTx();
SecurityContext.createSecurityContext(orientGraph, MANAGEMENT_SECURITY_CONTEXT);
orientGraph.commit();
getSecurityContextFactory(MANAGEMENT_SECURITY_CONTEXT, PermissionMode.READER);
getSecurityContextFactory(MANAGEMENT_SECURITY_CONTEXT, PermissionMode.WRITER);
DatabaseIntializator.createEntitiesAndRelations();
}

View File

@ -11,7 +11,7 @@ echo ""
# Creating VO
VO_NAME="myVO"
echo "Going to create Context with name ${VO_NAME} as child of ${ROOT_UUID} (${ROOT_NAME})"
VO_UUID=$(curl -H gcube-scope:/gcube/devNext -X PUT http://localhost:8080/resource-registry/context?name=${VO_NAME}?parentContextId=${ROOT_UUID})
VO_UUID=$(curl -H gcube-scope:/gcube/devNext -X PUT http://localhost:8080/resource-registry/context?name=${VO_NAME}&parentContextId=${ROOT_UUID})
echo "Created Context ${VO_NAME} has UUID ${VO_UUID} as child of ${ROOT_UUID} (${ROOT_NAME})"
echo ""
echo ""