Example usage for java.io File separatorChar

List of usage examples for java.io File separatorChar

Introduction

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

Prototype

char separatorChar

To view the source code for java.io File separatorChar.

Click Source Link

Document

The system-dependent default name-separator character.

Usage

From source file:com.util.FileService.java

/**
 * Get case file location//from w ww  . j ava2s  . c o  m
 * 
 * @param item EmailOutModel
 * @return String file path
 */
public static String getCaseFolderLocation(EmailOutModel item) {
    return Global.getActivityPath() + File.separatorChar + NumberFormatService.getSection(item.getCaseType())
            + File.separatorChar + item.getCaseYear() + File.separatorChar
            + NumberFormatService.FullCaseNumber(item) + File.separatorChar;
}

From source file:me.springframework.di.gen.factory.FileSystemDestination.java

/**
 * Returns the {@link File} to which all output will be written.
 * /* w  w  w . j a va  2  s  .  c o m*/
 * @return The {@link File} to which all output will be written.
 */
private File getFile() {
    File targetDir = new File(basedir, packageName.replace('.', File.separatorChar));
    File targetFile = new File(targetDir, className + ".java");
    return targetFile;
}

From source file:com.flipkart.poseidon.serviceclients.generator.Generator.java

private static void updateVersion() {
    String idlBasePath = IDL_BASE_PATH.replace('.', File.separatorChar);
    File folder = new File(modulePath + idlBasePath + SERVICE_FOLDER_NAME);
    if (folder.exists()) {
        File[] files = folder.listFiles();
        if (files != null && files.length > 0) {
            Versioner.getInstance().updateVersion(moduleParentPath, moduleName, files[0].getPath(), version);
        }//w  w  w  .j  av  a 2  s  . c  o m
    }
}

From source file:com.ibm.replication.iidr.utils.Settings.java

/**
 * Load the properties//from w w  w  .  j a  va  2s  .c o  m
 */
private void loadProperties(String propertiesFile) throws ConfigurationException {
    PropertiesConfiguration config = new PropertiesConfiguration(
            System.getProperty("user.dir") + File.separatorChar + "conf" + File.separator + propertiesFile);

    checkFrequencySeconds = config.getInt("checkFrequencySeconds", checkFrequencySeconds);
    connectionResetFrequencyMin = config.getInt("connectionResetFrequencyMin", connectionResetFrequencyMin);

    logMetricsToDB = config.getBoolean("logMetricsToDB", logMetricsToDB);
    logSubscriptionStatusToDB = config.getBoolean("logSubscriptionStatusToDB", logSubscriptionStatusToDB);
    logEventsToDB = config.getBoolean("logEventsToDB", logEventsToDB);

    logMetricsToCsv = config.getBoolean("logMetricsToCsv", logMetricsToCsv);
    logSubscriptionStatusToCsv = config.getBoolean("logSubscriptionStatusToCsv", logSubscriptionStatusToCsv);
    logEventsToCsv = config.getBoolean("logEventsToCsv", logEventsToCsv);

    // Number of events to retrieve
    numberOfEvents = config.getInt("numberOfEvents", numberOfEvents);

    // Access Server settings
    asHostName = config.getString("asHostName");
    asUserName = config.getString("asUserName");
    String encryptedAsPassword = config.getString("asPassword");
    asPort = config.getInt("asPort", 10101);

    // Check if the password has already been encrypted
    // If not, encrypt and save the properties
    try {
        asPassword = Encryptor.decodeAndDecrypt(encryptedAsPassword);
    } catch (EncryptedDataException e) {
        logger.debug("Encrypting asPassword");
        asPassword = encryptedAsPassword;
        encryptedAsPassword = Encryptor.encryptAndEncode(encryptedAsPassword);
        config.setProperty("asPassword", encryptedAsPassword);
        config.save();
    }

    // Metrics to include
    // if (includeMetrics.isEmpty())
    // includeMetricsList = new ArrayList<String>();
    // else
    includeMetricsList = new ArrayList<String>(Arrays.asList(config.getStringArray("includeMetrics")));
    includeMetricsList.removeAll(Arrays.asList(""));

    // Metrics to exclude
    excludeMetricsList = new ArrayList<String>(Arrays.asList(config.getStringArray("excludeMetrics")));
    excludeMetricsList.removeAll(Arrays.asList(""));

    // Database connection settings
    dbHostName = config.getString("dbHostName");
    dbPort = config.getInt("dbPort");
    dbDatabase = config.getString("dbDatabase");
    dbUserName = config.getString("dbUserName");
    String encryptedDbPassword = config.getString("dbPassword");
    dbDriverName = config.getString("dbDriverName");
    dbUrl = config.getString("dbUrl");
    dbSchema = config.getString("dbSchema");

    try {
        dbPassword = Encryptor.decodeAndDecrypt(encryptedDbPassword);
    } catch (EncryptedDataException e) {
        logger.debug("Encrypting dbPassword");
        dbPassword = encryptedDbPassword;
        encryptedDbPassword = Encryptor.encryptAndEncode(encryptedDbPassword);
        config.setProperty("dbPassword", encryptedDbPassword);
        config.save();
    }

    // CSV logging settings
    csvSeparator = config.getString("csvSeparator", csvSeparator);

    // Now report the settings
    logSettings(config);
}

From source file:net.thackbarth.sparrow.SparrowCrawler.java

private void processFile(Session session, File file, File rootFolder) {
    String filename = file.getName().toLowerCase();
    if (filename.endsWith(".mp3")) {
        if (moveCount < configuration.getScanLimit()) {
            // read
            if (logger.isDebugEnabled()) {
                logger.debug("Reading file: " + filename);
            }//from  w  ww  .j  a  va  2s .c  om
            String filePath = file.getAbsolutePath().substring(rootFolder.getAbsolutePath().length());
            Long modification = file.lastModified();

            Criteria criteria = session.createCriteria(MusicTrack.class)
                    .add(Restrictions.eq("filePath", filePath.replace(File.separatorChar, '/')))
                    .setMaxResults(1);
            MusicTrack track = (MusicTrack) criteria.uniqueResult();
            if (track == null) {
                track = new MusicTrack();
            }
            if ((track.getModificationDate() == null) || (!track.getModificationDate().equals(modification))) {
                if ((track.getModificationDate() != null)
                        && (!track.getModificationDate().equals(modification))) {
                    logger.info("Modificationdate not OK! Reload file " + filename);
                }
                boolean valid = reader.readFile(file, rootFolder, track);
                if (valid) {
                    // if the file was changed but the path is correct => update date
                    if (track.isFilePathCorrect()) {
                        track.setModificationDate(modification);
                    }
                    saveFile(session, track);
                }
            }
            fileCount++;
            if ((fileCount % configuration.getBatchSize()) == 0) {
                progress.info("Read files: " + fileCount + " / Files to move: " + moveCount);
                session.flush();
            }
        }
    } else {
        if (!file.getName().startsWith(".DS")) {
            // file must convert
            logger.error("File must be converted: " + file.getAbsolutePath());
        } else {
            logger.info("Remove Mac-File: " + file.getAbsolutePath());
            file.delete();
        }
    }
}

From source file:com.silverpeas.workflow.engine.model.ProcessModelManagerImplTest.java

/**
 * Test of getProcessModelDir method, of class ProcessModelManagerImpl.
 *//* w ww  .  java2s  . c o m*/
@org.junit.Test
public void testGetProcessModelDir() {
    System.out.println("getProcessModelDir");
    ProcessModelManagerImpl instance = new ProcessModelManagerImpl();
    String expResult = System.getProperty("basedir") + File.separatorChar + "target" + File.separatorChar
            + "test-classes" + File.separatorChar;
    String result = instance.getProcessModelDir();
    assertEquals(expResult, result);
}

From source file:com.iggroup.oss.restdoclet.doclet.util.DocletUtils.java

/**
 * Gets the file containing the documentation of a class.
 * //from w  w w .  j a  v a2s  . c o  m
 * @param classDoc the Java documentation object of the class.
 * @return the file containing documentation.
 */
public static File documentationFile(final ClassDoc classDoc) {
    final StringBuffer path = new StringBuffer();
    path.append(classDoc.qualifiedName().replace('.', File.separatorChar));
    if (isController(classDoc)) {
        path.append(Controller.FILE_SUFFIX);
    } else {
        path.append(".class.xml");
    }
    final File doc = new File(path.toString());
    doc.getParentFile().mkdirs();
    return doc;
}

From source file:com.neophob.PixelController.java

/**
 * //w ww.j a  v a2  s  .c  o m
 */
public void setup() {
    try {
        LOG.log(Level.INFO, "\n\nPixelController " + getVersion() + " - http://www.pixelinvaders.ch\n\n");

        size(SETUP_WINDOW_WIDTH, SETUP_WINDOW_HEIGHT);
        background(0);
        noStroke();

        //try to display the pixelcontroller logo
        String splashimg = "setup" + File.separatorChar + "splash.jpg";
        try {
            image(loadImage(splashimg), 0, 111);
        } catch (Exception e) {
            LOG.log(Level.INFO, "Failed to load splash logo (" + splashimg + ")", e);
        }

        //write pixelcontroller text
        textSize(SETUP_FONT_BIG);
        fill(227, 122, 182);
        text("PixelController " + getVersion(), 10, 29);

        text("Loading...", 10, 120);
        drawProgressBar(0.0f);
        drawSetupText("Load Configuration", TEXT_Y_OFFSET + TEXT_Y_HEIGHT * setupStep);
    } catch (Exception e) {
        LOG.log(Level.SEVERE, "Setup() call failed!", e);
    }
}

From source file:com.linkage.crm.csb.sign.DigitalSignUtil.java

/**
 * ./*w  ww.j  a v  a  2  s . c o m*/
 * @param code  5.:10.3 
 * @param xml xml.
 * @return true/false.
 * @throws IOException .
 */
public boolean verify(String xml, String key, String srcSysId) throws SignException {
    if (StringUtils.isEmpty(xml)) {
        throw new IllegalArgumentException("xml to be verified is null");
    }

    boolean result = false;
    ICAPSigner verifier = null;
    if (srcSysId == null || srcSysId.equals("")) {
        srcSysId = getSrcSysId(xml, key);
    }
    log.debug("srcSysId==" + srcSysId);
    if (srcSysId != null) {

        //SP.
        verifier = (ICAPSigner) verifierMap.get(srcSysId);

        if (verifier == null) {
            // srcSysIdpwd.
            Properties props = new Properties();
            String spConfigFile = null;
            try {
                System.out.println(this.servletContext.getRealPath(String.valueOf(File.separatorChar)));
                System.out.println(this.servletContext.getContextPath());
                configDir = this.servletContext.getRealPath(String.valueOf(File.separatorChar)) + "/META-INF";
                spConfigFile = configDir + File.separator + "keystore" + File.separator + srcSysId
                        + File.separator + "pwd";
                props.load(new FileInputStream(new File(spConfigFile)));
                log.debug("spConfigFile" + spConfigFile);
                log.debug("" + srcSysId + "." + props);
            } catch (Exception e) {
                throw new SignException(SignException.TYPE_VRF, "SP" + spConfigFile,
                        e);
            }
            String fileName = null, alias = null, password = null, certFileName = null;
            if (props != null && props.size() > 0) {
                fileName = props.getProperty("filename");
                alias = props.getProperty("alias");
                password = props.getProperty("password");
                certFileName = props.getProperty("certfile");

                log.debug("%%%%%%%%%%%%%%%%" + fileName + "===" + alias + "===" + password + "==="
                        + certFileName);
                {
                    verifier = new DefaultCAPSigner(password, alias,
                            configDir + File.separator + "keystore" + File.separator + srcSysId + File.separator
                                    + fileName, // 
                            configDir + File.separator + "keystore" + File.separator + srcSysId + File.separator
                                    + certFileName); // 

                    verifierMap.put(srcSysId, verifier);

                }
            } else {
                log.error(",srcSysId=" + srcSysId);
            }
        }
    }
    if (verifier != null) {
        result = verifier.verifyCAP(xml);
    } else {
        log.debug("SignException");
        throw new SignException(SignException.TYPE_VRF, "" + srcSysId + "",
                new NullPointerException("verifier for " + srcSysId + " is null"));
    }
    return result;
}

From source file:com.gnamp.struts.action.TerminalSettingAction.java

private static String CurrentPath(long devId) {
    return CONFIG_ROOT + File.separatorChar
            + String.format("%016X_1.xml", new Object[] { Long.valueOf(devId) });
}