Package org.apache.felix.bundlerepository.impl

Examples of org.apache.felix.bundlerepository.impl.ResourceImpl


            for ( File file : files )
            {
                try
                {
                    ResourceImpl resource = ( ResourceImpl ) dmh.createResource( file.toURI().toURL() );
                    if ( resource != null )
                    {
                        repository.addResource( resource );
                        doTemplate( mavenRepoUri, file, resource );
                        log.info( "Adding resource: " + file );
View Full Code Here


    command.execute(null);
    control.verify();
  }

  private Resource createResource(String presentationName, String symbolicName, String version) {
    ResourceImpl r1 = new ResourceImpl();
    r1.put(Resource.PRESENTATION_NAME, presentationName);
    r1.put(Resource.SYMBOLIC_NAME, symbolicName);
    r1.put(Resource.VERSION, version);
    return r1;
  }
View Full Code Here

        LOGGER.debug("Upload new artifact from {}", url);
        String artifactName = "artifact-" + System.currentTimeMillis();
        File temp = new File(new File(this.getLocation()), artifactName);
        FileUtils.copyURLToFile(url, temp);
        // update the repository.xml
        ResourceImpl resource = (ResourceImpl) new DataModelHelperImpl().createResource(temp.toURI().toURL());
        if (resource == null) {
            temp.delete();
            LOGGER.warn("The {} artifact source is not a valid OSGi bundle", url);
            return;
        }
        File destination = new File(new File(this.getLocation()), resource.getSymbolicName() + "-" + resource.getVersion() + ".jar");
        FileUtils.moveFile(temp, destination);
        resource = (ResourceImpl) new DataModelHelperImpl().createResource(destination.toURI().toURL());
        this.addResource(resource);
        this.generateRepositoryXml();
    }
View Full Code Here

        } else {
            // populate the repository
            try {
                URL bundleUrl = entry.toURI().toURL();
                if (isPotentialBundle(bundleUrl.toString())) {
                    ResourceImpl resource = (ResourceImpl) new DataModelHelperImpl().createResource(bundleUrl);
                    this.addResource(resource);
                }
            } catch (IllegalArgumentException e) {
                LOGGER.warn(e.getMessage());
            }
View Full Code Here

                populateFromFilesystem(children[i], filter, update);
            }
        } else {
            try {
                if ((filter == null) || (filesystem.toURI().toURL().toString().matches(filter))) {
                    ResourceImpl resource = (ResourceImpl) new DataModelHelperImpl().createResource(filesystem.toURI().toURL());
                    if (resource != null) {
                        // copy the resource
                        File destination = new File(new File(this.getLocation()), filesystem.getName());
                        LOGGER.debug("Copy from {} to {}", filesystem.getAbsolutePath(), destination.getAbsolutePath());
                        FileUtils.copyFile(filesystem, destination);
                        if (update) {
                            resource = (ResourceImpl) new DataModelHelperImpl().createResource(destination.toURI().toURL());
                            LOGGER.debug("Update the OBR metadata with {}", resource.getId());
                            this.addResource(resource);
                        }
                    }
                }
            } catch (IllegalArgumentException e) {
View Full Code Here

            if (entity.getContentType().getValue().equals("application/java-archive")
                    || entity.getContentType().getValue().equals("application/octet-stream")) {
                // I have a jar/binary, potentially a resource
                try {
                    if ((filter == null) || (url.matches(filter))) {
                        ResourceImpl resource = (ResourceImpl) new DataModelHelperImpl().createResource(new URL(url));
                        if (resource != null) {
                            LOGGER.debug("Copy {} into the Cave repository storage", url);
                            int index = url.lastIndexOf("/");
                            if (index > 0) {
                                url = url.substring(index);
                            }
                            File destination = new File(new File(this.getLocation()), url);
                            FileOutputStream outputStream = new FileOutputStream(destination);
                            entity.writeTo(outputStream);
                            outputStream.flush();
                            outputStream.close();
                            if (update) {
                                resource = (ResourceImpl) new DataModelHelperImpl().createResource(destination.toURI().toURL());
                                LOGGER.debug("Update OBR metadata with {}", resource.getId());
                                this.addResource(resource);
                            }
                        }
                    }
                } catch (IllegalArgumentException e) {
View Full Code Here

TOP

Related Classes of org.apache.felix.bundlerepository.impl.ResourceImpl

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.