Hi Eranda, I didn't understand what you mean. This is loading the attributes from content from what I understand, going by the code you highlighted. But, there are situations where we can have an RXT for artifacts such as WSDL and Schema (i.e. the ones that will have a different mediatype from "application/vnd\\.[a-zA-Z0-9.-]+\\+xml". For these, we conciously load attributes from properties. What's wrong here?
Thanks, Senaka. On Fri, Nov 14, 2014 at 8:44 PM, Eranda Sooriyabandara <[email protected]> wrote: > 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 > > > > > > -- *[image: http://wso2.com] <http://wso2.com>Senaka Fernando* Solutions Architect; WSO2 Inc.; http://wso2.com *Member; Apache Software Foundation; http://apache.org <http://apache.org>E-mail: senaka AT wso2.com <http://wso2.com>**P: +1 408 754 7388; ext: 51736*; *M: +44 782 741 1966Linked-In: http://linkedin.com/in/senakafernando <http://linkedin.com/in/senakafernando>*Lean . Enterprise . Middleware
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
