Reverted some changes

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@134084 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2016-11-11 11:01:12 +00:00
parent dfb9d513ce
commit 38eedcea37
3 changed files with 10 additions and 27 deletions

View File

@ -36,7 +36,7 @@ import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx;
* @author Luca Frosini (ISTI - CNR)
*
*/
public abstract class ContextUtility {
public class ContextUtility {
private static final Logger logger = LoggerFactory
.getLogger(ContextUtility.class);
@ -86,9 +86,8 @@ public abstract class ContextUtility {
}
return authorizationEntry.getContext();
}
public static Vertex getActualContextVertex() throws ContextNotFoundException, ContextException{
OrientGraphNoTx orientGraphNoTx = null;
public static UUID getActualContextUUID() throws ContextException {
try {
String scope = getCurrentScope();
if(scope==null){
@ -99,30 +98,14 @@ public abstract class ContextUtility {
.getSecurityContextFactory(
SecurityContextMapper.ADMIN_SECURITY_CONTEXT_UUID,
PermissionMode.READER);
orientGraphNoTx = factory.getNoTx();
return ContextUtility.getContextVertexByFullName(orientGraphNoTx, scope);
} catch (ContextNotFoundException e) {
throw e;
} catch (Exception e) {
throw new ContextException(
"Unable to restrive Context Vertex for current Context", e);
} finally{
if(orientGraphNoTx!=null){
orientGraphNoTx.shutdown();
}
}
}
public static UUID getActualContextUUID() throws ContextException {
try {
Vertex context = getActualContextVertex();
Vertex context = ContextUtility.getContextVertexByFullName(
factory.getTx(), scope);
return getContextUUIDFromContextVertex(context);
} catch (ContextException e) {
throw e;
} catch (Exception e) {
throw new ContextException(
"Unable to restrive Context UUID for current Context", e);
"Unable to restrive Context UUID from current Context", e);
}
}
@ -183,7 +166,7 @@ public abstract class ContextUtility {
}
}
public static Vertex getContextVertexByFullName(OrientGraphNoTx orientGraphNoTx,
public static Vertex getContextVertexByFullName(OrientGraph orientGraph,
String fullName) throws ContextNotFoundException {
logger.trace("Going to get {} {} from full name '{}'", Context.NAME, Vertex.class.getSimpleName(), fullName);
@ -199,7 +182,7 @@ public abstract class ContextUtility {
;
OSQLSynchQuery<Vertex> osqlSynchQuery = new OSQLSynchQuery<Vertex>(
select);
Iterable<Vertex> vertexes = orientGraphNoTx.command(osqlSynchQuery)
Iterable<Vertex> vertexes = orientGraph.command(osqlSynchQuery)
.execute();
if (vertexes == null || !vertexes.iterator().hasNext()) {

View File

@ -23,7 +23,7 @@ import com.tinkerpop.blueprints.Vertex;
* @author Luca Frosini (ISTI - CNR)
*
*/
public abstract class HeaderUtility {
public class HeaderUtility {
private static final Logger logger = LoggerFactory
.getLogger(HeaderUtility.class);

View File

@ -33,7 +33,7 @@ import com.tinkerpop.blueprints.util.io.graphson.GraphSONUtility;
* @author Luca Frosini (ISTI - CNR)
*
*/
public abstract class Utility {
public class Utility {
private static final Logger logger = LoggerFactory.getLogger(Utility.class);