@Override @Deprecated public Wagon getWagon( Repository repository ) throws UnsupportedProtocolException { return getWagon( repository.getProtocol() ); }
private ArtifactTransferResource wrap( Repository repository, Resource resource ) { if ( resource == null ) { return null; } else { synchronized ( artifacts ) { ArtifactTransferResource artifact = artifacts.get( resource ); if ( artifact == null ) { artifact = new MavenArtifact( repository.getUrl(), resource ); artifacts.put( resource, artifact ); } return artifact; } } }
private org.apache.maven.settings.Proxy getProxy( ArtifactRepository repository, List<org.apache.maven.settings.Proxy> proxies ) { if ( proxies != null && repository.getProtocol() != null ) { for ( org.apache.maven.settings.Proxy proxy : proxies ) { if ( proxy.isActive() && repository.getProtocol().equalsIgnoreCase( proxy.getProtocol() ) ) { if ( StringUtils.isNotEmpty( proxy.getNonProxyHosts() ) ) { ProxyInfo pi = new ProxyInfo(); pi.setNonProxyHosts( proxy.getNonProxyHosts() ); org.apache.maven.wagon.repository.Repository repo = new org.apache.maven.wagon.repository.Repository( repository.getId(), repository.getUrl() ); if ( !ProxyUtils.validateNonProxyHosts( pi, repo.getHost() ) ) { return proxy; } } else { return proxy; } } } } return null; }
wagon.connect( new Repository( repository.getId(), repository.getUrl() ), authenticationInfo( repository ), proxyInfo( repository ) ); wagon.connect( new Repository( repository.getId(), repository.getUrl() ), authenticationInfo( repository ) ); wagon.connect( new Repository( repository.getId(), repository.getUrl() ), proxyInfo( repository ) ); wagon.connect( new Repository( repository.getId(), repository.getUrl() ) );
File repoDir = new File("test-git/.git"); // open the repository Repository repo = new Repository(repoDir); // find the HEAD Commit head = repo.mapCommit(Constants.HEAD); // retrieve the tree in HEAD Tree tree = head.getTree(); // 1.2.0 api version here // find a file (as a TreeEntry, which contains the blob object id) TreeWalk treewalk = TreeWalk.forPath(repo, "b/test.txt", tree); // use the blob id to read the file's data byte[] data = repo.open(treewalk.getObjectId(0)).getBytes();
File repoDir = new File("test-git"); // open the repository Repository repository = new Repository(repoDir); // find the HEAD ObjectId lastCommitId = repository.resolve(Constants.HEAD); // now we have to get the commit RevWalk revWalk = new RevWalk(repository); RevCommit commit = revWalk.parseCommit(lastCommitId); // and using commit's tree find the path RevTree tree = commit.getTree(); TreeWalk treeWalk = new TreeWalk(repository); treeWalk.addTree(tree); treeWalk.setRecursive(true); treeWalk.setFilter(PathFilter.create(path)); if (!treeWalk.next()) { return null; } ObjectId objectId = treeWalk.getObjectId(0); ObjectLoader loader = repository.open(objectId); // and then one can use either InputStream in = loader.openStream() // or loader.copyTo(out)
Repository repository = new Repository(); repository.writeMoviesToXML();
public String resolve(Repository repository){ return repository.getHost(); }
public String getName() { if ( name == null ) { return getId(); } return name; }
static String getBaseDirectory(Repository repository) { StringBuilder sb = new StringBuilder(repository.getBasedir()).deleteCharAt(0); if ((sb.length() != 0) && (sb.charAt(sb.length() - 1) != '/')) { sb.append('/'); } return sb.toString(); }
protected RepositoryPermissions getPermissions() { return new RepositoryPermissions(); }
public ServiceImpl (Repository repository) this.repository= new Repository(); }
/** * getUrl * Implementors can override this to remove unwanted parts of the url such as role-hints * * @param repository * @return */ protected String getURL( Repository repository ) { return repository.getUrl(); }
static String getBucketName(Repository repository) { return repository.getHost(); }
public String getName() { if ( name == null ) { return getId(); } return name; }
protected RepositoryPermissions getPermissions() { return new RepositoryPermissions(); }
AbstractRepository repository = new Repository(); Set<SuperObject> set = repository.getObject();
/** * getUrl * Implementors can override this to remove unwanted parts of the url such as role-hints * * @param repository * @return */ protected String getURL( Repository repository ) { return repository.getUrl(); }
static String getBucketName(Repository repository) { return repository.getHost(); }
/** * Checks whtther provided url contains IPv6 format in host portion * * @return true if provide host part is of IPv6 format */ private boolean isIPv6Address() { return getHost().contains( ":" ); }