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

com.emc.mongoose.api.model.io.task.path.BasicPathIoTaskBuilder Maven / Gradle / Ivy

There is a newer version: 4.0.0-alpha5
Show newest version
package com.emc.mongoose.api.model.io.task.path;

import com.emc.mongoose.api.model.io.task.BasicIoTaskBuilder;
import com.emc.mongoose.api.model.item.PathItem;
import com.emc.mongoose.api.model.storage.Credential;

import java.io.IOException;
import java.util.List;

/**
 Created by kurila on 30.01.17.
 */
public class BasicPathIoTaskBuilder>
extends BasicIoTaskBuilder
implements PathIoTaskBuilder {
	
	@Override @SuppressWarnings("unchecked")
	public O getInstance(final I pathItem)
	throws IOException {
		final String uid;
		return (O) new BasicPathIoTask<>(
			originCode, ioType, pathItem,
			Credential.getInstance(uid = getNextUid(), getNextSecret(uid))
		);
	}
	
	@Override @SuppressWarnings("unchecked")
	public void getInstances(final List items, final List buff)
	throws IOException {
		String uid;
		for(final I nextItem : items) {
			buff.add(
				(O) new BasicPathIoTask<>(
					originCode, ioType, nextItem,
					Credential.getInstance(uid = getNextUid(), getNextSecret(uid))
				)
			);
		}
	}
}