Examples of ArtifactObject


Examples of org.apache.ace.client.repository.object.ArtifactObject

        Map<String, ArtifactObject> allProcessors = getAllProcessors();

        // Determine all resource processors we need
        for (String processor : artifacts.values()) {
            if (!bundles.containsValue(processor)) {
                ArtifactObject bundle = allProcessors.get(processor);
                if (bundle == null) {
                    m_log.log(LogService.LOG_ERROR, "Unable to create deployment version: there is no resource processing bundle available that publishes " + processor);
                    throw new IOException("Unable to create deployment version: there is no resource processing bundle available that publishes " + processor);
                }
                bundles.put(bundle, processor);
            }
        }

        List<DeploymentArtifact> result = new ArrayList<DeploymentArtifact>();

        for (ArtifactObject bundle : bundles.keySet()) {
            Map<String, String> directives = new HashMap<String, String>();
            if (m_bundleHelper.isResourceProcessor(bundle)) {
                // it's a resource processor, mark it as such.
                directives.put(DeploymentArtifact.DIRECTIVE_ISCUSTOMIZER, "true");
            }
            directives.put(BundleHelper.KEY_SYMBOLICNAME, m_bundleHelper.getSymbolicName(bundle));
            String bundleVersion = m_bundleHelper.getVersion(bundle);
            if (bundleVersion != null) {
                directives.put(BundleHelper.KEY_VERSION, bundleVersion);
            }

            directives.put(DeploymentArtifact.DIRECTIVE_KEY_BASEURL, bundle.getURL());

            String repositoryPath = getRepositoryPath(bundle, path);
            if (repositoryPath != null) {
                directives.put(DeploymentArtifact.REPOSITORY_PATH, repositoryPath);
            }

            result.add(m_deploymentRepository.createDeploymentArtifact(bundle.getURL(), bundle.getSize(), directives));
        }

        for (ArtifactObject artifact : artifacts.keySet()) {
            Map<String, String> directives = new HashMap<String, String>();
            directives.put(DeploymentArtifact.DIRECTIVE_KEY_PROCESSORID, artifact.getProcessorPID());
View Full Code Here

Examples of org.apache.ace.client.repository.object.ArtifactObject

     */
    private Map<String, ArtifactObject> getAllProcessors() {
        Map<String, ArtifactObject> allProcessors = new HashMap<String, ArtifactObject>();
        for (ArtifactObject processorBundle : m_artifactRepository.getResourceProcessors()) {
            String pid = m_bundleHelper.getResourceProcessorPIDs(processorBundle);
            ArtifactObject existingProcessorBundle = allProcessors.get(pid);
            if (existingProcessorBundle == null) {
                allProcessors.put(pid, processorBundle);
            }
            else {
                // if there are multiple versions of a resource processor, we explicitly want to always
                // return the latest version of a resource processor...
                String existingVersionString = existingProcessorBundle.getAttribute(BundleHelper.KEY_VERSION);
                String newVersionString = processorBundle.getAttribute(BundleHelper.KEY_VERSION);
                Version existingVersion = existingVersionString == null ? Version.emptyVersion : Version.parseVersion(existingVersionString);
                Version newVersion = newVersionString == null ? Version.emptyVersion : Version.parseVersion(newVersionString);
                if (existingVersion.compareTo(newVersion) < 0) {
                    allProcessors.put(pid, processorBundle);
View Full Code Here

Examples of org.apache.ace.client.repository.object.ArtifactObject

                            String processorPID = artifact.getProcessorPID();
                            if (processorPID == null) {
                                m_log.log(LogService.LOG_WARNING, "Cannot gather necessary artifacts: no processor PID defined for " + artifact.getName());
                                return null;
                            }
                            ArtifactObject processor = allProcessors.get(processorPID);
                            if (processor == null) {
                                // this means we cannot create a useful version; return null.
                                m_log.log(LogService.LOG_WARNING, "Cannot gather necessary artifacts: failed to find resource processor named '" + artifact.getProcessorPID() + "' for artifact '" + artifact.getName() + "'!");
                                return null;
                            }
View Full Code Here

Examples of org.apache.ace.client.repository.object.ArtifactObject

        if (upload) {
            String location = upload(artifact, attributes.get("filename"), mimetype);
            attributes.put(ArtifactObject.KEY_URL, location);
        }

        ArtifactObject result = create(attributes, tags);
        return result;
    }
View Full Code Here

Examples of org.apache.ace.client.repository.object.ArtifactObject

    @Override
    public Artifact2FeatureAssociation createArtifact2FeatureAssociation(String artifactId, String featureId) {
        boolean dynamicRelation = false;

        FeatureObject feature = m_featureRepository.get(featureId);
        ArtifactObject artifact = m_artifactRepository.get(artifactId);
        if (artifact == null) {
            // Maybe a BSN?
            try {
                List<ArtifactObject> artifacts = m_artifactRepository.get(FrameworkUtil.createFilter(String.format("(%s=%s)", Constants.BUNDLE_SYMBOLICNAME, artifactId)));
                if (artifacts != null && artifacts.size() > 0) {
                    dynamicRelation = true;
                    // we only need this artifact for creating the association, so it does not matter which one we
                    // take...
                    artifact = artifacts.get(0);
                }
            }
            catch (InvalidSyntaxException exception) {
                m_log.log(LogService.LOG_ERROR, "Invalid filter syntax?!", exception);
            }
        }

        // Make sure we didn't drop on a resource processor bundle...
        if (artifact != null && artifact.getAttribute(BundleHelper.KEY_RESOURCE_PROCESSOR_PID) != null) {
            // if you drop on a resource processor, and try to get it, you
            // will get null because you cannot associate anything with a
            // resource processor so we check for null here
            return null;
        }
View Full Code Here

Examples of org.apache.ace.client.repository.object.ArtifactObject

                        m_log.log(LogService.LOG_ERROR, "Upload of " + handle.getFile() + " failed.", handle.getFailureReason());
                    }
                    else {
                        try {
                            // Upload was successful, try to upload it to our OBR...
                            ArtifactObject artifact = uploadToOBR(handle);
                            if (artifact != null) {
                                selection.add(artifact.getDefinition());

                                appendSuccess(successMsg, handle);
                            }
                        }
                        catch (ArtifactAlreadyExistsException exception) {
View Full Code Here

Examples of org.apache.ace.client.repository.object.ArtifactObject

            // expected
        }

        m_artifactRepository.addHelper("myMime", helper);

        ArtifactObject obj = createArtifact("myMime", "myUrl", null, null, "10");

        assert obj.getURL().equals("yourURL");
        assert obj.getSize() == 10;

        try {
            m_artifactRepository.getHelper("yourMime");
            assert false : "We have not registered this helper.";
        }
View Full Code Here

Examples of org.apache.ace.client.repository.object.ArtifactObject

        m_artifactRepository.addHelper("myMime", new MockHelper());
        m_artifactRepository.addHelper(BundleHelper.MIMETYPE, new BundleHelperImpl());

        createArtifact(BundleHelper.MIMETYPE, "normalBundle", "normalBundle", null, "10");

        ArtifactObject resourceProcessor1 = createArtifact(BundleHelper.MIMETYPE, "resourceProcessor1", "resourceProcessor1", "somePID", "11");
        ArtifactObject resourceProcessor2 = createArtifact(BundleHelper.MIMETYPE, "resourceProcessor2", "resourceProcessor2", "someOtherPID", "12");

        ArtifactObject myArtifact = createArtifact("myMime", "myArtifact", null, null, "13");

        assert m_artifactRepository.get().size() == 2 : "We expect to find two artifacts, but we find " + m_artifactRepository.get().size();

        List<ArtifactObject> list = m_artifactRepository.get(m_artifactRepository.createFilter("(!(" + BundleHelper.KEY_SYMBOLICNAME + "=normalBundle))"));
        assert (list.size() == 1) && list.contains(myArtifact) : "We expect to find one artifact when filtering, but we find " + list.size();
View Full Code Here

Examples of org.apache.ace.client.repository.object.ArtifactObject

    }

    @Test( groups = { TestUtils.UNIT } )
    public void testArtifactSizeDeterminedByRepository() throws InvalidSyntaxException {
        m_artifactRepository.addHelper(BundleHelper.MIMETYPE, new BundleHelperImpl());
        ArtifactObject artifact = createArtifact(BundleHelper.MIMETYPE, "normalBundle", "normalBundle", null, "10");

        List<ArtifactObject> list = m_artifactRepository.get();
        assert (list.size() == 1) && list.contains(artifact) : "Expected a single artifact with the specified mimetype!";
       
        assert list.get(0).getSize() == 10 : "Expected the size to be filled in!";
View Full Code Here

Examples of org.apache.ace.client.repository.object.ArtifactObject

        }
        return null;
    }

    protected void handleEvent(String topic, RepositoryObject entity, org.osgi.service.event.Event event) {
        ArtifactObject artifact = (ArtifactObject) entity;
        if (ArtifactObject.TOPIC_ADDED.equals(topic)) {
            addToTable(artifact);
        }
        if (ArtifactObject.TOPIC_REMOVED.equals(topic)) {
            removeFromTable(artifact);
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.