Search in sources :

Example 21 with NYCFileUtils

use of org.onebusaway.admin.util.NYCFileUtils in project onebusaway-application-modules by camsys.

the class HastusTranslateTask method createScheduleDataDir.

private String createScheduleDataDir(String file) {
    NYCFileUtils fu = new NYCFileUtils();
    _log.info("expanding " + file);
    String dir = fu.parseDirectory(file);
    String auxDir = dir + File.separator + AUX_DIR;
    fu.unzip(file, auxDir);
    File[] files = new File(auxDir).listFiles();
    if (files != null) {
        for (File checkDir : files) {
            if (checkDir.exists() && checkDir.isDirectory()) {
                if (checkDir.getName().toUpperCase().contains("SCHEDULES")) {
                    _log.info("routes data dir=" + checkDir);
                    return checkDir.toString();
                }
            }
        }
    }
    _log.error("could not find routes data dir");
    return null;
}
Also used : NYCFileUtils(org.onebusaway.admin.util.NYCFileUtils) File(java.io.File)

Example 22 with NYCFileUtils

use of org.onebusaway.admin.util.NYCFileUtils in project onebusaway-application-modules by camsys.

the class HastusTranslateTask method createGisDataDir.

private String createGisDataDir(String file) {
    NYCFileUtils fu = new NYCFileUtils();
    _log.info("expanding " + file);
    String dir = fu.parseDirectory(file);
    String auxDir = dir + File.separator + AUX_DIR;
    fu.unzip(file, auxDir);
    File[] files = new File(auxDir).listFiles();
    if (files != null) {
        for (File checkDir : files) {
            if (checkDir.exists() && checkDir.isDirectory()) {
                if (checkDir.getName().toUpperCase().contains("GIS")) {
                    _log.info("gis data dir=" + checkDir);
                    return checkDir.toString();
                }
            }
        }
    }
    _log.error("could not find gis data dir");
    return null;
}
Also used : NYCFileUtils(org.onebusaway.admin.util.NYCFileUtils) File(java.io.File)

Aggregations

NYCFileUtils (org.onebusaway.admin.util.NYCFileUtils)22 File (java.io.File)15 ZipFile (java.util.zip.ZipFile)6 InputStream (java.io.InputStream)4 BundleBuildResponse (org.onebusaway.admin.model.BundleBuildResponse)4 BundleBuildRequest (org.onebusaway.admin.model.BundleBuildRequest)3 FileInputStream (java.io.FileInputStream)2 FileOutputStream (java.io.FileOutputStream)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 FileService (org.onebusaway.admin.service.FileService)2 BundleValidationServiceImpl (org.onebusaway.admin.service.bundle.impl.BundleValidationServiceImpl)2 S3FileServiceImpl (org.onebusaway.admin.service.impl.S3FileServiceImpl)2 FileUtility (org.onebusaway.util.FileUtility)2 RemoteConnectFailureException (org.springframework.remoting.RemoteConnectFailureException)2 GetObjectRequest (com.amazonaws.services.s3.model.GetObjectRequest)1 S3Object (com.amazonaws.services.s3.model.S3Object)1 JsonObject (com.google.gson.JsonObject)1 FileNotFoundException (java.io.FileNotFoundException)1 MalformedURLException (java.net.MalformedURLException)1