<commit_before>package edu.uw.apl.tupelo.model;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.util.List;

import edu.uw.apl.vmvols.model.VirtualMachine;
import edu.uw.apl.vmvols.model.virtualbox.VBoxVM;
import edu.uw.apl.vmvols.model.virtualbox.VDIDisk;
import edu.uw.apl.vmvols.model.vmware.VMDKDisk;
import edu.uw.apl.vmvols.model.vmware.VMwareVM;

/**
 * A simple bridge class, bridging from Tupelo model objects
 * (UnmanagedDisk) to * the vmvols artifact (outside of Tupelo) which
 * enables VirtualBox (vdi) and VMWare (vmdk) disk content to be read
 * on the host.
 *
 * VMs should be powered OFF when reading them on the host,
 * e.g. during Tupelo operations.
 */
public class VirtualDisk implements UnmanagedDisk {

	static public boolean likelyVirtualDisk( File f ) {
		if( f.getName().endsWith( VDIDisk.FILESUFFIX ) )
			return true;
		if( f.getName().endsWith( VMDKDisk.FILESUFFIX ) )
			return true;
		if( VBoxVM.isVBox( f ) )
			return true;
		if( VMwareVM.isVMware( f ) )
			return true;
		return false;
	}
	
	public VirtualDisk( File f ) throws IOException {
		vm = VirtualMachine.create( f );
		if( vm == null )
			throw new IllegalArgumentException( "Unknown vd file: " + f );
		List<edu.uw.apl.vmvols.model.VirtualDisk> disks =
			vm.getActiveDisks();
		if( disks.size() > 1 ) {
			throw new IllegalArgumentException
				( "VM created from " + f + " has " + disks.size() +
						  " disks, specify one." );
		}
		delegate = disks.get(0);
		source = f;<commit_msg>use delegate name for vd name, was using possible vm dir name instead<commit_after>package edu.uw.apl.tupelo.model;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.util.List;

import edu.uw.apl.vmvols.model.VirtualMachine;
import edu.uw.apl.vmvols.model.virtualbox.VBoxVM;
import edu.uw.apl.vmvols.model.virtualbox.VDIDisk;
import edu.uw.apl.vmvols.model.vmware.VMDKDisk;
import edu.uw.apl.vmvols.model.vmware.VMwareVM;

/**
 * A simple bridge class, bridging from Tupelo model objects
 * (UnmanagedDisk) to * the vmvols artifact (outside of Tupelo) which
 * enables VirtualBox (vdi) and VMWare (vmdk) disk content to be read
 * on the host.
 *
 * VMs should be powered OFF when reading them on the host,
 * e.g. during Tupelo operations.
 */
public class VirtualDisk implements UnmanagedDisk {

	static public boolean likelyVirtualDisk( File f ) {
		if( f.getName().endsWith( VDIDisk.FILESUFFIX ) )
			return true;
		if( f.getName().endsWith( VMDKDisk.FILESUFFIX ) )
			return true;
		if( VBoxVM.isVBox( f ) )
			return true;
		if( VMwareVM.isVMware( f ) )
			return true;
		return false;
	}
	
	public VirtualDisk( File f ) throws IOException {
		vm = VirtualMachine.create( f );
		if( vm == null )
			throw new IllegalArgumentException( "Unknown vd file: " + f );
		List<edu.uw.apl.vmvols.model.VirtualDisk> disks =
			vm.getActiveDisks();
		if( disks.size() > 1 ) {
			throw new IllegalArgumentException
				( "VM created from " + f + " has " + disks.size() +
						  " disks, specify one." );
		}
		delegate = disks.get(0);
		source = delegate.getPath();
{'fraction_non_alphanumeric': 0.1178314008147916, 'fraction_numerical': 0.0012535255405828893, 'mean_word_length': 3.7079646017699117, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1091549', 'n_tokens_mistral': 1208, 'n_tokens_neox': 1110, 'n_words': 297}