本文整理了Java中org.sonatype.nexus.proxy.repository.Repository.getName
方法的一些代码示例,展示了Repository.getName
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.getName
方法的具体详情如下:
包路径:org.sonatype.nexus.proxy.repository.Repository
类名称:Repository
方法名:getName
[英]Gets repository human name.
[中]获取存储库人名。
代码示例来源:origin: org.sonatype.nexus/nexus-app
@Override
public String getRepositoryName()
{
return repository.getName();
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-indexer-lucene-plugin
public void postprocess(IndexingContext ctx, ArtifactInfo ai) {
String result = ai.context;
try {
Repository sourceRepository = repositoryRegistry.getRepository(ai.repository);
result = sourceRepository.getName();
}
catch (NoSuchRepositoryException e) {
// nothing
}
ai.context = result;
}
});
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-indexer-lucene-plugin
@Deprecated
protected String formatContextId(ArtifactInfo ai) {
String result = ai.context;
try {
Repository sourceRepository = repositoryRegistry.getRepository(ai.repository);
result = sourceRepository.getName();
}
catch (NoSuchRepositoryException e) {
// nothing
}
return result;
}
代码示例来源:origin: org.sonatype.nexus/nexus-api
public static String getHumanizedNameString( final Repository repository )
{
return String.format( "\"%s\" [id=%s]", repository.getName(), repository.getId() );
}
代码示例来源:origin: org.sonatype.nexus/nexus-api
public void deleteRepositoryFolders( final Repository repository, final boolean deleteForever )
throws IOException
{
logger.debug("Removing folders of repository \"{}\" (ID={})", repository.getName(), repository.getId() );
for ( RepositoryFolderCleaner cleaner : cleaners.values() )
{
try
{
cleaner.cleanRepositoryFolders( repository, deleteForever );
}
catch ( Exception e )
{
logger.warn( "Got exception during execution of RepositoryFolderCleaner {}, continuing.", cleaner.getClass().getName(), e );
}
}
}
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-yum-repository-plugin
@Override
public InputStream getContent()
throws IOException
{
if (content == null) {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (PrintWriter out = new PrintWriter(baos)) {
out.println("[" + repository.getId() + "]");
out.println("name=" + repository.getName());
out.println("baseurl=" + repositoryURLBuilder.getExposedRepositoryContentUrl(repository, true));
out.println("enabled=1");
out.println("protect=0");
out.println("gpgcheck=0");
out.println("metadata_expire=30s");
out.println("autorefresh=1");
out.println("type=rpm-md");
}
content = new String(baos.toByteArray());
}
return new ByteArrayInputStream(content.getBytes("UTF-8"));
}
};
代码示例来源:origin: org.sonatype.nexus/nexus-indexer-lucene-app
@Deprecated
protected String formatContextId( ArtifactInfo ai )
{
String result = ai.context;
try
{
Repository sourceRepository = repositoryRegistry.getRepository( ai.repository );
if ( ai.context.endsWith( CTX_LOCAL_SUFIX ) )
{
if ( sourceRepository.getRepositoryKind().isFacetAvailable( ProxyRepository.class ) )
{
result = sourceRepository.getName() + " (Cache)";
}
else
{
result = sourceRepository.getName() + " (Local)";
}
}
else if ( ai.context.endsWith( CTX_REMOTE_SUFIX ) )
{
result = sourceRepository.getName() + " (Remote)";
}
}
catch ( NoSuchRepositoryException e )
{
// nothing
}
return result;
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-p2-repository-plugin
@Override
protected void validateMemberRepository(final Repository repository)
throws InvalidGroupingException
{
if (repository.getRepositoryKind().isFacetAvailable(P2CompositeGroupRepository.class)) {
throw new InvalidGroupingException(String.format(
"Repository '%s' cannot be grouped as P2 composite groups are not supported as members of P2 legacy groups",
repository.getName()
));
}
super.validateMemberRepository(repository);
}
代码示例来源:origin: org.sonatype.nexus/nexus-indexer-lucene-app
protected void logSkippingRepositoryMessage( Repository repository )
{
boolean isSupported = isIndexingSupported( repository );
boolean isIndexed = repository.isIndexable();
if ( getLogger().isDebugEnabled() )
{
StringBuilder sb = new StringBuilder( "Indexing is " );
if ( !isSupported )
{
sb.append( "not " );
}
sb.append( "supported on repository \"" + repository.getName() + "\" (ID=\"" + repository.getId() + "\")" );
if ( isSupported )
{
sb.append( " and is set as " );
if ( !isIndexed )
{
sb.append( "not " );
}
sb.append( "indexed. " );
}
else
{
sb.append( ". " );
}
sb.append( "Skipping it." );
getLogger().debug( sb.toString() );
}
}
代码示例来源:origin: org.sonatype.nexus/nexus-app
public void inspect( Event<?> evt )
{
Repository repository = ( (RepositoryRegistryEventPostRemove) evt ).getRepository();
try
{
// remove the storage folders for the repository
DeleteRepositoryFoldersTask task = nexusScheduler.createTaskInstance( DeleteRepositoryFoldersTask.class );
task.setRepository( repository );
nexusScheduler.submit( "Deleting repository folder for repository \"" + repository.getName() + "\" (id="
+ repository.getId() + ").", task );
}
catch ( Exception e )
{
getLogger().error(
"Could not remove repository folders for repository \"" + repository.getName() + "\" (id="
+ repository.getId() + ")!", e );
}
}
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-timeline-plugin
protected String getRepositoryName(NexusArtifactEvent event) {
String repoId = event.getNexusItemInfo().getRepositoryId();
try {
Repository repository = getRepositoryRegistry().getRepository(repoId);
return repository.getName();
}
catch (NoSuchRepositoryException e) {
// that's fine, no need to yell, old timeline entries might correspond to long-time removed reposes
return repoId;
}
}
代码示例来源:origin: org.sonatype.nexus/nexus-app
public String getRepositoryName()
{
try
{
Repository repo = getRepositoryRegistry().getRepository( getRepositoryId() );
return repo.getName();
}
catch ( NoSuchRepositoryException e )
{
this.getLogger().warn( "Could not read repository!", e );
return getRepositoryId();
}
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-indexer-lucene-plugin
/**
* Extracts the repo root on local FS as File. It may return null!
*/
protected File getRepositoryLocalStorageAsFile(Repository repository) {
if (repository.getLocalUrl() != null
&& repository.getLocalStorage() instanceof DefaultFSLocalRepositoryStorage) {
try {
File baseDir =
((DefaultFSLocalRepositoryStorage) repository.getLocalStorage()).getBaseDir(repository,
new ResourceStoreRequest(RepositoryItemUid.PATH_ROOT));
return baseDir;
}
catch (LocalStorageException e) {
log.warn(String.format("Cannot determine \"%s\" (ID=%s) repository's basedir:",
repository.getName(), repository.getId()), e);
}
}
return null;
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-timeline-plugin
@Subscribe
@AllowConcurrentEvents
public void inspect(final RepositoryEventLocalStatusChanged revt) {
StringBuilder sb = new StringBuilder("The repository '");
sb.append(revt.getRepository().getName());
sb.append("' (ID='").append(revt.getRepository().getId()).append("') was put ");
LocalStatus newStatus = revt.getNewLocalStatus();
if (LocalStatus.IN_SERVICE.equals(newStatus)) {
sb.append("IN SERVICE.");
}
else if (LocalStatus.OUT_OF_SERVICE.equals(newStatus)) {
sb.append("OUT OF SERVICE.");
}
else {
sb.append(revt.getRepository().getLocalStatus().toString()).append(".");
}
sb.append(" The previous state was ");
if (LocalStatus.IN_SERVICE.equals(revt.getOldLocalStatus())) {
sb.append("IN SERVICE.");
}
else if (LocalStatus.OUT_OF_SERVICE.equals(revt.getOldLocalStatus())) {
sb.append("OUT OF SERVICE.");
}
else {
sb.append(revt.getOldLocalStatus().toString()).append(".");
}
getFeedRecorder().addSystemEvent(FeedRecorder.SYSTEM_REPO_LSTATUS_CHANGES_ACTION, sb.toString());
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-p2-repository-plugin
@Override
protected String renderDescription() {
if (isConfigured()) {
try {
return repositoryRegistry.getRepository(getConfig().repositoryId()).getName();
}
catch (NoSuchRepositoryException e) {
return getConfig().repositoryId();
}
}
return null;
}
代码示例来源:origin: org.sonatype.nexus/nexus-app
@Override
public Configuration doGetConfiguration()
{
Configuration configuration = new Configuration();
configuration.addPrivilege( buildPrivilege( "All Repositories - (view)",
"Privilege that gives view access to all repositories.", "*" ) );
for ( Repository repo : repoRegistry.getRepositories() )
{
configuration.addPrivilege( buildPrivilege( repo.getName() + " - (view)",
"Privilege that gives view access to the " + repo.getName()
+ " repository.", repo.getId() ) );
}
Set<Entry<String, ContentClass>> contents = repoTypeRegistry.getContentClasses().entrySet();
for ( Entry<String, ContentClass> entry : contents )
{
// TODO in the future we can create CRUD privs / roles here
configuration.addRole( buildRole( entry, "view" ) );
}
setDirty( false );
return configuration;
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-yum-repository-plugin
@Override
public String renderDescription() {
if (isConfigured()) {
try {
return repositoryRegistry.getRepository(getConfig().repository()).getName();
}
catch (NoSuchRepositoryException e) {
return getConfig().repository();
}
}
return null;
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-p2-repository-plugin
@Override
protected String renderDescription() {
if (isConfigured()) {
try {
return repositoryRegistry.getRepository(getConfig().repositoryId()).getName();
}
catch (NoSuchRepositoryException e) {
return getConfig().repositoryId();
}
}
return null;
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-indexer-lucene-plugin
private void addRepositoryDetails(List<NexusNGRepositoryDetail> repoDetails, Request request, Repository repository) {
boolean add = true;
for (NexusNGRepositoryDetail repoDetail : repoDetails) {
if (repoDetail.getRepositoryId().equals(repository.getId())) {
add = false;
break;
}
}
if (add) {
NexusNGRepositoryDetail repoDetail = new NexusNGRepositoryDetail();
repoDetail.setRepositoryId(repository.getId());
repoDetail.setRepositoryName(repository.getName());
repoDetail.setRepositoryURL(createRepositoryReference(request, repository.getId()).getTargetRef().toString());
repoDetail.setRepositoryContentClass(repository.getRepositoryContentClass().getId());
repoDetail.setRepositoryKind(extractRepositoryKind(repository));
MavenRepository mavenRepo = repository.adaptToFacet(MavenRepository.class);
if (mavenRepo != null) {
repoDetail.setRepositoryPolicy(mavenRepo.getRepositoryPolicy().name());
}
repoDetails.add(repoDetail);
}
}
代码示例来源:origin: org.sonatype.nexus/nexus-indexer-lucene-rest-api
protected void addRepositoryDetails( Request request, SearchNGResponse response, Repository repository )
{
boolean add = true;
for ( NexusNGRepositoryDetail repoDetail : response.getRepoDetails() )
{
if ( repoDetail.getRepositoryId().equals( repository.getId() ) )
{
add = false;
break;
}
}
if ( add )
{
NexusNGRepositoryDetail repoDetail = new NexusNGRepositoryDetail();
repoDetail.setRepositoryId( repository.getId() );
repoDetail.setRepositoryName( repository.getName() );
repoDetail.setRepositoryURL( createRepositoryReference( request, repository.getId() ).getTargetRef().toString() );
repoDetail.setRepositoryContentClass( repository.getRepositoryContentClass().getId() );
repoDetail.setRepositoryKind( extractRepositoryKind( repository ) );
MavenRepository mavenRepo = repository.adaptToFacet( MavenRepository.class );
if ( mavenRepo != null )
{
repoDetail.setRepositoryPolicy( mavenRepo.getRepositoryPolicy().name() );
}
response.addRepoDetail( repoDetail );
}
}
内容来源于网络,如有侵权,请联系作者删除!