/**
 * 
 */
package ISClient;

import org.gcube.common.core.contexts.GHNContext;
import org.gcube.common.core.informationsystem.publisher.ISPublisher;
import org.gcube.common.core.resources.GCUBEGenericResource;
import org.gcube.common.core.scope.GCUBEScope;
import org.gcube.common.core.security.GCUBESecurityManagerImpl;

/**
 * @author Spyros Boutsis, NKUA
 *
 */
public class DeleteGenericResource {
	
	public static void main(String[] args) {
		
		if (args.length != 2) {
			System.out.println("Wrong number of arguments. Usage:");
			System.out.println("DeleteGenericResource <scope> <GR_ID>");
			System.exit(-1);
		}
		
		try {
			GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() {  public boolean isSecurityEnabled() {return false;}};
			
			GCUBEScope scope = GCUBEScope.getScope(args[0]);
			ISPublisher publisher = GHNContext.getImplementation(ISPublisher.class);
			publisher.removeGCUBEResource(args[1], GCUBEGenericResource.TYPE, scope, managerSec);
			System.out.println("Generic resource deleted.");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
