public IMetadataRepository create(URI location, String name, String type, Map<String, String> properties) { if (location.getScheme().equals("file")) //$NON-NLS-1$ return new LocalMetadataRepository(getAgent(), location, name, properties); return new URLMetadataRepository(getAgent(), location, name, properties); }
public IMetadataRepository create(URI location, String name, String type, Map<String, String> properties) { if (location.getScheme().equals("file")) //$NON-NLS-1$ return new LocalMetadataRepository(getAgent(), location, name, properties); return new URLMetadataRepository(getAgent(), location, name, properties); }
/** * Returns a file in the local file system that contains the contents of the * metadata repository at the given location. */ private File getLocalFile(URI location, IProgressMonitor monitor) throws IOException, ProvisionException { File localFile = null; URI xzLocation = URIUtil.append(location, REPOSITORY_FILENAME); // If the repository is local, we can return the repository file directly if (PROTOCOL_FILE.equals(xzLocation.getScheme())) { //look for a compressed local file localFile = URIUtil.toFile(xzLocation); if (localFile.exists()) return localFile; String msg = NLS.bind(Messages.io_failedRead, location); throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, msg, null)); } // file is not local, create a cache of the repository metadata CacheManager cache = (CacheManager) getAgent().getService(CacheManager.SERVICE_NAME); if (cache == null) throw new IllegalArgumentException("Cache manager service not available"); //$NON-NLS-1$ localFile = cache.createCacheFromFile(URIUtil.append(location, REPOSITORY_FILENAME), monitor); if (localFile == null) { // there is no remote file in either form - this should not really happen as // createCache should bail out with exception if something is wrong. This is an internal // error. throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, Messages.repoMan_internalError, null)); } return localFile; }
/** * Returns a file in the local file system that contains the contents of the * metadata repository at the given location. */ private File getLocalFile(URI location, IProgressMonitor monitor) throws IOException, ProvisionException { File localFile = null; URI xzLocation = URIUtil.append(location, REPOSITORY_FILENAME); // If the repository is local, we can return the repository file directly if (PROTOCOL_FILE.equals(xzLocation.getScheme())) { //look for a compressed local file localFile = URIUtil.toFile(xzLocation); if (localFile.exists()) return localFile; String msg = NLS.bind(Messages.io_failedRead, location); throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, msg, null)); } // file is not local, create a cache of the repository metadata CacheManager cache = (CacheManager) getAgent().getService(CacheManager.SERVICE_NAME); if (cache == null) throw new IllegalArgumentException("Cache manager service not available"); //$NON-NLS-1$ localFile = cache.createCacheFromFile(URIUtil.append(location, REPOSITORY_FILENAME), monitor); if (localFile == null) { // there is no remote file in either form - this should not really happen as // createCache should bail out with exception if something is wrong. This is an internal // error. throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, Messages.repoMan_internalError, null)); } return localFile; }
IMetadataRepository result = new MetadataRepositoryIO(getAgent()).read(localFile.toURL(), descriptorStream, sub.newChild(100)); if (result != null && (flags & IRepositoryManager.REPOSITORY_HINT_MODIFIABLE) > 0 && !result.isModifiable()) return null;
IMetadataRepository result = new MetadataRepositoryIO(getAgent()).read(localFile.toURL(), descriptorStream, sub.newChild(100)); if (result != null && (flags & IRepositoryManager.REPOSITORY_HINT_MODIFIABLE) > 0 && !result.isModifiable()) return null;