private void importFile(final File baseDir, final String relPath) throws StorageException, UnsupportedStorageOperationException, IllegalOperationException { final File source = new File(baseDir, relPath); final ResourceStoreRequest request = new ResourceStoreRequest(relPath); final DefaultStorageFileItem file = new DefaultStorageFileItem(this, request, source.canRead(), source.canWrite(), new FileContentLocator( source, getMimeSupport().guessMimeTypeFromPath(source.getName()))); file.setModified(source.lastModified()); file.setCreated(source.lastModified()); storeItem(false, file); }
protected void storeIndexItem(Repository repository, File file, IndexingContext context) { String path = PUBLISHING_PATH_PREFIX + "/" + file.getName(); try { ResourceStoreRequest request = new ResourceStoreRequest(path); DefaultStorageFileItem fItem = new DefaultStorageFileItem(repository, request, true, true, new FileContentLocator(file, mimeSupport.guessMimeTypeFromPath(repository.getMimeRulesSource(), file.getAbsolutePath()))); if (context.getTimestamp() == null) { fItem.setModified(0); fItem.setCreated(0); } else { fItem.setModified(context.getTimestamp().getTime()); fItem.setCreated(context.getTimestamp().getTime()); } if (repository instanceof MavenRepository) { // this is maven repo, so use the checksumming facility ((MavenRepository) repository).storeItemWithChecksums(false, fItem); } else { // simply store it repository.storeItem(false, fItem); } } catch (Exception e) { log.error("Cannot store index file " + path, e); } }
fItem.setModified( 0 ); fItem.setModified( context.getTimestamp().getTime() );
httpItem.setModified( makeDateFromHeader( httpResponse.getFirstHeader( "last-modified" ) ) ); httpItem.setCreated( httpItem.getModified() ); httpItem.getItemContext().putAll( request.getRequestContext() );
repository.getMimeRulesSource(), target.getAbsolutePath() ) ) ); repository.getAttributesHandler().fetchAttributes( file ); file.setModified( target.lastModified() ); file.setCreated( target.lastModified() ); file.setLength( target.length() );
@Override public void retrieve(SpecsIndexFile specs) { log.debug("retrieve :: {}", specs); SpecsIndexZippedFile source = specs.zippedSpecsIndexFile(); try { StorageFileItem item = (StorageFileItem) repository.retrieveDirectItem(new ResourceStoreRequest(source.storagePath())); DefaultStorageFileItem unzippedItem = new DefaultStorageFileItem(repository, new ResourceStoreRequest(specs.storagePath()), true, false, gunzipContentLocator(item)); unzippedItem.setModified(item.getModified()); specs.set(unzippedItem); } catch (ItemNotFoundException e) { specs.markAsNotExists(); } catch (IOException | IllegalOperationException e) { specs.setException(e); } }
result.setLength( content.length ); result.setCreated( mdItem.getCreated() ); result.setModified( System.currentTimeMillis() ); return result;
httpItem.setModified( makeDateFromHeader( method.getResponseHeader( "last-modified" ) ) );
result.setModified( lastModified );