diff --git a/src/org/gcube/vremanagement/vremodeler/db/DBInterface.java b/src/org/gcube/vremanagement/vremodeler/db/DBInterface.java index d326d73..fe6253d 100644 --- a/src/org/gcube/vremanagement/vremodeler/db/DBInterface.java +++ b/src/org/gcube/vremanagement/vremodeler/db/DBInterface.java @@ -108,9 +108,8 @@ public class DBInterface { st.executeUpdate(insertQuery.toString()); // run the query }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(); - } + } catch(Exception e){ logger.error("VDLModelService error: Problem inserting data "+e.getMessage()); diff --git a/src/org/gcube/vremanagement/vremodeler/db/IStoDBUtil.java b/src/org/gcube/vremanagement/vremodeler/db/IStoDBUtil.java index fb09159..d84c04c 100644 --- a/src/org/gcube/vremanagement/vremodeler/db/IStoDBUtil.java +++ b/src/org/gcube/vremanagement/vremodeler/db/IStoDBUtil.java @@ -166,7 +166,6 @@ public class IStoDBUtil { GCUBECollectionQuery query= queryClient.getQuery(GCUBECollectionQuery.class); query.addGenericCondition("$result/Profile/IsUserCollection[string(@value) eq 'true']"); collectionList= queryClient.execute(query, scope); - System.out.println("collections "+ collectionList.size()); }catch(Exception e ){logger.error("Error queryng IS"); throw new GCUBEFault(e); } try{ @@ -236,7 +235,7 @@ public class IStoDBUtil { throw new GCUBEFault(e); } - /* + ArrayList MDFormatArray=new ArrayList(); ArrayList MDNativeArray=new ArrayList(); ArrayList MDDerivableArray=new ArrayList(); @@ -245,38 +244,7 @@ public class IStoDBUtil { String metadataFormatQuery; String[] singleNativeMDF; 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) { @@ -284,6 +252,7 @@ public class IStoDBUtil { uuid=uuidMFGEN.nextUUID(); String existID; //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 "+uuid+"{$MetadataFormat/Profile/MetadataFormat/Name/string()}{$MetadataFormat/Profile/MetadataFormat/SchemaURI/string()}{$MetadataFormat/Profile/MetadataFormat/Language/string()}"; results=makeQueryDIS(epr, cred, metadataFormatQuery); String[][] resultsMDFParsed= parseResults(results, "r"); diff --git a/src/org/gcube/vremanagement/vremodeler/impl/ModelerService.java b/src/org/gcube/vremanagement/vremodeler/impl/ModelerService.java index 8b43dac..98dc190 100644 --- a/src/org/gcube/vremanagement/vremodeler/impl/ModelerService.java +++ b/src/org/gcube/vremanagement/vremodeler/impl/ModelerService.java @@ -219,7 +219,6 @@ public class ModelerService { public void setCollection(CollectionArray request) throws GCUBEFault{ try{ logger.trace("method setCollection Called"); - System.out.println("method setCollection Called"); DBInterface.connect(); DBInterface.ExecuteUpdate("DELETE FROM VRERELATEDCOLLECTION WHERE VRERELATEDCOLLECTION.vreid='"+getResource().getId()+"';"); diff --git a/src/org/gcube/vremanagement/vremodeler/impl/XMLUtil.java b/src/org/gcube/vremanagement/vremodeler/impl/XMLUtil.java index 98d559d..c0630a4 100644 --- a/src/org/gcube/vremanagement/vremodeler/impl/XMLUtil.java +++ b/src/org/gcube/vremanagement/vremodeler/impl/XMLUtil.java @@ -36,8 +36,7 @@ public class XMLUtil { try{ 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(""); temp.append(res.getString(1)); temp.append(""); diff --git a/src/org/gcube/vremanagement/vremodeler/impl/util/MetadataFormat.java b/src/org/gcube/vremanagement/vremodeler/impl/util/MetadataFormat.java new file mode 100644 index 0000000..d5c8335 --- /dev/null +++ b/src/org/gcube/vremanagement/vremodeler/impl/util/MetadataFormat.java @@ -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)); + } + + + +}