Hi Senaka,
> 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? > Sorry for the code extractions which is bit messed up. :) Those types you mentioned are handled differently before this code is executed. Please check GovernanceUtils.retrieveGovernanceArtifactByPath() method. It uses the WsdlManager, SchemaManager and PolicyManager and EndpointManager to retrieve Wsdls, Schemas Policies and Endpoints respectively. So still I can't see any value of this code which violates registry concepts and I think we can remove. WDYT? Hi Ajith, We can replace ServiceManager with GenericArtifactManager. But I don't think WsdlManager, SchemaManager and PolicyManager since they have some specific methods in them which we don't have in GenericArtifactManager. thanks Eranda > > 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 <%2B1%20408%20754%207388>; ext: 51736*; > > > *M: +44 782 741 1966 <%2B44%20782%20741%201966>Linked-In: > http://linkedin.com/in/senakafernando > <http://linkedin.com/in/senakafernando>*Lean . Enterprise . Middleware > -- *Eranda Sooriyabandara*Senior Software Engineer; Integration Technologies Team; WSO2 Inc.; http://wso2.com Lean . Enterprise . Middleware E-mail: eranda AT wso2.com Mobile: +94 716 472 816 Linked-In: http://www.linkedin.com/in/erandasooriyabandara Blog: http://emsooriyabandara.blogspot.com/
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
