Examples of ArtifactResource


Examples of org.apache.ace.client.repository.helper.ArtifactResource

        assertEquals(map.get(ArtifactObject.KEY_ARTIFACT_NAME), "My Cool Bundle-1.0.0");
    }

    @Test(groups = { UNIT })
    public void testLocalizedManifestExtraction() {
        ArtifactResource artifact = new ArtifactResource() {
            @Override
            public InputStream openStream() throws IOException {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                Manifest manifest = new Manifest();
                Attributes attrs = manifest.getMainAttributes();
View Full Code Here

Examples of org.apache.ace.client.repository.helper.ArtifactResource

    }

    @Test(groups = { UNIT })
    public void testLocalizedManifestExtractionWithDefaultBase() {
        // note that we do not set the Bundle-Localization header
        ArtifactResource artifact = new ArtifactResource() {
            @Override
            public InputStream openStream() throws IOException {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                Manifest manifest = new Manifest();
                Attributes attrs = manifest.getMainAttributes();
View Full Code Here

Examples of org.apache.ace.client.repository.helper.ArtifactResource

        assertEquals(map.get(ArtifactObject.KEY_ARTIFACT_NAME), "The Coolest Bundle-1.0.0");
    }

    @Test(groups = { UNIT })
    public void testLocalizedManifestExtractionWithLocale() {
        ArtifactResource artifact = new ArtifactResource() {
            @Override
            public InputStream openStream() throws IOException {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                Manifest manifest = new Manifest();
                Attributes attrs = manifest.getMainAttributes();
View Full Code Here

Examples of org.apache.ace.client.repository.helper.ArtifactResource

        assertEquals(map.get(ArtifactObject.KEY_ARTIFACT_NAME), "De koelste Bundle-1.0.0");
    }

    @Test(groups = { UNIT })
    public void testLocalizedManifestExtractionWithLocaleOverrule() {
        ArtifactResource artifact = new ArtifactResource() {
            @Override
            public InputStream openStream() throws IOException {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                Manifest manifest = new Manifest();
                Attributes attrs = manifest.getMainAttributes();
View Full Code Here

Examples of org.apache.ace.client.repository.helper.ArtifactResource

        if (res == null) {
            return null;
        }

        final URL url = getClass().getClassLoader().getResource("./" + res);
        return new ArtifactResource() {
            @Override
            public long getSize() throws IOException {
                return -1L;
            }
View Full Code Here

Examples of org.apache.ace.client.repository.helper.ArtifactResource

        if (res == null) {
            return null;
        }

        final URL url = getClass().getClassLoader().getResource("./" + res);
        return new ArtifactResource() {
            @Override
            public long getSize() throws IOException {
                return -1L;
            }
View Full Code Here

Examples of org.apache.ace.client.repository.helper.ArtifactResource

        }

        // Sort the references by service ranking.
        Arrays.sort(refs, Collections.reverseOrder());

        ArtifactResource resource = convertToArtifactResource(url);

        // Check all referenced services to find one that matches our input.
        ArtifactRecognizer recognizer = null;
        String foundMimetype = null;
        for (ServiceReference ref : refs) {
View Full Code Here

Examples of org.apache.ace.client.repository.helper.ArtifactResource

       
        return importArtifact(artifact, recognizer, helper, mimetype, true, upload);
    }

    private ArtifactObject importArtifact(URL artifact, ArtifactRecognizer recognizer, ArtifactHelper helper, String mimetype, boolean overwrite, boolean upload) throws IOException {
        ArtifactResource resource = convertToArtifactResource(artifact);

        Map<String, String> attributes = recognizer.extractMetaData(resource);
        Map<String, String> tags = new HashMap<String, String>();

        helper.checkAttributes(attributes);
        attributes.put(ArtifactObject.KEY_ARTIFACT_DESCRIPTION, "");
        attributes.put(ArtifactObject.KEY_SIZE, Long.toString(resource.getSize()));
        if (overwrite) {
            attributes.put(ArtifactObject.KEY_MIMETYPE, mimetype);
        }

        String artifactURL = artifact.toString();
View Full Code Here

Examples of org.apache.ace.client.repository.helper.ArtifactResource

    private ArtifactResource convertToArtifactResource(final URL url) {
        if (url == null) {
            return null;
        }

        return new ArtifactResource() {
            public URL getURL() {
                return url;
            }

            @Override
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.