001/* 002 * Copyright 2012 Chris Pheby 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.jadira.scanner.core.spi; 017 018import java.io.File; 019import java.net.URL; 020import java.util.List; 021 022import org.jadira.scanner.core.api.Allocator; 023import org.jadira.scanner.core.helper.FileUtils; 024 025public abstract class AbstractFileResolver<F> extends AbstractResolver<F, File, URL> { 026 027 private static final Allocator<File, URL> FILE_ALLOCATOR = new Allocator<File, URL>() { 028 @Override 029 public File allocate(URL e) { 030 return FileUtils.getFileFromURL(e); 031 }}; 032 033 protected AbstractFileResolver() { 034 super(); 035 } 036 037 protected AbstractFileResolver(List<URL> classpaths) { 038 super(); 039 getDriverData().addAll(classpaths); 040 } 041 042 @Override 043 protected Allocator<File, URL> getAllocator() { 044 return FILE_ALLOCATOR; 045 } 046}