Closed michael-conway closed 5 years ago
stack trace for this file...
2019-03-15 11:37:25 ERROR TemplateController:551 - Could not import metadata templates
javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"metadata"). Expected elements are <{http://www.emc.com/com/emc/metalnx/core/xml}mlxMetadataTemplates>
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:726)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:247)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:242)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:109)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1131)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:556)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:538)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:153)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:243)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:214)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:157)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:204)
at com.emc.metalnx.services.irods.TemplateServiceImpl.importXmlMetadataTemplate(TemplateServiceImpl.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy70.importXmlMetadataTemplate(Unknown Source)
at com.emc.metalnx.controller.TemplateController.importXMLFile(TemplateController.java:543)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:610)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
2019-03-15 11:37:25 INFO ConfigServiceImpl:95 - getGlobalConfig()
2019-03-15 11:37:25 DEBUG ConfigServiceImpl:100 - globalConfig:GlobalConfig [ticketsEnabled
I vote that the XML binding and ops are flakey. What do you say we switch this over to JSON? We can do something simple and get it working and then refine it into a schema that starts to approach the MDTemplates WG notion?
Votes?
@trel @jasoncoposky
Definitely JSON over XML, please. I don't think there is any legacy/existing usage out there of XML... right?
Not sure...tho remember mlx stores this in a database and just creates the xml on the fly....so one could export any existing mdts as JSON
but even the export is strange...I suspect some code drift that was not accounted for....
For example adding a template and then exporting shows only a partial rendering..so it needs a refresh either way. Fortunately this doesn't look overly complicated.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<mlxMetadataTemplates xmlns="http://www.emc.com/com/emc/metalnx/core/xml"/>
proposed JSON format for first iteration, NB this is simply the first rough test but for comment. This is the bare minimum to get data in and out of metalnx and can phase into a more precise version of a template as we go.
{
"id": "0",
"template-name": "boo",
"template-owner": "me",
"description": "desc",
"access-type": "PUBLIC",
"version": 0,
"create-date": "",
"modify-date": "",
"template-fields": [
{
"id": "",
"attribute": "a2",
"value": "foo",
"unit": "",
"field_order": 1
},
{
"id": "",
"attribute": "",
"value": "",
"unit": "",
"field_order": 0
}
]
}
schema
{
2 "definitions": {},
3 "$schema": "http://json-schema.org/draft-07/schema#",
4 "$id": "http://example.com/root.json",
5 "type": "object",
6 "title": "The Root Schema",
7 "required": [
8 "id",
9 "template-name",
10 "template-owner",
11 "description",
12 "access-type",
13 "version",
14 "create-date",
15 "modify-date",
16 "template-fields"
17 ],
18 "properties": {
19 "id": {
20 "$id": "#/properties/id",
21 "type": "string",
22 "title": "The Id Schema",
23 "default": "",
24 "examples": [
25 "0"
26 ],
27 "pattern": "^(.*)$"
28 },
29 "template-name": {
30 "$id": "#/properties/template-name",
31 "type": "string",
32 "title": "The Template-name Schema",
33 "default": "",
34 "examples": [
35 "boo"
36 ],
37 "pattern": "^(.*)$"
38 },
39 "template-owner": {
40 "$id": "#/properties/template-owner",
41 "type": "string",
42 "title": "The Template-owner Schema",
43 "default": "",
44 "examples": [
45 "me"
46 ],
47 "pattern": "^(.*)$"
48 },
49 "description": {
50 "$id": "#/properties/description",
51 "type": "string",
52 "title": "The Description Schema",
53 "default": "",
54 "examples": [
55 "desc"
56 ],
57 "pattern": "^(.*)$"
58 },
59 "access-type": {
60 "$id": "#/properties/access-type",
61 "type": "string",
62 "title": "The Access-type Schema",
63 "default": "",
64 "examples": [
65 "PUBLIC"
66 ],
67 "pattern": "^(.*)$"
68 },
69 "version": {
70 "$id": "#/properties/version",
71 "type": "integer",
72 "title": "The Version Schema",
73 "default": 0,
74 "examples": [
75 0
76 ]
77 },
78 "create-date": {
79 "$id": "#/properties/create-date",
80 "type": "string",
81 "title": "The Create-date Schema",
82 "default": "",
83 "examples": [
84 ""
85 ],
86 "pattern": "^(.*)$"
87 },
88 "modify-date": {
89 "$id": "#/properties/modify-date",
90 "type": "string",
91 "title": "The Modify-date Schema",
92 "default": "",
93 "examples": [
94 ""
95 ],
96 "pattern": "^(.*)$"
97 },
98 "template-fields": {
99 "$id": "#/properties/template-fields",
100 "type": "array",
101 "title": "The Template-fields Schema",
102 "items": {
103 "$id": "#/properties/template-fields/items",
104 "type": "object",
105 "title": "The Items Schema",
106 "required": [
107 "id",
108 "attribute",
109 "value",
110 "unit",
111 "field_order"
112 ],
113 "properties": {
114 "id": {
115 "$id": "#/properties/template-fields/items/properties/id",
116 "type": "string",
117 "title": "The Id Schema",
118 "default": "",
119 "examples": [
120 ""
121 ],
122 "pattern": "^(.*)$"
123 },
124 "attribute": {
125 "$id": "#/properties/template-fields/items/properties/attribute",
126 "type": "string",
127 "title": "The Attribute Schema",
128 "default": "",
129 "examples": [
130 "a2"
131 ],
132 "pattern": "^(.*)$"
133 },
134 "value": {
135 "$id": "#/properties/template-fields/items/properties/value",
136 "type": "string",
137 "title": "The Value Schema",
138 "default": "",
139 "examples": [
140 "foo"
141 ],
142 "pattern": "^(.*)$"
143 },
144 "unit": {
145 "$id": "#/properties/template-fields/items/properties/unit",
146 "type": "string",
147 "title": "The Unit Schema",
148 "default": "",
149 "examples": [
150 ""
151 ],
152 "pattern": "^(.*)$"
153 },
154 "field_order": {
155 "$id": "#/properties/template-fields/items/properties/field_order",
156 "type": "integer",
157 "title": "The Field_order Schema",
158 "default": 0,
159 "examples": [
160 1
161 ]
162 }
163 }
164 }
165 }
166 }
167 }
update am testing serialization before pushing branch...should be soon
import/export is implemented
I can now do basic upload, download and metadata operations. I would like to import a XML template.
Is there a sample XML template that I can play with? I tried to import the following but I got "Error! The templates could not be imported"