// Path: src/main/java/org/cloudfoundry/community/servicebroker/datalifecycle/repo/ServiceInstanceRepo.java
// public interface ServiceInstanceRepo extends
// 		PagingAndSortingRepository<ServiceInstanceEntity, String> {
// }
// 
// Path: src/main/java/org/cloudfoundry/community/servicebroker/datalifecycle/service/LCServiceInstanceManager.java
// public class LCServiceInstanceManager {
// 	private ServiceInstanceRepo repo;
// 
// 	public LCServiceInstanceManager(ServiceInstanceRepo repo) {
// 		this.repo = repo;
// 	}
// 
// 	public ServiceInstance getInstance(String id) {
// 		ServiceInstanceEntity entity = repo.findOne(id);
// 		return convert(entity);
// 	}
// 
// 	public String getCopyIdForInstance(String id) {
// 		ServiceInstanceEntity entity = repo.findOne(id);
// 		return null == entity ? null : entity.getCopyId();
// 	}
// 
// 	// TODO this could have a more natural data structure.
// 	public Collection<Pair<String, ServiceInstance>> getInstances() {
// 		List<Pair<String, ServiceInstance>> instancePairs = new ArrayList<Pair<String, ServiceInstance>>();
// 		repo.findAll().forEach(
// 				e -> instancePairs
// 						.add(new ImmutablePair<String, ServiceInstance>(e
// 								.getCopyId(), convert(e))));
// 		return instancePairs;
// 	}
// 
// 	public void saveInstance(ServiceInstance instance, String copyId) {
// 		repo.save(new ServiceInstanceEntity(instance, copyId));
// 	}
// 
// 	public ServiceInstance removeInstance(String id) {
// 		ServiceInstanceEntity entity = repo.findOne(id);
// 		if (null != entity) {
// 			repo.delete(id);
// 		}
// 		return convert(entity);
// 	}
// 
// 	private ServiceInstance convert(ServiceInstanceEntity i) {
// 		if (null == i) {
// 			return null;
// 		}
// 		// TODO Gross, the base should handle this for us.
// 		OperationState state = null;
// 		switch (i.getLastOperationState()) {
// 		case "in progress":
// 			state = OperationState.IN_PROGRESS;
// 			break;
// 		case "succeeded":
// 			state = OperationState.SUCCEEDED;
// 			break;
// 		case "failed":
// 			state = OperationState.FAILED;
// 			break;
// 		default:
// 			assert (false);
// 		}
// 		// @formatter:off
// 		return new ServiceInstance(new CreateServiceInstanceRequest(
// 				i.getServiceDefinitionId(), i.getPlanGuid(), i.getOrgGuid(),
// 				i.getSpaceGuid(), true).withServiceInstanceId(i
// 				.getServiceInstanceId()))
// 				.withDashboardUrl(i.getDashboardUrl())
// 				.and()
// 				.withLastOperation(
// 						new ServiceInstanceLastOperation(i
// 								.getLastOperationDescription(), state));
// 		// @formatter:on
// 	}
// }


import org.cloudfoundry.community.servicebroker.datalifecycle.repo.ServiceInstanceRepo;
import org.cloudfoundry.community.servicebroker.datalifecycle.service.LCServiceInstanceManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
package org.cloudfoundry.community.servicebroker.datalifecycle.config;


@Configuration
class LCServiceInstanceManagerConfig {

	@Autowired
	private
	ServiceInstanceRepo repo;

	@Bean
// Path: src/main/java/org/cloudfoundry/community/servicebroker/datalifecycle/repo/ServiceInstanceRepo.java
// public interface ServiceInstanceRepo extends
// 		PagingAndSortingRepository<ServiceInstanceEntity, String> {
// }
// 
// Path: src/main/java/org/cloudfoundry/community/servicebroker/datalifecycle/service/LCServiceInstanceManager.java
// public class LCServiceInstanceManager {
// 	private ServiceInstanceRepo repo;
// 
// 	public LCServiceInstanceManager(ServiceInstanceRepo repo) {
// 		this.repo = repo;
// 	}
// 
// 	public ServiceInstance getInstance(String id) {
// 		ServiceInstanceEntity entity = repo.findOne(id);
// 		return convert(entity);
// 	}
// 
// 	public String getCopyIdForInstance(String id) {
// 		ServiceInstanceEntity entity = repo.findOne(id);
// 		return null == entity ? null : entity.getCopyId();
// 	}
// 
// 	// TODO this could have a more natural data structure.
// 	public Collection<Pair<String, ServiceInstance>> getInstances() {
// 		List<Pair<String, ServiceInstance>> instancePairs = new ArrayList<Pair<String, ServiceInstance>>();
// 		repo.findAll().forEach(
// 				e -> instancePairs
// 						.add(new ImmutablePair<String, ServiceInstance>(e
// 								.getCopyId(), convert(e))));
// 		return instancePairs;
// 	}
// 
// 	public void saveInstance(ServiceInstance instance, String copyId) {
// 		repo.save(new ServiceInstanceEntity(instance, copyId));
// 	}
// 
// 	public ServiceInstance removeInstance(String id) {
// 		ServiceInstanceEntity entity = repo.findOne(id);
// 		if (null != entity) {
// 			repo.delete(id);
// 		}
// 		return convert(entity);
// 	}
// 
// 	private ServiceInstance convert(ServiceInstanceEntity i) {
// 		if (null == i) {
// 			return null;
// 		}
// 		// TODO Gross, the base should handle this for us.
// 		OperationState state = null;
// 		switch (i.getLastOperationState()) {
// 		case "in progress":
// 			state = OperationState.IN_PROGRESS;
// 			break;
// 		case "succeeded":
// 			state = OperationState.SUCCEEDED;
// 			break;
// 		case "failed":
// 			state = OperationState.FAILED;
// 			break;
// 		default:
// 			assert (false);
// 		}
// 		// @formatter:off
// 		return new ServiceInstance(new CreateServiceInstanceRequest(
// 				i.getServiceDefinitionId(), i.getPlanGuid(), i.getOrgGuid(),
// 				i.getSpaceGuid(), true).withServiceInstanceId(i
// 				.getServiceInstanceId()))
// 				.withDashboardUrl(i.getDashboardUrl())
// 				.and()
// 				.withLastOperation(
// 						new ServiceInstanceLastOperation(i
// 								.getLastOperationDescription(), state));
// 		// @formatter:on
// 	}
// }


// Path: src/main/java/org/cloudfoundry/community/servicebroker/datalifecycle/config/LCServiceInstanceManagerConfig.java
import org.cloudfoundry.community.servicebroker.datalifecycle.repo.ServiceInstanceRepo;
import org.cloudfoundry.community.servicebroker.datalifecycle.service.LCServiceInstanceManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

package org.cloudfoundry.community.servicebroker.datalifecycle.config;


@Configuration
class LCServiceInstanceManagerConfig {

	@Autowired
	private
	ServiceInstanceRepo repo;

	@Bean
	LCServiceInstanceManager newLCServiceInstanceManager() {