Package org.apache.ace.client.repository.helper

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


        Arrays.sort(refs, SERVICE_RANK_COMPARATOR);

        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) {
            ArtifactRecognizer candidate = (ArtifactRecognizer) m_context.getService(ref);
            try {
                if (mimetype != null) {
                    if (candidate.canHandle(mimetype)) {
                        recognizer = candidate;
                        break;
                    }
                }
                else {
                    String candidateMime = candidate.recognize(resource);
                    if (candidateMime != null) {
                        foundMimetype = candidateMime;
                        recognizer = candidate;
                        break;
                    }
View Full Code Here


                throw new IllegalArgumentException("The URL to import cannot be null or empty.");
            }
            checkURL(artifact);

            Map<Class<?>, Object> fromArtifact = findRecognizerAndHelper(artifact);
            ArtifactRecognizer recognizer = (ArtifactRecognizer) fromArtifact.get(ArtifactRecognizer.class);
            ArtifactHelper helper = (ArtifactHelper) fromArtifact.get(ArtifactHelper.class);
            String mimetype = (String) fromArtifact.get(String.class);

            return importArtifact(artifact, recognizer, helper, mimetype, false, upload);
        }
View Full Code Here

            }

            checkURL(artifact);

            Map<Class<?>, Object> fromMimetype = findRecognizerAndHelper(mimetype);
            ArtifactRecognizer recognizer = (ArtifactRecognizer) fromMimetype.get(ArtifactRecognizer.class);
            ArtifactHelper helper = (ArtifactHelper) fromMimetype.get(ArtifactHelper.class);

            return importArtifact(artifact, recognizer, helper, mimetype, true, upload);
        }
        catch (IllegalArgumentException iae) {
View Full Code Here

        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) {
            ArtifactRecognizer candidate = (ArtifactRecognizer) m_context.getService(ref);
            try {
                if (mimetype != null) {
                    if (candidate.canHandle(mimetype)) {
                        recognizer = candidate;
                        break;
                    }
                }
                else {
                    String candidateMime = candidate.recognize(resource);
                    if (candidateMime != null) {
                        foundMimetype = candidateMime;
                        recognizer = candidate;
                        break;
                    }
View Full Code Here

            throw new IllegalArgumentException("The URL to import cannot be null or empty.");
        }
        checkURL(artifact);
       
        Map<Class<?>, Object> fromArtifact = findRecognizerAndHelper(artifact);
        ArtifactRecognizer recognizer = (ArtifactRecognizer) fromArtifact.get(ArtifactRecognizer.class);
        ArtifactHelper helper = (ArtifactHelper) fromArtifact.get(ArtifactHelper.class);
        String mimetype = (String) fromArtifact.get(String.class);
       
        return importArtifact(artifact, recognizer, helper, mimetype, false, upload);
    }
View Full Code Here

        }
       
        checkURL(artifact);
       
        Map<Class<?>, Object> fromMimetype = findRecognizerAndHelper(mimetype);
        ArtifactRecognizer recognizer = (ArtifactRecognizer) fromMimetype.get(ArtifactRecognizer.class);
        ArtifactHelper helper = (ArtifactHelper) fromMimetype.get(ArtifactHelper.class);
       
        return importArtifact(artifact, recognizer, helper, mimetype, true, upload);
    }
View Full Code Here

        // If available, sort the references by service ranking.
        Arrays.sort(refs, SERVICE_RANK_COMPARATOR);

        // Check all referenced services to find one that matches our input.
        ArtifactRecognizer recognizer = null;
        String foundMimetype = null;
        for (ServiceReference ref : refs) {
            ArtifactRecognizer candidate = (ArtifactRecognizer) m_context.getService(ref);
            if (mimetype != null) {
                if (candidate.canHandle(mimetype)) {
                    recognizer = candidate;
                    break;
                }
            }
            else {
                String candidateMime = candidate.recognize(url);
                if (candidateMime != null) {
                    foundMimetype = candidateMime;
                    recognizer = candidate;
                    break;
                }
View Full Code Here

                throw new IllegalArgumentException("The URL to import cannot be null or empty.");
            }
            checkURL(artifact);

            Map<Class<?>, Object> fromArtifact = findRecognizerAndHelper(artifact);
            ArtifactRecognizer recognizer = (ArtifactRecognizer) fromArtifact.get(ArtifactRecognizer.class);
            ArtifactHelper helper = (ArtifactHelper) fromArtifact.get(ArtifactHelper.class);
            String mimetype = (String) fromArtifact.get(String.class);

            return importArtifact(artifact, recognizer, helper, mimetype, false, upload);
        }
View Full Code Here

            }

            checkURL(artifact);

            Map<Class<?>, Object> fromMimetype = findRecognizerAndHelper(mimetype);
            ArtifactRecognizer recognizer = (ArtifactRecognizer) fromMimetype.get(ArtifactRecognizer.class);
            ArtifactHelper helper = (ArtifactHelper) fromMimetype.get(ArtifactHelper.class);

            return importArtifact(artifact, recognizer, helper, mimetype, true, upload);
        }
        catch (IllegalArgumentException iae) {
View Full Code Here

TOP

Related Classes of org.apache.ace.client.repository.helper.ArtifactRecognizer

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.