boolean executeOntologiesBatch = false;
boolean executeLanguagesBatch = false;
boolean executePropertiesBatch = false;
while(iter.hasNext()){
ServiceDescription service = (ServiceDescription)iter.next();
String serviceId = getGUID();
pss.stm_insService.clearParameters();
pss.stm_insService.setString(1, serviceId);
pss.stm_insService.setString(2, descrId);
pss.stm_insService.setString(3, service.getName());
pss.stm_insService.setString(4, service.getType());
pss.stm_insService.setString(5, service.getOwnership());
pss.stm_insService.addBatch();
// Service - Protocols
Iterator iterS = service.getAllProtocols();
while(iterS.hasNext()){
pss.stm_insServiceProtocol.setString(1, serviceId);
pss.stm_insServiceProtocol.setString(2, (String)iterS.next());
pss.stm_insServiceProtocol.addBatch();
executeProtocolsBatch = true;
}
// Service - Ontologies
iterS = service.getAllOntologies();
while(iterS.hasNext()){
pss.stm_insServiceOntology.setString(1, serviceId);
pss.stm_insServiceOntology.setString(2, (String)iterS.next());
pss.stm_insServiceOntology.addBatch();
executeOntologiesBatch = true;
}
// Service - Languages
iterS = service.getAllLanguages();
while(iterS.hasNext()){
pss.stm_insServiceLanguage.setString(1, serviceId);
pss.stm_insServiceLanguage.setString(2, (String)iterS.next());
pss.stm_insServiceLanguage.addBatch();
executeLanguagesBatch = true;
}
// Service - Properties
iterS = service.getAllProperties();
while(iterS.hasNext()){
Property prop = (Property)iterS.next();
try {
pss.stm_insServiceProperty.setString(1, serviceId);
pss.stm_insServiceProperty.setString(2, prop.getName());
// serialize value to a string and calcualte
// a hash map for later search operations
Object value = prop.getValue();
// store plain String object value directly
// in 'propval_str' field otherwise store it in
// 'propval_obj' field and fill hash field (this will be used in search phase to allow matching Serializable objects)
if ( needSerialization(value) ) {
//System.out.println("DF Handling Object property "+prop.getName()+": value = "+value);
String valueStr = serializeObj(value);
pss.stm_insServiceProperty.setString(3, valueStr);
pss.stm_insServiceProperty.setString(4, null);
String hashStr = getHashValue(value);
pss.stm_insServiceProperty.setString(5, hashStr);
}
else {
// set to NULL the serialized representation of the object and its hash
//System.out.println("DF Handling String property "+prop.getName()+": value = "+value);
pss.stm_insServiceProperty.setString(3, null);
pss.stm_insServiceProperty.setString(4, (String) value);
pss.stm_insServiceProperty.setString(5, null);
};
pss.stm_insServiceProperty.addBatch();
executePropertiesBatch = true;
} catch (Exception e) {
if(logger.isLoggable(Logger.SEVERE))
logger.log(Logger.SEVERE,"Cannot serialize property '" + prop.getName() +
"' for service '" + service.getName() + "'", e);
}
}
}
pss.stm_insService.executeBatch();
if (executeProtocolsBatch) {