This commit is contained in:
Lucio Lelii 2008-12-02 18:37:25 +00:00
parent 58fc35a30b
commit 15294f965f
5 changed files with 65 additions and 38 deletions

View File

@ -108,7 +108,6 @@ public class DBInterface {
st.executeUpdate(insertQuery.toString()); // run the query st.executeUpdate(insertQuery.toString()); // run the query
}catch(SQLException e){logger.error("HSQLDB ERROR: Problem inserting data "+e.getMessage()+" -- "+ insertQuery); }catch(SQLException e){logger.error("HSQLDB ERROR: Problem inserting data "+e.getMessage()+" -- "+ insertQuery);
System.out.println("HSQLDB ERROR: Problem inserting data "+e.getMessage()+" -- "+ insertQuery);
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -166,7 +166,6 @@ public class IStoDBUtil {
GCUBECollectionQuery query= queryClient.getQuery(GCUBECollectionQuery.class); GCUBECollectionQuery query= queryClient.getQuery(GCUBECollectionQuery.class);
query.addGenericCondition("$result/Profile/IsUserCollection[string(@value) eq 'true']"); query.addGenericCondition("$result/Profile/IsUserCollection[string(@value) eq 'true']");
collectionList= queryClient.execute(query, scope); collectionList= queryClient.execute(query, scope);
System.out.println("collections "+ collectionList.size());
}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{
@ -236,7 +235,7 @@ public class IStoDBUtil {
throw new GCUBEFault(e); } 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[]>();
@ -245,38 +244,7 @@ public class IStoDBUtil {
String metadataFormatQuery; String metadataFormatQuery;
String[] singleNativeMDF; String[] singleNativeMDF;
String[] singleDerivableMDF; String[] singleDerivableMDF;
/*
MetadataBrokerPortType metadataBroker=null;
MetadataBrokerServiceAddressingLocator mbLoc;
boolean brokerConnected=true;
//connecting to metadata broker service
try{
RunningInstanceManager ri=DISHLSClient.getRunningInstanceManager(cred, epr);
String[] eprs= ri.getEPRsRIFromClassAndName("MetadataManagement", "MetadataBrokerService", "diligentproject/metadatamanagement/metadatabrokerservice", cred, epr);
EndpointReferenceType eprTemp= new EndpointReferenceType();
eprTemp.setAddress(new AttributedURI(eprs[0]));
//metadata Broker Service connection
mbLoc = new MetadataBrokerServiceAddressingLocator() ;
metadataBroker=mbLoc.getMetadataBrokerPortTypePort(eprTemp);
if (ModelFactoryService.isSecurityEnabled){
ConfigureSecurity.setSecurity(((javax.xml.rpc.Stub) metadataBroker), true, cred, GSIConstants.GSI_MODE_FULL_DELEG );
}
}catch(Exception e){
logger.error("error contacting metadata broker Service "+e.getMessage());
//e.printStackTrace();
brokerConnected=false;
}
for(String[] singleColl: resultsParsed) for(String[] singleColl: resultsParsed)
{ {
@ -284,6 +252,7 @@ public class IStoDBUtil {
uuid=uuidMFGEN.nextUUID(); uuid=uuidMFGEN.nextUUID();
String existID; String existID;
//retriving the metadataFormat for the current MDCollection //retriving the metadataFormat for the current MDCollection
metadataFormatQuery="for $MetadataFormat in collection(\"/db/Profiles/MetadataCollection\")//Document/Data/child::*[local-name()='Profile']/DILIGENTResource where $MetadataFormat/UniqueID/string() eq '"+singleColl[0]+"' return <r><id>"+uuid+"</id><Name>{$MetadataFormat/Profile/MetadataFormat/Name/string()}</Name><SchemaURI>{$MetadataFormat/Profile/MetadataFormat/SchemaURI/string()}</SchemaURI><lng>{$MetadataFormat/Profile/MetadataFormat/Language/string()}</lng></r>"; metadataFormatQuery="for $MetadataFormat in collection(\"/db/Profiles/MetadataCollection\")//Document/Data/child::*[local-name()='Profile']/DILIGENTResource where $MetadataFormat/UniqueID/string() eq '"+singleColl[0]+"' return <r><id>"+uuid+"</id><Name>{$MetadataFormat/Profile/MetadataFormat/Name/string()}</Name><SchemaURI>{$MetadataFormat/Profile/MetadataFormat/SchemaURI/string()}</SchemaURI><lng>{$MetadataFormat/Profile/MetadataFormat/Language/string()}</lng></r>";
results=makeQueryDIS(epr, cred, metadataFormatQuery); results=makeQueryDIS(epr, cred, metadataFormatQuery);
String[][] resultsMDFParsed= parseResults(results, "r"); String[][] resultsMDFParsed= parseResults(results, "r");

View File

@ -219,7 +219,6 @@ public class ModelerService {
public void setCollection(CollectionArray request) throws GCUBEFault{ public void setCollection(CollectionArray request) throws GCUBEFault{
try{ try{
logger.trace("method setCollection Called"); logger.trace("method setCollection Called");
System.out.println("method setCollection Called");
DBInterface.connect(); DBInterface.connect();
DBInterface.ExecuteUpdate("DELETE FROM VRERELATEDCOLLECTION WHERE VRERELATEDCOLLECTION.vreid='"+getResource().getId()+"';"); DBInterface.ExecuteUpdate("DELETE FROM VRERELATEDCOLLECTION WHERE VRERELATEDCOLLECTION.vreid='"+getResource().getId()+"';");

View File

@ -36,7 +36,6 @@ public class XMLUtil {
try{ try{
while (res.next()){ while (res.next()){
System.out.println("entered");
selectedString= relatedCollection.contains(res.getString("ID")) ? "true" : "false"; selectedString= relatedCollection.contains(res.getString("ID")) ? "true" : "false";
temp.append("<Collection><ID>"); temp.append("<Collection><ID>");
temp.append(res.getString(1)); temp.append(res.getString(1));

View File

@ -0,0 +1,61 @@
package org.gcube.vremanagement.vremodeler.impl.util;
import org.gcube.common.core.informationsystem.client.XMLResult;
import org.gcube.common.core.informationsystem.client.XMLResult.ISResultEvaluationException;
import org.gcube.common.core.utils.logging.GCUBELog;
public class MetadataFormat{
private static GCUBELog log= new GCUBELog(MetadataFormat.class.getName());
private String name;
private String schemaURI;
private String language;
public MetadataFormat(){}
public MetadataFormat(XMLResult xml){
try {
name= xml.evaluate("//Name/text()").get(0);
schemaURI= xml.evaluate("//SchemaURI/text()").get(0);
language= xml.evaluate("//lng/text()").get(0);
}catch(ISResultEvaluationException ise){
log.error("Error parsing th emetadata "+ise.getMessage());
}
}
public String getName(){
return name;
}
public void setName(String Name){
name= Name;
}
public String getSchemaURI(){
return schemaURI;
}
public void setSchemaURI(String schemaURI){
name= schemaURI;
}
public String getLanguage(){
return language;
}
public void setLanguage(String lng){
name= lng;
}
@Override
public boolean equals(Object o){
MetadataFormat mf = (MetadataFormat)o;
return ((this.name.compareTo(mf.getName())==0) &&
(this.language.compareTo(mf.getLanguage())==0) &&
(this.schemaURI.compareTo(mf.getSchemaURI())==0));
}
}