All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.javamoney.moneta.internal.loader.DefaultLoaderServiceFacade Maven / Gradle / Ivy

Go to download

JSR 354 provides an API for representing, transporting, and performing comprehensive calculations with Money and Currency. This module implements JSR 354.

There is a newer version: 1.4.1
Show newest version
/*
 * Copyright (c) 2012, 2015, Credit Suisse (Anatole Tresch), Werner Keil and others by the @author tag.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package org.javamoney.moneta.internal.loader;

import java.util.Map;
import java.util.Timer;

class DefaultLoaderServiceFacade {

	private final ScheduledDataLoaderService scheduledDataLoaderService;

	private final LoadDataLoaderService loadDataLoaderService;

	private final LoadDataLocalLoaderService loadDataLocalLoaderService;

	private final LoadRemoteDataLoaderService loadRemoteDataLoaderService;

	DefaultLoaderServiceFacade(Timer timer, DefaultLoaderListener listener, Map resources){
		this.scheduledDataLoaderService = new ScheduledDataLoaderService(timer, listener);
		this.loadDataLoaderService = new LoadDataLoaderService(listener);
		this.loadDataLocalLoaderService = new LoadDataLocalLoaderService(resources, listener);
		this.loadRemoteDataLoaderService = new LoadRemoteDataLoaderService(listener);
	}

	public void scheduledData(LoadableResource load) {
		scheduledDataLoaderService.execute(load);
	}

	public boolean loadData(String resourceId, Map resources){
		return loadDataLoaderService.execute(resourceId, resources);
	}

	public boolean loadDataLocal(String resourceId){
		return loadDataLocalLoaderService.execute(resourceId);
	}

	public boolean loadDataRemote(String resourceId, Map resources){
		return loadRemoteDataLoaderService.execute(resourceId, resources);
	}
	@Override
	public String toString() {
        String sb = DefaultLoaderServiceFacade.class.getName() + '{' +
                " scheduledDataLoaderService: " + scheduledDataLoaderService + ',' +
                " asyncLoaderService: " + loadDataLoaderService + ',' +
                " loadDataLocalLoaderService: " + loadDataLocalLoaderService + ',';
        return sb;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy