@@ -0,0 +1,2683 @@
+/*%0A *%0A *  * Copyright (C) 2018 EPAM Systems%0A *  *%0A *  * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A *  * you may not use this file except in compliance with the License.%0A *  * You may obtain a copy of the License at%0A *  *%0A *  * http://www.apache.org/licenses/LICENSE-2.0%0A *  *%0A *  * Unless required by applicable law or agreed to in writing, software%0A *  * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A *  * See the License for the specific language governing permissions and%0A *  * limitations under the License.%0A *%0A */%0A%0Apackage com.epam.ta.reportportal.config;%0A%0Aimport com.epam.ta.reportportal.exception.ReportPortalException;%0Aimport com.epam.ta.reportportal.filesystem.DataStore;%0Aimport com.epam.ta.reportportal.filesystem.LocalDataStore;%0Aimport com.epam.ta.reportportal.filesystem.distributed.SeaweedDataStore;%0Aimport org.lokra.seaweedfs.core.FileSource;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.beans.factory.annotation.Value;%0Aimport org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;%0Aimport org.springframework.context.annotation.Bean;%0Aimport org.springframework.context.annotation.Configuration;%0Aimport org.springframework.context.annotation.PropertySource;%0A%0Aimport java.io.IOException;%0A%0A/**%0A * @author Dzianis_Shybeka%0A */%0A@Configuration%0A@PropertySource(value = %7B %22classpath:datastore.properties%22 %7D)%0Apublic class DataStoreConfiguration %7B%0A%0A%09private static final Logger LOGGER = LoggerFactory.getLogger(DataStoreConfiguration.class);%0A%0A%09@Bean%0A%09@ConditionalOnProperty(name = %22datastore.type%22, havingValue = %22seaweed%22)%0A%09public FileSource fileSource(@Value(%22$%7Bdatastore.seaweed.master.host%7D%22) String masterHost,%0A%09%09%09@Value(%22$%7Bdatastore.seaweed.master.port%7D%22) Integer masterPort) %7B%0A%0A%09%09FileSource fileSource = new FileSource();%0A%09%09fileSource.setHost(masterHost);%0A%09%09fileSource.setPort(masterPort);%0A%0A%09%09try %7B%0A%09%09%09fileSource.startup();%0A%09%09%7D catch (IOException e) %7B%0A%0A%09%09%09throw new ReportPortalException(%22Cannot connect to seaweed fs%22);%0A%09%09%7D%0A%0A%09%09LOGGER.debug(%22Connected to seaweed fs !%22);%0A%0A%09%09return fileSource;%0A%09%7D%0A%0A%09@Bean%0A%09@ConditionalOnProperty(name = %22datastore.type%22, havingValue = %22seaweed%22)%0A%09public DataStore seaweedDataStore(@Autowired FileSource fileSource) %7B%0A%0A%09%09return new SeaweedDataStore(fileSource);%0A%09%7D%0A%0A%09@Bean%0A%09@ConditionalOnProperty(name = %22datastore.type%22, havingValue = %22filesystem%22)%0A%09public DataStore localDataStore(@Value(%22$%7Bdatastore.default.path:/data/store%7D%22) String storagePath) %7B%0A%0A%09%09return new LocalDataStore(storagePath);%0A%09%7D%0A%7D%0A

add datastore configuration