This commit is contained in:
Lucio Lelii 2009-02-10 18:54:48 +00:00
parent f4c3f5ba20
commit 6a63b53c6f
6 changed files with 47 additions and 13 deletions

View File

@ -88,12 +88,12 @@ public class IStoDBUtil {
{
try{
DBInterface.connect();
DBInterface.deleteAll("VRERELATEDCOLLECTION");
DBInterface.deleteAll("VRERELATEDCS");
DBInterface.deleteAll("VRERELATEDMETADATAFORMAT");
DBInterface.deleteAll("VRERELATEDFUNCT");
DBInterface.deleteAll("VRERELATEDGHN");
DBInterface.deleteAll("VRE");
//DBInterface.deleteAll("VRERELATEDCOLLECTION");
//DBInterface.deleteAll("VRERELATEDCS");
//DBInterface.deleteAll("VRERELATEDMETADATAFORMAT");
//DBInterface.deleteAll("VRERELATEDFUNCT");
//DBInterface.deleteAll("VRERELATEDGHN");
//DBInterface.deleteAll("VRE");
DBInterface.deleteAll("nativemdf");
DBInterface.deleteAll("derivablemdf");
DBInterface.deleteAll("mdformat");

View File

@ -0,0 +1,26 @@
package org.gcube.vremanagement.vremodeler.impl;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import org.gcube.common.core.persistence.GCUBEWSFilePersistenceDelegate;
public class ModelerPersistenceDelegate extends GCUBEWSFilePersistenceDelegate<ModelerResource>{
protected void onLoad(ModelerResource resource, ObjectInputStream ois) throws Exception {
super.onLoad(resource, ois);
resource.setId((String)ois.readObject());
resource.setReportFirstStep((String)ois.readObject());
resource.setReportSecondStep((String)ois.readObject());
}
protected void onStore(ModelerResource resource,ObjectOutputStream oos) throws Exception {
super.onStore(resource, oos);
oos.writeObject(resource.getId());
oos.writeObject(resource.getReportFirstStep());
oos.writeObject(resource.getReportSecondStep());
}
}

View File

@ -1,6 +1,8 @@
package org.gcube.vremanagement.vremodeler.impl;
import org.gcube.common.core.contexts.GCUBEServiceContext;
import org.gcube.common.core.resources.GCUBERunningInstance;
import org.gcube.common.core.resources.runninginstance.DeploymentData;
import org.gcube.vremanagement.vremodeler.db.IStoDBUtil;
public class ServiceContext extends GCUBEServiceContext{
@ -18,9 +20,14 @@ public class ServiceContext extends GCUBEServiceContext{
protected String getJNDIName() {return "gcube/vremanagement/vremodeler";}
protected void onReady() throws Exception{
logger.info("ready event invoked on " + this.getName());
IStoDBUtil.initDB(ServiceContext.getContext().getStartScopes()[0].isInfrastructure()? ServiceContext.getContext().getStartScopes()[1]: ServiceContext.getContext().getStartScopes()[0]);
try{
logger.info("ready event invoked on " + this.getName());
IStoDBUtil.initDB(ServiceContext.getContext().getStartScopes()[0].isInfrastructure()? ServiceContext.getContext().getStartScopes()[1]: ServiceContext.getContext().getStartScopes()[0]);
ModelerContext.getPortTypeContext().getWSHome().checkResourceScope();
}catch (Exception e){
this.setStatus(Status.FAILED, true);
throw e;
}
}
}

View File

@ -28,6 +28,6 @@ public class MFRelationNative implements Listable{
public boolean equals(Object o){
MFRelationNative mf= (MFRelationNative) o;
return (this.metaCollectionID==mf.getMetadataCollectionId()) && (this.metaFormatID==mf.getMetadataFormatId());
return (this.metaCollectionID.compareTo(mf.getMetadataCollectionId())==0) && (this.metaFormatID.compareTo(mf.getMetadataFormatId())==0);
}
}

View File

@ -61,7 +61,7 @@ public class MetadataFormat implements Listable{
return ((this.name.compareTo(mf.getName())==0) &&
(languageControl) &&
(this.schemaURI.compareTo(mf.getSchemaURI())==0));
(this.schemaURI.toString().compareTo(mf.getSchemaURI().toString())==0));
}
public List<String> getAsStringList(){

View File

@ -198,7 +198,8 @@ public class XMLUtil {
//setting the derivable MDF
while(resDerivable.next()){
/* TODO: when metadataBroker will be ready for transformation
* while(resDerivable.next()){
Element tmpKeyEl= addElements(doc, "Collection", new Element[]{
createTextElement(doc,"CollectionID" , resDerivable.getString(1)),
createTextElement(doc,"Name" , resDerivable.getString(2)),
@ -227,7 +228,7 @@ public class XMLUtil {
MDFHash.put(resDerivable.getString(1), new Couple<Element, ArrayList<Element>>(tmpKeyEl, tempArray) );
}
}
*/
}catch(SQLException e){logger.error("hsqldb error");
e.printStackTrace();
}catch(Exception e){