Package org.rioproject.impl.util

Examples of org.rioproject.impl.util.DownloadManager


                throw new IOException("Not an OAR");
            StagedData artifact = new StagedData();
            artifact.setLocation(archive.toExternalForm());
            artifact.setInstallRoot(dirName);
            artifact.setUnarchive(true);
            DownloadManager downloadMgr =
                new DownloadManager(FileUtils.getFilePath(installDir), artifact);
            DownloadRecord record = downloadMgr.download();
            return(record);
        } else {
            throw new IOException("Installation must be a .jar or an .oar");
        }
    }
View Full Code Here


            platformCapabilities.add(pCap);
        }

        try {
            if(stagedSoftware !=null) {
                DownloadManager downloadMgr = new DownloadManager(provisionRoot, stagedSoftware);
                DownloadRecord record = null;
                try {
                    logger.trace("Provisioning StagedSoftware for PlatformCapability : {}", pCap.getClass().getName());
                    record = downloadMgr.download();
                    if(record!=null) {
                        logger.trace(record.toString());
                        pCap.addDownloadRecord(record);
                        pCap.setPath(record.unarchived()?
                                     record.getExtractedPath():record.getPath());
                    }
                    pCap.addStagedSoftware(stagedSoftware);
                    DownloadRecord postInstallRecord = downloadMgr.postInstall();
                    if(postInstallRecord!=null)
                        pCap.addDownloadRecord(postInstallRecord);

                    if(stagedSoftware.getUseAsClasspathResource()) {
                        String[] classpath;
                        if(pCap.getPath().endsWith(".jar") || pCap.getPath().endsWith(".zip")) {
                            classpath = StringUtil.toArray(pCap.getPath());
                        } else {
                            String cp = pCap.getPath();
                            File f = new File(cp);
                            if(!f.isDirectory())
                                cp = FileUtils.getFilePath(f.getParentFile());
                            classpath = new String[]{cp};
                        }
                        pCap.setClassPath(classpath);
                    }
                    if(!stagedSoftware.removeOnDestroy()) {
                        String configFileLocation = systemCapabilitiesLoader.getPlatformConfigurationDirectory(config);
                        if(configFileLocation==null) {
                            logger.warn("Unable to write PlatformConfiguration [{}] configuration, " +
                                        "unknown platform configuration directory. The RIO_HOME environment " +
                                        "variable must be set", pCap.getName());
                        } else {
                            PlatformCapabilityWriter pCapWriter = new PlatformCapabilityWriter();
                            String fileName = pCapWriter.write(pCap, configFileLocation);
                            pCap.setConfigurationFile(fileName);
                            logger.info("Wrote PlatformCapability [{}] configuration to {}", pCap.getName(), fileName);
                        }
                    }
                    logger.trace("Have PlatformCapability : {} load any system resources", pCap.getClass().getName());
                    stateChange();

                } catch(IOException e) {
                    if(record!=null)
                        downloadMgr.remove();
                    logger.warn("Provisioning StagedSoftware for PlatformCapability : {}", pCap.getClass().getName(), e);
                }
            }
        } finally {
            synchronized(platformCapabilityPending) {
View Full Code Here

        StagedData[] stagedData = sElem.getStagedData();
        for (StagedData data : stagedData) {
            DownloadRecord dlRec;
            if (data.getInstallRoot().startsWith(File.separator)) {
                DownloadManager dlManager = new DownloadManager(data);
                dlRec = dlManager.download();
                dlRecords.add(dlRec);
            } else {
                String provisionRoot = computeResource.getPersistentProvisioningRoot();
                DownloadManager dlManager = new DownloadManager(provisionRoot, data);
                dlRec = dlManager.download();
                dlRecords.add(dlRec);
            }
            if (data.getPerms() != null) {
                if (OperatingSystemType.isWindows()) {
                    logger.warn("Cannot apply permissions [{}] to StagedData on Windows", data.getPerms());
View Full Code Here

TOP

Related Classes of org.rioproject.impl.util.DownloadManager

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.