本文整理汇总了Java中org.databene.commons.IOUtil.isURIAvailable方法的典型用法代码示例。如果您正苦于以下问题:Java IOUtil.isURIAvailable方法的具体用法?Java IOUtil.isURIAvailable怎么用?Java IOUtil.isURIAvailable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.databene.commons.IOUtil
的用法示例。
在下文中一共展示了IOUtil.isURIAvailable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: environmentFileName
import org.databene.commons.IOUtil; //导入方法依赖的package包/类
public static String environmentFileName(String environment) throws IOException {
String filename = environment + ".env.properties";
File file = FileUtil.getFileIgnoreCase(new File(filename), false);
if (!file.exists()) {
File defaultUserHomeFile = new File(SystemInfo.getUserHome() + SystemInfo.getFileSeparator() + "databene", filename);
file = FileUtil.getFileIgnoreCase(defaultUserHomeFile, false);
}
String path;
if (file.exists()) {
path = file.getCanonicalPath();
} else if (IOUtil.isURIAvailable(filename)) {
path = filename;
} else {
throw new ConfigurationError("No environment definition '" + filename + "' found");
}
return path;
}
示例2: importStates
import org.databene.commons.IOUtil; //导入方法依赖的package包/类
private void importStates() {
this.states = new OrderedNameMap<State>();
String filename = "/org/databene/domain/address/state_" + isoCode + ".csv";
if (!IOUtil.isURIAvailable(filename)) {
LOGGER.debug("No states defined for {}", this);
return;
}
ComplexTypeDescriptor stateDescriptor = (ComplexTypeDescriptor) new BeanDescriptorProvider().getTypeDescriptor(State.class.getName());
CSVEntitySource source = new CSVEntitySource(filename, stateDescriptor, Encodings.UTF_8);
source.setContext(new DefaultBeneratorContext());
DataIterator<Entity> iterator = source.iterator();
DataContainer<Entity> container = new DataContainer<Entity>();
while ((container = iterator.next(container)) != null) {
Entity entity = container.getData();
State state = new State();
mapProperty("id", entity, state, true);
mapProperty("name", entity, state, true);
mapProperty("defaultLanguage", entity, state, false);
state.setCountry(this);
addState(state);
}
IOUtil.close(iterator);
}
示例3: FemaleFamilyNameConverter
import org.databene.commons.IOUtil; //导入方法依赖的package包/类
public FemaleFamilyNameConverter(String datasetName) {
super(String.class, String.class);
ArrayBuilder<String[]> builder = new ArrayBuilder<String[]>(String[].class);
try {
if (datasetName != null) {
String dataFileName = DatasetUtil.filenameOfDataset(datasetName,
"/org/databene/domain/person/ffn_{0}.properties");
if (IOUtil.isURIAvailable(dataFileName)) {
Map<String, String> props = IOUtil.readProperties(dataFileName);
for (Map.Entry<String, String> entry : props.entrySet())
builder.add(new String[] { entry.getKey(), entry.getValue() });
}
}
} catch (Exception e) {
logger.debug("No female family name conversion defined for dataset '" + datasetName + "'");
}
this.mappings = builder.toArray();
}
示例4: parseReservedWordsConfigFile
import org.databene.commons.IOUtil; //导入方法依赖的package包/类
private void parseReservedWordsConfigFile() {
String resourceName = "org/databene/jdbacl/dialect/" + system + "-reserved_words.txt";
if (IOUtil.isURIAvailable(resourceName)) {
parseReservedWords(resourceName);
} else {
logger.debug("Configuration file not found: " + resourceName + ". Falling back to SQL:2003 keywords");
parseReservedWords("org/databene/jdbacl/dialect/SQL2003-reserved_words.txt");
}
}
示例5: CSVEntityIterator
import org.databene.commons.IOUtil; //导入方法依赖的package包/类
public CSVEntityIterator(String uri, ComplexTypeDescriptor descriptor, Converter<String, ?> preprocessor, char separator, String encoding) throws FileNotFoundException {
if (!IOUtil.isURIAvailable(uri))
throw new FileNotFoundException("URI not found: " + uri);
this.uri = uri;
this.preprocessor = preprocessor;
this.separator = separator;
this.encoding = encoding;
this.entityDescriptor = descriptor;
this.initialized = false;
this.expectingHeader = true;
this.rowBased = (descriptor != null && descriptor.isRowBased() != null ? descriptor.isRowBased() : true);
}
示例6: initPrinter
import org.databene.commons.IOUtil; //导入方法依赖的package包/类
protected void initPrinter(Object data) throws IOException {
if (uri == null)
throw new ConfigurationError("Property 'uri' not set on bean " + getClass().getName());
wasAppended = (append && IOUtil.isURIAvailable(uri));
printer = IOUtil.getPrinterForURI(uri, encoding, append, lineSeparator, true);
postInitPrinter(data);
}
示例7: init
import org.databene.commons.IOUtil; //导入方法依赖的package包/类
private static void init() {
if (IOUtil.isURIAvailable(FILENAME)) {
try {
Map<String, String> values = IOUtil.readProperties(FILENAME);
for (Map.Entry<String, String> entry : values.entrySet())
MAP.put(entry.getKey(), new IncrementalIdGenerator(Long.parseLong(entry.getValue())));
} catch (Exception e) {
throw new ConfigurationError(e);
}
}
}
示例8: createGeneratorForAtomicDataset
import org.databene.commons.IOUtil; //导入方法依赖的package包/类
@Override
protected WeightedGenerator<E> createGeneratorForAtomicDataset(Dataset dataset) {
String filename = DatasetUtil.filenameOfDataset(dataset.getName(), filenamePattern);
LOGGER.debug("Creating weighted data set CSV generator for file {}", filename);
if (IOUtil.isURIAvailable(filename)) {
List<WeightedSample<E>> samples = CSVGeneratorUtil.parseFile(filename, separator, encoding, converter);
AttachedWeightSampleGenerator<E> generator = new AttachedWeightSampleGenerator<E>(generatedType);
for (WeightedSample<E> sample : samples)
generator.addSample(sample.getValue(), sample.getWeight());
if (samples.size() > 0)
return new AtomicDatasetGenerator<E>(generator, filename, dataset.getName());
}
return null;
}