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

com.openshift.internal.client.response.DownloadableCartridgeSpec Maven / Gradle / Ivy

/******************************************************************************* 
 * Copyright (c) 2014 Red Hat, Inc. 
 * Distributed under license by Red Hat, Inc. All rights reserved. 
 * This program is made available under the terms of the 
 * Eclipse Public License v1.0 which accompanies this distribution, 
 * and is available at http://www.eclipse.org/legal/epl-v10.html 
 * 
 * Contributors: 
 * Red Hat, Inc. - initial API and implementation 
 ******************************************************************************/
package com.openshift.internal.client.response;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.Collections;
import java.util.List;

import com.openshift.client.cartridge.ICartridge;
import com.openshift.client.cartridge.query.ICartridgeQuery;
import com.openshift.internal.client.cartridge.BaseCartridge;

/**
 * @author Andre Dietisheim
 */
public class DownloadableCartridgeSpec implements ICartridgeQuery {

	private final ICartridge cartridge;

	protected DownloadableCartridgeSpec(String url) throws MalformedURLException {
		this(new URL(url));
	}

	protected DownloadableCartridgeSpec(URL url) {
		this.cartridge = new BaseCartridge(url);
	}

	@SuppressWarnings("unchecked")
	@Override
	public  List getAll(List cartridges) {
		return (List) Collections.singletonList(cartridge);
	}

	@SuppressWarnings("unchecked")
	@Override
	public  C get(List cartridges) {
		return (C) cartridge;
	}

	@Override
	public  boolean matches(C cartridge) {
		return this.cartridge.equals(cartridge);
	}

	@Override
	public String toString() {
		return "DownloadableCartridgeSpec [cartridge=" + cartridge + "]";
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy