Revision 45204
Added by Claudio Atzori over 7 years ago
modules/dnet-data-transformation-service/trunk/deploy.info | ||
---|---|---|
1 |
{"type_source": "SVN", "goal": "package -U -T 4C source:jar", "url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet40/modules/dnet-data-transformation-service/trunk/", "deploy_repository": "dnet4-snapshots", "version": "4", "mail": "sandro.labruzzo@isti.cnr.it,michele.artini@isti.cnr.it, claudio.atzori@isti.cnr.it, alessia.bardi@isti.cnr.it", "deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet4-snapshots", "name": "dnet-data-transformation-service"} |
modules/dnet-data-transformation-service/trunk/src/main/java/eu/dnetlib/data/transformation/service/DataTransformerFactory.java | ||
---|---|---|
1 |
package eu.dnetlib.data.transformation.service; |
|
2 |
|
|
3 |
import javax.annotation.Resource; |
|
4 |
|
|
5 |
import eu.dnetlib.common.profile.ResourceDao; |
|
6 |
import eu.dnetlib.data.collective.transformation.VocabularyRegistry; |
|
7 |
import eu.dnetlib.data.collective.transformation.utils.TransformationRulesImportTool; |
|
8 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpDocumentNotFoundException; |
|
9 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
|
10 |
|
|
11 |
public class DataTransformerFactory { |
|
12 |
|
|
13 |
@Resource(name = "vocabularyRegistry") |
|
14 |
private VocabularyRegistry vocabularyRegistry; |
|
15 |
|
|
16 |
@Resource(name = "transformationTemplate") |
|
17 |
private org.springframework.core.io.Resource transformationTemplate; |
|
18 |
|
|
19 |
@Resource(name = "defaultSchema") |
|
20 |
private org.springframework.core.io.Resource defaultSchema; |
|
21 |
|
|
22 |
@Resource(name = "transformationRuleProfileUtil") |
|
23 |
private TransformationRulesImportTool transformationRuleProfileUtil; |
|
24 |
|
|
25 |
@Resource(name = "resourceDao") |
|
26 |
private ResourceDao resourceDao; |
|
27 |
|
|
28 |
@Resource(name = "blacklistApi") |
|
29 |
private org.springframework.core.io.Resource blacklistApi; |
|
30 |
|
|
31 |
public SimpleDataTransformer createTransformer(final String ruleid) throws ISLookUpDocumentNotFoundException, ISLookUpException { |
|
32 |
// String profile = lookupLocator.getService().getResourceProfile(ruleid); |
|
33 |
SimpleDataTransformer transformer = new SimpleDataTransformer(ruleid); |
|
34 |
try { |
|
35 |
transformer.setupEngine(vocabularyRegistry, transformationTemplate, defaultSchema, transformationRuleProfileUtil, resourceDao, blacklistApi); |
|
36 |
} catch (Exception e) { |
|
37 |
throw new IllegalStateException(e); |
|
38 |
} |
|
39 |
return transformer; |
|
40 |
} |
|
41 |
} |
modules/dnet-data-transformation-service/trunk/src/main/java/eu/dnetlib/data/transformation/service/SimpleDataTransformer.java | ||
---|---|---|
1 |
package eu.dnetlib.data.transformation.service; |
|
2 |
|
|
3 |
import javax.xml.transform.TransformerConfigurationException; |
|
4 |
|
|
5 |
import org.apache.commons.logging.Log; |
|
6 |
import org.apache.commons.logging.LogFactory; |
|
7 |
import org.springframework.core.io.Resource; |
|
8 |
|
|
9 |
import eu.dnetlib.common.profile.ProfileNotFoundException; |
|
10 |
import eu.dnetlib.common.profile.ResourceDao; |
|
11 |
import eu.dnetlib.data.collective.transformation.VocabularyRegistry; |
|
12 |
import eu.dnetlib.data.collective.transformation.engine.SimpleTransformationEngine; |
|
13 |
import eu.dnetlib.data.collective.transformation.engine.core.TransformationImpl; |
|
14 |
import eu.dnetlib.data.collective.transformation.utils.TransformationRulesImportTool; |
|
15 |
import eu.dnetlib.miscutils.functional.UnaryFunction; |
|
16 |
|
|
17 |
public class SimpleDataTransformer implements UnaryFunction<String, String> { |
|
18 |
|
|
19 |
/** |
|
20 |
* logger. |
|
21 |
*/ |
|
22 |
private static final Log log = LogFactory.getLog(SimpleDataTransformer.class); |
|
23 |
|
|
24 |
/** |
|
25 |
* Transformation rule profile |
|
26 |
*/ |
|
27 |
private String ruleProfile; |
|
28 |
private SimpleTransformationEngine transformationEngine; |
|
29 |
|
|
30 |
public SimpleDataTransformer(final String ruleProfile) { |
|
31 |
this.ruleProfile = ruleProfile; |
|
32 |
|
|
33 |
// TODO |
|
34 |
// instantiate here the xml transformer |
|
35 |
|
|
36 |
if (log.isDebugEnabled()) { |
|
37 |
log.debug("************************************************************"); |
|
38 |
log.debug("New transformer created from profile " + ruleProfile); |
|
39 |
log.debug("************************************************************"); |
|
40 |
} |
|
41 |
|
|
42 |
} |
|
43 |
|
|
44 |
@Override |
|
45 |
public String evaluate(String record) { |
|
46 |
if (log.isDebugEnabled()) { |
|
47 |
log.debug("************************************************************"); |
|
48 |
log.debug("INPUT: " + record); |
|
49 |
log.debug("************************************************************"); |
|
50 |
} |
|
51 |
|
|
52 |
final String output = transform(record); |
|
53 |
|
|
54 |
if (log.isDebugEnabled()) { |
|
55 |
log.debug("************************************************************"); |
|
56 |
log.debug("OUTPUT: " + output); |
|
57 |
log.debug("************************************************************"); |
|
58 |
} |
|
59 |
|
|
60 |
return output; |
|
61 |
} |
|
62 |
|
|
63 |
private String transform(String record) { |
|
64 |
// use here the xml transformer |
|
65 |
return transformationEngine.transform(record); |
|
66 |
} |
|
67 |
|
|
68 |
protected void setupEngine(VocabularyRegistry vocabularyRegistry, Resource transformationTemplate, |
|
69 |
Resource defaultSchema, TransformationRulesImportTool rulesProfileUtil, ResourceDao resourceDao, Resource blacklistApi)throws TransformerConfigurationException, ProfileNotFoundException{ |
|
70 |
transformationEngine = new SimpleTransformationEngine(); |
|
71 |
transformationEngine.setVocabularyRegistry(vocabularyRegistry); |
|
72 |
TransformationImpl transformation = new TransformationImpl(); |
|
73 |
transformation.setSchema(defaultSchema); |
|
74 |
transformation.setTemplate(transformationTemplate); |
|
75 |
transformation.init(); |
|
76 |
if (log.isDebugEnabled()) { |
|
77 |
log.debug("************************************************************"); |
|
78 |
log.debug(ruleProfile); |
|
79 |
log.debug("************************************************************"); |
|
80 |
} |
|
81 |
transformation.setRuleLanguageParser(rulesProfileUtil.getRuleLanguageParser(ruleProfile)); |
|
82 |
transformation.configureTransformation(); |
|
83 |
transformationEngine.setTransformation(transformation); |
|
84 |
transformationEngine.setResourceDao(resourceDao); |
|
85 |
transformationEngine.setBlacklistApi(blacklistApi); |
|
86 |
} |
|
87 |
|
|
88 |
public String getRuleProfile() { |
|
89 |
return ruleProfile; |
|
90 |
} |
|
91 |
|
|
92 |
public void setRuleProfile(String ruleProfile) { |
|
93 |
this.ruleProfile = ruleProfile; |
|
94 |
} |
|
95 |
|
|
96 |
} |
modules/dnet-data-transformation-service/trunk/src/main/java/eu/dnetlib/data/transformation/service/TransformationServiceImpl.java | ||
---|---|---|
1 |
package eu.dnetlib.data.transformation.service; |
|
2 |
|
|
3 |
import javax.annotation.Resource; |
|
4 |
import javax.xml.ws.wsaddressing.W3CEndpointReference; |
|
5 |
|
|
6 |
import org.apache.commons.logging.Log; |
|
7 |
import org.apache.commons.logging.LogFactory; |
|
8 |
|
|
9 |
import eu.dnetlib.data.transformation.service.rmi.TransformationService; |
|
10 |
import eu.dnetlib.data.transformation.service.rmi.TransformationServiceException; |
|
11 |
import eu.dnetlib.enabling.resultset.MappedResultSetFactory; |
|
12 |
import eu.dnetlib.enabling.tools.AbstractBaseService; |
|
13 |
|
|
14 |
public class TransformationServiceImpl extends AbstractBaseService implements TransformationService { |
|
15 |
|
|
16 |
@Resource |
|
17 |
private MappedResultSetFactory mappedResultSetFactory; |
|
18 |
|
|
19 |
@Resource |
|
20 |
private DataTransformerFactory dataTransformerFactory; |
|
21 |
|
|
22 |
/** |
|
23 |
* logger. |
|
24 |
*/ |
|
25 |
private static final Log log = LogFactory.getLog(TransformationServiceImpl.class); |
|
26 |
|
|
27 |
@Override |
|
28 |
public W3CEndpointReference transform(String ruleid, W3CEndpointReference epr) throws TransformationServiceException { |
|
29 |
try { |
|
30 |
return mappedResultSetFactory.createMappedResultSet(epr, dataTransformerFactory.createTransformer(ruleid)); |
|
31 |
} catch (Exception e) { |
|
32 |
log.error("Error generating mapped resultset - ruleId: " + ruleid, e); |
|
33 |
throw new TransformationServiceException("Error generating mapped resultset - ruleId: " + ruleid, e); |
|
34 |
} |
|
35 |
} |
|
36 |
|
|
37 |
} |
modules/dnet-data-transformation-service/trunk/src/main/java/eu/dnetlib/data/transformation/inspector/DataTransformationController.java | ||
---|---|---|
1 |
package eu.dnetlib.data.transformation.inspector; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
import javax.annotation.Resource; |
|
6 |
|
|
7 |
import org.springframework.stereotype.Controller; |
|
8 |
import org.springframework.ui.Model; |
|
9 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
10 |
import org.springframework.web.bind.annotation.RequestParam; |
|
11 |
|
|
12 |
import com.google.common.base.Function; |
|
13 |
import com.google.common.collect.Lists; |
|
14 |
|
|
15 |
import eu.dnetlib.data.transformation.service.DataTransformerFactory; |
|
16 |
import eu.dnetlib.data.transformation.service.SimpleDataTransformer; |
|
17 |
import eu.dnetlib.enabling.inspector.AbstractInspectorController; |
|
18 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
|
19 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
|
20 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
|
21 |
|
|
22 |
@Controller |
|
23 |
public class DataTransformationController extends AbstractInspectorController { |
|
24 |
|
|
25 |
@Resource |
|
26 |
private DataTransformerFactory dataTransformerFactory; |
|
27 |
|
|
28 |
@Resource |
|
29 |
private UniqueServiceLocator serviceLocator; |
|
30 |
|
|
31 |
public static class SelectOption { |
|
32 |
|
|
33 |
private String id; |
|
34 |
private String name; |
|
35 |
private boolean selected; |
|
36 |
|
|
37 |
public SelectOption(final String id, final String name, final boolean selected) { |
|
38 |
this.id = id; |
|
39 |
this.name = name; |
|
40 |
this.selected = selected; |
|
41 |
} |
|
42 |
|
|
43 |
public String getId() { |
|
44 |
return id; |
|
45 |
} |
|
46 |
|
|
47 |
public String getName() { |
|
48 |
return name; |
|
49 |
} |
|
50 |
|
|
51 |
public boolean isSelected() { |
|
52 |
return selected; |
|
53 |
} |
|
54 |
} |
|
55 |
|
|
56 |
@RequestMapping(value = "/inspector/transform.do") |
|
57 |
public void transform(final Model model, |
|
58 |
@RequestParam(value = "rule", required = false) final String ruleId, |
|
59 |
@RequestParam(value = "record", required = false) final String record) throws Exception { |
|
60 |
|
|
61 |
model.addAttribute("rules", obtainRuleProfiles(ruleId)); |
|
62 |
|
|
63 |
if (ruleId != null && record != null) { |
|
64 |
final SimpleDataTransformer transformer = dataTransformerFactory.createTransformer(ruleId); |
|
65 |
model.addAttribute("input", record); |
|
66 |
model.addAttribute("output", transformer.evaluate(record)); |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
70 |
private List<SelectOption> obtainRuleProfiles(final String currentId) throws ISLookUpException { |
|
71 |
String xquery = "for $x " + |
|
72 |
"in collection('/db/DRIVER/TransformationRuleDSResources/TransformationRuleDSResourceType') " + |
|
73 |
"return concat($x//RESOURCE_IDENTIFIER/@value, ' @@@ ', $x//TITLE)"; |
|
74 |
|
|
75 |
return Lists.transform(serviceLocator.getService(ISLookUpService.class).quickSearchProfile(xquery), new Function<String, SelectOption>() { |
|
76 |
|
|
77 |
@Override |
|
78 |
public SelectOption apply(final String value) { |
|
79 |
final String[] arr = value.split("@@@"); |
|
80 |
final String id = arr[0].trim(); |
|
81 |
final String name = arr[1].trim(); |
|
82 |
return new SelectOption(id, name, id.equals(currentId)); |
|
83 |
} |
|
84 |
}); |
|
85 |
} |
|
86 |
} |
modules/dnet-data-transformation-service/trunk/src/main/resources/eu/dnetlib/enabling/views/inspector/transform.st | ||
---|---|---|
1 |
$inspector/master(it={ |
|
2 |
|
|
3 |
<style type="text/css"> |
|
4 |
#results { |
|
5 |
width: 100%; |
|
6 |
} |
|
7 |
|
|
8 |
#results td:first-child { |
|
9 |
width: 2em; |
|
10 |
} |
|
11 |
|
|
12 |
#results td { |
|
13 |
border: 1px solid #cecece; |
|
14 |
} |
|
15 |
</style> |
|
16 |
|
|
17 |
<h2>Test transformation:</h2> |
|
18 |
|
|
19 |
<form method="POST"> |
|
20 |
Transformation rules: |
|
21 |
<select name="rule"> |
|
22 |
$rules:{<option $if(it.selected)$selected$endif$ value="$it.id$">$it.name$</option>}$ |
|
23 |
</select><br /><br /> |
|
24 |
|
|
25 |
Input Record:<br /> |
|
26 |
<textarea name="record" cols="100" rows="10">$input$</textarea> |
|
27 |
<br /><br /> |
|
28 |
<input type="submit" value="submit"/> |
|
29 |
</form> |
|
30 |
<br /> |
|
31 |
|
|
32 |
Output Record:<br /> |
|
33 |
<textarea readonly="readonly" cols="100" rows="10">$output$</textarea> |
|
34 |
|
|
35 |
|
|
36 |
})$ |
modules/dnet-data-transformation-service/trunk/src/main/resources/eu/dnetlib/test/schemas/TransformationRuleDSResourceType.xsd | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<!-- edited with XMLSpy v2007 sp1 (http://www.altova.com) by Paolo (ISTI |
|
3 |
- CNR) --> |
|
4 |
<!--W3C Schema generated by XMLSpy v2007 sp1 (http://www.altova.com) --> |
|
5 |
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
|
6 |
<xs:element name="RESOURCE_PROFILE"> |
|
7 |
<xs:complexType> |
|
8 |
<xs:sequence> |
|
9 |
<xs:element name="HEADER" type="HEADERType" /> |
|
10 |
<xs:element name="BODY" type="BODYType" /> |
|
11 |
</xs:sequence> |
|
12 |
</xs:complexType> |
|
13 |
</xs:element> |
|
14 |
<xs:complexType name="RESOURCE_TYPEType"> |
|
15 |
<xs:attribute name="value" use="required"> |
|
16 |
<xs:simpleType> |
|
17 |
<xs:restriction base="xs:string"> |
|
18 |
<xs:enumeration value="TransformationRuleDSResourceType" /> |
|
19 |
</xs:restriction> |
|
20 |
</xs:simpleType> |
|
21 |
</xs:attribute> |
|
22 |
</xs:complexType> |
|
23 |
<xs:complexType name="RESOURCE_URIType"> |
|
24 |
<xs:attribute name="value" type="xs:string" use="required" /> |
|
25 |
</xs:complexType> |
|
26 |
<xs:complexType name="RESOURCE_KINDType"> |
|
27 |
<xs:attribute name="value" use="required"> |
|
28 |
<xs:simpleType> |
|
29 |
<xs:restriction base="xs:string"> |
|
30 |
<xs:enumeration value="TransformationRuleDSResources" /> |
|
31 |
</xs:restriction> |
|
32 |
</xs:simpleType> |
|
33 |
</xs:attribute> |
|
34 |
</xs:complexType> |
|
35 |
<xs:complexType name="RESOURCE_IDENTIFIERType"> |
|
36 |
<xs:attribute name="value" type="xs:string" use="required" /> |
|
37 |
</xs:complexType> |
|
38 |
<xs:complexType name="DATE_OF_CREATIONType"> |
|
39 |
<xs:attribute name="value" type="xs:dateTime" use="required" /> |
|
40 |
</xs:complexType> |
|
41 |
|
|
42 |
<xs:complexType name="HEADERType"> |
|
43 |
<xs:all> |
|
44 |
<xs:element name="RESOURCE_IDENTIFIER" type="RESOURCE_IDENTIFIERType" /> |
|
45 |
<xs:element name="RESOURCE_TYPE" type="RESOURCE_TYPEType" /> |
|
46 |
<xs:element name="RESOURCE_KIND" type="RESOURCE_KINDType" /> |
|
47 |
<xs:element name="RESOURCE_URI" type="RESOURCE_URIType" /> |
|
48 |
<xs:element name="DATE_OF_CREATION" type="DATE_OF_CREATIONType" /> |
|
49 |
</xs:all> |
|
50 |
</xs:complexType> |
|
51 |
|
|
52 |
<xs:complexType name="CONFIGURATIONType"> |
|
53 |
<xs:all> |
|
54 |
<xs:element name="SOURCE_METADATA_FORMAT" minOccurs="0" |
|
55 |
maxOccurs="1" type="METADATA_FORMATType" /> |
|
56 |
<xs:element name="SINK_METADATA_FORMAT" minOccurs="0" |
|
57 |
maxOccurs="1" type="METADATA_FORMATType" /> |
|
58 |
<xs:element name="IMPORTED" type="IMPORTEDType" /> |
|
59 |
<xs:element name="SCRIPT" type="SCRIPTType" /> |
|
60 |
</xs:all> |
|
61 |
</xs:complexType> |
|
62 |
|
|
63 |
<xs:complexType name="METADATA_FORMATType"> |
|
64 |
<xs:attribute name="name" type="xs:string" /> |
|
65 |
<xs:attribute name="interpretation" type="xs:string" /> |
|
66 |
<xs:attribute name="layout" type="xs:string" /> |
|
67 |
</xs:complexType> |
|
68 |
<xs:complexType name="STATUSType"> |
|
69 |
<xs:all> |
|
70 |
</xs:all> |
|
71 |
</xs:complexType> |
|
72 |
|
|
73 |
<xs:complexType name="BODYType"> |
|
74 |
<xs:sequence> |
|
75 |
<xs:element name="CONFIGURATION" type="CONFIGURATIONType" /> |
|
76 |
<xs:element name="STATUS" type="STATUSType" /> |
|
77 |
<xs:element name="SECURITY_PARAMETERS" type="xs:string" /> |
|
78 |
</xs:sequence> |
|
79 |
</xs:complexType> |
|
80 |
|
|
81 |
<xs:complexType name="SCRIPTType"> |
|
82 |
<xs:sequence> |
|
83 |
<xs:element name="TITLE" type="xs:string" /> |
|
84 |
<xs:element name="CODE" type="CODEType" /> |
|
85 |
</xs:sequence> |
|
86 |
</xs:complexType> |
|
87 |
|
|
88 |
<xs:complexType name="CODEType" mixed="true"> |
|
89 |
<xs:complexContent mixed="true"> |
|
90 |
<xs:restriction base="xs:anyType"> |
|
91 |
<xs:sequence> |
|
92 |
<xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" /> |
|
93 |
</xs:sequence> |
|
94 |
</xs:restriction> |
|
95 |
</xs:complexContent> |
|
96 |
</xs:complexType> |
|
97 |
|
|
98 |
<xs:complexType name="SCRIPT_REFERENCEType" mixed="true"> |
|
99 |
<xs:attribute name="id" use="required" /> |
|
100 |
</xs:complexType> |
|
101 |
|
|
102 |
<xs:complexType name="IMPORTEDType"> |
|
103 |
<xs:sequence> |
|
104 |
<xs:element name="SCRIPT_REFERENCE" type="SCRIPT_REFERENCEType" |
|
105 |
minOccurs="0" maxOccurs="unbounded"></xs:element> |
|
106 |
</xs:sequence> |
|
107 |
</xs:complexType> |
|
108 |
</xs:schema> |
modules/dnet-data-transformation-service/trunk/src/main/resources/eu/dnetlib/applicationContext-dnet-data-transformation-service.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" |
|
4 |
xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:wsa="http://cxf.apache.org/ws/addressing" |
|
5 |
xmlns:p="http://www.springframework.org/schema/p" xmlns:http="http://cxf.apache.org/transports/http/configuration" |
|
6 |
xmlns:t="http://dnetlib.eu/springbeans/t" xmlns:template="http://dnetlib.eu/springbeans/template" |
|
7 |
xmlns:util="http://www.springframework.org/schema/util" |
|
8 |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd |
|
9 |
http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-conf.xsd |
|
10 |
http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd |
|
11 |
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd |
|
12 |
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd |
|
13 |
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd |
|
14 |
http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd"> |
|
15 |
|
|
16 |
<bean id="transformationService" class="eu.dnetlib.data.transformation.service.TransformationServiceImpl" |
|
17 |
init-method="start" destroy-method="stop" /> |
|
18 |
|
|
19 |
<bean id="dataTransformerFactory" class="eu.dnetlib.data.transformation.service.DataTransformerFactory" /> |
|
20 |
|
|
21 |
<bean id="transformationServiceLocator" class="eu.dnetlib.enabling.tools.StaticServiceLocator" |
|
22 |
p:service-ref="transformationService" /> |
|
23 |
|
|
24 |
<!-- endpoints --> |
|
25 |
<jaxws:endpoint id="transformationServiceEndpoint" implementor="#transformationService" |
|
26 |
implementorClass="eu.dnetlib.data.transformation.service.rmi.TransformationService" address="/transformation" /> |
|
27 |
|
|
28 |
<template:instance name="serviceRegistrationManager" |
|
29 |
t:serviceRegistrationManagerClass="eu.dnetlib.enabling.tools.registration.ValidatingServiceRegistrationManagerImpl" |
|
30 |
t:name="transformationServiceRegistrationManager" t:service="transformationService" |
|
31 |
t:endpoint="transformationServiceEndpoint" t:jobScheduler="jobScheduler" |
|
32 |
t:serviceRegistrator="blackboardServiceRegistrator" /> |
|
33 |
|
|
34 |
</beans> |
modules/dnet-data-transformation-service/trunk/src/main/resources/eu/dnetlib/webContext-dnet-data-transformation-inspector.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xmlns:p="http://www.springframework.org/schema/p" |
|
5 |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> |
|
6 |
|
|
7 |
<bean id="transformationInspectorGroup" |
|
8 |
class="eu.dnetlib.enabling.inspector.StaticEntryPointDescriptorGroup" |
|
9 |
p:name="transformer"> |
|
10 |
<property name="descriptors"> |
|
11 |
<list> |
|
12 |
<bean class="eu.dnetlib.enabling.inspector.StaticEntryPointDescriptor" |
|
13 |
p:name="transformer" p:relativeUrl="transform.do" |
|
14 |
p:hiddenAsDefault="true"/> |
|
15 |
</list> |
|
16 |
</property> |
|
17 |
</bean> |
|
18 |
|
|
19 |
</beans> |
modules/dnet-data-transformation-service/trunk/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<parent> |
|
4 |
<groupId>eu.dnetlib</groupId> |
|
5 |
<artifactId>dnet-parent</artifactId> |
|
6 |
<version>1.0.0-SNAPSHOT</version> |
|
7 |
</parent> |
|
8 |
<modelVersion>4.0.0</modelVersion> |
|
9 |
<groupId>eu.dnetlib</groupId> |
|
10 |
<artifactId>dnet-data-transformation-service</artifactId> |
|
11 |
<packaging>jar</packaging> |
|
12 |
<version>3.0.1-SNAPSHOT</version> |
|
13 |
<scm> |
|
14 |
<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/dnet-data-transformation-service/trunk</developerConnection> |
|
15 |
</scm> |
|
16 |
<dependencies> |
|
17 |
<dependency> |
|
18 |
<groupId>eu.dnetlib</groupId> |
|
19 |
<artifactId>dnet-data-transformation-service-rmi</artifactId> |
|
20 |
<version>[1.0.0,2.0.0)</version> |
|
21 |
</dependency> |
|
22 |
<dependency> |
|
23 |
<groupId>eu.dnetlib</groupId> |
|
24 |
<artifactId>cnr-blackboard-common</artifactId> |
|
25 |
<version>[2.0.0,3.0.0)</version> |
|
26 |
</dependency> |
|
27 |
<dependency> |
|
28 |
<groupId>eu.dnetlib</groupId> |
|
29 |
<artifactId>cnr-resultset-service</artifactId> |
|
30 |
<version>[2.0.0,3.0.0)</version> |
|
31 |
</dependency> |
|
32 |
<dependency> |
|
33 |
<groupId>eu.dnetlib</groupId> |
|
34 |
<artifactId>cnr-inspector</artifactId> |
|
35 |
<version>[1.0.0,2.0.0)</version> |
|
36 |
</dependency> |
|
37 |
<dependency> |
|
38 |
<groupId>eu.dnetlib</groupId> |
|
39 |
<artifactId>unibi-data-collective-transformation-common</artifactId> |
|
40 |
<version>[2.0.0,3.0.0)</version> |
|
41 |
</dependency> |
|
42 |
<dependency> |
|
43 |
<groupId>junit</groupId> |
|
44 |
<artifactId>junit</artifactId> |
|
45 |
<version>${junit.version}</version> |
|
46 |
<scope>test</scope> |
|
47 |
</dependency> |
|
48 |
</dependencies> |
|
49 |
</project> |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.0/deploy.info | ||
---|---|---|
1 |
{"type_source": "SVN", "goal": "package -U -T 4C source:jar", "url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet40/modules/dnet-data-transformation-service/trunk/", "deploy_repository": "dnet4-snapshots", "version": "4", "mail": "sandro.labruzzo@isti.cnr.it,michele.artini@isti.cnr.it, claudio.atzori@isti.cnr.it, alessia.bardi@isti.cnr.it", "deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet4-snapshots", "name": "dnet-data-transformation-service"} |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.0/src/main/java/eu/dnetlib/data/transformation/service/DataTransformerFactory.java | ||
---|---|---|
1 |
package eu.dnetlib.data.transformation.service; |
|
2 |
|
|
3 |
import javax.annotation.Resource; |
|
4 |
|
|
5 |
import eu.dnetlib.common.profile.ResourceDao; |
|
6 |
import eu.dnetlib.data.collective.transformation.VocabularyRegistry; |
|
7 |
import eu.dnetlib.data.collective.transformation.utils.TransformationRulesImportTool; |
|
8 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpDocumentNotFoundException; |
|
9 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
|
10 |
|
|
11 |
public class DataTransformerFactory { |
|
12 |
|
|
13 |
@Resource(name = "vocabularyRegistry") |
|
14 |
private VocabularyRegistry vocabularyRegistry; |
|
15 |
|
|
16 |
@Resource(name = "transformationTemplate") |
|
17 |
private org.springframework.core.io.Resource transformationTemplate; |
|
18 |
|
|
19 |
@Resource(name = "defaultSchema") |
|
20 |
private org.springframework.core.io.Resource defaultSchema; |
|
21 |
|
|
22 |
@Resource(name = "transformationRuleProfileUtil") |
|
23 |
private TransformationRulesImportTool transformationRuleProfileUtil; |
|
24 |
|
|
25 |
@Resource(name = "resourceDao") |
|
26 |
private ResourceDao resourceDao; |
|
27 |
|
|
28 |
@Resource(name = "blacklistApi") |
|
29 |
private org.springframework.core.io.Resource blacklistApi; |
|
30 |
|
|
31 |
public SimpleDataTransformer createTransformer(final String ruleid) throws ISLookUpDocumentNotFoundException, ISLookUpException { |
|
32 |
// String profile = lookupLocator.getService().getResourceProfile(ruleid); |
|
33 |
SimpleDataTransformer transformer = new SimpleDataTransformer(ruleid); |
|
34 |
try { |
|
35 |
transformer.setupEngine(vocabularyRegistry, transformationTemplate, defaultSchema, transformationRuleProfileUtil, resourceDao, blacklistApi); |
|
36 |
} catch (Exception e) { |
|
37 |
throw new IllegalStateException(e); |
|
38 |
} |
|
39 |
return transformer; |
|
40 |
} |
|
41 |
} |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.0/src/main/java/eu/dnetlib/data/transformation/service/SimpleDataTransformer.java | ||
---|---|---|
1 |
package eu.dnetlib.data.transformation.service; |
|
2 |
|
|
3 |
import javax.xml.transform.TransformerConfigurationException; |
|
4 |
|
|
5 |
import org.apache.commons.logging.Log; |
|
6 |
import org.apache.commons.logging.LogFactory; |
|
7 |
import org.springframework.core.io.Resource; |
|
8 |
|
|
9 |
import eu.dnetlib.common.profile.ProfileNotFoundException; |
|
10 |
import eu.dnetlib.common.profile.ResourceDao; |
|
11 |
import eu.dnetlib.data.collective.transformation.VocabularyRegistry; |
|
12 |
import eu.dnetlib.data.collective.transformation.engine.SimpleTransformationEngine; |
|
13 |
import eu.dnetlib.data.collective.transformation.engine.core.TransformationImpl; |
|
14 |
import eu.dnetlib.data.collective.transformation.utils.TransformationRulesImportTool; |
|
15 |
import eu.dnetlib.miscutils.functional.UnaryFunction; |
|
16 |
|
|
17 |
public class SimpleDataTransformer implements UnaryFunction<String, String> { |
|
18 |
|
|
19 |
/** |
|
20 |
* logger. |
|
21 |
*/ |
|
22 |
private static final Log log = LogFactory.getLog(SimpleDataTransformer.class); |
|
23 |
|
|
24 |
/** |
|
25 |
* Transformation rule profile |
|
26 |
*/ |
|
27 |
private String ruleProfile; |
|
28 |
private SimpleTransformationEngine transformationEngine; |
|
29 |
|
|
30 |
public SimpleDataTransformer(final String ruleProfile) { |
|
31 |
this.ruleProfile = ruleProfile; |
|
32 |
|
|
33 |
// TODO |
|
34 |
// instantiate here the xml transformer |
|
35 |
|
|
36 |
if (log.isDebugEnabled()) { |
|
37 |
log.debug("************************************************************"); |
|
38 |
log.debug("New transformer created from profile " + ruleProfile); |
|
39 |
log.debug("************************************************************"); |
|
40 |
} |
|
41 |
|
|
42 |
} |
|
43 |
|
|
44 |
@Override |
|
45 |
public String evaluate(String record) { |
|
46 |
if (log.isDebugEnabled()) { |
|
47 |
log.debug("************************************************************"); |
|
48 |
log.debug("INPUT: " + record); |
|
49 |
log.debug("************************************************************"); |
|
50 |
} |
|
51 |
|
|
52 |
final String output = transform(record); |
|
53 |
|
|
54 |
if (log.isDebugEnabled()) { |
|
55 |
log.debug("************************************************************"); |
|
56 |
log.debug("OUTPUT: " + output); |
|
57 |
log.debug("************************************************************"); |
|
58 |
} |
|
59 |
|
|
60 |
return output; |
|
61 |
} |
|
62 |
|
|
63 |
private String transform(String record) { |
|
64 |
// use here the xml transformer |
|
65 |
return transformationEngine.transform(record); |
|
66 |
} |
|
67 |
|
|
68 |
protected void setupEngine(VocabularyRegistry vocabularyRegistry, Resource transformationTemplate, |
|
69 |
Resource defaultSchema, TransformationRulesImportTool rulesProfileUtil, ResourceDao resourceDao, Resource blacklistApi)throws TransformerConfigurationException, ProfileNotFoundException{ |
|
70 |
transformationEngine = new SimpleTransformationEngine(); |
|
71 |
transformationEngine.setVocabularyRegistry(vocabularyRegistry); |
|
72 |
TransformationImpl transformation = new TransformationImpl(); |
|
73 |
transformation.setSchema(defaultSchema); |
|
74 |
transformation.setTemplate(transformationTemplate); |
|
75 |
transformation.init(); |
|
76 |
if (log.isDebugEnabled()) { |
|
77 |
log.debug("************************************************************"); |
|
78 |
log.debug(ruleProfile); |
|
79 |
log.debug("************************************************************"); |
|
80 |
} |
|
81 |
transformation.setRuleLanguageParser(rulesProfileUtil.getRuleLanguageParser(ruleProfile)); |
|
82 |
transformation.configureTransformation(); |
|
83 |
transformationEngine.setTransformation(transformation); |
|
84 |
transformationEngine.setResourceDao(resourceDao); |
|
85 |
transformationEngine.setBlacklistApi(blacklistApi); |
|
86 |
} |
|
87 |
|
|
88 |
public String getRuleProfile() { |
|
89 |
return ruleProfile; |
|
90 |
} |
|
91 |
|
|
92 |
public void setRuleProfile(String ruleProfile) { |
|
93 |
this.ruleProfile = ruleProfile; |
|
94 |
} |
|
95 |
|
|
96 |
} |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.0/src/main/java/eu/dnetlib/data/transformation/service/TransformationServiceImpl.java | ||
---|---|---|
1 |
package eu.dnetlib.data.transformation.service; |
|
2 |
|
|
3 |
import javax.annotation.Resource; |
|
4 |
import javax.xml.ws.wsaddressing.W3CEndpointReference; |
|
5 |
|
|
6 |
import org.apache.commons.logging.Log; |
|
7 |
import org.apache.commons.logging.LogFactory; |
|
8 |
|
|
9 |
import eu.dnetlib.data.transformation.service.rmi.TransformationService; |
|
10 |
import eu.dnetlib.data.transformation.service.rmi.TransformationServiceException; |
|
11 |
import eu.dnetlib.enabling.resultset.MappedResultSetFactory; |
|
12 |
import eu.dnetlib.enabling.tools.AbstractBaseService; |
|
13 |
|
|
14 |
public class TransformationServiceImpl extends AbstractBaseService implements TransformationService { |
|
15 |
|
|
16 |
@Resource |
|
17 |
private MappedResultSetFactory mappedResultSetFactory; |
|
18 |
|
|
19 |
@Resource |
|
20 |
private DataTransformerFactory dataTransformerFactory; |
|
21 |
|
|
22 |
/** |
|
23 |
* logger. |
|
24 |
*/ |
|
25 |
private static final Log log = LogFactory.getLog(TransformationServiceImpl.class); |
|
26 |
|
|
27 |
@Override |
|
28 |
public W3CEndpointReference transform(String ruleid, W3CEndpointReference epr) throws TransformationServiceException { |
|
29 |
try { |
|
30 |
return mappedResultSetFactory.createMappedResultSet(epr, dataTransformerFactory.createTransformer(ruleid)); |
|
31 |
} catch (Exception e) { |
|
32 |
log.error("Error generating mapped resultset - ruleId: " + ruleid, e); |
|
33 |
throw new TransformationServiceException("Error generating mapped resultset - ruleId: " + ruleid, e); |
|
34 |
} |
|
35 |
} |
|
36 |
|
|
37 |
} |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.0/src/main/java/eu/dnetlib/data/transformation/inspector/DataTransformationController.java | ||
---|---|---|
1 |
package eu.dnetlib.data.transformation.inspector; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
import javax.annotation.Resource; |
|
6 |
|
|
7 |
import org.springframework.stereotype.Controller; |
|
8 |
import org.springframework.ui.Model; |
|
9 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
10 |
import org.springframework.web.bind.annotation.RequestParam; |
|
11 |
|
|
12 |
import com.google.common.base.Function; |
|
13 |
import com.google.common.collect.Lists; |
|
14 |
|
|
15 |
import eu.dnetlib.data.transformation.service.DataTransformerFactory; |
|
16 |
import eu.dnetlib.data.transformation.service.SimpleDataTransformer; |
|
17 |
import eu.dnetlib.enabling.inspector.AbstractInspectorController; |
|
18 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
|
19 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
|
20 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
|
21 |
|
|
22 |
@Controller |
|
23 |
public class DataTransformationController extends AbstractInspectorController { |
|
24 |
|
|
25 |
@Resource |
|
26 |
private DataTransformerFactory dataTransformerFactory; |
|
27 |
|
|
28 |
@Resource |
|
29 |
private UniqueServiceLocator serviceLocator; |
|
30 |
|
|
31 |
public static class SelectOption { |
|
32 |
|
|
33 |
private String id; |
|
34 |
private String name; |
|
35 |
private boolean selected; |
|
36 |
|
|
37 |
public SelectOption(final String id, final String name, final boolean selected) { |
|
38 |
this.id = id; |
|
39 |
this.name = name; |
|
40 |
this.selected = selected; |
|
41 |
} |
|
42 |
|
|
43 |
public String getId() { |
|
44 |
return id; |
|
45 |
} |
|
46 |
|
|
47 |
public String getName() { |
|
48 |
return name; |
|
49 |
} |
|
50 |
|
|
51 |
public boolean isSelected() { |
|
52 |
return selected; |
|
53 |
} |
|
54 |
} |
|
55 |
|
|
56 |
@RequestMapping(value = "/inspector/transform.do") |
|
57 |
public void transform(final Model model, |
|
58 |
@RequestParam(value = "rule", required = false) final String ruleId, |
|
59 |
@RequestParam(value = "record", required = false) final String record) throws Exception { |
|
60 |
|
|
61 |
model.addAttribute("rules", obtainRuleProfiles(ruleId)); |
|
62 |
|
|
63 |
if (ruleId != null && record != null) { |
|
64 |
final SimpleDataTransformer transformer = dataTransformerFactory.createTransformer(ruleId); |
|
65 |
model.addAttribute("input", record); |
|
66 |
model.addAttribute("output", transformer.evaluate(record)); |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
70 |
private List<SelectOption> obtainRuleProfiles(final String currentId) throws ISLookUpException { |
|
71 |
String xquery = "for $x " + |
|
72 |
"in collection('/db/DRIVER/TransformationRuleDSResources/TransformationRuleDSResourceType') " + |
|
73 |
"return concat($x//RESOURCE_IDENTIFIER/@value, ' @@@ ', $x//TITLE)"; |
|
74 |
|
|
75 |
return Lists.transform(serviceLocator.getService(ISLookUpService.class).quickSearchProfile(xquery), new Function<String, SelectOption>() { |
|
76 |
|
|
77 |
@Override |
|
78 |
public SelectOption apply(final String value) { |
|
79 |
final String[] arr = value.split("@@@"); |
|
80 |
final String id = arr[0].trim(); |
|
81 |
final String name = arr[1].trim(); |
|
82 |
return new SelectOption(id, name, id.equals(currentId)); |
|
83 |
} |
|
84 |
}); |
|
85 |
} |
|
86 |
} |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.0/src/main/resources/eu/dnetlib/enabling/views/inspector/transform.st | ||
---|---|---|
1 |
$inspector/master(it={ |
|
2 |
|
|
3 |
<style type="text/css"> |
|
4 |
#results { |
|
5 |
width: 100%; |
|
6 |
} |
|
7 |
|
|
8 |
#results td:first-child { |
|
9 |
width: 2em; |
|
10 |
} |
|
11 |
|
|
12 |
#results td { |
|
13 |
border: 1px solid #cecece; |
|
14 |
} |
|
15 |
</style> |
|
16 |
|
|
17 |
<h2>Test transformation:</h2> |
|
18 |
|
|
19 |
<form method="POST"> |
|
20 |
Transformation rules: |
|
21 |
<select name="rule"> |
|
22 |
$rules:{<option $if(it.selected)$selected$endif$ value="$it.id$">$it.name$</option>}$ |
|
23 |
</select><br /><br /> |
|
24 |
|
|
25 |
Input Record:<br /> |
|
26 |
<textarea name="record" cols="100" rows="10">$input$</textarea> |
|
27 |
<br /><br /> |
|
28 |
<input type="submit" value="submit"/> |
|
29 |
</form> |
|
30 |
<br /> |
|
31 |
|
|
32 |
Output Record:<br /> |
|
33 |
<textarea readonly="readonly" cols="100" rows="10">$output$</textarea> |
|
34 |
|
|
35 |
|
|
36 |
})$ |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.0/src/main/resources/eu/dnetlib/test/schemas/TransformationRuleDSResourceType.xsd | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<!-- edited with XMLSpy v2007 sp1 (http://www.altova.com) by Paolo (ISTI |
|
3 |
- CNR) --> |
|
4 |
<!--W3C Schema generated by XMLSpy v2007 sp1 (http://www.altova.com) --> |
|
5 |
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
|
6 |
<xs:element name="RESOURCE_PROFILE"> |
|
7 |
<xs:complexType> |
|
8 |
<xs:sequence> |
|
9 |
<xs:element name="HEADER" type="HEADERType" /> |
|
10 |
<xs:element name="BODY" type="BODYType" /> |
|
11 |
</xs:sequence> |
|
12 |
</xs:complexType> |
|
13 |
</xs:element> |
|
14 |
<xs:complexType name="RESOURCE_TYPEType"> |
|
15 |
<xs:attribute name="value" use="required"> |
|
16 |
<xs:simpleType> |
|
17 |
<xs:restriction base="xs:string"> |
|
18 |
<xs:enumeration value="TransformationRuleDSResourceType" /> |
|
19 |
</xs:restriction> |
|
20 |
</xs:simpleType> |
|
21 |
</xs:attribute> |
|
22 |
</xs:complexType> |
|
23 |
<xs:complexType name="RESOURCE_URIType"> |
|
24 |
<xs:attribute name="value" type="xs:string" use="required" /> |
|
25 |
</xs:complexType> |
|
26 |
<xs:complexType name="RESOURCE_KINDType"> |
|
27 |
<xs:attribute name="value" use="required"> |
|
28 |
<xs:simpleType> |
|
29 |
<xs:restriction base="xs:string"> |
|
30 |
<xs:enumeration value="TransformationRuleDSResources" /> |
|
31 |
</xs:restriction> |
|
32 |
</xs:simpleType> |
|
33 |
</xs:attribute> |
|
34 |
</xs:complexType> |
|
35 |
<xs:complexType name="RESOURCE_IDENTIFIERType"> |
|
36 |
<xs:attribute name="value" type="xs:string" use="required" /> |
|
37 |
</xs:complexType> |
|
38 |
<xs:complexType name="DATE_OF_CREATIONType"> |
|
39 |
<xs:attribute name="value" type="xs:dateTime" use="required" /> |
|
40 |
</xs:complexType> |
|
41 |
|
|
42 |
<xs:complexType name="HEADERType"> |
|
43 |
<xs:all> |
|
44 |
<xs:element name="RESOURCE_IDENTIFIER" type="RESOURCE_IDENTIFIERType" /> |
|
45 |
<xs:element name="RESOURCE_TYPE" type="RESOURCE_TYPEType" /> |
|
46 |
<xs:element name="RESOURCE_KIND" type="RESOURCE_KINDType" /> |
|
47 |
<xs:element name="RESOURCE_URI" type="RESOURCE_URIType" /> |
|
48 |
<xs:element name="DATE_OF_CREATION" type="DATE_OF_CREATIONType" /> |
|
49 |
</xs:all> |
|
50 |
</xs:complexType> |
|
51 |
|
|
52 |
<xs:complexType name="CONFIGURATIONType"> |
|
53 |
<xs:all> |
|
54 |
<xs:element name="SOURCE_METADATA_FORMAT" minOccurs="0" |
|
55 |
maxOccurs="1" type="METADATA_FORMATType" /> |
|
56 |
<xs:element name="SINK_METADATA_FORMAT" minOccurs="0" |
|
57 |
maxOccurs="1" type="METADATA_FORMATType" /> |
|
58 |
<xs:element name="IMPORTED" type="IMPORTEDType" /> |
|
59 |
<xs:element name="SCRIPT" type="SCRIPTType" /> |
|
60 |
</xs:all> |
|
61 |
</xs:complexType> |
|
62 |
|
|
63 |
<xs:complexType name="METADATA_FORMATType"> |
|
64 |
<xs:attribute name="name" type="xs:string" /> |
|
65 |
<xs:attribute name="interpretation" type="xs:string" /> |
|
66 |
<xs:attribute name="layout" type="xs:string" /> |
|
67 |
</xs:complexType> |
|
68 |
<xs:complexType name="STATUSType"> |
|
69 |
<xs:all> |
|
70 |
</xs:all> |
|
71 |
</xs:complexType> |
|
72 |
|
|
73 |
<xs:complexType name="BODYType"> |
|
74 |
<xs:sequence> |
|
75 |
<xs:element name="CONFIGURATION" type="CONFIGURATIONType" /> |
|
76 |
<xs:element name="STATUS" type="STATUSType" /> |
|
77 |
<xs:element name="SECURITY_PARAMETERS" type="xs:string" /> |
|
78 |
</xs:sequence> |
|
79 |
</xs:complexType> |
|
80 |
|
|
81 |
<xs:complexType name="SCRIPTType"> |
|
82 |
<xs:sequence> |
|
83 |
<xs:element name="TITLE" type="xs:string" /> |
|
84 |
<xs:element name="CODE" type="CODEType" /> |
|
85 |
</xs:sequence> |
|
86 |
</xs:complexType> |
|
87 |
|
|
88 |
<xs:complexType name="CODEType" mixed="true"> |
|
89 |
<xs:complexContent mixed="true"> |
|
90 |
<xs:restriction base="xs:anyType"> |
|
91 |
<xs:sequence> |
|
92 |
<xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" /> |
|
93 |
</xs:sequence> |
|
94 |
</xs:restriction> |
|
95 |
</xs:complexContent> |
|
96 |
</xs:complexType> |
|
97 |
|
|
98 |
<xs:complexType name="SCRIPT_REFERENCEType" mixed="true"> |
|
99 |
<xs:attribute name="id" use="required" /> |
|
100 |
</xs:complexType> |
|
101 |
|
|
102 |
<xs:complexType name="IMPORTEDType"> |
|
103 |
<xs:sequence> |
|
104 |
<xs:element name="SCRIPT_REFERENCE" type="SCRIPT_REFERENCEType" |
|
105 |
minOccurs="0" maxOccurs="unbounded"></xs:element> |
|
106 |
</xs:sequence> |
|
107 |
</xs:complexType> |
|
108 |
</xs:schema> |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.0/src/main/resources/eu/dnetlib/applicationContext-dnet-data-transformation-service.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" |
|
4 |
xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:wsa="http://cxf.apache.org/ws/addressing" |
|
5 |
xmlns:p="http://www.springframework.org/schema/p" xmlns:http="http://cxf.apache.org/transports/http/configuration" |
|
6 |
xmlns:t="http://dnetlib.eu/springbeans/t" xmlns:template="http://dnetlib.eu/springbeans/template" |
|
7 |
xmlns:util="http://www.springframework.org/schema/util" |
|
8 |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd |
|
9 |
http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-conf.xsd |
|
10 |
http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd |
|
11 |
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd |
|
12 |
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd |
|
13 |
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd |
|
14 |
http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd"> |
|
15 |
|
|
16 |
<bean id="transformationService" class="eu.dnetlib.data.transformation.service.TransformationServiceImpl" |
|
17 |
init-method="start" destroy-method="stop" /> |
|
18 |
|
|
19 |
<bean id="dataTransformerFactory" class="eu.dnetlib.data.transformation.service.DataTransformerFactory" /> |
|
20 |
|
|
21 |
<bean id="transformationServiceLocator" class="eu.dnetlib.enabling.tools.StaticServiceLocator" |
|
22 |
p:service-ref="transformationService" /> |
|
23 |
|
|
24 |
<!-- endpoints --> |
|
25 |
<jaxws:endpoint id="transformationServiceEndpoint" implementor="#transformationService" |
|
26 |
implementorClass="eu.dnetlib.data.transformation.service.rmi.TransformationService" address="/transformation" /> |
|
27 |
|
|
28 |
<template:instance name="serviceRegistrationManager" |
|
29 |
t:serviceRegistrationManagerClass="eu.dnetlib.enabling.tools.registration.ValidatingServiceRegistrationManagerImpl" |
|
30 |
t:name="transformationServiceRegistrationManager" t:service="transformationService" |
|
31 |
t:endpoint="transformationServiceEndpoint" t:jobScheduler="jobScheduler" |
|
32 |
t:serviceRegistrator="blackboardServiceRegistrator" /> |
|
33 |
|
|
34 |
</beans> |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.0/src/main/resources/eu/dnetlib/webContext-dnet-data-transformation-inspector.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xmlns:p="http://www.springframework.org/schema/p" |
|
5 |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> |
|
6 |
|
|
7 |
<bean id="transformationInspectorGroup" |
|
8 |
class="eu.dnetlib.enabling.inspector.StaticEntryPointDescriptorGroup" |
|
9 |
p:name="transformer"> |
|
10 |
<property name="descriptors"> |
|
11 |
<list> |
|
12 |
<bean class="eu.dnetlib.enabling.inspector.StaticEntryPointDescriptor" |
|
13 |
p:name="transformer" p:relativeUrl="transform.do" |
|
14 |
p:hiddenAsDefault="true"/> |
|
15 |
</list> |
|
16 |
</property> |
|
17 |
</bean> |
|
18 |
|
|
19 |
</beans> |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.0/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<parent> |
|
4 |
<groupId>eu.dnetlib</groupId> |
|
5 |
<artifactId>dnet-parent</artifactId> |
|
6 |
<version>1.0.0</version> |
|
7 |
</parent> |
|
8 |
<modelVersion>4.0.0</modelVersion> |
|
9 |
<groupId>eu.dnetlib</groupId> |
|
10 |
<artifactId>dnet-data-transformation-service</artifactId> |
|
11 |
<packaging>jar</packaging> |
|
12 |
<version>3.0.0</version> |
|
13 |
<scm> |
|
14 |
<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.0</developerConnection> |
|
15 |
</scm> |
|
16 |
<dependencies> |
|
17 |
<dependency> |
|
18 |
<groupId>eu.dnetlib</groupId> |
|
19 |
<artifactId>dnet-data-transformation-service-rmi</artifactId> |
|
20 |
<version>[1.0.0,2.0.0)</version> |
|
21 |
</dependency> |
|
22 |
<dependency> |
|
23 |
<groupId>eu.dnetlib</groupId> |
|
24 |
<artifactId>cnr-blackboard-common</artifactId> |
|
25 |
<version>[2.0.0,3.0.0)</version> |
|
26 |
</dependency> |
|
27 |
<dependency> |
|
28 |
<groupId>eu.dnetlib</groupId> |
|
29 |
<artifactId>cnr-resultset-service</artifactId> |
|
30 |
<version>[2.0.0,3.0.0)</version> |
|
31 |
</dependency> |
|
32 |
<dependency> |
|
33 |
<groupId>eu.dnetlib</groupId> |
|
34 |
<artifactId>cnr-inspector</artifactId> |
|
35 |
<version>[1.0.0,2.0.0)</version> |
|
36 |
</dependency> |
|
37 |
<dependency> |
|
38 |
<groupId>eu.dnetlib</groupId> |
|
39 |
<artifactId>unibi-data-collective-transformation-common</artifactId> |
|
40 |
<version>[2.0.0,3.0.0)</version> |
|
41 |
</dependency> |
|
42 |
<dependency> |
|
43 |
<groupId>junit</groupId> |
|
44 |
<artifactId>junit</artifactId> |
|
45 |
<version>${junit.version}</version> |
|
46 |
<scope>test</scope> |
|
47 |
</dependency> |
|
48 |
</dependencies> |
|
49 |
</project> |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-1.0.0/deploy.info | ||
---|---|---|
1 |
{"type_source": "SVN", "goal": "package -U -T 4C source:jar", "url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet40/modules/dnet-data-transformation-service/trunk/", "deploy_repository": "dnet4-snapshots", "version": "4", "mail": "sandro.labruzzo@isti.cnr.it,michele.artini@isti.cnr.it, claudio.atzori@isti.cnr.it, alessia.bardi@isti.cnr.it", "deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet4-snapshots", "name": "dnet-data-transformation-service"} |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-1.0.0/src/main/java/eu/dnetlib/data/transformation/service/DataTransformerFactory.java | ||
---|---|---|
1 |
package eu.dnetlib.data.transformation.service; |
|
2 |
|
|
3 |
import javax.annotation.Resource; |
|
4 |
|
|
5 |
import eu.dnetlib.common.profile.ResourceDao; |
|
6 |
import eu.dnetlib.data.collective.transformation.VocabularyRegistry; |
|
7 |
import eu.dnetlib.data.collective.transformation.utils.TransformationRulesImportTool; |
|
8 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpDocumentNotFoundException; |
|
9 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
|
10 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
|
11 |
import eu.dnetlib.enabling.tools.ServiceLocator; |
|
12 |
|
|
13 |
public class DataTransformerFactory { |
|
14 |
|
|
15 |
@Resource(name = "lookupLocator") |
|
16 |
private ServiceLocator<ISLookUpService> lookupLocator; |
|
17 |
|
|
18 |
@Resource(name = "vocabularyRegistry") |
|
19 |
private VocabularyRegistry vocabularyRegistry; |
|
20 |
|
|
21 |
@Resource(name = "transformationTemplate") |
|
22 |
private org.springframework.core.io.Resource transformationTemplate; |
|
23 |
|
|
24 |
@Resource(name = "defaultSchema") |
|
25 |
private org.springframework.core.io.Resource defaultSchema; |
|
26 |
|
|
27 |
@Resource(name = "transformationRuleProfileUtil") |
|
28 |
private TransformationRulesImportTool transformationRuleProfileUtil; |
|
29 |
|
|
30 |
@Resource(name = "resourceDao") |
|
31 |
private ResourceDao resourceDao; |
|
32 |
|
|
33 |
public SimpleDataTransformer createTransformer(String ruleid) throws ISLookUpDocumentNotFoundException, ISLookUpException { |
|
34 |
//String profile = lookupLocator.getService().getResourceProfile(ruleid); |
|
35 |
SimpleDataTransformer transformer = new SimpleDataTransformer(ruleid); |
|
36 |
try { |
|
37 |
transformer.setupEngine(vocabularyRegistry, transformationTemplate, defaultSchema, transformationRuleProfileUtil, resourceDao); |
|
38 |
} catch (Exception e) { |
|
39 |
throw new IllegalStateException(e); |
|
40 |
} |
|
41 |
return transformer; |
|
42 |
} |
|
43 |
} |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-1.0.0/src/main/java/eu/dnetlib/data/transformation/service/SimpleDataTransformer.java | ||
---|---|---|
1 |
package eu.dnetlib.data.transformation.service; |
|
2 |
|
|
3 |
import javax.xml.transform.TransformerConfigurationException; |
|
4 |
|
|
5 |
import org.apache.commons.logging.Log; |
|
6 |
import org.apache.commons.logging.LogFactory; |
|
7 |
import org.springframework.core.io.Resource; |
|
8 |
|
|
9 |
import eu.dnetlib.common.profile.ProfileNotFoundException; |
|
10 |
import eu.dnetlib.common.profile.ResourceDao; |
|
11 |
import eu.dnetlib.data.collective.transformation.VocabularyRegistry; |
|
12 |
import eu.dnetlib.data.collective.transformation.engine.SimpleTransformationEngine; |
|
13 |
import eu.dnetlib.data.collective.transformation.engine.core.TransformationImpl; |
|
14 |
import eu.dnetlib.data.collective.transformation.utils.TransformationRulesImportTool; |
|
15 |
import eu.dnetlib.miscutils.functional.UnaryFunction; |
|
16 |
|
|
17 |
public class SimpleDataTransformer implements UnaryFunction<String, String> { |
|
18 |
|
|
19 |
/** |
|
20 |
* logger. |
|
21 |
*/ |
|
22 |
private static final Log log = LogFactory.getLog(SimpleDataTransformer.class); |
|
23 |
|
|
24 |
/** |
|
25 |
* Transformation rule profile |
|
26 |
*/ |
|
27 |
private String ruleProfile; |
|
28 |
private SimpleTransformationEngine transformationEngine; |
|
29 |
|
|
30 |
public SimpleDataTransformer(final String ruleProfile) { |
|
31 |
this.ruleProfile = ruleProfile; |
|
32 |
|
|
33 |
// TODO |
|
34 |
// instantiate here the xml transformer |
|
35 |
|
|
36 |
if (log.isDebugEnabled()) { |
|
37 |
log.debug("************************************************************"); |
|
38 |
log.debug("New transformer created from profile " + ruleProfile); |
|
39 |
log.debug("************************************************************"); |
|
40 |
} |
|
41 |
|
|
42 |
} |
|
43 |
|
|
44 |
@Override |
|
45 |
public String evaluate(String record) { |
|
46 |
if (log.isDebugEnabled()) { |
|
47 |
log.debug("************************************************************"); |
|
48 |
log.debug("INPUT: " + record); |
|
49 |
log.debug("************************************************************"); |
|
50 |
} |
|
51 |
|
|
52 |
final String output = transform(record); |
|
53 |
|
|
54 |
if (log.isDebugEnabled()) { |
|
55 |
log.debug("************************************************************"); |
|
56 |
log.debug("OUTPUT: " + output); |
|
57 |
log.debug("************************************************************"); |
|
58 |
} |
|
59 |
|
|
60 |
return output; |
|
61 |
} |
|
62 |
|
|
63 |
private String transform(String record) { |
|
64 |
// use here the xml transformer |
|
65 |
return transformationEngine.transform(record); |
|
66 |
} |
|
67 |
|
|
68 |
protected void setupEngine(VocabularyRegistry vocabularyRegistry, Resource transformationTemplate, |
|
69 |
Resource defaultSchema, TransformationRulesImportTool rulesProfileUtil, ResourceDao resourceDao)throws TransformerConfigurationException, ProfileNotFoundException{ |
|
70 |
transformationEngine = new SimpleTransformationEngine(); |
|
71 |
transformationEngine.setVocabularyRegistry(vocabularyRegistry); |
|
72 |
TransformationImpl transformation = new TransformationImpl(); |
|
73 |
transformation.setSchema(defaultSchema); |
|
74 |
transformation.setTemplate(transformationTemplate); |
|
75 |
transformation.init(); |
|
76 |
transformation.setRuleLanguageParser(rulesProfileUtil.getRuleLanguageParser(ruleProfile)); |
|
77 |
transformation.configureTransformation(); |
|
78 |
transformationEngine.setTransformation(transformation); |
|
79 |
transformationEngine.setResourceDao(resourceDao); |
|
80 |
|
|
81 |
} |
|
82 |
|
|
83 |
public String getRuleProfile() { |
|
84 |
return ruleProfile; |
|
85 |
} |
|
86 |
|
|
87 |
public void setRuleProfile(String ruleProfile) { |
|
88 |
this.ruleProfile = ruleProfile; |
|
89 |
} |
|
90 |
|
|
91 |
} |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-1.0.0/src/main/java/eu/dnetlib/data/transformation/service/TransformationServiceImpl.java | ||
---|---|---|
1 |
package eu.dnetlib.data.transformation.service; |
|
2 |
|
|
3 |
import javax.annotation.Resource; |
|
4 |
import javax.xml.ws.wsaddressing.W3CEndpointReference; |
|
5 |
|
|
6 |
import org.apache.commons.logging.Log; |
|
7 |
import org.apache.commons.logging.LogFactory; |
|
8 |
|
|
9 |
import eu.dnetlib.data.transformation.service.rmi.TransformationService; |
|
10 |
import eu.dnetlib.data.transformation.service.rmi.TransformationServiceException; |
|
11 |
import eu.dnetlib.enabling.resultset.MappedResultSetFactory; |
|
12 |
import eu.dnetlib.enabling.tools.AbstractBaseService; |
|
13 |
|
|
14 |
public class TransformationServiceImpl extends AbstractBaseService implements TransformationService { |
|
15 |
|
|
16 |
@Resource |
|
17 |
private MappedResultSetFactory mappedResultSetFactory; |
|
18 |
|
|
19 |
@Resource |
|
20 |
private DataTransformerFactory dataTransformerFactory; |
|
21 |
|
|
22 |
/** |
|
23 |
* logger. |
|
24 |
*/ |
|
25 |
private static final Log log = LogFactory.getLog(TransformationServiceImpl.class); |
|
26 |
|
|
27 |
@Override |
|
28 |
public W3CEndpointReference transform(String ruleid, W3CEndpointReference epr) throws TransformationServiceException { |
|
29 |
try { |
|
30 |
return mappedResultSetFactory.createMappedResultSet(epr, dataTransformerFactory.createTransformer(ruleid)); |
|
31 |
} catch (Exception e) { |
|
32 |
log.error("Error generating mapped resultset - ruleId: " + ruleid, e); |
|
33 |
throw new TransformationServiceException("Error generating mapped resultset - ruleId: " + ruleid, e); |
|
34 |
} |
|
35 |
} |
|
36 |
|
|
37 |
} |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-1.0.0/src/main/java/eu/dnetlib/data/transformation/inspector/DataTransformationController.java | ||
---|---|---|
1 |
package eu.dnetlib.data.transformation.inspector; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
import javax.annotation.Resource; |
|
6 |
|
|
7 |
import org.springframework.stereotype.Controller; |
|
8 |
import org.springframework.ui.Model; |
|
9 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
10 |
import org.springframework.web.bind.annotation.RequestParam; |
|
11 |
|
|
12 |
import com.google.common.base.Function; |
|
13 |
import com.google.common.collect.Lists; |
|
14 |
|
|
15 |
import eu.dnetlib.data.transformation.service.DataTransformerFactory; |
|
16 |
import eu.dnetlib.data.transformation.service.SimpleDataTransformer; |
|
17 |
import eu.dnetlib.enabling.inspector.AbstractInspectorController; |
|
18 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
|
19 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
|
20 |
import eu.dnetlib.enabling.tools.ServiceLocator; |
|
21 |
|
|
22 |
@Controller |
|
23 |
public class DataTransformationController extends AbstractInspectorController { |
|
24 |
|
|
25 |
@Resource |
|
26 |
private DataTransformerFactory dataTransformerFactory; |
|
27 |
|
|
28 |
@Resource(name = "lookupLocator") |
|
29 |
private ServiceLocator<ISLookUpService> lookupLocator; |
|
30 |
|
|
31 |
public static class SelectOption { |
|
32 |
private String id; |
|
33 |
private String name; |
|
34 |
private boolean selected; |
|
35 |
|
|
36 |
public SelectOption(String id, String name, boolean selected) { |
|
37 |
this.id = id; |
|
38 |
this.name = name; |
|
39 |
this.selected = selected; |
|
40 |
} |
|
41 |
|
|
42 |
public String getId() { |
|
43 |
return id; |
|
44 |
} |
|
45 |
|
|
46 |
public String getName() { |
|
47 |
return name; |
|
48 |
} |
|
49 |
|
|
50 |
public boolean isSelected() { |
|
51 |
return selected; |
|
52 |
} |
|
53 |
} |
|
54 |
|
|
55 |
@RequestMapping(value = "/inspector/transform.do") |
|
56 |
public void transform(final Model model, |
|
57 |
@RequestParam(value = "rule", required = false) final String ruleId, |
|
58 |
@RequestParam(value = "record", required = false) final String record) throws Exception { |
|
59 |
|
|
60 |
model.addAttribute("rules",obtainRuleProfiles(ruleId)); |
|
61 |
|
|
62 |
if (ruleId != null && record != null) { |
|
63 |
final SimpleDataTransformer transformer = dataTransformerFactory.createTransformer(ruleId); |
|
64 |
model.addAttribute("input", record); |
|
65 |
model.addAttribute("output", transformer.evaluate(record)); |
|
66 |
} |
|
67 |
} |
|
68 |
|
|
69 |
private List<SelectOption> obtainRuleProfiles(final String currentId) throws ISLookUpException { |
|
70 |
String xquery = "for $x " + |
|
71 |
"in collection('/db/DRIVER/TransformationRuleDSResources/TransformationRuleDSResourceType') " + |
|
72 |
"return concat($x//RESOURCE_IDENTIFIER/@value, ' @@@ ', $x//TITLE)"; |
|
73 |
|
|
74 |
return Lists.transform(lookupLocator.getService().quickSearchProfile(xquery), new Function<String, SelectOption>() { |
|
75 |
@Override |
|
76 |
public SelectOption apply(final String value) { |
|
77 |
final String[] arr = value.split("@@@"); |
|
78 |
final String id = arr[0].trim(); |
|
79 |
final String name = arr[1].trim(); |
|
80 |
return new SelectOption(id, name, id.equals(currentId)); |
|
81 |
} |
|
82 |
}); |
|
83 |
} |
|
84 |
} |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-1.0.0/src/main/resources/eu/dnetlib/enabling/views/inspector/transform.st | ||
---|---|---|
1 |
$inspector/master(it={ |
|
2 |
|
|
3 |
<style type="text/css"> |
|
4 |
#results { |
|
5 |
width: 100%; |
|
6 |
} |
|
7 |
|
|
8 |
#results td:first-child { |
|
9 |
width: 2em; |
|
10 |
} |
|
11 |
|
|
12 |
#results td { |
|
13 |
border: 1px solid #cecece; |
|
14 |
} |
|
15 |
</style> |
|
16 |
|
|
17 |
<h2>Test transformation:</h2> |
|
18 |
|
|
19 |
<form method="POST"> |
|
20 |
Transformation rules: |
|
21 |
<select name="rule"> |
|
22 |
$rules:{<option $if(it.selected)$selected$endif$ value="$it.id$">$it.name$</option>}$ |
|
23 |
</select><br /><br /> |
|
24 |
|
|
25 |
Input Record:<br /> |
|
26 |
<textarea name="record" cols="100" rows="10">$input$</textarea> |
|
27 |
<br /><br /> |
|
28 |
<input type="submit" value="submit"/> |
|
29 |
</form> |
|
30 |
<br /> |
|
31 |
|
|
32 |
Output Record:<br /> |
|
33 |
<textarea readonly="readonly" cols="100" rows="10">$output$</textarea> |
|
34 |
|
|
35 |
|
|
36 |
})$ |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-1.0.0/src/main/resources/eu/dnetlib/test/schemas/TransformationRuleDSResourceType.xsd | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<!-- edited with XMLSpy v2007 sp1 (http://www.altova.com) by Paolo (ISTI |
|
3 |
- CNR) --> |
|
4 |
<!--W3C Schema generated by XMLSpy v2007 sp1 (http://www.altova.com) --> |
|
5 |
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
|
6 |
<xs:element name="RESOURCE_PROFILE"> |
|
7 |
<xs:complexType> |
|
8 |
<xs:sequence> |
|
9 |
<xs:element name="HEADER" type="HEADERType" /> |
|
10 |
<xs:element name="BODY" type="BODYType" /> |
|
11 |
</xs:sequence> |
|
12 |
</xs:complexType> |
|
13 |
</xs:element> |
|
14 |
<xs:complexType name="RESOURCE_TYPEType"> |
|
15 |
<xs:attribute name="value" use="required"> |
|
16 |
<xs:simpleType> |
|
17 |
<xs:restriction base="xs:string"> |
|
18 |
<xs:enumeration value="TransformationRuleDSResourceType" /> |
|
19 |
</xs:restriction> |
|
20 |
</xs:simpleType> |
|
21 |
</xs:attribute> |
|
22 |
</xs:complexType> |
Also available in: Unified diff
codebase used to migrate to java8 the production system