2016-10-11 10 views
1

sonaytype nexus 2.14.0-01にアップロードされたアーティファクト(配信を含むzipファイル)にアクセスして、tmpディレクトリに解凍してコンテンツを調べます。アップロード後にネクサスプラグインからSonatype Nexusアーティファクトにアクセスする

私はcreateアクションのハンドル要求にフックできますが、その時点でアーティファクトはまだリポジトリにアップロードされていません。

public void onHandle(Repository repository, ResourceStoreRequest resourceStoreRequest, Action action) throws ItemNotFoundException, IllegalOperationException 
{ 
    log.info("got onHandle Request for " + repository.toString() + " " + action.toString() + " " + resourceStoreRequest.toString()); 
    log.info("that is the file to process: " + resourceStoreRequest.getRequestPath()); 
} 

ログエントリ:

2016-10-11 18:01:23,760+0200 INFO [qtp1685232414-73] admin DeliveryRequestProcessor - got onHandle Request for M2Repository(id=deliveries) create ResourceStoreRequest{requestPath='/fakepath/configurationmanagement/0.1/configurationmanagement-0.1.zip', requestContext=RequestContext{[email protected], parent=null}, pathStack=[], processedRepositories=[], appliedMappings={}}(GAVCE=fakepath:configurationmanagement:0.1:c=null:e=zip, for "deliveries" [id=deliveries]) 

しかし

repository.getLocalStorage().retrieveItem(repository,resourceStoreRequest) 

ための呼び出しは(自然に)失敗しています。

ファイルのアップロード後にどのフックを使用して処理できるのかアドバイスはありますか?

敬具、 エドゥアルド

答えて

0

私は必要な機能を実装するために、それほど素敵ではない回避策を使用。

元のクラスでは、ListenerをEventBusに登録します。

@Named(DeliveryRequestProcessor.ID) 
public class DeliveryRequestProcessor extends ComponentSupport 
    implements RequestStrategy { 

    @Inject 
    public DeliveryRequestProcessor(final EventBus eventBus) 
    { 
     this.eventBus = Preconditions.checkNotNull(eventBus); 
     eventBus.register(new EventBusListener()); 
    } 
} 

私はネクサスが送信しているすべてのイベントに登録する別のクラスを作成しました。この解決策には、いくつかの欠点、例えば、欠点がある。イベントが複数回発生し、処理が1つだけ実行されることを保証する必要がありますが、最初の解決策は受け入れ可能です(私にとって)。

お問い合わせ Eduard

関連する問題