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:org.wildfly.swarm.plugin.FractionMetadata.java

@JsonIgnore
public String getModule() {
    if (this.bootstrap != null) {
        if (this.bootstrap.equals("false")) {
            return null;
        }/*from  ww w  . j av a  2 s . c o  m*/
        return this.bootstrap;
    }
    return this.baseModulePath.toString().replace(File.separatorChar, '.');
}

From source file:de.erdesignerng.generator.openxava.OpenXavaGenerator.java

public void generate(Model aModel, OpenXavaOptions aOptions) throws IOException {

    String thePackageName = aOptions.getPackageName();

    File theTargetDirectory = new File(aOptions.getSrcDirectory());
    if (!StringUtils.isEmpty(thePackageName)) {
        theTargetDirectory = new File(theTargetDirectory, thePackageName.replace('.', File.separatorChar));
    }//from   www .j  a va 2 s . co  m

    if (theTargetDirectory.exists()) {
        LOGGER.info("Target directory " + theTargetDirectory + " exists");
    } else {
        LOGGER.info("Target directory " + theTargetDirectory + " will be created");
        theTargetDirectory.mkdirs();
    }

    for (Table theTable : aModel.getTables()) {
        String theTableClassName = aOptions.createTableName(theTable.getName());

        LOGGER.info("Processing generated code for " + theTableClassName);

        File theTargetFile = new File(theTargetDirectory, theTableClassName + ".java");
        CompilationUnit theUnit;
        if (!theTargetFile.exists()) {

            LOGGER.info("Creating new file for " + theTableClassName + " at " + theTargetFile);

            theUnit = createNewCompilationUnit(thePackageName, theTableClassName);
        } else {
            theUnit = createCompilationUnitFromFile(theTargetFile);
        }

        updateCompilationUnit(aModel, aOptions, theTable, theUnit);

        PrintWriter theWriter = new PrintWriter(
                new OutputStreamWriter(new FileOutputStream(theTargetFile), JAVA_ENCODING));
        theWriter.print(theUnit.toString());
        theWriter.close();
    }
}

From source file:ClassPath.java

/**
 * Checks for class path components in the following properties:
 * "java.class.path", "sun.boot.class.path", "java.ext.dirs"
 * //  ww  w .j a  v  a 2  s .com
 * @return class path as used by default by BCEL
 */
public static final String getClassPath() {
    String class_path = System.getProperty("java.class.path");
    String boot_path = System.getProperty("sun.boot.class.path");
    String ext_path = System.getProperty("java.ext.dirs");
    List list = new ArrayList();
    getPathComponents(class_path, list);
    getPathComponents(boot_path, list);
    List dirs = new ArrayList();
    getPathComponents(ext_path, dirs);
    for (Iterator e = dirs.iterator(); e.hasNext();) {
        File ext_dir = new File((String) e.next());
        String[] extensions = ext_dir.list(new FilenameFilter() {

            public boolean accept(File dir, String name) {
                name = name.toLowerCase(Locale.ENGLISH);
                return name.endsWith(".zip") || name.endsWith(".jar");
            }
        });
        if (extensions != null) {
            for (int i = 0; i < extensions.length; i++) {
                list.add(ext_dir.getPath() + File.separatorChar + extensions[i]);
            }
        }
    }
    StringBuffer buf = new StringBuffer();
    for (Iterator e = list.iterator(); e.hasNext();) {
        buf.append((String) e.next());
        if (e.hasNext()) {
            buf.append(File.pathSeparatorChar);
        }
    }
    return buf.toString().intern();
}

From source file:com.elasticgrid.amazon.boot.BootstrapperTest.java

@Test
public void testMonitorLaunchWithMissingClusterName() throws IOException, EC2Exception {
    String data = "AWS_ACCESS_ID=123456123456\n" + "AWS_SECRET_KEY=123456123456\n"
            + "AWS_EC2_AMI32=ami-bdcb2dd4\n" + "AWS_EC2_AMI64=ami-fdcb2d94\n" + "AWS_EC2_KEYPAIR=eg-keypair\n"
            + "AWS_SQS_SECURED=true\n" + "DROP_BUCKET=elastic-grid-drop-target";
    FileUtils.writeStringToFile(new File("/tmp/user-data"), data);
    FileUtils.writeStringToFile(new File("/tmp/security-groups"),
            "elastic-grid, elastic-grid-cluster-test, eg-agent");
    System.setProperty("EG_HOME", System.getProperty("java.io.tmpdir"));
    new File(System.getProperty("java.io.tmpdir") + File.separatorChar + "config").mkdir();
    Bootstrapper bootstrapper = new Bootstrapper();

    Properties props = new Properties();
    props.load(new FileInputStream(System.getProperty("java.io.tmpdir") + "/config/eg.properties"));
    Assert.assertEquals("Wrong AWS Access ID", "123456123456",
            props.getProperty(EC2Configuration.AWS_ACCESS_ID));
    Assert.assertEquals("Wrong AWS Secret Key", "123456123456",
            props.getProperty(EC2Configuration.AWS_SECRET_KEY));
    Assert.assertEquals("Wrong AWS AMI for 32 bits", "ami-bdcb2dd4",
            props.getProperty(EC2Configuration.AWS_EC2_AMI32));
    Assert.assertEquals("Wrong AWS AMI for 64 bits", "ami-fdcb2d94",
            props.getProperty(EC2Configuration.AWS_EC2_AMI64));
    Assert.assertEquals("Wrong AWS KeyPair", "eg-keypair", props.getProperty(EC2Configuration.AWS_EC2_KEYPAIR));
    Assert.assertEquals("Wrong AWS SQS security setting", "true",
            props.getProperty(EC2Configuration.AWS_SQS_SECURED));
    Assert.assertEquals("Wrong EG Cluster name", "elastic-grid",
            props.getProperty(EC2Configuration.EG_CLUSTER_NAME));
    Assert.assertEquals("Wrong EG Drop Bucket", "elastic-grid-drop-target",
            props.getProperty(EC2Configuration.EG_DROP_BUCKET));
}

From source file:com.microsoft.tfs.core.clients.versioncontrol.internal.localworkspace.WorkspaceVersionTable.java

/**
 * Called unconditionlly during the base class ctor to allow this class a
 * chance to initialize prior to Load being called.
 *///from   w w  w  . j  av a  2 s.  com
@Override
protected void initialize() {
    server = new SparseTree<WorkspaceLocalItemPair>(ServerPath.PREFERRED_SEPARATOR_CHARACTER,
            String.CASE_INSENSITIVE_ORDER);

    local = new SparseTree<WorkspaceLocalItem>(File.separatorChar, String.CASE_INSENSITIVE_ORDER);

    removedItems = new ArrayList<WorkspaceLocalItem>();
}

From source file:org.v2020.service.ie.Vna.java

private static String createTempFileName(String uuid) {
    String tempDir = System.getProperty("java.io.tmpdir");
    StringBuilder sb = new StringBuilder().append(tempDir);
    if (!tempDir.endsWith(String.valueOf(File.separatorChar))) {
        sb.append(File.separatorChar);
    }// ww  w  . j av a2s. c o m
    return sb.append(uuid).toString();
}

From source file:com.baifendian.swordfish.common.hadoop.HdfsClient.java

/**
 *  HDFS /* ww w.jav a2  s.  c  o  m*/
 *
 * @param fileName    ??
 * @param content     
 * @param destPath    
 * @param isOverwrite ???
 */
public void addFile(String fileName, byte[] content, String destPath, boolean isOverwrite)
        throws HdfsException {
    LOGGER.debug("Begin addFile. fileName: {}, path: {}", fileName, destPath);

    // 
    String destFile;
    if (destPath.charAt(destPath.length() - 1) != File.separatorChar) {
        destFile = destPath + File.separatorChar + fileName;
    } else {
        destFile = destPath + fileName;
    }

    // ?
    Path path = new Path(destFile);

    try {
        // ?
        if (fileSystem.exists(path)) {
            if (isOverwrite) { // 
                fileSystem.delete(path, false);// 
            } else { // ?
                LOGGER.error("File " + destFile + " already exists");
                return;
            }
        }
    } catch (IOException e) {
        LOGGER.error("Operator Hdfs exception", e);
        throw new HdfsException("Operator Hdfs exception", e);
    }

    try (FSDataOutputStream out = fileSystem.create(path);
            InputStream in = new BufferedInputStream(new ByteArrayInputStream(content));) {
        byte[] b = new byte[1024];
        int numBytes = 0;
        while ((numBytes = in.read(b)) > 0) {
            out.write(b, 0, numBytes);
        }

        out.hflush();
    } catch (IOException e) {
        LOGGER.error("Operator Hdfs exception", e);
        throw new HdfsException("Operator Hdfs exception", e);
    }

    LOGGER.debug("End addFile. fileName:" + fileName + ", path:" + destPath);
}

From source file:io.cloudslang.lang.tools.build.validation.StaticValidatorImpl.java

private void validateNamespace(File slangFile, Executable executable, Queue<RuntimeException> exceptions) {
    // Validate that the namespace is not empty
    String namespace = executable.getNamespace();
    addExceptionIfEmptyString(namespace,
            "Error validating Slang file: \'" + slangFile.getAbsoluteFile()
                    + "\'. Namespace of slang source: \'" + executable.getName() + "\' cannot be empty.",
            exceptions);/* w  ww  .  ja  v  a  2  s. co  m*/

    // Validate that the namespace matches the path of the file
    String executableNamespacePath = namespace.replace('.', File.separatorChar);
    String namespaceErrorMessage = "Error validating Slang file: \'" + slangFile.getAbsoluteFile()
            + "\'. Namespace of slang source: " + executable.getName() + " is wrong.\nIt is currently \'"
            + namespace + "\', but it should match the file path: \'" + slangFile.getPath() + "\'";
    String filePathWithoutFileName = slangFile.getParent();
    addExceptionIfTrue(endsWithIgnoreCase(filePathWithoutFileName, executableNamespacePath),
            namespaceErrorMessage, exceptions);

    // Validate that the namespace is composed only of abc letters, _ or -
    Matcher matcher = PATTERN.matcher(namespace);
    addExceptionIfTrue(matcher.matches(), "Namespace: " + namespace + " is invalid. It can contain only "
            + "alphanumeric characters, underscore or hyphen", exceptions);
}

From source file:org.openmeetings.app.data.flvrecord.converter.BaseConverter.java

protected String getStreamFolderName(String name) {
    String streamFolderName = ScopeApplicationAdapter.webAppPath + File.separatorChar
            + OpenmeetingsVariables.STREAMS_DIR + File.separatorChar + name + File.separatorChar;

    log.debug("###################################################");
    log.debug("### streamFolderName - " + streamFolderName);

    File sf = new File(streamFolderName);
    if (!sf.exists()) {
        log.debug("### streamFolderName is NOT exists");
        if (!sf.mkdir()) {
            log.error("### streamFolderName: Failed to create folder");
        }/*from   w  ww .j av a2  s  .  c om*/
    }
    return streamFolderName;
}

From source file:com.gargoylesoftware.htmlunit.javascript.SimpleScriptableTest.java

/**
 * Test.//w  ww. j a v a  2  s.  c  o  m
 */
@Test
public void htmlJavaScriptMapping_AllJavaScriptClassesArePresent() {
    final JavaScriptConfiguration jsConfiguration = JavaScriptConfiguration.getInstance(getBrowserVersion());
    final Map<Class<? extends HtmlElement>, Class<? extends SimpleScriptable>> map = jsConfiguration
            .getHtmlJavaScriptMapping();
    String directoryName = "../../../src/main/java/com/gargoylesoftware/htmlunit/javascript/host";
    final Set<String> names = getFileNames(directoryName.replace('/', File.separatorChar));
    directoryName = "../../../src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html";
    names.addAll(getFileNames(directoryName.replace('/', File.separatorChar)));

    // Now pull out those names that we know don't have HTML equivalents
    names.remove("ActiveXObject");
    names.remove("ActiveXObjectImpl");
    names.remove("BoxObject");
    names.remove("ClipboardData");
    names.remove("ComputedCSSStyleDeclaration");
    names.remove("CSSImportRule");
    names.remove("CSSRule");
    names.remove("CSSRuleList");
    names.remove("CSSStyleDeclaration");
    names.remove("CSSStyleRule");
    names.remove("Document");
    names.remove("DocumentProxy");
    names.remove("DOMException");
    names.remove("DOMImplementation");
    names.remove("DOMParser");
    names.remove("Enumerator");
    names.remove("Event");
    names.remove("EventNode");
    names.remove("EventHandler");
    names.remove("EventListenersContainer");
    names.remove("External");
    names.remove("FormChild");
    names.remove("FormField");
    names.remove("History");
    names.remove("HTMLCollection");
    names.remove("HTMLCollectionTags");
    names.remove("HTMLDocument");
    names.remove("HTMLListElement");
    names.remove("HTMLOptionsCollection");
    names.remove("HTMLTableComponent");
    names.remove("KeyboardEvent");
    names.remove("JavaScriptBackgroundJob");
    names.remove("Location");
    names.remove("MediaList");
    names.remove("MimeType");
    names.remove("MimeTypeArray");
    names.remove("MouseEvent");
    names.remove("MutationEvent");
    names.remove("Namespace");
    names.remove("NamespaceCollection");
    names.remove("Navigator");
    names.remove("Node");
    names.remove("NodeFilter");
    names.remove("OfflineResourceList");
    names.remove("Plugin");
    names.remove("PluginArray");
    names.remove("Popup");
    names.remove("Range");
    names.remove("RowContainer");
    names.remove("Screen");
    names.remove("ScoperFunctionObject");
    names.remove("Selection");
    names.remove("SimpleArray");
    names.remove("StaticNodeList");
    names.remove("Storage");
    names.remove("StorageImpl");
    names.remove("StorageList");
    names.remove("StringCustom");
    names.remove("StyleSheetList");
    names.remove("TextRange");
    names.remove("TextRectangle");
    names.remove("TreeWalker");
    names.remove("UIEvent");
    names.remove("Window");
    names.remove("WindowProxy");
    names.remove("XMLDocument");
    names.remove("XMLDOMParseError");
    names.remove("XMLHttpRequest");
    names.remove("XMLSerializer");
    names.remove("XPathNSResolver");
    names.remove("XPathResult");
    names.remove("XSLTProcessor");
    names.remove("XSLTemplate");
    names.remove("XMLAttr");

    if (getBrowserVersion() != BrowserVersion.FIREFOX_3_6) {
        names.remove("HTMLAudioElement");
        names.remove("HTMLSourceElement");
        names.remove("HTMLVideoElement");

        if (getBrowserVersion().isIE()) {
            names.remove("HTMLCanvasElement");
        }
    }

    final Collection<String> hostClassNames = new ArrayList<String>();
    for (final Class<? extends SimpleScriptable> clazz : map.values()) {
        hostClassNames.add(ClassUtils.getShortClassName(clazz));
    }
    assertEquals(new TreeSet<String>(names).toString(), new TreeSet<String>(hostClassNames).toString());
}