Revision 55257
Added by Michele Artini almost 5 years ago
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.3/deploy.info | ||
---|---|---|
1 |
{"type_source": "SVN", "goal": "package -U -T 4C source:jar", "url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-data-transformation-service/trunk/", "deploy_repository": "dnet45-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/dnet45-snapshots", "name": "dnet-data-transformation-service"} |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.3/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.3/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.3/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.3/src/main/java/eu/dnetlib/data/transformation/ui/TransformerUtils.java | ||
---|---|---|
1 |
package eu.dnetlib.data.transformation.ui; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
import java.util.stream.Collectors; |
|
5 |
|
|
6 |
import javax.annotation.Resource; |
|
7 |
|
|
8 |
import org.springframework.stereotype.Component; |
|
9 |
|
|
10 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
|
11 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
|
12 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
|
13 |
|
|
14 |
@Component |
|
15 |
public class TransformerUtils { |
|
16 |
|
|
17 |
@Resource |
|
18 |
private UniqueServiceLocator serviceLocator; |
|
19 |
|
|
20 |
public List<SelectOption> obtainRuleProfiles(final String currentId) throws ISLookUpException { |
|
21 |
final String xquery = "for $x " + |
|
22 |
"in collection('/db/DRIVER/TransformationRuleDSResources/TransformationRuleDSResourceType') " + |
|
23 |
"return concat($x//RESOURCE_IDENTIFIER/@value, ' @@@ ', $x//TITLE)"; |
|
24 |
|
|
25 |
return serviceLocator.getService(ISLookUpService.class) |
|
26 |
.quickSearchProfile(xquery) |
|
27 |
.stream() |
|
28 |
.map(s -> { |
|
29 |
final String[] arr = s.split("@@@"); |
|
30 |
final String id = arr[0].trim(); |
|
31 |
final String name = arr[1].trim(); |
|
32 |
return new SelectOption(id, name, id.equals(currentId)); |
|
33 |
}) |
|
34 |
.sorted() |
|
35 |
.collect(Collectors.toList()); |
|
36 |
|
|
37 |
} |
|
38 |
} |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.3/src/main/java/eu/dnetlib/data/transformation/ui/DataTransformationController.java | ||
---|---|---|
1 |
package eu.dnetlib.data.transformation.ui; |
|
2 |
|
|
3 |
import java.io.IOException; |
|
4 |
|
|
5 |
import javax.annotation.Resource; |
|
6 |
import javax.servlet.http.HttpServletRequest; |
|
7 |
import javax.servlet.http.HttpServletResponse; |
|
8 |
|
|
9 |
import org.apache.commons.io.IOUtils; |
|
10 |
import org.apache.commons.lang3.exception.ExceptionUtils; |
|
11 |
import org.springframework.http.HttpStatus; |
|
12 |
import org.springframework.stereotype.Controller; |
|
13 |
import org.springframework.ui.Model; |
|
14 |
import org.springframework.web.bind.annotation.ExceptionHandler; |
|
15 |
import org.springframework.web.bind.annotation.RequestBody; |
|
16 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
17 |
import org.springframework.web.bind.annotation.RequestParam; |
|
18 |
import org.springframework.web.bind.annotation.ResponseBody; |
|
19 |
import org.springframework.web.bind.annotation.ResponseStatus; |
|
20 |
|
|
21 |
import eu.dnetlib.data.transformation.service.DataTransformerFactory; |
|
22 |
import eu.dnetlib.data.transformation.service.SimpleDataTransformer; |
|
23 |
import eu.dnetlib.enabling.inspector.AbstractInspectorController; |
|
24 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpDocumentNotFoundException; |
|
25 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
|
26 |
import eu.dnetlib.functionality.modular.ui.error.ErrorMessage; |
|
27 |
|
|
28 |
@Controller |
|
29 |
public class DataTransformationController extends AbstractInspectorController { |
|
30 |
|
|
31 |
@Resource |
|
32 |
private DataTransformerFactory dataTransformerFactory; |
|
33 |
|
|
34 |
@Resource |
|
35 |
private TransformerUtils transformerUtils; |
|
36 |
|
|
37 |
@RequestMapping(value = "/inspector/transform.do") |
|
38 |
public void transform(final Model model, |
|
39 |
@RequestParam(value = "rule", required = false) final String ruleId, |
|
40 |
@RequestParam(value = "record", required = false) final String record) throws Exception { |
|
41 |
|
|
42 |
model.addAttribute("rules", transformerUtils.obtainRuleProfiles(ruleId)); |
|
43 |
|
|
44 |
if (ruleId != null && record != null) { |
|
45 |
final SimpleDataTransformer transformer = dataTransformerFactory.createTransformer(ruleId); |
|
46 |
model.addAttribute("input", record); |
|
47 |
model.addAttribute("output", transformer.evaluate(record)); |
|
48 |
} |
|
49 |
} |
|
50 |
|
|
51 |
@RequestMapping(value = "/ui/transform/transform.do") |
|
52 |
public void transform(final HttpServletResponse res, |
|
53 |
@RequestParam(value = "rule", required = true) final String ruleId, |
|
54 |
@RequestBody final String record) throws ISLookUpDocumentNotFoundException, ISLookUpException, IOException { |
|
55 |
res.setContentType("text/xml"); |
|
56 |
IOUtils.write(dataTransformerFactory.createTransformer(ruleId).evaluate(record), res.getOutputStream()); |
|
57 |
} |
|
58 |
|
|
59 |
@ExceptionHandler(Exception.class) |
|
60 |
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR) |
|
61 |
public @ResponseBody ErrorMessage handleException(final HttpServletRequest req, final Exception e) { |
|
62 |
return new ErrorMessage(e.getMessage(), ExceptionUtils.getStackTrace(e)); |
|
63 |
} |
|
64 |
} |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.3/src/main/java/eu/dnetlib/data/transformation/ui/SelectOption.java | ||
---|---|---|
1 |
package eu.dnetlib.data.transformation.ui; |
|
2 |
|
|
3 |
public class SelectOption implements Comparable<SelectOption> { |
|
4 |
|
|
5 |
private final String id; |
|
6 |
private final String name; |
|
7 |
private final boolean selected; |
|
8 |
|
|
9 |
public SelectOption(final String id, final String name, final boolean selected) { |
|
10 |
this.id = id; |
|
11 |
this.name = name; |
|
12 |
this.selected = selected; |
|
13 |
} |
|
14 |
|
|
15 |
public String getId() { |
|
16 |
return id; |
|
17 |
} |
|
18 |
|
|
19 |
public String getName() { |
|
20 |
return name; |
|
21 |
} |
|
22 |
|
|
23 |
public boolean isSelected() { |
|
24 |
return selected; |
|
25 |
} |
|
26 |
|
|
27 |
@Override |
|
28 |
public int compareTo(final SelectOption o) { |
|
29 |
return getName().toLowerCase().compareTo(o.getName().toLowerCase()); |
|
30 |
} |
|
31 |
} |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.3/src/main/java/eu/dnetlib/data/transformation/ui/TransformEntryPointController.java | ||
---|---|---|
1 |
package eu.dnetlib.data.transformation.ui; |
|
2 |
|
|
3 |
import javax.annotation.Resource; |
|
4 |
import javax.servlet.http.HttpServletRequest; |
|
5 |
import javax.servlet.http.HttpServletResponse; |
|
6 |
|
|
7 |
import org.springframework.ui.ModelMap; |
|
8 |
|
|
9 |
import eu.dnetlib.functionality.modular.ui.ModuleEntryPoint; |
|
10 |
|
|
11 |
public class TransformEntryPointController extends ModuleEntryPoint { |
|
12 |
|
|
13 |
@Resource |
|
14 |
private TransformerUtils transformerUtils; |
|
15 |
|
|
16 |
@Override |
|
17 |
protected void initialize(final ModelMap map, final HttpServletRequest request, final HttpServletResponse response) throws Exception { |
|
18 |
map.addAttribute("rules", transformerUtils.obtainRuleProfiles(null)); |
|
19 |
} |
|
20 |
|
|
21 |
} |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.3/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.3/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.3/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.3/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/transform.st | ||
---|---|---|
1 |
$common/master( |
|
2 |
|
|
3 |
header={ |
|
4 |
<script type="text/javascript" src="../resources/js/angular.min.js"></script> |
|
5 |
<script type="text/javascript" src="../resources/js/transform/transform.js"></script> |
|
6 |
}, |
|
7 |
onLoad={}, |
|
8 |
body={ |
|
9 |
<div class="row" ng-app="transformUI" ng-controller="transformCtrl"> |
|
10 |
<div class="col-xs-12 col-md-10 col-lg-8"> |
|
11 |
<form> |
|
12 |
<div class="form-group"> |
|
13 |
<label>Transformation rules:</label> |
|
14 |
<select name="rule" class="form-control" ng-model="rule"> |
|
15 |
$rules:{<option $if(it.selected)$selected$endif$ value="$it.id$">$it.name$</option>}$ |
|
16 |
</select> |
|
17 |
</div> |
|
18 |
<div class="form-group"> |
|
19 |
<label>Input Record:</label> |
|
20 |
<textarea cols="100" rows="10" class="form-control" ng-model="inputRecord"></textarea> |
|
21 |
</div> |
|
22 |
|
|
23 |
<button class="btn btn-sm btn-primary" ng-click="transform(rule, inputRecord)" ng-disabled="!rule || !inputRecord">transform</button> |
|
24 |
<button class="btn btn-sm btn-default pull-right" ng-click="showProfile(rule)" ng-disabled="!rule">show transformation rule</button> |
|
25 |
</form> |
|
26 |
|
|
27 |
<br /> |
|
28 |
|
|
29 |
<p ng-if="outputRecord"> |
|
30 |
<label>Output Record:</label> |
|
31 |
<pre ng-if="outputRecord">{{outputRecord}}</pre> |
|
32 |
</p> |
|
33 |
|
|
34 |
<p ng-if="error.message"> |
|
35 |
<label>Error: <i>{{error.message}}</i></label> |
|
36 |
<pre ng-if="error.stacktrace">{{error.stacktrace}}</pre> |
|
37 |
</p> |
|
38 |
</div> |
|
39 |
</div> |
|
40 |
} |
|
41 |
)$ |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.3/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 |
<bean name="/ui/transform.do" |
|
20 |
class="eu.dnetlib.data.transformation.ui.TransformEntryPointController" |
|
21 |
p:menu="Transformation Tester" p:title="Transformation Tester" |
|
22 |
p:description="Transformation Tester" p:group="Tools" |
|
23 |
p:order="6"> |
|
24 |
<property name="permissionLevels"> |
|
25 |
<set> |
|
26 |
<value>DS_ADMIN</value> |
|
27 |
</set> |
|
28 |
</property> |
|
29 |
</bean> |
|
30 |
|
|
31 |
</beans> |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.3/src/main/resources/eu/dnetlib/web/resources/js/transform/transform.js | ||
---|---|---|
1 |
var module = angular.module('transformUI', []); |
|
2 |
|
|
3 |
module.controller('transformCtrl', function ($scope, $http) { |
|
4 |
$scope.outputRecord = ''; |
|
5 |
$scope.error = {}; |
|
6 |
|
|
7 |
$scope.transform = function(rule, s) { |
|
8 |
$scope.outputRecord = ''; |
|
9 |
$scope.error = {}; |
|
10 |
$http.defaults.headers.post["Content-Type"] = "application/json; charset=UTF-8"; |
|
11 |
$http.post('transform/transform.do?rule=' + encodeURIComponent(rule), s).success(function(res) { |
|
12 |
if(res) { |
|
13 |
$scope.outputRecord = res; |
|
14 |
} else { |
|
15 |
$scope.error({ |
|
16 |
'message' : 'empty response', |
|
17 |
}); |
|
18 |
} |
|
19 |
}).error(function(err) { |
|
20 |
$scope.error = err; |
|
21 |
}); |
|
22 |
|
|
23 |
} |
|
24 |
|
|
25 |
$scope.showProfile = function(rule) { |
|
26 |
location.href = './isManager.do#/profile/' + encodeURIComponent(rule); |
|
27 |
} |
|
28 |
|
|
29 |
}); |
modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.3/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>dnet45-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.3</version> |
|
13 |
<scm> |
|
14 |
<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-data-transformation-service/tags/dnet-data-transformation-service-3.0.3</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>eu.dnetlib</groupId> |
|
44 |
<artifactId>dnet-modular-ui</artifactId> |
|
45 |
<version>[3.0.0,4.0.0)</version> |
|
46 |
</dependency> |
|
47 |
<dependency> |
|
48 |
<groupId>javax.servlet</groupId> |
|
49 |
<artifactId>javax.servlet-api</artifactId> |
|
50 |
<version>${javax.servlet.version}</version> |
|
51 |
<scope>provided</scope> |
|
52 |
</dependency> |
|
53 |
<dependency> |
|
54 |
<groupId>junit</groupId> |
|
55 |
<artifactId>junit</artifactId> |
|
56 |
<version>${junit.version}</version> |
|
57 |
<scope>test</scope> |
|
58 |
</dependency> |
|
59 |
</dependencies> |
|
60 |
</project> |
Also available in: Unified diff
[maven-release-plugin] copy for tag dnet-data-transformation-service-3.0.3