Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registring behaviours for model that are deployed in the same extension fail. #275

Closed
vierbergenlars opened this issue Nov 22, 2019 · 1 comment · Fixed by #279
Closed

Comments

@vierbergenlars
Copy link
Member

I'm submitting a ... (check one with "x")

[x] bug report
[ ] feature request
[ ] question

Expected Behavior

Components registered with @Behaviour are registered without any problems.
They are only registered after the necessary models have already been deployed.

Current Behavior

@Behaviour annotated components are registered before the models that are present in the same extension are deployed.
They log a warning in Alfresco, and the policies are not registered at all the first time that Alfresco starts up.

2019-11-22 14:11:31,677  WARN  [dynamicextensionsalfresco.policy.AnnotationBasedBehaviourRegistrar] [localhost-startStop-1] Invalid QName specified on annotation @com.github.dynamicextensionsalfresco.behaviours.annotations.Behaviour(event=ALL, value={"ams:material", "ams:scene", "ams:render"}): Namespace prefix ams is not mapped to a namespace URI

When Alfresco is restarted, the models have already been deployed to data dictionary, and the policy is registered correctly.

Possible Solution

Re-register failed behaviours after models have been deployed, or register behaviours after models have been deployed.

Steps to Reproduce (for bugs)

  1. Create a dynamic extensions bundle containing a model and a behaviour
  2. Deploy the extension statically inside Alfresco (in WEB-INF/dynamic-extensions/bundles/)
  3. Start up a clean Alfresco.
  4. Notice that the behaviours are not registered

Your Environment

  • Alfresco version used: 6.1
  • DE version used: 2.0.1
kerkhofsd pushed a commit that referenced this issue Jan 2, 2020
@kerkhofsd
Copy link
Contributor

Reproduced and added some DEBUG logging in an integration test:

[ALFRESCO] 2020-01-02 15:32:42,561  DEBUG [dynamicextensionsalfresco.models.RepositoryModelRegistrar] [localhost-startStop-1] Registered model test:testModel
 [ALFRESCO] 2020-01-02 15:32:42,573  WARN  [dynamicextensionsalfresco.policy.AnnotationBasedBehaviourRegistrar] [localhost-startStop-1] Invalid QName specified on annotation @com.github.dynamicextensionsalfresco.behaviours.annotations.Behaviour(event=ALL, value=[test:document]): Namespace prefix test is not mapped to a namespace URI
 [ALFRESCO] 2020-01-02 15:32:42,576  DEBUG [dynamicextensionsalfresco.policy.AnnotationBasedBehaviourRegistrar] [localhost-startStop-1] Binding class Behaviour for policy {http://www.alfresco.org}onCreateNode for method public void eu.xenit.de.testing.behaviours.TestBehaviour.onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) with notification frequency EVERY_EVENT.
 [ALFRESCO] 2020-01-02 15:32:42,576  DEBUG [dynamicextensionsalfresco.policy.DefaultBehaviourProxyFactory] [localhost-startStop-1] Creating BehaviourProxy for com.github.dynamicextensionsalfresco.policy.DescriptiveJavaBehaviour instance.

Hence it actually looks like the logic to register the model is actually executed before the logic to register the behavior.

Looks like issue #197 shares the same root cause: Alfresco adds the model to the NamespaceDAO only after the transaction has been committed.
See:
#197 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants