Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-21456

Allow to relax document property check depending on configuration

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9.2
    • Component/s: Core
    • Upgrade notes:
      Hide

      With this feature, you're able to flag properties as deprecated or removed. Which is useful when you want to remove a property from your schema or rename/move it. Nuxeo Platform will also log messages for these properties in order to help developers to remove deprecated usage.
      Extension point documentation:
      XML extensions may contain any number of 'property' elements of the form:
      <code>
      <property schema="common" name="size" deprecated="true" />
      <property schema="file" name="filename" fallback="content/name" />
      </code>
      A property contributed to this extension point enables deprecation mechanisms inside Nuxeo Platform.
      This generates WARN message of usage to help to remove deprecated usage.
      <p />
      A contribution is one of these types:
      <ul>
      <li>deprecated: property still exists in schema definition, but it'll be removed in next version</li>
      <li>removed: property has been removed from schema definition, relax platform behavior. This will avoid Nuxeo
      property not found exceptions for remaining use of the property</li>
      </ul>
      The fallback attribute is optional, its value has to be a xpath referencing an existing property in the same
      schema than removed/deprecated property.
      When presents, it is used:
      <ul>
      <li>to set the value to the fallback property</li>
      <li>to get the value from the fallback property if it exists</li>
      </ul>
      Note: for a deprecated property, setValue also set value to property and getValue get value from property if
      fallback value is null.
      <p />
      For example, the contribution below enables WARN message of usage of property <i>file:filename</i>. This will also
      get/set the value from/to <i>file:content/name</i> for deprecated usage of <i>file:filename</i> property.
      <code>
      <property schema="file" name="filename" fallback="content/name" />
      </code>
      As it, each usage of this property will automatically fallback on the fallback and avoid exception from platform.
      This will also allows to import document declaring the removed property.

      Show
      With this feature, you're able to flag properties as deprecated or removed. Which is useful when you want to remove a property from your schema or rename/move it. Nuxeo Platform will also log messages for these properties in order to help developers to remove deprecated usage. Extension point documentation: XML extensions may contain any number of 'property' elements of the form: <code> <property schema="common" name="size" deprecated="true" /> <property schema="file" name="filename" fallback="content/name" /> </code> A property contributed to this extension point enables deprecation mechanisms inside Nuxeo Platform. This generates WARN message of usage to help to remove deprecated usage. <p /> A contribution is one of these types: <ul> <li>deprecated: property still exists in schema definition, but it'll be removed in next version</li> <li>removed: property has been removed from schema definition, relax platform behavior. This will avoid Nuxeo property not found exceptions for remaining use of the property</li> </ul> The fallback attribute is optional, its value has to be a xpath referencing an existing property in the same schema than removed/deprecated property. When presents, it is used: <ul> <li>to set the value to the fallback property</li> <li>to get the value from the fallback property if it exists</li> </ul> Note: for a deprecated property, setValue also set value to property and getValue get value from property if fallback value is null. <p /> For example, the contribution below enables WARN message of usage of property <i> file:filename </i>. This will also get/set the value from/to <i> file:content/name </i> for deprecated usage of <i> file:filename </i> property. <code> <property schema="file" name="filename" fallback="content/name" /> </code> As it, each usage of this property will automatically fallback on the fallback and avoid exception from platform. This will also allows to import document declaring the removed property.
    • Sprint:
      nxfit 9.1.4, nxfit 9.1.5, nxcore 9.2.5, nxcore 9.2.6
    • Story Points:
      3

      Description

      As seen during NXP-21025, removing a property from generic schemas (in our case: common:size and file: filename) leads to issue when importing previous exported documents caused by:

      11:41:02,068 ERROR [RegistrationInfoImpl] Component service:org.nuxeo.ecm.core.repository.RepositoryServiceComponent notification of application started failed: Invalid input document. No such property was found size in schema common
      org.nuxeo.ecm.core.api.NuxeoException: Invalid input document. No such property was found size in schema common
      	at org.nuxeo.ecm.core.io.impl.AbstractDocumentModelWriter.loadSchema(AbstractDocumentModelWriter.java:299)
      	at org.nuxeo.ecm.core.io.impl.AbstractDocumentModelWriter.loadSchemas(AbstractDocumentModelWriter.java:285)
      	at org.nuxeo.ecm.core.io.impl.AbstractDocumentModelWriter.createDocument(AbstractDocumentModelWriter.java:141)
      	at org.nuxeo.ecm.core.io.impl.plugins.DocumentModelWriter.doWrite(DocumentModelWriter.java:88)
      	at org.nuxeo.ecm.core.io.impl.plugins.DocumentModelWriter.write(DocumentModelWriter.java:75)
      	at org.nuxeo.ecm.core.io.impl.AbstractDocumentWriter.write(AbstractDocumentWriter.java:53)
      	at org.nuxeo.ecm.core.io.impl.DocumentPipeImpl.readAndWriteDocs(DocumentPipeImpl.java:127)
      	at org.nuxeo.ecm.core.io.impl.DocumentPipeImpl.run(DocumentPipeImpl.java:102)
      	at org.nuxeo.ecm.platform.routing.core.persistence.RouteModelsZipImporter.create(RouteModelsZipImporter.java:94)
      	at org.nuxeo.ecm.platform.filemanager.service.FileManagerService.createDocumentFromBlob(FileManagerService.java:225)
      	at org.nuxeo.ecm.platform.filemanager.service.FileManagerService.createDocumentFromBlob(FileManagerService.java:208)
      	at org.nuxeo.ecm.platform.routing.core.impl.DocumentRoutingServiceImpl.importRouteModel(DocumentRoutingServiceImpl.java:699)
      	at org.nuxeo.ecm.platform.routing.core.impl.DocumentRoutingServiceImpl.importAllRouteModels(DocumentRoutingServiceImpl.java:686)
      	at org.nuxeo.ecm.platform.routing.core.listener.RouteModelsInitializator.doInitializeRepository(RouteModelsInitializator.java:39)
      	at org.nuxeo.ecm.core.repository.RepositoryInitializationHandler.initializeRepository(RepositoryInitializationHandler.java:93)
      	at org.nuxeo.ecm.core.repository.RepositoryService$3.run(RepositoryService.java:134)
      	at org.nuxeo.ecm.core.api.UnrestrictedSessionRunner.runUnrestricted(UnrestrictedSessionRunner.java:131)
      	at org.nuxeo.ecm.core.repository.RepositoryService.initializeRepository(RepositoryService.java:136)
      	at org.nuxeo.ecm.core.repository.RepositoryService.initRepositories(RepositoryService.java:107)
      	at org.nuxeo.runtime.transaction.TransactionHelper.runInTransaction(TransactionHelper.java:492)
      	at org.nuxeo.ecm.core.repository.RepositoryService.applicationStarted(RepositoryService.java:87)
      	at org.nuxeo.runtime.model.impl.RegistrationInfoImpl.notifyApplicationStarted(RegistrationInfoImpl.java:332)
      	at org.nuxeo.runtime.osgi.OSGiRuntimeService.notifyComponentsOnStarted(OSGiRuntimeService.java:461)
      	at org.nuxeo.runtime.osgi.OSGiRuntimeService.fireApplicationStarted(OSGiRuntimeService.java:497)
      	at org.nuxeo.runtime.api.ServicePassivator$Waiter.proceed(ServicePassivator.java:415)
      	at org.nuxeo.runtime.api.ServicePassivator.proceed(ServicePassivator.java:83)
      	at org.nuxeo.runtime.osgi.OSGiRuntimeService.frameworkEvent(OSGiRuntimeService.java:509)
      	at org.nuxeo.osgi.OSGiAdapter.fireFrameworkEvent(OSGiAdapter.java:232)
      	at org.nuxeo.osgi.application.loader.FrameworkLoader.doStart(FrameworkLoader.java:239)
      	at org.nuxeo.osgi.application.loader.FrameworkLoader.start(FrameworkLoader.java:125)
      	at org.nuxeo.runtime.deployment.NuxeoStarter.start(NuxeoStarter.java:120)
      	at org.nuxeo.runtime.deployment.NuxeoStarter.contextInitialized(NuxeoStarter.java:93)
      	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5068)
      	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5584)
      	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
      	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
      	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java7)
      	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
      	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
      	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
      	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:679)
      	at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1966)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      11:41:02,362 INFO  [AutomationComponent] You can activate automation trace mode to get more informations on automation executions
      11:41:02,564 INFO  [PageProviderClassReplacerRegistry] List of page provider names that are superseded: 
        - default_search: org.nuxeo.elasticsearch.provider.ElasticSearchNxqlPageProvider
        - expired_search: org.nuxeo.elasticsearch.provider.ElasticSearchNxqlPageProvider
        - DEFAULT_DOCUMENT_SUGGESTION: org.nuxeo.elasticsearch.provider.ElasticSearchNxqlPageProvider
        - advanced_document_content: org.nuxeo.elasticsearch.provider.ElasticSearchNxqlPageProvider
        - default_document_suggestion: org.nuxeo.elasticsearch.provider.ElasticSearchNxqlPageProvider
        - domain_documents: org.nuxeo.elasticsearch.provider.ElasticSearchNxqlPageProvider
      
      11:41:06,883 ERROR [OSGiRuntimeService] Nuxeo Platform Started
      ======================================================================
      

      We want to relax this check depending on a configuration, log a message to not use this property anymore, and optionally use a fallback property.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 week, 1 day
                  1w 1d

                    PagerDuty

                    Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.