Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 package org.ros.internal.message.service;
00018
00019 import org.ros.internal.message.definition.MessageDefinitionFileProvider;
00020
00021 import org.apache.commons.io.filefilter.FileFilterUtils;
00022 import org.apache.commons.io.filefilter.IOFileFilter;
00023 import org.ros.internal.message.StringFileProvider;
00024
00025 import java.io.File;
00026 import java.io.FileFilter;
00027
00031 public class ServiceDefinitionFileProvider extends MessageDefinitionFileProvider {
00032
00033 private static final String PARENT = "srv";
00034 private static final String SUFFIX = "srv";
00035
00036 private static StringFileProvider newStringFileProvider() {
00037 IOFileFilter extensionFilter = FileFilterUtils.suffixFileFilter(SUFFIX);
00038 IOFileFilter parentBaseNameFilter = FileFilterUtils.asFileFilter(new FileFilter() {
00039 @Override
00040 public boolean accept(File file) {
00041 return getParentBaseName(file.getAbsolutePath()).equals(PARENT);
00042 }
00043 });
00044 IOFileFilter fileFilter = FileFilterUtils.andFileFilter(extensionFilter, parentBaseNameFilter);
00045 return new StringFileProvider(fileFilter);
00046 }
00047
00048 public ServiceDefinitionFileProvider() {
00049 super(newStringFileProvider());
00050 }
00051 }