use of eu.etaxonomy.cdm.model.common.LSIDWSDLLocator in project cdmlib by cybertaxonomy.
the class LsidWsdlWrapperImpl method importNamespace.
/**
* import the given namespace into the def.
*/
private void importNamespace(String prefix, String ns, String location) throws LSIDException {
Definition importDef = null;
try {
WSDLReader wsdlReader = WSDLFactoryImpl.newInstance().newWSDLReader();
;
String resource = baseURI + location;
Reader reader = new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream(resource));
WSDLLocator locator = new LSIDWSDLLocator(baseURI, reader, Thread.currentThread().getContextClassLoader());
importDef = wsdlReader.readWSDL(locator);
} catch (WSDLException e) {
throw new LSIDException(e, "Error importing namespace: " + ns);
}
definition.addNamespace(prefix, ns);
Import imp = definition.createImport();
imp.setLocationURI(location);
imp.setNamespaceURI(ns);
imp.setDefinition(importDef);
definition.addImport(imp);
}
use of eu.etaxonomy.cdm.model.common.LSIDWSDLLocator in project cdmlib by cybertaxonomy.
the class WSDLDefinitionUserType method assemble.
// not tested if this works with jadira.usertype
@Override
public Object assemble(Serializable cached, Object owner) throws HibernateException {
try {
WSDLFactory wsdlFactory = WSDLFactoryImpl.newInstance();
WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
Reader reader = new StringReader(cached.toString());
WSDLLocator locator = new LSIDWSDLLocator("wsdl", reader, Thread.currentThread().getContextClassLoader());
Definition definition = wsdlReader.readWSDL(locator);
return definition;
} catch (Exception e) {
throw new HibernateException(e);
}
}
use of eu.etaxonomy.cdm.model.common.LSIDWSDLLocator in project cdmlib by cybertaxonomy.
the class WSDLDefinitionUserType method deepCopy.
public Object deepCopy(Object o) throws HibernateException {
if (o == null) {
return null;
}
Definition d = (Definition) o;
try {
WSDLFactory wsdlFactory = WSDLFactoryImpl.newInstance();
StringWriter stringWriter = new StringWriter();
WSDLWriter writer = wsdlFactory.newWSDLWriter();
writer.writeWSDL(d, stringWriter);
WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
Reader reader = new StringReader(stringWriter.getBuffer().toString());
WSDLLocator locator = new LSIDWSDLLocator("wsdl", reader, Thread.currentThread().getContextClassLoader());
Definition definition = wsdlReader.readWSDL(locator);
return definition;
} catch (Exception e) {
throw new HibernateException(e);
}
}
use of eu.etaxonomy.cdm.model.common.LSIDWSDLLocator in project cdmlib by cybertaxonomy.
the class WSDLDefinitionUserType method nullSafeGet.
@Override
public Definition nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object o) throws HibernateException, SQLException {
Clob val = (Clob) StandardBasicTypes.CLOB.nullSafeGet(rs, names, session, o);
// Clob val = (Clob) rs.getClob(names[0]);
if (val == null) {
return null;
} else {
try {
WSDLFactory wsdlFactory = WSDLFactoryImpl.newInstance();
WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
Reader reader = val.getCharacterStream();
WSDLLocator locator = new LSIDWSDLLocator("wsdl", reader, Thread.currentThread().getContextClassLoader());
Definition definition = wsdlReader.readWSDL(locator);
return definition;
} catch (Exception e) {
throw new HibernateException(e);
}
}
}
Aggregations