Hi Senaka,
Sorry for being this much late on this commit. But I have seen it now.
In GovernanceUtils
if (mediaType.matches("application/vnd\\.[a-zA-Z0-9.-]+\\+xml")) {
byte[] contentBytes = (byte[])
artifactResource.getContent();
if (contentBytes == null) {
throw new GovernanceException(
"Unable to read payload of
governance artifact " +
"at path: " +
artifactPath);
}
OMElement contentElement =
buildOMElement(contentBytes);
artifact = new GenericArtifactImpl(
artifactId, contentElement,
configuration.getArtifactNameAttribute(),
configuration.getArtifactNamespaceAttribute(),
configuration.getArtifactElementNamespace(),
configuration.getMediaType());
artifact.associateRegistry(registry);
artifact.setArtifactPath(artifactPath);
} else {
artifact = new
GenericArtifactImpl(artifactId, registry);
}
In GovernanceArtifactImpl
public GenericArtifactImpl(String id, Registry registry) throws
GovernanceException {
super(id);
associateRegistry(registry);
loadDetails();
}
The construct invoke loadDetails method which is as below.
+ /**
+ * Method to load the details into this artifact.
+ *
+ * @throws GovernanceException if the operation failed.
+ */
+ public void loadDetails() throws GovernanceException {
+ checkRegistryResourceAssociation();
+ Registry registry = getAssociatedRegistry();
+ String path = getPath();
+ String id = getId();
+ Resource resource;
+ try {
+ resource = registry.get(path);
+ this.content = (byte[]) resource.getContent();
+ this.mediaType = resource.getMediaType();
+ } catch (RegistryException e) {
+ throw new GovernanceException("Error in getting the qualified
name for the artifact. " +
+ "artifact id: " + id + ", " + "path: " + path + ".",
e);
+ }
+ // get the target namespace.
+ String fileName = RegistryUtils.getResourceName(path);
+ this.qName = new QName(null, fileName);
+
+ // and then iterate all the properties and add.
+ Properties properties = resource.getProperties();
+ if (properties != null) {
+ Set keySet = properties.keySet();
+ if (keySet != null) {
+ for (Object keyObj : keySet) {
+ String key = (String) keyObj;
+ List values = (List) properties.get(key);
+ if (values != null) {
+ for (Object valueObj : values) {
+ String value = (String) valueObj;
+ addAttribute(key, value);
+ }
+ }
+ }
+ }
+ }
+ }
Why are we loading artifact attributes from resource properties, not from
resource content? Log says "Fix 5, getting the Assets to show up on the
Asset Store". AFAIK this is we are doing wrong or we did a hack.
thanks
Eranda
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev