@Override public void updateRemoteInstance(EditableRemoteRepository repo, RemoteRepositoryConfiguration cfg) throws RepositoryException { setBaseConfig(repo, cfg); repo.setCheckPath(cfg.getCheckPath()); repo.setSchedulingDefinition(cfg.getRefreshCronExpression()); try {
@SuppressWarnings("unchecked") @Override public void updateRemoteInstance( EditableRemoteRepository remoteRepository, RemoteRepositoryConfiguration configuration ) throws RepositoryException { try { remoteRepository.setName( remoteRepository.getPrimaryLocale(), configuration.getName( ) ); remoteRepository.setBaseUri( new URI( "" ) ); remoteRepository.setDescription( remoteRepository.getPrimaryLocale(), configuration.getDescription( ) ); remoteRepository.setLayout( configuration.getLayout( ) ); remoteRepository.setSchedulingDefinition( configuration.getRefreshCronExpression( ) ); remoteRepository.setCheckPath( configuration.getCheckPath( ) ); remoteRepository.setExtraHeaders( configuration.getExtraHeaders( ) ); remoteRepository.setExtraParameters( configuration.getExtraParameters( ) ); remoteRepository.setTimeout( Duration.ofSeconds( configuration.getTimeout( ) ) ); char[] pwd = configuration.getPassword()==null ? "".toCharArray() : configuration.getPassword().toCharArray(); remoteRepository.setCredentials( new PasswordCredentials( configuration.getUsername( ), pwd ) ); remoteRepository.setLocation( new URI( configuration.getUrl( )==null ? "" : configuration.getUrl() ) ); RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( ); rif.setDownloadRemoteIndexOnStartup( configuration.isDownloadRemoteIndexOnStartup( ) ); rif.setDownloadRemoteIndex( configuration.isDownloadRemoteIndex( ) ); rif.setIndexUri( new URI( configuration.getIndexDir( ) ) ); rif.setDownloadTimeout( Duration.ofSeconds( configuration.getRemoteDownloadTimeout( ) ) ); rif.setProxyId( configuration.getRemoteDownloadNetworkProxyId( ) ); } catch ( Exception e ) { throw new RepositoryException( "Error", e ); } }