Package org.apache.felix.sigil.common.repository

Examples of org.apache.felix.sigil.common.repository.RepositoryException


            return cache.repo;
        }
        catch (RuntimeException e)
        {
            throw new RepositoryException("Failed to build repositories", e);
        }
    }
View Full Code Here


        if (repository == null)
        {
            String pattern = properties.getProperty("pattern");
            if (pattern == null)
            {
                throw new RepositoryException("property 'pattern' not specified.");
            }
            repository = new ProjectRepository(id, pattern);
            cache.put(id, repository);
        }
View Full Code Here

    public IBundleRepository createRepository(String id, Properties preferences)
        throws RepositoryException
    {
        String urlStr = preferences.getProperty("url");
        if (urlStr == null)
            throw new RepositoryException("url is not specified.");

        try
        {
            File urlFile = new File(urlStr);
            URL repositoryURL = urlFile.exists() ? urlFile.toURI().toURL() : new URL(
                urlStr);
            URL testURL = urlFile.exists() ? urlFile.toURI().toURL() : new URL(urlStr);
            File indexCache = new File(preferences.getProperty(INDEX_CACHE_FILE));
            File localCache = new File(preferences.getProperty(CACHE_DIRECTORY));
            String auth = preferences.getProperty(AUTH_FILE);
            File authFile = auth == null ? null : new File(auth);
            Long up = preferences.containsKey(UPDATE_PERIOD) ? Long.parseLong(preferences.getProperty(UPDATE_PERIOD))
                : 60 * 60 * 24 * 7;
           
            boolean offline = preferences.containsKey(OFFLINE) ? Boolean.parseBoolean(preferences.getProperty(OFFLINE)) : false;

            if (!offline && testURL.openConnection().getLastModified() == 0)
            {
                String msg = "Failed to read OBR index: ";
                if (!indexCache.exists())
                    throw new RepositoryException(msg + urlStr);
                System.err.println("WARNING: " + msg + "using cache: " + urlStr);
            }

            long updatePeriod = TimeUnit.MILLISECONDS.convert(up, TimeUnit.SECONDS);
            if (preferences.getProperty(IN_MEMORY) == null)
            {
                return new NonCachingOBRBundleRepository(id, repositoryURL, indexCache,
                    localCache, updatePeriod, authFile, offline);
            }
            else
            {
                return new CachingOBRBundleRepository(id, repositoryURL, indexCache,
                    localCache, updatePeriod, authFile, offline);
            }
        }
        catch (IOException e)
        {
            throw new RepositoryException(id + ": invalid repository url:" + urlStr, e);
        }
    }
View Full Code Here

           
            return new SystemRepository(id, frameworkPath, pkgs);
        }
        catch (IOException e)
        {
            throw new RepositoryException("Failed to load profile", e);
        }
    }
View Full Code Here

    {
        String dirStr = preferences.getProperty("dir");
        File dir = new File(dirStr);
        if (!dir.isDirectory())
        {
            throw new RepositoryException("directory '" + dir + "' does not exist.");
        }
        boolean recurse = Boolean.valueOf(preferences.getProperty("recurse"));
        return new FileSystemRepository(id, dir, recurse);
    }
View Full Code Here

TOP

Related Classes of org.apache.felix.sigil.common.repository.RepositoryException

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.