public ArtifactStoreRequest( MavenRepository repository, String path, boolean localOnly ) { super( path, localOnly ); this.mavenRepository = repository; this.gav = mavenRepository.getGavCalculator().pathToGav( path ); if ( gav == null ) { throw new IllegalArgumentException( "The path does not represent an artifact!" ); } }
public ArtifactStoreRequest( MavenRepository repository, Gav gav, boolean localOnly, boolean remoteOnly ) { super( repository.getGavCalculator().gavToPath( gav ), localOnly, remoteOnly ); this.mavenRepository = repository; this.gav = gav; }
@Override public boolean isMavenArtifactPath( String path ) { return getGavCalculator().pathToGav( path ) != null; }
public StorageFileItem retrieveArtifact( ArtifactStoreRequest gavRequest ) throws IllegalOperationException, ItemNotFoundException, StorageException, AccessDeniedException { checkRequest( gavRequest ); Gav gav = resolveArtifact( gavRequest ); gavRequest.setRequestPath( repository.getGavCalculator().gavToPath( gav ) ); StorageItem item = repository.retrieveItem( gavRequest ); if ( StorageFileItem.class.isAssignableFrom( item.getClass() ) ) { return (StorageFileItem) item; } else { throw new LocalStorageException( "The Artifact retrieval returned non-file, path:" + item.getRepositoryItemUid().toString() ); } }
public boolean isMavenArtifactPath( String path ) { return getGavCalculator().pathToGav( path ) != null; }
artifactInfo.packaging), null, null, null, false, null, false, null); ResourceStoreRequest req = new ResourceStoreRequest(mr.getGavCalculator().gavToPath(gav));
public boolean isMavenArtifactPath( String path ) { return getGavCalculator().pathToGav( path ) != null; }
String pomPath = gavCalculator.gavToPath( pomGav );
/** * Transforms a full artifact path from M2 layout to M1 layout. * * @param path * @return */ protected String transformM2toM1( final String path ) { final Gav gav = getM2GavCalculator().pathToGav( path ); // Unsupported path if ( gav == null ) { return null; } // m1 repo is layouted as: // g.i.d // poms/jars/java-sources/licenses // files StringBuilder sb = new StringBuilder( RepositoryItemUid.PATH_ROOT ); sb.append( gav.getGroupId() ); sb.append( RepositoryItemUid.PATH_SEPARATOR ); sb.append( gav.getExtension() + "s" ); sb.append( RepositoryItemUid.PATH_SEPARATOR ); sb.append( gav.getName() ); return sb.toString(); }
public void deleteArtifact( ArtifactStoreRequest gavRequest, boolean withChecksums, boolean withAllSubordinates, boolean deleteWholeGav ) throws UnsupportedStorageOperationException, IllegalOperationException, ItemNotFoundException, StorageException, AccessDeniedException { // delete the artifact Gav gav = new Gav( gavRequest.getGroupId(), gavRequest.getArtifactId(), gavRequest.getVersion(), gavRequest.getClassifier(), gavRequest.getExtension(), null, null, null, false, null, false, null ); gavRequest.setRequestPath( repository.getGavCalculator().gavToPath( gav ) ); handleDelete( gavRequest, deleteWholeGav, withChecksums, withAllSubordinates ); }
/** * Transforms a full artifact path from M1 layout to M2 layout. * * @param path * @return */ protected String transformM1toM2( final String path ) { final Gav gav = getM1GavCalculator().pathToGav( path ); // Unsupported path if ( gav == null ) { return null; } // m2 repo is layouted as: // g/i/d // aid // version // files StringBuilder sb = new StringBuilder( RepositoryItemUid.PATH_ROOT ); sb.append( gav.getGroupId().replaceAll( "\\.", "/" ) ); sb.append( RepositoryItemUid.PATH_SEPARATOR ); sb.append( gav.getArtifactId() ); sb.append( RepositoryItemUid.PATH_SEPARATOR ); sb.append( gav.getVersion() ); sb.append( RepositoryItemUid.PATH_SEPARATOR ); sb.append( gav.getName() ); return sb.toString(); }
.gavToPath(new Gav(groupId, artifactId, version.toString())); final String vDirectory = PathUtils.getParentPath(gavPath); try {
protected boolean pathIsValidGav( MavenRepository repository, String path ) { final Gav gav = repository.getGavCalculator().pathToGav( path ); return gav != null && !gav.isHash() && !gav.isSignature(); } }
public void storeArtifact( ArtifactStoreRequest gavRequest, InputStream is, Map<String, String> attributes ) throws UnsupportedStorageOperationException, IllegalOperationException, ItemNotFoundException, StorageException, AccessDeniedException { checkRequest( gavRequest ); Gav gav = new Gav( gavRequest.getGroupId(), gavRequest.getArtifactId(), gavRequest.getVersion(), gavRequest.getClassifier(), gavRequest.getExtension(), null, null, null, false, null, false, null ); gavRequest.setRequestPath( repository.getGavCalculator().gavToPath( gav ) ); repository.storeItemWithChecksums( gavRequest, is, attributes ); }
protected boolean pathIsValidGav( MavenRepository repository, String path ) { final Gav gav = repository.getGavCalculator().pathToGav( path ); return gav != null && !gav.isHash() && gav.isSignature(); } }
String pomPath = request.getMavenRepository().getGavCalculator().gavToPath( gav );
protected boolean pathIsValidSnapshotGav( MavenRepository repository, String path ) { final Gav gav = repository.getGavCalculator().pathToGav( path ); return gav != null && gav.isSnapshot() && !gav.isHash() && !gav.isSignature(); } }
public void deleteArtifactPom( ArtifactStoreRequest gavRequest, boolean withChecksums, boolean withAllSubordinates, boolean deleteWholeGav ) throws UnsupportedStorageOperationException, IllegalOperationException, ItemNotFoundException, StorageException, AccessDeniedException { // This is just so we can get teh gavToPath functionallity, to give us a path to work with Gav gav = new Gav( gavRequest.getGroupId(), gavRequest.getArtifactId(), gavRequest.getVersion(), gavRequest.getClassifier(), "pom", null, null, null, false, null, false, null ); gavRequest.setRequestPath( repository.getGavCalculator().gavToPath( gav ) ); /* * // First undeploy, we will read the pom contents to build the gav try { gav = new Gav( * gavRequest.getGroupId(), gavRequest.getArtifactId(), gavRequest.getVersion(), gavRequest.getClassifier(), * getPackagingFromPom( gavRequest.getRequestPath() ), null, null, null, RepositoryPolicy.SNAPSHOT.equals( * repository.getRepositoryPolicy() ), false, null, false, null ); } catch ( IOException e ) { throw new * StorageException( "Could not read pom file!", e ); } catch ( XmlPullParserException e ) { throw new * StorageException( "Could not read pom file!", e ); } gavRequest.setRequestPath( * repository.getGavCalculator().gavToPath( gav ) ); // delete the pom's artifact handleDelete( gavRequest, * deleteWholeGav, withChecksums, withAllSubordinates ); // Now delete the pom gav = new Gav( * gavRequest.getGroupId(), gavRequest.getArtifactId(), gavRequest.getVersion(), gavRequest .getClassifier(), * "pom", null, null, null, RepositoryPolicy.SNAPSHOT.equals( repository .getRepositoryPolicy() ), false, null, * false, null ); gavRequest.setRequestPath( repository.getGavCalculator().gavToPath( gav ) ); */ handleDelete( gavRequest, deleteWholeGav, withChecksums, withAllSubordinates ); }
protected Gav buildGAV(final NexusArtifactEvent event) { if (event.getNexusItemInfo() == null) { return null; } try { final Repository repo = getRepositoryRegistry().getRepository(event.getNexusItemInfo().getRepositoryId()); if (MavenRepository.class.isAssignableFrom(repo.getClass())) { return ((MavenRepository) repo).getGavCalculator().pathToGav(event.getNexusItemInfo().getPath()); } return null; } catch (NoSuchRepositoryException e) { log.debug( "Feed entry contained invalid repository id " + event.getNexusItemInfo().getRepositoryId(), e); return null; } }
null, false, null ); String path = mrepository.getGavCalculator().gavToPath( releaseGav );