Example usage for java.io File getAbsoluteFile

List of usage examples for java.io File getAbsoluteFile

Introduction

In this page you can find the example usage for java.io File getAbsoluteFile.

Prototype

public File getAbsoluteFile() 

Source Link

Document

Returns the absolute form of this abstract pathname.

Usage

From source file:fr.norsys.asoape.mojo.GenerateAndroidClientMojo.java

private Definition readDefinitionFrom(File definitionFile) throws MojoExecutionException {
    try {/*from   www .  j  a  v a  2 s  . c o m*/
        WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
        return reader.readWSDL(definitionFile.getAbsolutePath());
    } catch (WSDLException cause) {
        throw new MojoExecutionException(
                String.format("Unable to read definition file %s", definitionFile.getAbsoluteFile()), cause);
    }
}

From source file:net.ontopia.infoset.content.FileContentStore.java

@Override
public synchronized ContentInputStream get(int key) throws ContentStoreException {
    checkOpen();/*from   w w w.j  a  va 2  s .  c  om*/
    File file = getFileForKey(key);

    try {
        return new ContentInputStream(new FileInputStream(file), (int) file.length());
    } catch (FileNotFoundException e) {
        throw new ContentStoreException("No entry in content store for key " + key + "; file "
                + file.getAbsoluteFile() + " not " + "found.");
    }
}

From source file:ch.elexis.importer.div.Test_HL7_parser.java

@Test
public void testOverwrite() throws IOException {
    removeAllPatientsAndDependants();//from   ww w.j a v a2  s . co  m
    removeAllLaboWerte();
    File overwrite_test_1 = new File(workDir.toString(), "overwrite_test_1.hl7");
    assertEquals("Must be able to read: " + overwrite_test_1.getAbsoluteFile().toString(), true,
            overwrite_test_1.canRead());
    parseOneHL7file(hlp, new File(workDir.toString(), "overwrite_test_1.hl7"), false, true);
    Query<LabResult> qr = new Query<LabResult>(LabResult.class);
    qr.orderBy(false, LabResult.ITEM_ID, LabResult.DATE, LabResult.RESULT);
    List<LabResult> qrr = qr.execute();

    int foundCnt = 0;
    for (LabResult labResult : qrr) {
        String name = labResult.getItem().getName();
        System.out.println(name);
        if (name.equals("AST (GOT)")) {
            assertEquals("?", labResult.getResult());
            foundCnt++;
        }
    }
    assertEquals(1, foundCnt);
}

From source file:com.dnielfe.manager.AppManager.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    int index = info.position;
    String packagename = mAppList.get(index).packageName;

    switch (item.getItemId()) {
    case ID_LAUNCH:
        Intent i = pm.getLaunchIntentForPackage(packagename);
        startActivity(i);/*w w w  . j  av a  2s  .  c o m*/
        break;

    case ID_MANAGE:
        startActivity(new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
                Uri.parse("package:" + packagename)));
        break;

    case ID_UNINSTALL:
        Intent i1 = new Intent(Intent.ACTION_DELETE);
        i1.setData(Uri.parse("package:" + packagename));
        startActivity(i1);
        get_downloaded_apps();
        break;

    case ID_MARKET:
        Intent intent1 = new Intent(Intent.ACTION_VIEW);
        intent1.setData(Uri.parse("market://details?id=" + packagename));
        startActivity(intent1);
        break;

    case ID_SEND:
        try {
            ApplicationInfo info1 = pm.getApplicationInfo(packagename, 0);
            String source_dir = info1.sourceDir;
            File file = new File(source_dir);
            Uri uri11 = Uri.fromFile(file.getAbsoluteFile());

            Intent infointent = new Intent(Intent.ACTION_SEND);
            infointent.setType("application/zip");
            infointent.putExtra(Intent.EXTRA_STREAM, uri11);
            startActivity(Intent.createChooser(infointent, getString(R.string.share)));
        } catch (Exception e) {
            Toast.makeText(AppManager.this, "Error", Toast.LENGTH_SHORT).show();
        }
        break;
    }
    return false;
}

From source file:com.moss.veracity.core.data.PersistenceManager.java

public PersistenceManager(File envDir) {

    envDir = envDir.getAbsoluteFile();

    if (log.isDebugEnabled()) {
        log.debug("Loading environment using envDir: " + envDir);
    }// w  w w.  j a  v  a2s.  c  o m

    if (!envDir.exists() && !envDir.mkdirs()) {
        throw new RuntimeException("Cannot create envDir: " + envDir);
    }

    try {

        List<Class> classes = new ArrayList<Class>();

        /*
         * Root classes
         */
        classes.add(PublicSignatureKey.class);
        classes.add(Account.class);

        /*
         * Hierarchy Leafs
         */
        classes.add(PasswordMechanism.class);

        if (log.isDebugEnabled()) {
            log.debug("Building JAXB context");
        }

        jaxbContext = JAXBContext.newInstance(classes.toArray(new Class[0]));

        if (log.isDebugEnabled()) {
            log.debug("Opening environment");
        }

        EnvironmentConfig envConfig = new EnvironmentConfig();
        envConfig.setAllowCreate(true);
        envConfig.setTransactional(true);
        envConfig.setSharedCache(true);

        env = new Environment(envDir, envConfig);

        {
            if (log.isDebugEnabled()) {
                log.debug("Opening database " + ACCOUNTS_DB);
            }

            DatabaseConfig dbConfig = new DatabaseConfig();
            dbConfig.setAllowCreate(true);
            dbConfig.setTransactional(true);

            accountsDb = env.openDatabase(null, ACCOUNTS_DB, dbConfig);
        }

        {
            if (log.isDebugEnabled()) {
                log.debug("Opening database " + PUBLIC_SIGNING_KEYS_DB);
            }

            DatabaseConfig dbConfig = new DatabaseConfig();
            dbConfig.setAllowCreate(true);
            dbConfig.setTransactional(true);

            publicSigningKeysDb = env.openDatabase(null, PUBLIC_SIGNING_KEYS_DB, dbConfig);
        }
    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }

    listeners = new ArrayList<PersistenceListener>();
}

From source file:com.github.riccardove.easyjasub.EasyJaSubInputFromCommand.java

private static File getOutputIdxFile(EasyJaSubInputCommand command, File videoFile,
        DefaultFileList defaultFileList) throws EasyJaSubException {
    String fileName = command.getOutputIdxFileName();
    if (isDisabled(fileName)) {
        return null;
    }//from  w ww .j  av  a 2  s.co  m
    File file = null;
    if (fileName != null && !isDefault(fileName)) {
        file = new File(fileName);
    }
    if (file == null) {
        if (videoFile == null) {
            file = new File(defaultFileList.getDefaultDirectory(),
                    defaultFileList.getDefaultFileNamePrefix() + ".idx");
        } else {
            file = new File(videoFile.getAbsoluteFile().getParentFile(),
                    FilenameUtils.getBaseName(videoFile.getName()) + ".idx");
        }
        fileName = file.getAbsolutePath();
    }
    checkOutputFile(fileName, file);
    return file;
}

From source file:com.tactfactory.harmony.Harmony.java

private void loadTemplates(File plugin) {
    // Template bundles
    File templateFolderFile = plugin;

    if (templateFolderFile.isFile()) {
        templateFolderFile = templateFolderFile.getParentFile();
    }/* w  w w.ja  va2 s  .  co m*/

    this.templateFolders.put(plugin.getName(), templateFolderFile.getAbsoluteFile());

    ConsoleUtils.displayDebug("Load templates from : " + templateFolderFile);
}

From source file:aes.pica.touresbalon.tb_serviciosbolivariano.ServiciosBolivarianos.java

@Override
public List<TouresBalonOrdenVO> consultaReservas(String ordenId) {
    List<TouresBalonOrdenVO> listaReservasTB = new ArrayList<>();
    String nombreArchivo = Constantes.NAME_RESERVAS + ordenId + Constantes.CSV_FILE;
    try {//  www  .jav  a 2 s. c  om
        File archivoConsulta = FileUtils.getFile(rutaReservas, nombreArchivo);
        if (archivoConsulta != null && archivoConsulta.exists()) {
            List<String> lineasArchivo = FileUtils.readLines(archivoConsulta);
            System.out.println("Archivo encontrado: " + archivoConsulta.getAbsoluteFile());
            for (String s : lineasArchivo) {
                listaReservasTB.add(new TouresBalonOrdenVO(s));
            }
        } else {
            System.out.println("No existe archivo: " + nombreArchivo + " en el directorio: " + rutaReservas);
        }
    } catch (IOException ex) {
        System.err.println(ex.toString());
    }
    return listaReservasTB;
}

From source file:Json.JsonWrite.java

public void jsonCreate(String patchName) {
    JSONObject obj = new JSONObject();
    obj.put("patch", this.patch);
    obj.put("page", this.page);
    obj.put("eddWay", this.eddWay);
    obj.put("proffName", this.proffName);
    obj.put("yearStart", this.YStart);
    obj.put("yearEnd", this.YEnd);
    obj.put("eddName", this.EddName);

    File file = new File(patchName);

    try {//from  w w  w. ja  v a2  s . co m
        //?,  ?   ??  ? 
        if (!file.exists()) {
            file.createNewFile();
        }

        //PrintWriter ? ? ?  
        PrintWriter out = new PrintWriter(file.getAbsoluteFile());

        try {
            //? ?  
            out.print(obj);
        } finally {
            //?     
            //   ??
            out.close();
        }
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}

From source file:aes.pica.touresbalon.tb_serviciosbolivariano.ServiciosBolivarianos.java

@Override
public List<ViajeVO> consultarViajes(String fechaViaje, String ciudadOrigen, String ciudadDestino) {
    List<ViajeVO> listaViajes = new ArrayList<>();
    String nombreArchivo = Constantes.NAME_VIAJES + fechaViaje + Constantes.CSV_FILE;
    try {/* w  w w . ja v  a 2 s  .c  om*/
        File archivoConsulta = FileUtils.getFile(rutaConsulta, nombreArchivo);
        if (archivoConsulta != null && archivoConsulta.exists()) {
            List<String> lineasArchivo = FileUtils.readLines(archivoConsulta);
            System.out.println("Archivo encontrado: " + archivoConsulta.getAbsoluteFile());
            ViajeVO viajeAux;
            for (String s : lineasArchivo) {
                viajeAux = new ViajeVO(s);
                if (viajeAux.getCiudadOrigen().equalsIgnoreCase(ciudadOrigen)
                        && viajeAux.getCiudadDestino().equalsIgnoreCase(ciudadDestino)) {
                    listaViajes.add(viajeAux);
                }
            }
        } else {
            System.out.println("No existe archivo: " + nombreArchivo + " en el directorio: " + rutaConsulta);
        }
    } catch (IOException ex) {
        System.err.println(ex.toString());
    }
    return listaViajes;
}