Package org.jboss.gravia.resource

Examples of org.jboss.gravia.resource.VersionRange


                String slot = version != Version.emptyVersion ? "slot='" + version + "'" : "";
                buffer.append("<module name='" + modname + "' " + slot + "/>");
                LOGGER.info("  {}", identity);
            } else {
                String modname = (String) req.getAttribute(IdentityNamespace.IDENTITY_NAMESPACE);
                VersionRange versionRange = (VersionRange) req.getAttribute(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE);
                if (versionRange != null) {
                    LOGGER.warn("Cannot find mapping for: {}", req);
                }
                buffer.append("<module name='" + modname + "'/>");
                LOGGER.info("  {}", modname);
View Full Code Here


        // Build a resource that has a dependency on camel.core
        DefaultResourceBuilder builderE = new DefaultResourceBuilder();
        Capability icapE = builderE.addIdentityCapability(RESOURCE_E, Version.emptyVersion);
        icapE.getAttributes().put(ContentNamespace.CAPABILITY_RUNTIME_NAME_ATTRIBUTE, RESOURCE_E + ".war");
        builderE.addContentCapability(deployer.getDeployment(RESOURCE_E));
        builderE.addIdentityRequirement("org.apache.camel.core", new VersionRange("[2.11,3.0)"));
        Resource res = builderE.getResource();

        // Add that resource to the repository
        Resource resB = provisioner.getRepository().addResource(res);
        Assert.assertEquals(RESOURCE_E + ":0.0.0", resB.getIdentity().toString());
View Full Code Here

                String slot = version != Version.emptyVersion ? "slot='" + version + "'" : "";
                buffer.append("<module name='" + modname + "' " + slot + "/>");
                LOGGER.info("  {}", identity);
            } else {
                String modname = (String) req.getAttribute(IdentityNamespace.IDENTITY_NAMESPACE);
                VersionRange versionRange = (VersionRange) req.getAttribute(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE);
                if (versionRange != null) {
                    LOGGER.warn("Cannot find mapping for: {}", req);
                }
                buffer.append("<module name='" + modname + "'/>");
                LOGGER.info("  {}", modname);
View Full Code Here

        }

        @Override
        public Set<Capability> findProviders(Requirement requirement) {
            String symbolicName = (String) requirement.getAttribute(IdentityNamespace.IDENTITY_NAMESPACE);
            VersionRange versionRange = (VersionRange) requirement.getAttribute(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE);

            Set<Capability> result = new HashSet<Capability>();

            // Find the module versions that match
            File moduleDir = new File(modulesDir, symbolicName.replace(".", File.separator));
            if (versionRange != null && moduleDir.isDirectory()) {
                for (File file : moduleDir.listFiles()) {
                    if (!file.isDirectory() || file.getName().equals("main")) {
                        continue;
                    }
                    Version version;
                    try {
                        version = new Version(file.getName());
                    } catch (Throwable th) {
                        continue;
                    }
                    if (!versionRange.includes(version)) {
                        continue;
                    }
                    String modname = symbolicName + ":" + version;
                    ModuleIdentifier modid = ModuleIdentifier.fromString(modname);
                    try {
View Full Code Here

        // Build a resource that has a dependency on camel.core
        DefaultResourceBuilder builderE = new DefaultResourceBuilder();
        Capability icapE = builderE.addIdentityCapability(RESOURCE_E, Version.emptyVersion);
        icapE.getAttributes().put(ContentNamespace.CAPABILITY_RUNTIME_NAME_ATTRIBUTE, RESOURCE_E + ".war");
        builderE.addContentCapability(deployer.getDeployment(RESOURCE_E));
        builderE.addIdentityRequirement("org.apache.camel.core", new VersionRange("[2.11,3.0)"));
        Resource res = builderE.getResource();

        // Add that resource to the repository
        Resource resB = provisioner.getRepository().addResource(res);
        Assert.assertEquals(RESOURCE_E + ":0.0.0", resB.getIdentity().toString());
View Full Code Here

        // Build a resource that has a dependency on camel.core
        DefaultResourceBuilder builderE = new DefaultResourceBuilder();
        Capability icapE = builderE.addIdentityCapability(RESOURCE_E, Version.emptyVersion);
        icapE.getAttributes().put(ContentNamespace.CAPABILITY_RUNTIME_NAME_ATTRIBUTE, RESOURCE_E + ".war");
        builderE.addContentCapability(deployer.getDeployment(RESOURCE_E));
        builderE.addIdentityRequirement("org.apache.camel.core", new VersionRange("[2.11,3.0)"));
        Resource res = builderE.getResource();

        // Add that resource to the repository
        Resource resB = provisioner.getRepository().addResource(res);
        Assert.assertEquals(RESOURCE_E + ":0.0.0", resB.getIdentity().toString());
View Full Code Here

        // Build a resource that has a dependency on camel.core
        DefaultResourceBuilder builderE = new DefaultResourceBuilder();
        Capability icapE = builderE.addIdentityCapability(RESOURCE_E, Version.emptyVersion);
        icapE.getAttributes().put(ContentNamespace.CAPABILITY_RUNTIME_NAME_ATTRIBUTE, RESOURCE_E + ".war");
        builderE.addContentCapability(deployer.getDeployment(RESOURCE_E));
        builderE.addIdentityRequirement("org.apache.camel.core", new VersionRange("[2.11,3.0)"));
        Resource res = builderE.getResource();

        // Add that resource to the repository
        Resource resB = provisioner.getRepository().addResource(res);
        Assert.assertEquals(RESOURCE_E + ":0.0.0", resB.getIdentity().toString());
View Full Code Here

                break;
            case VersionRange:
                if (listType) {
                    List<VersionRange> list = new ArrayList<>();
                    for (String val : split(valstr)) {
                        list.add(new VersionRange(val.trim()));
                    }
                    value = list;
                } else {
                    value = new VersionRange(valstr);
                }
                break;
            default:
                value = valstr;
                break;
View Full Code Here

        return attributes != null ? attributes.get(key) : null;
    }

    public static VersionRange getVersionRange(Requirement req, String attr) {
        Object value = req.getAttribute(attr);
        return (value instanceof String) ? new VersionRange((String) value) : (VersionRange) value;
    }
View Full Code Here

    }

    protected void validate() {
        Object attval = getAttribute(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE);
        if (attval != null && !(attval instanceof VersionRange)) {
            getAttributes().put(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE, new VersionRange(attval.toString()));
        }
        String resdir = getDirective(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE);
        optional = Namespace.RESOLUTION_OPTIONAL.equals(resdir);
        canonicalName = toString();
    }
View Full Code Here

TOP

Related Classes of org.jboss.gravia.resource.VersionRange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.