git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vre-management/VREModeler@5178 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
6a6c8daed7
commit
6c8f513884
|
@ -5,6 +5,7 @@ import java.rmi.RemoteException;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
@ -20,8 +21,14 @@ import org.gcube.common.core.contexts.GHNContext;
|
||||||
import org.gcube.common.core.faults.GCUBEFault;
|
import org.gcube.common.core.faults.GCUBEFault;
|
||||||
import org.gcube.common.core.informationsystem.client.ISClient;
|
import org.gcube.common.core.informationsystem.client.ISClient;
|
||||||
import org.gcube.common.core.informationsystem.client.ISQuery;
|
import org.gcube.common.core.informationsystem.client.ISQuery;
|
||||||
|
import org.gcube.common.core.informationsystem.client.queries.GCUBECSQuery;
|
||||||
import org.gcube.common.core.informationsystem.client.queries.GCUBECollectionQuery;
|
import org.gcube.common.core.informationsystem.client.queries.GCUBECollectionQuery;
|
||||||
|
import org.gcube.common.core.informationsystem.client.queries.GCUBEGHNQuery;
|
||||||
|
import org.gcube.common.core.informationsystem.client.queries.GCUBEMCollectionQuery;
|
||||||
|
import org.gcube.common.core.resources.GCUBECS;
|
||||||
import org.gcube.common.core.resources.GCUBECollection;
|
import org.gcube.common.core.resources.GCUBECollection;
|
||||||
|
import org.gcube.common.core.resources.GCUBEHostingNode;
|
||||||
|
import org.gcube.common.core.resources.GCUBEMCollection;
|
||||||
import org.gcube.common.core.resources.GCUBEResource;
|
import org.gcube.common.core.resources.GCUBEResource;
|
||||||
import org.gcube.common.core.scope.GCUBEScope;
|
import org.gcube.common.core.scope.GCUBEScope;
|
||||||
import org.gcube.common.core.utils.logging.GCUBELog;
|
import org.gcube.common.core.utils.logging.GCUBELog;
|
||||||
|
@ -33,6 +40,11 @@ import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author lucio lelii CNR
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class IStoDBUtil {
|
public class IStoDBUtil {
|
||||||
|
|
||||||
private static UUIDGen uuidMFGEN=UUIDGenFactory.getUUIDGen();
|
private static UUIDGen uuidMFGEN=UUIDGenFactory.getUUIDGen();
|
||||||
|
@ -41,34 +53,34 @@ public class IStoDBUtil {
|
||||||
|
|
||||||
private static ISClient queryClient;
|
private static ISClient queryClient;
|
||||||
/**
|
/**
|
||||||
* Itialize all database tables
|
* Initialize all database tables
|
||||||
*
|
*
|
||||||
* @param epr
|
* @param GCUBEScope the scope
|
||||||
*/
|
*/
|
||||||
public static void initDB(EndpointReferenceType epr, ExtendedGSSCredential cred) throws RemoteException{
|
public static void initDB(GCUBEScope scope) throws GCUBEFault{
|
||||||
|
|
||||||
cleanDB();
|
cleanDB();
|
||||||
insertCollection(epr, cred);
|
insertCollection(scope);
|
||||||
//logger.debug("initialization: collection");
|
//logger.debug("initialization: collection");
|
||||||
insertMetadataCollection(epr, cred);
|
insertMetadataCollection(scope);
|
||||||
//logger.debug("initialization: metadata");
|
//logger.debug("initialization: metadata");
|
||||||
insertCS(epr, cred);
|
insertCS(scope);
|
||||||
//logger.debug("initialization: cs");
|
//logger.debug("initialization: cs");
|
||||||
insertServices(epr, cred);
|
insertServices(scope);
|
||||||
insertDHN(epr, cred);
|
insertGHN(scope);
|
||||||
//logger.debug("initialization: DHN");
|
//logger.debug("initialization: DHN");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void cleanDB() throws RemoteException
|
private static void cleanDB() throws GCUBEFault
|
||||||
{
|
{
|
||||||
try{
|
try{
|
||||||
DBInterface.connect();
|
DBInterface.connect();
|
||||||
DBInterface.deleteAll("DLRELATEDCOLLECTION");
|
DBInterface.deleteAll("VRERELATEDCOLLECTION");
|
||||||
DBInterface.deleteAll("DLRELATEDCS");
|
DBInterface.deleteAll("VRERELATEDCS");
|
||||||
DBInterface.deleteAll("DLRELATEDMETADATAFORMAT");
|
DBInterface.deleteAll("VRERELATEDMETADATAFORMAT");
|
||||||
DBInterface.deleteAll("DLRELATEDFUNCT");
|
DBInterface.deleteAll("VRERELATEDFUNCT");
|
||||||
DBInterface.deleteAll("DLRELATEDDHN");
|
DBInterface.deleteAll("VRERELATEDDHN");
|
||||||
DBInterface.deleteAll("DL");
|
DBInterface.deleteAll("VRE");
|
||||||
DBInterface.deleteAll("nativemdf");
|
DBInterface.deleteAll("nativemdf");
|
||||||
DBInterface.deleteAll("derivablemdf");
|
DBInterface.deleteAll("derivablemdf");
|
||||||
DBInterface.deleteAll("mdformat");
|
DBInterface.deleteAll("mdformat");
|
||||||
|
@ -80,7 +92,7 @@ public class IStoDBUtil {
|
||||||
DBInterface.deleteAll("dhnrelatedri");
|
DBInterface.deleteAll("dhnrelatedri");
|
||||||
DBInterface.deleteAll("cs");
|
DBInterface.deleteAll("cs");
|
||||||
}catch (SQLException e){//logger.error("error cleaning DB");
|
}catch (SQLException e){//logger.error("error cleaning DB");
|
||||||
e.printStackTrace(); throw new RemoteException(e.getMessage(),e); }
|
e.printStackTrace(); throw new GCUBEFault(e); }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,30 +186,46 @@ public class IStoDBUtil {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param epr
|
|
||||||
* @throws RemoteException
|
|
||||||
*/
|
|
||||||
private static void insertCollection(GCUBEScope scope) throws GCUBEFault {
|
private static void insertCollection(GCUBEScope scope) throws GCUBEFault {
|
||||||
|
|
||||||
List<GCUBECollection> collectionList= null;
|
List<GCUBECollection> collectionList= null;
|
||||||
try{
|
try{
|
||||||
if (queryClient==null) queryClient= GHNContext.getImplementation(ISClient.class);
|
if (queryClient==null) queryClient= GHNContext.getImplementation(ISClient.class);
|
||||||
GCUBECollectionQuery query= queryClient.getQuery(GCUBECollectionQuery.class);
|
GCUBECollectionQuery query= queryClient.getQuery(GCUBECollectionQuery.class);
|
||||||
|
query.addGenericCondition("$result/Profile/IsUserCollection[string(@value) eq 'true']");
|
||||||
collectionList= queryClient.execute(query, scope);
|
collectionList= queryClient.execute(query, scope);
|
||||||
}catch(Exception e ){logger.error("Error queryng IS"); throw new GCUBEFault(e); }
|
}catch(Exception e ){logger.error("Error queryng IS"); throw new GCUBEFault(e); }
|
||||||
|
|
||||||
try{
|
try{
|
||||||
if (collectionList.size()!=0){
|
if (collectionList.size()!=0){
|
||||||
|
//preparing collectionList to insert
|
||||||
|
//table declaration:
|
||||||
|
//COLLECTION(ID VARCHAR NOT NULL PRIMARY KEY,NAME VARCHAR,DESCRIPTION VARCHAR,MEMBERS VARCHAR,CREATION VARCHAR,LASTUPDATE VARCHAR)
|
||||||
|
List<List<String>> values = new LinkedList<List<String>>();
|
||||||
|
List<String> row;
|
||||||
|
for (GCUBECollection col: collectionList ){
|
||||||
|
row= new LinkedList<String>();
|
||||||
|
row.add(col.getID());
|
||||||
|
row.add(col.getName());
|
||||||
|
row.add(col.getDescription());
|
||||||
|
row.add(col.getNumberOfMembers()+"");
|
||||||
|
row.add(col.getCreationTime().getTime().getTime()+"");
|
||||||
|
row.add(col.getLastUpdateTime().getTime().getTime()+"");
|
||||||
|
values.add(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
//insert the values in the database
|
||||||
DBInterface.connect();
|
DBInterface.connect();
|
||||||
DBInterface.InsertInto("collection", collectionList, false);
|
DBInterface.InsertInto("collection", values);
|
||||||
}
|
}
|
||||||
}catch (SQLException e){//logger.error("VDLModel: DB error "+e.getMessage());
|
}catch (SQLException e){logger.error("VDLModel: DB error "+e.getMessage());
|
||||||
throw new GCUBEFault(e); }
|
throw new GCUBEFault(e); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
private static String[] ParseTP(String[] tp){
|
private static String[] ParseTP(String[] tp){
|
||||||
//logger.debug("ParseTP start");
|
//logger.debug("ParseTP start");
|
||||||
|
|
||||||
|
@ -207,12 +235,7 @@ public class IStoDBUtil {
|
||||||
return new String[]{tp[0],schemaNameURI[0],schemaNameURI[1],lng};
|
return new String[]{tp[0],schemaNameURI[0],schemaNameURI[1],lng};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param item
|
|
||||||
* @param container
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private static String ContainsControl(String[] item, ArrayList<String[]> container){
|
private static String ContainsControl(String[] item, ArrayList<String[]> container){
|
||||||
for(String[] cont: container){
|
for(String[] cont: container){
|
||||||
//logger.debug("MDFormat: "+cont[1]+" "+cont[2]);
|
//logger.debug("MDFormat: "+cont[1]+" "+cont[2]);
|
||||||
|
@ -224,29 +247,49 @@ public class IStoDBUtil {
|
||||||
//logger.debug("MDFormat: not yet present");
|
//logger.debug("MDFormat: not yet present");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param epr
|
* @param epr
|
||||||
* @throws RemoteException
|
* @throws RemoteException
|
||||||
*/
|
*/
|
||||||
private static void insertMetadataCollection(EndpointReferenceType epr, ExtendedGSSCredential cred) throws RemoteException {
|
private static void insertMetadataCollection(GCUBEScope scope) throws GCUBEFault {
|
||||||
ResultSet res=null;
|
|
||||||
String tempQuery="";
|
|
||||||
try {
|
|
||||||
DBInterface.connect();
|
|
||||||
res = DBInterface.queryDB("select id from collection");
|
|
||||||
while(res.next())
|
|
||||||
tempQuery+=" $CollectionProfile/Profile/RelatedCollection/CollectionID/string() eq '"+res.getString(1)+"' or ";
|
|
||||||
tempQuery=tempQuery.substring(0, tempQuery.length()-4);
|
|
||||||
} catch (SQLException e1) {
|
|
||||||
//logger.error("VDLModel: initialization error on inserMetadataCollection");
|
|
||||||
throw new RemoteException("VDLModel: initialization error on inserMetadataCollection",e1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
List<GCUBEMCollection> collectionList;
|
||||||
String MDcollectionQuery= "for $CollectionProfile in collection(\"/db/Profiles/MetadataCollection\")//Document/Data/child::*[local-name()='Profile']/DILIGENTResource where "+tempQuery+" return <r><Id>{$CollectionProfile/UniqueID/string()}</Id><Name>{$CollectionProfile/Profile/Name/string()}</Name><Description>{$CollectionProfile/Profile/Description/string()}</Description><RelatedCollectionId>{$CollectionProfile/Profile/RelatedCollection/CollectionID/string()}</RelatedCollectionId></r>";
|
try{
|
||||||
String results=makeQueryDIS(epr, cred, MDcollectionQuery);
|
if (queryClient==null) queryClient= GHNContext.getImplementation(ISClient.class);
|
||||||
|
GCUBEMCollectionQuery query= queryClient.getQuery(GCUBEMCollectionQuery.class);
|
||||||
|
query.addGenericCondition("$result/Profile/IsUserCollection[string(@value) eq 'true']");
|
||||||
|
collectionList= queryClient.execute(query, scope);
|
||||||
|
}catch(Exception e ){logger.error("Error queryng IS"); throw new GCUBEFault(e); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try{
|
||||||
|
if (collectionList.size()!=0){
|
||||||
|
//preparing collectionList to insert
|
||||||
|
//table declaration:
|
||||||
|
//MDCOLLECTION(ID VARCHAR NOT NULL PRIMARY KEY,NAME VARCHAR,DESCRIPTION VARCHAR,RELATEDCOLLECTIONID VARCHAR NOT NULL)
|
||||||
|
List<List<String>> values = new LinkedList<List<String>>();
|
||||||
|
List<String> row;
|
||||||
|
for (GCUBEMCollection col: collectionList ){
|
||||||
|
row= new LinkedList<String>();
|
||||||
|
row.add(col.getID());
|
||||||
|
row.add(col.getName());
|
||||||
|
row.add(col.getDescription());
|
||||||
|
row.add(col.getRelCollection().getCollectionID());
|
||||||
|
values.add(row);
|
||||||
|
}
|
||||||
|
//insert the values in the database
|
||||||
|
DBInterface.connect();
|
||||||
|
DBInterface.InsertInto("mdcollection", values);
|
||||||
|
}
|
||||||
|
}catch (SQLException e){logger.error("VDLModel: DB error "+e.getMessage());
|
||||||
|
throw new GCUBEFault(e); }
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
ArrayList<String[]> MDFormatArray=new ArrayList<String[]>();
|
ArrayList<String[]> MDFormatArray=new ArrayList<String[]>();
|
||||||
ArrayList<String[]> MDNativeArray=new ArrayList<String[]>();
|
ArrayList<String[]> MDNativeArray=new ArrayList<String[]>();
|
||||||
ArrayList<String[]> MDDerivableArray=new ArrayList<String[]>();
|
ArrayList<String[]> MDDerivableArray=new ArrayList<String[]>();
|
||||||
|
@ -287,7 +330,7 @@ public class IStoDBUtil {
|
||||||
//e.printStackTrace();
|
//e.printStackTrace();
|
||||||
brokerConnected=false;
|
brokerConnected=false;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
for(String[] singleColl: resultsParsed)
|
for(String[] singleColl: resultsParsed)
|
||||||
{
|
{
|
||||||
//generate the uid for MetadataFormat
|
//generate the uid for MetadataFormat
|
||||||
|
@ -351,7 +394,7 @@ public class IStoDBUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
//trying to parse TransformationProgram from DIS-IC
|
//trying to parse TransformationProgram from DIS-IC
|
||||||
existID=null;
|
existID=null;
|
||||||
String queryDerivableMDF="";
|
String queryDerivableMDF="";
|
||||||
|
@ -407,7 +450,7 @@ public class IStoDBUtil {
|
||||||
DBInterface.InsertInto("derivablemdf",MDDerivableArray.toArray(new String[0][0]), true);
|
DBInterface.InsertInto("derivablemdf",MDDerivableArray.toArray(new String[0][0]), true);
|
||||||
}catch (SQLException e){//logger.error("error DB");
|
}catch (SQLException e){//logger.error("error DB");
|
||||||
e.printStackTrace(); throw new RemoteException(e.getMessage(),e); }
|
e.printStackTrace(); throw new RemoteException(e.getMessage(),e); }
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -415,16 +458,35 @@ public class IStoDBUtil {
|
||||||
* @param epr
|
* @param epr
|
||||||
* @throws RemoteException
|
* @throws RemoteException
|
||||||
*/
|
*/
|
||||||
private static void insertCS(EndpointReferenceType epr, ExtendedGSSCredential cred) throws RemoteException {
|
private static void insertCS(GCUBEScope scope) throws GCUBEFault {
|
||||||
String csQuery= "for $CS in collection(\"/db/Profiles/CS\")//Document/Data/child::*[local-name()='Profile']/DILIGENTResource return <r><Id>{$CS/UniqueID/string()}</Id><Name>{$CS/Profile/ProcessName/string()}</Name><Description>{$CS/Profile/Description/string()}</Description></r>";
|
List<GCUBECS> csList= null;
|
||||||
String results=makeQueryDIS(epr, cred, csQuery);
|
try{
|
||||||
|
if (queryClient==null) queryClient= GHNContext.getImplementation(ISClient.class);
|
||||||
|
GCUBECSQuery query= queryClient.getQuery(GCUBECSQuery.class);
|
||||||
|
csList= queryClient.execute(query, scope);
|
||||||
|
}catch(Exception e ){logger.error("Error queryng IS"); throw new GCUBEFault(e); }
|
||||||
|
|
||||||
String[][] resultsParsed= parseResults(results, "r");
|
|
||||||
try{
|
try{
|
||||||
DBInterface.connect();
|
if (csList.size()!=0){
|
||||||
DBInterface.InsertInto("cs", resultsParsed, false);
|
//preparing collectionList to insert
|
||||||
}catch (SQLException e){//logger.error("error DB");
|
//table declaration:
|
||||||
e.printStackTrace(); throw new RemoteException(e.getMessage(),e); }
|
//TABLE CS(ID VARCHAR NOT NULL PRIMARY KEY, NAME VARCHAR NOT NULL, DESCRIPTION VARCHAR NOT NULL)
|
||||||
|
List<List<String>> values = new LinkedList<List<String>>();
|
||||||
|
List<String> row;
|
||||||
|
for (GCUBECS cs: csList ){
|
||||||
|
row= new LinkedList<String>();
|
||||||
|
row.add(cs.getID());
|
||||||
|
row.add(cs.getProcessName());
|
||||||
|
row.add(cs.getDescription());
|
||||||
|
values.add(row);
|
||||||
|
}
|
||||||
|
//insert the values in the database
|
||||||
|
DBInterface.connect();
|
||||||
|
DBInterface.InsertInto("cs", values);
|
||||||
|
}
|
||||||
|
}catch (SQLException e){logger.error("error inserting cs");
|
||||||
|
throw new GCUBEFault(e); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -434,13 +496,47 @@ public class IStoDBUtil {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static void insertDHN(EndpointReferenceType epr, ExtendedGSSCredential cred) throws RemoteException {
|
private static void insertGHN(GCUBEScope scope) throws GCUBEFault {
|
||||||
String dhnQuery="for $DHN in collection(\"/db/Profiles/DHN\")//Document/Data/child::*[local-name()='Profile']/DILIGENTResource where $DHN/Profile/DHNDescription/Type/string() eq 'Dynamic' or $DHN/Profile/DHNDescription/Type/string() eq 'SelfCleaning' return <r><Id>{$DHN/UniqueID/string()}</Id><Name>{$DHN/Profile/DHNDescription/Name/string()}</Name>" +
|
List<GCUBEHostingNode> ghnList= null;
|
||||||
"<Security>{$DHN/Profile/DHNDescription/SecurityEnabled/string(@value)}</Security><UpTime>{$DHN/Profile/DHNDescription/Uptime/string()}</UpTime><VirtualAvailable>{$DHN/Profile/DHNDescription/MainMemory/string(@VirtualAvailable)}</VirtualAvailable><VirtualSize>{string($DHN/Profile/DHNDescription/MainMemory/string(@VirtualSize))}</VirtualSize>" +
|
try{
|
||||||
"<LocalAvailableSpace>{$DHN/Profile/DHNDescription/LocalAvailableSpace/string()}</LocalAvailableSpace><Location>{$DHN/Profile/Site/Location/string()}</Location><Country>{$DHN/Profile/Site/Country/string()}</Country><Domain>{$DHN/Profile/Site/Domain/string()}</Domain></r>";
|
if (queryClient==null) queryClient= GHNContext.getImplementation(ISClient.class);
|
||||||
|
GCUBEGHNQuery query= queryClient.getQuery(GCUBEGHNQuery.class);
|
||||||
|
query.addGenericCondition("$result/Profile/GHNDescription/Type/string() eq 'Dynamic'");
|
||||||
|
ghnList= queryClient.execute(query, scope);
|
||||||
|
}catch(Exception e ){logger.error("Error queryng IS"); throw new GCUBEFault(e); }
|
||||||
|
|
||||||
|
try{
|
||||||
|
if (ghnList.size()!=0){
|
||||||
|
//preparing collectionList to insert
|
||||||
|
//table declaration:
|
||||||
|
//TABLE DHN(ID VARCHAR NOT NULL PRIMARY KEY,HOST VARCHAR,SECURITY VARCHAR,UPTIME VARCHAR,MAINMEMORYVA VARCHAR,MAINMEMORYVS VARCHAR,LOCALAS VARCHAR,LOCATION VARCHAR,COUNTRY VARCHAR,DOMAIN VARCHAR)
|
||||||
|
List<List<String>> values = new LinkedList<List<String>>();
|
||||||
|
List<String> row;
|
||||||
|
for (GCUBEHostingNode ghn: ghnList ){
|
||||||
|
row= new LinkedList<String>();
|
||||||
|
row.add(ghn.getID());
|
||||||
|
row.add(ghn.getNodeDescription().getName());
|
||||||
|
row.add(ghn.getNodeDescription().isSecurityEnabled()+"");
|
||||||
|
row.add(ghn.getNodeDescription().getUptime());
|
||||||
|
row.add(ghn.getNodeDescription().getMemory().getVirtualAvailable()+"");
|
||||||
|
row.add(ghn.getNodeDescription().getMemory().getVirtualSize()+"");
|
||||||
|
row.add(ghn.getNodeDescription().getLocalAvailableSpace()+"");
|
||||||
|
row.add(ghn.getSite().getLocation());
|
||||||
|
row.add(ghn.getSite().getCountry());
|
||||||
|
row.add(ghn.getSite().getDomain());
|
||||||
|
values.add(row);
|
||||||
|
}
|
||||||
|
//insert the values in the database
|
||||||
|
DBInterface.connect();
|
||||||
|
DBInterface.InsertInto("ghn", values);
|
||||||
|
}
|
||||||
|
}catch (SQLException e){logger.error("error inserting cs");
|
||||||
|
throw new GCUBEFault(e); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String results=makeQueryDIS(epr, cred, dhnQuery);
|
|
||||||
String[][] resultsDHNParsed= parseResults(results, "r");
|
|
||||||
String RIQuery="for $RI in collection(\"/db/Profiles/RunningInstance\")//Document/Data/child::*[local-name()='Profile']/DILIGENTResource return <r><id>{$RI/UniqueID/string()}</id><name>{$RI/Profile/ServiceName/string()}</name></r>";
|
String RIQuery="for $RI in collection(\"/db/Profiles/RunningInstance\")//Document/Data/child::*[local-name()='Profile']/DILIGENTResource return <r><id>{$RI/UniqueID/string()}</id><name>{$RI/Profile/ServiceName/string()}</name></r>";
|
||||||
results=makeQueryDIS(epr, cred, RIQuery);
|
results=makeQueryDIS(epr, cred, RIQuery);
|
||||||
|
|
||||||
|
@ -485,7 +581,7 @@ public class IStoDBUtil {
|
||||||
|
|
||||||
try{
|
try{
|
||||||
DBInterface.connect();
|
DBInterface.connect();
|
||||||
DBInterface.InsertInto("dhn", resultsDHNParsed, false);
|
DBInterface.InsertInto("ghn", resultsDHNParsed, false);
|
||||||
DBInterface.InsertInto("runninginstance", resultsRIParsed, false);
|
DBInterface.InsertInto("runninginstance", resultsRIParsed, false);
|
||||||
DBInterface.InsertInto("dhnrelatedri", DNHRelatedRIArray.toArray(new String[0][0]), false);
|
DBInterface.InsertInto("dhnrelatedri", DNHRelatedRIArray.toArray(new String[0][0]), false);
|
||||||
}catch (SQLException e){//logger.error("error DB");
|
}catch (SQLException e){//logger.error("error DB");
|
||||||
|
@ -494,7 +590,7 @@ public class IStoDBUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void insertServices(EndpointReferenceType epr, ExtendedGSSCredential cred) throws RemoteException {
|
private static void insertServices(GCUBEScope scope) throws GCUBEFault {
|
||||||
|
|
||||||
String csQuery= "for $SERVICE in collection(\"/db/Profiles/Service\")//Document/Data/child::*[local-name()='Profile']/DILIGENTResource return <r><Id>{$SERVICE/UniqueID/string()}</Id><Name>{$SERVICE/Profile/Name/string()}</Name><Class>{$SERVICE/Profile/Class/string()}</Class></r>";
|
String csQuery= "for $SERVICE in collection(\"/db/Profiles/Service\")//Document/Data/child::*[local-name()='Profile']/DILIGENTResource return <r><Id>{$SERVICE/UniqueID/string()}</Id><Name>{$SERVICE/Profile/Name/string()}</Name><Class>{$SERVICE/Profile/Class/string()}</Class></r>";
|
||||||
String results=makeQueryDIS(epr, cred, csQuery);
|
String results=makeQueryDIS(epr, cred, csQuery);
|
||||||
|
@ -602,9 +698,9 @@ public class IStoDBUtil {
|
||||||
*/
|
*/
|
||||||
try{
|
try{
|
||||||
DBInterface.connect();
|
DBInterface.connect();
|
||||||
DBInterface.InsertInto("dhn", resultsDHNParsed, false);
|
DBInterface.InsertInto("ghn", resultsDHNParsed, false);
|
||||||
DBInterface.InsertInto("runninginstance", resultsRIParsed, false);
|
DBInterface.InsertInto("runninginstance", resultsRIParsed, false);
|
||||||
DBInterface.InsertInto("dhnrelatedri", DNHRelatedRIArray.toArray(new String[0][0]), false);
|
DBInterface.InsertInto("ghnrelatedri", DNHRelatedRIArray.toArray(new String[0][0]), false);
|
||||||
}catch (SQLException e){//logger.error("error updating DHN on DB");
|
}catch (SQLException e){//logger.error("error updating DHN on DB");
|
||||||
e.printStackTrace(); throw new RemoteException(e.getMessage(),e); }
|
e.printStackTrace(); throw new RemoteException(e.getMessage(),e); }
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue