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.setCreated( 0 ); fItem.setCreated( context.getTimestamp().getTime() );
httpItem.setCreated( httpItem.getModified() ); httpItem.getItemContext().putAll( request.getRequestContext() );
repository.getAttributesHandler().fetchAttributes( file ); file.setModified( target.lastModified() ); file.setCreated( target.lastModified() ); file.setLength( target.length() ); result = file;
new DefaultStorageFileItem( this, request, true, false, contentLocator ); result.setLength( content.length ); result.setCreated( mdItem.getCreated() ); result.setModified( System.currentTimeMillis() ); return result;
httpItem.setCreated( httpItem.getModified() );
result.setCreated( result.getModified() );