List of usage examples for java.io File separatorChar
char separatorChar
To view the source code for java.io File separatorChar.
Click Source Link
From source file:com.elasticgrid.examples.video.VideoConverterJSBTest.java
@BeforeTest public void setupAWS() throws IOException, S3ServiceException { Properties awsProperties = new Properties(); File awsPropertiesFile = new File(System.getProperty("user.home") + File.separatorChar + ".eg", "aws.properties"); InputStream stream = null;/*from ww w . j a v a 2 s . c om*/ try { stream = new FileInputStream(awsPropertiesFile); awsProperties.load(stream); } catch (Exception e) { e.printStackTrace(); throw new IOException("Can't load Amazon Web Services property file from $HOME/.eg/aws.properties"); } finally { IOUtils.closeQuietly(stream); } awsAccessId = (String) awsProperties.get("aws.accessId"); awsSecretKey = (String) awsProperties.get("aws.secretKey"); s3 = new RestS3Service(new AWSCredentials(awsAccessId, awsSecretKey)); }
From source file:net.lightbody.bmp.proxy.jetty.html.Image.java
/** Set the image size from the header of a GIF file. * @param dirname The directory name, expected to be in OS format * @param pathname The image path name relative to the directory. * Expected to be in WWW format (i.e. with slashes) * and will be converted to OS format. *///from w ww.ja v a2 s. c om public Image setSizeFromGif(String dirname, String pathname) { String filename = dirname + pathname.replace('/', File.separatorChar); return setSizeFromGif(filename); }
From source file:net.sf.wickedshell.domain.completion.CompletionDao.java
/** * Resets the <code>StaticCompletionList</code> of static * <code>Completions</code> defined by the guy who wrote this plugin :) *///from www . ja va 2s. c om public void writeDefaultCompletions() throws IOException { List<ICompletion> staticCompletions = new ArrayList<ICompletion>(); // create the default static completions staticCompletions.add(ICompletion.Factory.newInstance("cd " + File.separatorChar, "cd " + File.separatorChar + " - Change to root directory (Static)", "img/changeToRootDirectory.gif")); staticCompletions.add(ICompletion.Factory.newInstance("cd ..", "cd .. - Change to parent directory (Static)", "img/changeToParentDirectory.gif")); staticCompletions.add(ICompletion.Factory.newInstance("cls", "cls - Clear screen (Static)", new String())); staticCompletions .add(ICompletion.Factory.newInstance("dir", "dir - List directory (Static)", new String())); staticCompletions.add(ICompletion.Factory.newInstance("ipconfig", "ipconfig - Show IP-Configuration (Static)", new String())); staticCompletions.add(ICompletion.Factory.newInstance("ipconfig /all", "ipconfig /all - Show detailed IP-Configuration (Static)", new String())); staticCompletions.add( ICompletion.Factory.newInstance("mkdir", "mkdir - Create a new directory (Static)", new String())); staticCompletions.add(ICompletion.Factory.newInstance("net", "net - Manage local system services (Static)", new String())); staticCompletions.add(ICompletion.Factory.newInstance("net start", "net start - Start local system service (Static)", new String())); staticCompletions.add(ICompletion.Factory.newInstance("net stop", "net stop - Stop local system service (Static)", new String())); writeCompletions(staticCompletions); }
From source file:com.flexive.core.storage.binary.FxBinaryUtils.java
/** * Get the binary directory for the current node * * @return binary directory for the current node *///from w w w. j a v a 2 s . c om public static String getBinaryDirectory() { String cacheDir = (String) FxContext.get().getAttribute(CTX_BINARY_DIR); if (cacheDir != null) return cacheDir; String path; try { path = EJBLookup.getConfigurationEngine().get(SystemParameters.NODE_BINARY_PATH); } catch (FxApplicationException e) { if (!e.isMessageLogged()) { LOG.error("Failed to get binary storage path: " + e.getMessage(), e); } path = "~" + File.separatorChar + "flexive" + File.separatorChar + "binaries"; } File dir = new File(FxFileUtils.expandPath(path)); if (!dir.exists() && !dir.mkdirs()) { LOG.error("Could not create directory: " + dir.getAbsolutePath()); } FxContext.get().setAttribute(CTX_BINARY_DIR, dir.getAbsolutePath()); return dir.getAbsolutePath(); }
From source file:com.qcadoo.model.internal.file.FileServiceImpl.java
@Override public String getLastModificationDate(final String path) { if (!StringUtils.hasText(path)) { return null; }/*from w ww . j av a 2s . co m*/ Date date = new Date(Long.valueOf(path.substring(path.lastIndexOf(File.separatorChar) + 1, path.lastIndexOf(File.separatorChar) + 14))); return new SimpleDateFormat(DateUtils.L_DATE_FORMAT, getLocale()).format(date); }
From source file:gov.nih.nci.sdk.example.generator.CXFSpringConfGenerator.java
private void generateSpringServerConf() { StringTemplate template = getScriptContext().getTemplateGroup().getInstanceOf("SpringBeanServerConf"); for (String focusDomain : getScriptContext().retrieveDomainSet()) { template.setAttribute("beanId", EcoreUtil.determineClassName(focusDomain) + "Service"); template.setAttribute("beanImpl", EcoreUtil.determinePackageName(focusDomain) + ".service." + EcoreUtil.determineClassName(focusDomain) + "ServiceImpl"); template.setAttribute("beanAddress", "/" + EcoreUtil.determineClassName(focusDomain) + "Service"); }/*w ww .j a va 2 s . c om*/ File targetBase = new File(getScriptContext().getTargetBase()); String outputDir = getScriptContext().getProperties().getProperty("PROJECT_ROOT") + File.separatorChar + "webapp" + File.separatorChar + "WEB-INF"; getScriptContext().getLogger().info("Beans.xml is being generated into directory: " + outputDir); GeneratorUtil.writeFile(outputDir, "beans.xml", template.toString()); }
From source file:com.hubrick.raml.codegen.springweb.RestControllerClassGenerator.java
public JType generate() { final String subPackageName = emptyToNull( nullToEmpty(new File(file).getParent()).replace(File.separatorChar, '.')); final String packageName = JavaNames.joinPackageMembers(basePackage, subPackageName); int extPos = file.lastIndexOf('.'); final String baseName = extPos < 0 ? file : file.substring(0, extPos); final String resourceSimpleClassName = JavaNames.toSimpleClassName(baseName) + "Resource"; final JPackage aPackage = codeModel._package(packageName); final JDefinedClass resourceClass; try {/*from w w w. j a va 2s. com*/ resourceClass = aPackage._interface(JMod.PUBLIC, resourceSimpleClassName); } catch (JClassAlreadyExistsException e) { throw new IllegalStateException("Resource interface already exists: " + e.getExistingClass().fullName(), e); } annotateControllerClass(resourceClass); // action methods for (ActionMetaInfo a : actionDefinitions) { final JType returnType; if (a.getResponseBodySchema() != null) { final InlineSchemaReference schemaRef = InlineSchemaReference.of(file, a.getResponseBodySchema()); checkState(schemaIndex.containsKey(schemaRef), "Schema <%s> is not defined in the file: %s", schemaRef.getSchema(), file); final SchemaMetaInfo schemaMetaInfo = schemaIndex.get(schemaRef); returnType = schemaMetaInfo.getJType(); } else { returnType = JType.parse(codeModel, "void"); } final JMethod actionMethod = resourceClass.method(JMod.PUBLIC, returnType, RamlUtil.toJavaMethodName(a.getAction())); annotateActionMethod(actionMethod, a); // path parameters a.getUriParameterDefinitions().stream().forEach(p -> { final JVar param = actionMethod.param(JMod.FINAL, codeModel.ref(p.getJavaType()), p.getName()); param.annotate(codeModel.ref("org.springframework.web.bind.annotation.PathVariable")).param("value", p.getName()); }); // query parameters a.getQueryParameterDefinitions().stream().forEach(p -> { final JVar param = actionMethod.param(JMod.FINAL, codeModel.ref(p.getJavaType()), p.getName()); param.annotate(codeModel.ref("org.springframework.web.bind.annotation.RequestParam")).param("value", p.getName()); }); // request body if (a.getRequestBodySchema() != null) { final InlineSchemaReference schemaRef = InlineSchemaReference.of(file, a.getRequestBodySchema()); checkState(schemaIndex.containsKey(schemaRef), "Schema <%s> is not defined in the file: %s", schemaRef.getSchema(), file); final SchemaMetaInfo schemaMetaInfo = schemaIndex.get(schemaRef); actionMethod.param(JMod.FINAL, schemaMetaInfo.getJType(), "body") .annotate(codeModel.ref("org.springframework.web.bind.annotation.RequestBody")); } } return resourceClass; }
From source file:controllers.Uploads.java
public static void viewDoc(@Required Long id, @Required String moduleName, @Required String version) { models.Upload upload = getUpload(id); String docPath = moduleName.replace('.', File.separatorChar) + File.separatorChar + version + File.separatorChar + "module-doc" + File.separatorChar + "index.html"; render(upload, moduleName, version, docPath); }
From source file:FileUtils.java
/** * Utility method for concatenation names of collection of files * @param files - array of strings to concatenate * @return concatenated string//w ww .j ava2 s . c o m */ public static String joinFiles(String... files) { final StringBuilder res = new StringBuilder(); for (String file : files) { res.append(file).append(File.separatorChar); } return res.substring(0, res.length() - 1); }
From source file:org.jvnet.hudson.mojo.TeamCityToHudsonConverterMojo.java
@Override public void execute() throws MojoExecutionException, MojoFailureException { TeamCityParser parser = new TeamCityParser(); final List<VCSRoot> roots = parser.parseVCSRoots(baseDir + "/vcs-roots.xml"); TeamCityToHudsonConverter converter = new TeamCityToHudsonConverter(); converter.setVcsRoots(roots);/*from w ww . j a va 2 s.co m*/ converter.setBaseDir(baseDir); List<JobConfig> jobConfigs = new ArrayList<JobConfig>(); ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext( "classpath:/META-INF/spring/core-context.xml"); JobConfigGenerator generator = (JobConfigGenerator) appContext.getBean("jobConfigGenerator"); int i = 1; String[] projectFiles = converter.findProjects(); for (String projectFile : projectFiles) { final Project project = parser.parseBuildTypes(baseDir + File.separatorChar + projectFile); if (project.getBuildTypes() != null) { for (BuildType buildType : project.getBuildTypes()) { getLog().info("Parsing modules [" + i + "/" + projectFiles.length + "] defined in TeamCity '" + new File(baseDir + File.separatorChar + projectFile).getAbsolutePath() + "' project file..."); final JobConfig jobConfig = converter.convertProject(buildType); if (jobConfig != null && jobConfig.getBuilderType() != 0 && jobConfig.getScmURL() != null && jobConfig.getScmURL().indexOf("null") == -1 && !matchesSCMExclusion(jobConfig)) { // TODO: Add the job config to a final list of migrated modules getLog().info(jobConfig.toString()); getLog().info( " + Generating config file for project '" + jobConfig.getProjectName() + "':"); getLog().info(" - Subversion URL: " + jobConfig.getScmURL()); getLog().info(" - Maven goals: " + jobConfig.getMavenGoals()); getLog().info(""); File dir = new File(outputDirectory + File.separatorChar + jobConfig.getModuleName()); if (!dir.exists()) //noinspection ResultOfMethodCallIgnored dir.mkdirs(); generator.setJobConfig(jobConfig); generator.setOutputDirectory(dir.getAbsolutePath()); generator.generate(); jobConfigs.add(jobConfig); } else { getLog().error(" Failed to migrate the project!"); getLog().error(" + Causes:"); if (jobConfig != null && jobConfig.getBuilderType() == 0) getLog().error( " - Unidentified build type! The module doesn't define Maven goals or Ant tasks."); if (jobConfig != null && jobConfig.getScmURL() != null) getLog().error(" - The project has no source control management settings."); if (jobConfig != null && jobConfig.getScmURL() != null && jobConfig.getScmURL().indexOf("null") != -1) getLog().error( " - Failed to properly parse the project's source control management settings (" + jobConfig.getScmURL() + ")"); } } } else { getLog().info("Skipping project " + projectFile + " ['" + project.getId() + " / " + project.getDescription() + "'] due to missing build type definitions!"); } i++; } MetaBuildGenerator metaBuildGenerator = new MetaBuildGenerator(new MetaBuild(jobConfigs)); metaBuildGenerator.setOutputDirectory(outputDirectory); metaBuildGenerator.generate(); }