chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "linzhixing (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CMIS-573) CmisExtensionElement update fails
Date Wed, 03 Oct 2012 19:46:07 GMT

    [ https://issues.apache.org/jira/browse/CMIS-573?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13468768#comment-13468768
] 

linzhixing commented on CMIS-573:
---------------------------------

In the above code, as a code test, CmisExtensionElement is only retrieved from the repository
and backed.
If possible, I would have customize it to retrieve user-defined parameters from a client side
JSP, rewrite or create a new CmisExtensionElement and set it back to the document.

So, I still need the bi-direction, that is to say, getting and setting CmisExtensionElement
of the same document.  
>Extensions should only be used in one direction. No CMIS client except yours would be
able to send them back and forth.
You are saying it is impossible?
I would want to do the things like Alfresco does in its aspect update via CMIS. 
My main purpose of all of this is updating custom properties which cannnot be provided CMIS
method like name, ACL, etc. CmisExtensionElement is considered to be a hook. Could you tell
me a suitable way?


Regarding using 0.6.0. is not an inevitable restriction, just because the repository has been
developed by 0.6.0.
If upgrading the version makes CmisExtensionElement issue better, it would take priority.
                
> CmisExtensionElement update fails
> ---------------------------------
>
>                 Key: CMIS-573
>                 URL: https://issues.apache.org/jira/browse/CMIS-573
>             Project: Chemistry
>          Issue Type: Bug
>    Affects Versions: OpenCMIS 0.6.0
>         Environment: OSX 10.8.2
>            Reporter: linzhixing
>
> I'm now developing a document management system implementing CMIS specification, using
Apache Chemistry OpenCMIS 0.6.0.
> My CMIS repository is for the present almost already working, but CmisExtensionElement
update function fails.
> I would to know if it is really an error, or there is a better and correct way to update
CmisExtensionElement.
> of course I read the following article "Adding CMIS extensions (Server)",
> http://chemistry.apache.org/java/how-to/how-to-add-extension.html
> but it describes ObjectDataImpl, not CmisObject or Document object's update itself.
> Here is my code.
> --------------------------------------------------------------------------------------
> //Get the document to be updated
> Document doc = (Document) facade.getSession().getObject(getModel().getId());
> //Prepare update properties except CmisExtensionElement
> Map<String, Object> props = new HashMap<String, Object>();
> props.put(PropertyIds.NAME, getModel().getName());
> if (getModel().getUpload() != null) setAttachment(doc);
> 			
> //Prepare CmisExtensionElement
> Session session = facade.getSession();
> String repositoryId = session.getRepositoryInfo().getId();
> Holder<String> objectHolder = new Holder<String>(getModel().getId());
> Set<Updatability> updatebility = new HashSet<Updatability>();
> updatebility.add(Updatability.READWRITE);
> Properties properties = session.getObjectFactory().convertProperties(props, doc.getType(),
updatebility);
> properties.setExtensions(convertCmisExtensionElement(doc.getExtensions(ExtensionLevel.OBJECT)));
> //Update the document with the properties including CmisExtensionElement
> facade.getSession().getBinding().getObjectService().updateProperties(
> 					repositoryId, objectHolder, null, properties, null);
> --------------------------------------------------------------------------------------
> "updateProperties" method in the code fails, though when CmisExtensionElement is not
set successfully.
> The error is as follows:
> --------------------------------------------------------------------------------------
> org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: Exception: NAMESPACE_ERR:
An attempt is made to create or change an object in a way which is incorrect with regard to
namespaces.
> 	at org.apache.chemistry.opencmis.commons.impl.Converter.convertExtension(Converter.java:2587)
> 	at org.apache.chemistry.opencmis.commons.impl.Converter.convert(Converter.java:1450)
> 	at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.updateProperties(ObjectServiceImpl.java:273)
> 	at jp.aegif.struts2cmisexplorer.struts2actions.UpdateDocumentAction.executeUpdate(UpdateDocumentAction.java:243)
> 	at jp.aegif.struts2cmisexplorer.struts2actions.UpdateDocumentAction.execute(UpdateDocumentAction.java:82)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)
> 	at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
> 	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
> 	at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
> 	at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
> 	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
> 	at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
> 	at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
> 	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
> 	at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
> 	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
> 	at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
> 	at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
> 	at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
> 	at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:306)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
> 	at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
> 	at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
> 	at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
> 	at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
> 	at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
> 	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
> 	at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
> 	at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
> 	at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
> 	at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
> 	at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
> 	at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
> 	at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
> 	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
> 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
> 	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
> 	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
> 	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
> 	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
> 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> 	at org.mortbay.jetty.Server.handle(Server.java:326)
> 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
> 	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
> 	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
> 	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
> 	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
> 	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
> Caused by: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change
an object in a way which is incorrect with regard to namespaces.
> 	at com.sun.org.apache.xerces.internal.dom.AttrNSImpl.setName(AttrNSImpl.java:105)
> 	at com.sun.org.apache.xerces.internal.dom.AttrNSImpl.<init>(AttrNSImpl.java:74)
> 	at com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.createAttributeNS(CoreDocumentImpl.java:2138)
> 	at com.sun.org.apache.xerces.internal.dom.ElementImpl.setAttributeNS(ElementImpl.java:656)
> 	at org.apache.chemistry.opencmis.commons.impl.Converter.convertCmisExtensionElementToNode(Converter.java:2697)
> 	at org.apache.chemistry.opencmis.commons.impl.Converter.convertExtension(Converter.java:2582)
> 	... 71 more
> --------------------------------------------------------------------------------------
> As far as I investigated, namespace key-values are automatically included into the CmisExtentionElement's
attributes, like:
> --------------------------------------------------------------------------------------
> [{http://hoge.jp/MyCmis/}aspects {ns3=http://docs.oasis-open.org/ns/cmis/messaging/200908/,
aspects=http://hoge.jp/MyCmis/, xmlns=http://hoge.jp/MyCmis/}: [{http://hoge.jp/MyCmis/}customProperty1
{title=customevalue1, ns0=http://hoge.jp/MyCmis/}: ], {http://hoge.jp/MyCmis/}pastVersions
{v1=doc_5_attach_1, ns2=http://hoge.jp/MyCmis/, v0=doc_5_attach_0, ns1=http://hoge.jp/MyCmis/,
ns3=http://docs.oasis-open.org/ns/cmis/messaging/200908/, ns0=http://hoge.jp/MyCmis/, v2=doc_5_attach_2,
pastVersions=http://hoge.jp/MyCmis/, xmlns=http://hoge.jp/MyCmis/}: dummy]
> --------------------------------------------------------------------------------------
> "ns0","ns1","ns2", "ns3", and "xlmns" are the namespaces. 
> My CMIS repository doesn't output any namespaces and they are already included when I
got "doc.getExtensions(ExtensionLevel.OBJECT)" from my CMIS repository.
> I debugged NAMESPACE error and the "xmlns" article is critical.
> Removing "xmlns" key-value from the attribute can avoid the namespace error, but then
I got the error:
> --------------------------------------------------------------------------------------
> org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: Object Info is
missing!
> 	at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:452)
> 	at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.put(AbstractAtomPubService.java:595)
> 	at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.put(AbstractAtomPubService.java:581)
> 	at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.updateProperties(ObjectServiceImpl.java:278)
> --------------------------------------------------------------------------------------
> So, what can I do to update CmisExtensionElement?
> Thanks in advance.
> Best regards,

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message