Skip to content

Commit

Permalink
#8: Fully qualified names fixed so pmd is ok.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cajova-Houba committed Dec 18, 2018
1 parent fb83cf6 commit 63042df
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import cz.zcu.kiv.crce.metadata.osgi.namespace.*;
import cz.zcu.kiv.crce.metadata.service.MetadataService;
import cz.zcu.kiv.crce.metadata.type.Version;
import org.apache.felix.utils.manifest.Attribute;
import org.apache.felix.utils.manifest.Clause;
import org.apache.felix.utils.manifest.Directive;
import org.apache.felix.utils.manifest.Parser;
Expand Down Expand Up @@ -122,16 +121,16 @@ public InputStream getInputStream() throws IOException {
return Collections.emptyList();
}

cz.zcu.kiv.crce.metadata.Attribute<String> pn = osgiIdentity.getAttribute(NsOsgiIdentity.ATTRIBUTE__PRESENTATION_NAME);
Attribute<String> pn = osgiIdentity.getAttribute(NsOsgiIdentity.ATTRIBUTE__PRESENTATION_NAME);
if (pn != null) {
metadataService.setPresentationName(resource, pn.getValue());
}
cz.zcu.kiv.crce.metadata.Attribute<String> sn = osgiIdentity.getAttribute(NsOsgiIdentity.ATTRIBUTE__SYMBOLIC_NAME);
Attribute<String> sn = osgiIdentity.getAttribute(NsOsgiIdentity.ATTRIBUTE__SYMBOLIC_NAME);
if(sn != null) {
metadataService.setExternalId(resource, sn.getValue());
}

cz.zcu.kiv.crce.metadata.Attribute<Version> ver = osgiIdentity.getAttribute(NsOsgiIdentity.ATTRIBUTE__VERSION);
Attribute<Version> ver = osgiIdentity.getAttribute(NsOsgiIdentity.ATTRIBUTE__VERSION);
if(ver != null) {
Capability identity = metadataService.getIdentity(resource);
identity.setAttribute(NsCrceIdentity.ATTRIBUTE__VERSION, ver.getValue());
Expand Down Expand Up @@ -354,9 +353,9 @@ private void createServiceFilter(Requirement ri, Clause clause) {
private Capability createServiceCapability(Clause clause) {
Capability capability = metadataFactory.createCapability(NsOsgiService.NAMESPACE__OSGI_SERVICE);
capability.setAttribute(NsOsgiService.ATTRIBUTE__NAME, clause.getName());
Attribute[] attributes = clause.getAttributes();
org.apache.felix.utils.manifest.Attribute[] attributes = clause.getAttributes();
if (attributes != null) {
for (Attribute attribute : attributes) {
for (org.apache.felix.utils.manifest.Attribute attribute : attributes) {
capability.setAttribute(new SimpleAttributeType<>(attribute.getName(), String.class), attribute.getValue());
}
}
Expand Down Expand Up @@ -444,7 +443,7 @@ private Capability createCapability(Clause clause) {
Capability capability = metadataFactory.createCapability(NsOsgiPackage.NAMESPACE__OSGI_PACKAGE);
capability.setAttribute(NsOsgiPackage.ATTRIBUTE__NAME, clause.getName());
capability.setAttribute(NsOsgiPackage.ATTRIBUTE__VERSION, new Version(getVersion(clause)));
Attribute[] attributes = clause.getAttributes();
org.apache.felix.utils.manifest.Attribute[] attributes = clause.getAttributes();
for (int i = 0; attributes != null && i < attributes.length; i++) {
String key = attributes[i].getName();
if (!key.equalsIgnoreCase(Constants.PACKAGE_SPECIFICATION_VERSION) && !key.equalsIgnoreCase(Constants.VERSION_ATTRIBUTE)) {
Expand Down Expand Up @@ -478,7 +477,7 @@ private void doImportPackages(Resource resource, Headers headers) throws IOExcep
private void createImportFilter(Requirement requirement, AttributeType<String> name, Clause clause) {
requirement.addAttribute(name, clause.getName());
appendVersion(requirement, NsOsgiPackage.ATTRIBUTE__VERSION, getVersionRange(clause));
Attribute[] attributes = clause.getAttributes();
org.apache.felix.utils.manifest.Attribute[] attributes = clause.getAttributes();
Set<String> attrs = doImportPackageAttributes(requirement, attributes);

// The next code is using the subset operator
Expand All @@ -502,7 +501,7 @@ private void createImportFilter(Requirement requirement, AttributeType<String> n
}

@SuppressWarnings("deprecation")
private Set<String> doImportPackageAttributes(Requirement requirement, Attribute[] attributes) {
private Set<String> doImportPackageAttributes(Requirement requirement, org.apache.felix.utils.manifest.Attribute[] attributes) {
HashSet<String> set = new HashSet<>();
for (int i = 0; attributes != null && i < attributes.length; i++) {
String name = attributes[i].getName();
Expand Down

0 comments on commit 63042df

Please sign in to comment.