io.minio.errors.InvalidPortException Java Examples

The following examples show how to use io.minio.errors.InvalidPortException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MinioClientComponentImpl.java    From sctalk with Apache License 2.0 6 votes vote down vote up
@PostConstruct
public void init() {
    try {
        logger.info("init minio client start");
        if (minioConfig == null) {
            logger.warn("MINIO未正确配置,文件上传服务将不可用");
        } else {
            minioClient = new MinioClient(minioConfig.getEndpoint(), minioConfig.getPort(),
                    minioConfig.getAccessKey(), minioConfig.getSecretKey());
        }
    } catch (InvalidEndpointException | InvalidPortException e) {
        logger.warn("MINIO未正确配置,文件上传服务将不可用", e);
    } finally {
        logger.info("init minio client end");
    }
}
 
Example #2
Source File: CacheService.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Autowired
public CacheService(
	@Value("${minio.endpoint}") String minioEndpoint,
	@Value("${minio.accesskey}") String accessKey,
	@Value("${minio.secretkey}") String secretKey
) throws InvalidEndpointException, InvalidPortException
{
	this.minioClient = new MinioClient(minioEndpoint, accessKey, secretKey);
}
 
Example #3
Source File: StorageConfig.java    From flow-platform-x with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnProperty(name = "app.minio.enabled", havingValue = "true")
public MinioClient minioClient() throws InvalidPortException, InvalidEndpointException {
    URL endpoint = minioProperties.getEndpoint();
    String key = minioProperties.getKey();
    String secret = minioProperties.getSecret();
    return new MinioClient(endpoint, key, secret);
}
 
Example #4
Source File: FileClient.java    From file-service with Apache License 2.0 5 votes vote down vote up
public void initClient(boolean isAwsS3) throws InvalidEndpointException, InvalidPortException {
    if (isAwsS3) {
        initAmazonS3();
    } else {
        initMinioClient();
    }
}
 
Example #5
Source File: FileClient.java    From file-service with Apache License 2.0 5 votes vote down vote up
private void initMinioClient() throws InvalidEndpointException, InvalidPortException {
    if (fileClientConfig.getRegion() != null) {
        this.minioClient = new MinioClient(
                fileClientConfig.getEndpoint(),
                fileClientConfig.getAccessKey(),
                fileClientConfig.getSecretKey(),
                fileClientConfig.getRegion());
    } else {
        this.minioClient = new MinioClient(
                fileClientConfig.getEndpoint(),
                fileClientConfig.getAccessKey(),
                fileClientConfig.getSecretKey());
    }

}
 
Example #6
Source File: StorageConfig.java    From flow-platform-x with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnProperty(name = "app.minio.enabled", havingValue = "true")
public MinioClient minioClient() throws InvalidPortException, InvalidEndpointException {
    URL endpoint = minioProperties.getEndpoint();
    String key = minioProperties.getKey();
    String secret = minioProperties.getSecret();
    return new MinioClient(endpoint, key, secret);
}
 
Example #7
Source File: MinioAutoConfiguration.java    From beihu-boot with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean(MinioClient.class)
public MinioClient minioClient(MinioProperties minioProperties) throws InvalidPortException, InvalidEndpointException {
    return new MinioClient(minioProperties.getUrl(), minioProperties.getAccessKey(), minioProperties.getSecretKey());
}
 
Example #8
Source File: MinioFileManagerTest.java    From flow-platform-x with Apache License 2.0 4 votes vote down vote up
@Before
public void init() throws InvalidPortException, InvalidEndpointException {
    MinioClient client = new MinioClient("http://localhost:9000", "minio", "minio123");
    fileManager = new MinioFileManager(client, bucket);
}
 
Example #9
Source File: FileClient.java    From file-service with Apache License 2.0 4 votes vote down vote up
public void initClient() throws InvalidEndpointException, InvalidPortException {
    this.initClient(this.isAwsS3);
}
 
Example #10
Source File: MinioFileManagerTest.java    From flow-platform-x with Apache License 2.0 4 votes vote down vote up
@Before
public void init() throws InvalidPortException, InvalidEndpointException {
    MinioClient client = new MinioClient("http://localhost:9000", "minio", "minio123");
    fileManager = new MinioFileManager(client, bucket);
}
 
Example #11
Source File: CacheConfiguration.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Bean
public MinioClient minioClient() throws InvalidEndpointException, InvalidPortException
{
	return new MinioClient(minioUrl, minioAccessKey, minioSecretKey);
}
 
Example #12
Source File: CacheUpdater.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void update() throws IOException, InvalidEndpointException, InvalidPortException, InterruptedException
{
	int rsVersion = RuneLiteAPI.getRsVersion();

	try (Connection con = sql2o.beginTransaction())
	{
		CacheDAO cacheDao = new CacheDAO();
		CacheEntry cache = cacheDao.findMostRecent(con);
		boolean created = false;
		if (cache == null)
		{
			created = true;
			cache = cacheDao.createCache(con, rsVersion, Instant.now());
		}

		CacheStorage storage = new CacheStorage(cache, cacheDao, con);
		Store store = new Store(storage);
		store.load();

		ExecutorService executor = Executors.newSingleThreadExecutor();

		CacheClient client = new CacheClient(store, rsVersion,
			(Archive archive, byte[] data) -> executor.submit(new CacheUploader(minioClient, minioBucket, archive, data)));

		client.connect();
		HandshakeResponseType result = client.handshake().join();

		if (result != HandshakeResponseType.RESPONSE_OK)
		{
			logger.warn("Out of date!");
			return;
		}

		List<IndexInfo> indexes = client.requestIndexes();
		List<IndexEntry> entries = cacheDao.findIndexesForCache(con, cache);

		if (!checkOutOfDate(indexes, entries))
		{
			logger.info("All up to date.");
			return;
		}

		client.download();

		CacheEntry newCache = created ? cache : cacheDao.createCache(con, rsVersion, Instant.now());

		storage.setCacheEntry(newCache);
		store.save();

		// ensure objects are added to the store before they become
		// visible in the database
		executor.shutdown();
		while (!executor.awaitTermination(1, TimeUnit.SECONDS))
		{
			logger.debug("Waiting for termination of executor...");
		}

		// commit database
		con.commit();
	}
}