Change By: Matthijs Hendriks (31/May/12 2:54 PM)
Description: If you have exported a model, you get something like this:
{code}
{
  "resources": {
    "artifact2feature": [],
    "artifact": [
      {
        "definition": "artifact-Bundle-SymbolicName-org.amdatu.kitchensink.demo.tenant.global-Bundle-Version-1.0.0.SNAPSHOT",
        "attributes": {
          "artifactName": "Amdatu Kitchensink - Multi-Tenant Demo Global-1.0.0.SNAPSHOT",
          "mimetype": "application/vnd.osgi.bundle",
          "Bundle-Name": "Amdatu Kitchensink - Multi-Tenant Demo Global",
          "Bundle-SymbolicName": "org.amdatu.kitchensink.demo.tenant.global",
          "Bundle-Version": "1.0.0.SNAPSHOT",
          "url": "http://localhost:8080/obr/org.amdatu.kitchensink.demo.tenant.global-1.0.0-20120529.115032-40.jar",
          "artifactDescription": "",
          "processorPid": ""
        },
        "tags": {}
      }
    ],
    "feature2distribution": [],
    "target": [],
    "distribution2target": [],
    "feature": [],
    "distribution": []
  }
}
{code}
This works perfectly fine.

However, if you want to import this model, the error "Cannot create existing resource!" will be thrown, because of an incorrect (?) check in createResource, in the ace-client (AceClientWorkspace.createResource(T) to be precise). In that method, it checks wether the definition of the resource is null, or not. If it isn't, it assumes the resource already exists, since the definition of a resource is used as a unique identifier and gets assigned to a resource after it is added. But, because exportModel exports everything, including the definition, the definition already exists, even when the resource does not yet. This way, the same exception is thrown every time.

There are a few solutions to this problem:
 1) remove the check or the definition in the import (with the risk resources actually can be double in the workspace or an other exception is thrown in case of double resources);
 2) before creating the resource, check if it actually does exist and update it if it does/throw an exception, but just create it if it doesn't;
 3) have the exportModel no longer export this property;
 4) other?

On a side note, in the ace-client bundle, there are both resourceIds
 as  and  definitions, which are exactly the same, save for the different naming. This should be consequent.
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
_______________________________________________
Amdatu-developers mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-developers

Reply via email to