List of usage examples for java.io File getAbsoluteFile
public File getAbsoluteFile()
From source file:hudson.Util.java
/** * Checks if the given file represents a symlink. *///ww w . ja va2 s. c om //Taken from http://svn.apache.org/viewvc/maven/shared/trunk/file-management/src/main/java/org/apache/maven/shared/model/fileset/util/FileSetManager.java?view=markup public static boolean isSymlink(File file) throws IOException { String name = file.getName(); if (name.equals(".") || name.equals("..")) return false; File fileInCanonicalParent; File parentDir = file.getParentFile(); if (parentDir == null) { fileInCanonicalParent = file; } else { fileInCanonicalParent = new File(parentDir.getCanonicalPath(), name); } return !fileInCanonicalParent.getCanonicalFile().equals(fileInCanonicalParent.getAbsoluteFile()); }
From source file:info.magnolia.cms.servlets.PropertyInitializer.java
/** * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent) *///from w w w. j a va 2s . c o m public void contextInitialized(ServletContextEvent sce) { final ServletContext context = sce.getServletContext(); String propertiesLocationString = context.getInitParameter(MAGNOLIA_INITIALIZATION_FILE); if (log.isDebugEnabled()) { log.debug("{} value in web.xml is :[{}]", MAGNOLIA_INITIALIZATION_FILE, propertiesLocationString); //$NON-NLS-1$ } if (StringUtils.isEmpty(propertiesLocationString)) { propertiesLocationString = DEFAULT_INITIALIZATION_PARAMETER; } String[] propertiesLocation = StringUtils.split(propertiesLocationString, ','); String servername = null; try { servername = StringUtils.lowerCase(InetAddress.getLocalHost().getHostName()); } catch (UnknownHostException e) { log.error(e.getMessage()); } String rootPath = StringUtils.replace(context.getRealPath(StringUtils.EMPTY), "\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$ String webapp = StringUtils.substringAfterLast(rootPath, "/"); //$NON-NLS-1$ File logs = new File(webapp + File.separator + "logs"); File tmp = new File(webapp + File.separator + "tmp"); if (!logs.exists()) { logs.mkdir(); log.debug("Creating " + logs.getAbsoluteFile() + " folder"); } if (!tmp.exists()) { tmp.mkdir(); log.debug("Creating " + tmp.getAbsoluteFile() + " folder"); } if (log.isDebugEnabled()) { log.debug("rootPath is {}, webapp is {}", rootPath, webapp); //$NON-NLS-1$ } for (int j = 0; j < propertiesLocation.length; j++) { String location = StringUtils.trim(propertiesLocation[j]); location = StringUtils.replace(location, "${servername}", servername); //$NON-NLS-1$ location = StringUtils.replace(location, "${webapp}", webapp); //$NON-NLS-1$ File initFile = new File(rootPath, location); if (!initFile.exists() || initFile.isDirectory()) { if (log.isDebugEnabled()) { log.debug("Configuration file not found with path [{}]", //$NON-NLS-1$ initFile.getAbsolutePath()); } continue; } InputStream fileStream; try { fileStream = new FileInputStream(initFile); } catch (FileNotFoundException e1) { log.debug("Configuration file not found with path [{}]", //$NON-NLS-1$ initFile.getAbsolutePath()); return; } try { envProperties.load(fileStream); log.info("Loading configuration at {}", initFile.getAbsolutePath());//$NON-NLS-1$ Log4jConfigurer.initLogging(context, envProperties); new ConfigLoader(context, envProperties); } catch (Exception e) { log.error(e.getMessage(), e); } finally { IOUtils.closeQuietly(fileStream); } return; } log.error(MessageFormat.format( "No configuration found using location list {0}. [servername] is [{1}], [webapp] is [{2}] and base path is [{3}]", //$NON-NLS-1$ new Object[] { ArrayUtils.toString(propertiesLocation), servername, webapp, rootPath })); }
From source file:com.lightbox.android.bitmap.BitmapUtils.java
public static void writeBitmapInFile(File file, Bitmap bitmap, CompressFormat compressFormat, StringBuilder outMD5) throws IOException { // Ensure that the directory exist file.getParentFile().mkdirs();/* w w w . ja v a 2 s . c om*/ OutputStream outputStream = null; try { if (outMD5 != null) { // We want a MD5: writing JPEG into a byte array outputStream = new ByteArrayOutputStream(); } else { // Directly write to file try { outputStream = new BufferedOutputStream(new RandomAccessFileOutputStream(file), 65536); } catch (OutOfMemoryError e) { outputStream = new BufferedOutputStream(new RandomAccessFileOutputStream(file)); } } boolean success = bitmap.compress(compressFormat, FULL_QUALITY, outputStream); if (!success) { throw new IOException(String.format("Unable to save bitmap as a %s file: %s", (compressFormat == CompressFormat.JPEG) ? "jpeg" : "png", file.getAbsoluteFile().toString())); } else { if (outMD5 != null) { // Calculate MD5 and write the file to disk long time = System.currentTimeMillis(); byte[] jpeg = ((ByteArrayOutputStream) outputStream).toByteArray(); if (outMD5 != null) { outMD5.append(getMD5String(jpeg)); } DebugLog.d(TAG, "Time to calculate MD5: " + (System.currentTimeMillis() - time)); time = System.currentTimeMillis(); RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rwd"); randomAccessFile.write(jpeg); randomAccessFile.close(); DebugLog.d(TAG, "Time to write to file: " + (System.currentTimeMillis() - time)); } } } finally { IOUtils.closeQuietly(outputStream); } }
From source file:com.maxl.java.aips2sqlite.PseudoExpertInfo.java
public int process() { try {/*from w w w .j a va 2s. com*/ File dir = new File(FILE_PSEUDO_INFO_DIR); if (dir != null && dir.isDirectory()) { Collection<File> files = FileUtils.listFiles(dir, FileFilterUtils.suffixFileFilter(".docx"), TrueFileFilter.INSTANCE); if (files != null) { System.out.println("\nProcessing total of " + files.size() + " pseudo Fachinfos..."); int idxPseudo = 1; for (File pseudo : files) { if (pseudo.isFile()) { FileInputStream pseudoInfoFile = new FileInputStream(pseudo.getAbsoluteFile()); if (extractInfo(idxPseudo, pseudoInfoFile)) idxPseudo++; } } return idxPseudo - 1; } } else { System.out.println("Directory with pseudo FIs not found!"); } } catch (FileNotFoundException e) { e.printStackTrace(); return 0; } return 0; }
From source file:com.palantir.atlasdb.table.description.Schema.java
private void emit(File srcDir, String code, String packName, String className) throws IOException { File outputDir = new File(srcDir, packName.replace(".", "/")); File outputFile = new File(outputDir, className + ".java"); // create paths if they don't exist outputDir.mkdirs();// w w w . ja v a 2 s . c om outputFile = outputFile.getAbsoluteFile(); outputFile.createNewFile(); FileWriter os = null; try { os = new FileWriter(outputFile); os.write(code); } finally { if (os != null) { os.close(); } } }
From source file:localization.SplitterUI.java
public static void createMacro() throws IOException { String content = "Option Explicit" + "\r\n" + "Sub Main" + "\r\n" + "Dim prj As PslProject" + "\r\n" + "Set prj = PSL.ActiveProject" + "\r\n" + "'Check whether we have open a project or not" + "\r\n" + "If prj Is Nothing Then" + "\r\n" + "MsgBox(\"No active Passolo project.\")" + "\r\n" + "Exit Sub" + "\r\n" + "End If" + "\r\n" + "Const ForWriting = 2" + "\r\n" + "Dim logFile As String" + "\r\n" + "logFile = Mid(prj.Location,1,InStrRev(prj.Location,\"\\\")) & prj.Name & \".log\"" + "\r\n" + "Dim objFSO, objFile, objFile2" + "\r\n" + "Set objFSO = CreateObject(\"Scripting.FileSystemObject\")" + "\r\n" + "If Dir(logFile) <> \"\" Then" + "\r\n" + "Set objFile2 = objFSO.OpenTextFile(logFile,ForWriting)" + "\r\n" + "Else" + "\r\n" + "Set objFile = objFSO.CreateTextFile(logFile,True)" + "\r\n" + "objFile.Close" + "\r\n" + "Set objFile2 = objFSO.OpenTextFile(logFile,ForWriting)" + "\r\n" + "End If" + "\r\n" + "Dim prjName As String" + "\r\n" + "prjName = prj.Name" + "\r\n" + "If (InStr(prj.Name,\"ECI_10\") > 0) Then" + "\r\n" + "ECI_th(prj,objFile2)" + "\r\n" + "ElseIf (InStr(prj.Name,\"ECI\") > 0) Then" + "\r\n" + "ECI(prj,objFile2)" + "\r\n" + "ElseIf (InStr(prj.Name,\"AAC\") > 0) Then" + "\r\n" + "AAC(prj,objFile2)" + "\r\n" + "ElseIf (InStr(prj.Name,\"TOIN\") > 0) Then" + "\r\n" + "TOIN(prj,objFile2)" + "\r\n" + "ElseIf (InStr(prj.Name,\"LIOX_10\") > 0) Then" + "\r\n" + "LIOX_Self(prj,objFile2)" + "\r\n" + "ElseIf (InStr(prj.Name,\"LIOX\") > 0) Then" + "\r\n" + "LIOX_main(prj,objFile2)" + "\r\n" + "End If" + "\r\n" + "objFile2.Close" + "\r\n" + "End Sub" + "\r\n" + "Function ECI_th(prj,objFile2)" + "\r\n" + "Dim Lang As String" + "\r\n" + "Dim trn As PslTransList" + "\r\n" + "Dim i,j,h As Integer" + "\r\n" + "Dim LangNum As Integer" + "\r\n" + "Dim logoutput As String" + "\r\n" + "logoutput = \"Begin to process file \" & prj.Name" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "'Remove the language sets" + "\r\n" + "'The pointer of each string list of each language" + "\r\n" + "'It goes thought only one string list" + "\r\n" + "i = 0" + "\r\n" + "h = 0" + "\r\n" + "'The pointer of language" + "\r\n" + "j = 1" + "\r\n" + "LangNum = prj.Languages.Count" + "\r\n" + "For Each trn In prj.TransLists" + "\r\n" + "i = i + 1" + "\r\n" + "If ( i > LangNum) Then" + "\r\n" + "Exit For" + "\r\n" + "End If" + "\r\n" + "Lang = trn.Language.LangCode" + "\r\n" + "If (StrComp(Lang,\"tha\") = 0 ) Then" + "\r\n" + "j = j + 1" + "\r\n" + "h = h + 1" + "\r\n" + "Else" + "\r\n" + "logoutput = \"Removing language: \" & Lang" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "prj.Languages.Remove(j)" + "\r\n" + "End If" + "\r\n" + "Next trn" + "\r\n" + "'Delete those source lists that are all translated and validated" + "\r\n" + "Dim delete As Boolean" + "\r\n" + "delete = True" + "\r\n" + "j = 0" + "\r\n" + "i = 1" + "\r\n" + "For Each trn In prj.TransLists" + "\r\n" + "j = j + 1" + "\r\n" + "If(j > h) Then" + "\r\n" + "j = 1" + "\r\n" + "i = i + 1" + "\r\n" + "End If" + "\r\n" + "Dim k As Integer" + "\r\n" + "If (trn.TransRate <> 100) Then" + "\r\n" + "delete = False" + "\r\n" + "For k = 1 To trn.StringCount" + "\r\n" + "On Error Resume Next" + "\r\n" + "Dim tString As PslTransString" + "\r\n" + "Set tString = trn.String(k)" + "\r\n" + "If StrComp(tString.SourceText,tString.Text) <> 0 And tString.State(pslStateTranslated) = False And tString.State(pslStateReadOnly) = False Then" + "\r\n" + "logoutput = \"Find one source and translation are not identical in untranslated state. Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "tString.Text = tString.SourceText" + "\r\n" + "End If" + "\r\n" + "If tString.State(pslStateTranslated) = True And tString.State(pslStateReadOnly) = False And tString.State(pslStateReview) = True And tString.State(pslStateAutoTranslated) = True Then" + "\r\n" + "If tString.State(pslStateLocked) = True Then" + "\r\n" + "logoutput = \"Find one green locked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "Else" + "\r\n" + "logoutput = \"Find one green unlocked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "End If" + "\r\n" + "End If" + "\r\n" + "Next k" + "\r\n" + "trn.Save" + "\r\n" + "Else" + "\r\n" + "For k = 1 To trn.StringCount" + "\r\n" + "On Error Resume Next" + "\r\n" + "Dim tString1 As PslTransString" + "\r\n" + "Set tString1 = trn.String(k)" + "\r\n" + "If tString1.State(pslStateTranslated) = True And tString1.State(pslStateReadOnly) = False And tString1.State(pslStateReview) = True And tString1.State(pslStateAutoTranslated) = False Then" + "\r\n" + "delete = False" + "\r\n" + "ElseIf tString1.State(pslStateTranslated) = True And tString1.State(pslStateReadOnly) = False And tString1.State(pslStateReview) = True And tString1.State(pslStateAutoTranslated) = True Then" + "\r\n" + "If tString1.State(pslStateLocked) = True Then" + "\r\n" + "logoutput = \"Find one green locked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "Else" + "\r\n" + "logoutput = \"Find one green unlocked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "End If" + "\r\n" + "End If" + "\r\n" + "Next k" + "\r\n" + "End If" + "\r\n" + "If (delete = True) And (j = h) Then" + "\r\n" + "prj.SourceLists.Remove(i)" + "\r\n" + "i = i - 1" + "\r\n" + "ElseIf (j = h) Then" + "\r\n" + "delete = True" + "\r\n" + "End If" + "\r\n" + "Next trn" + "\r\n" + "If prj.Languages.Count = 0 Or prj.SourceLists.Count = 0 Then" + "\r\n" + "Dim deleteFile As String" + "\r\n" + "deleteFile = prj.Location & \"\\\" + prj.Name & \".lpu\"" + "\r\n" + "prj.Close()" + "\r\n" + "Dim FileSys" + "\r\n" + "Set FileSys = CreateObject(\"Scripting.FileSystemObject\")" + "\r\n" + "FileSys.DeleteFile(deleteFile)" + "\r\n" + "End If" + "\r\n" + "End Function" + "\r\n" + "Function ECI(prj,objFile2)" + "\r\n" + "Dim Lang As String" + "\r\n" + "Dim trn As PslTransList" + "\r\n" + "Dim i,j,h As Integer" + "\r\n" + "Dim LangNum As Integer" + "\r\n" + "Dim logoutput As String" + "\r\n" + "logoutput = \"Begin to process file \" & prj.Name" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "'Remove the language sets" + "\r\n" + "'The pointer of each string list of each language" + "\r\n" + "'It goes thought only one string list" + "\r\n" + "i = 0" + "\r\n" + "h = 0" + "\r\n" + "'The pointer of language" + "\r\n" + "j = 1" + "\r\n" + "LangNum = prj.Languages.Count" + "\r\n" + "For Each trn In prj.TransLists" + "\r\n" + "i = i + 1" + "\r\n" + "If ( i > LangNum) Then" + "\r\n" + "Exit For" + "\r\n" + "End If" + "\r\n" + "Lang = trn.Language.LangCode" + "\r\n" + "If ((StrComp(Lang,\"chs\") = 0) Or (StrComp(Lang,\"vit\") = 0) Or (StrComp(Lang, \"cht\") = 0) ) Then" + "\r\n" + "j = j + 1" + "\r\n" + "h = h + 1" + "\r\n" + "Else" + "\r\n" + "logoutput = \"Removing language \" & Lang" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "prj.Languages.Remove(j)" + "\r\n" + "End If" + "\r\n" + "Next trn" + "\r\n" + "'Delete those source lists that are all translated and validated" + "\r\n" + "Dim delete As Boolean" + "\r\n" + "delete = True" + "\r\n" + "'The pointer of each string list of each language" + "\r\n" + "j = 0" + "\r\n" + "'The pointer of each string list" + "\r\n" + "i = 1" + "\r\n" + "For Each trn In prj.TransLists" + "\r\n" + "j = j + 1" + "\r\n" + "If(j > h) Then" + "\r\n" + "j = 1" + "\r\n" + "i = i + 1" + "\r\n" + "End If" + "\r\n" + "Dim k As Integer" + "\r\n" + "If (trn.TransRate <> 100) Then" + "\r\n" + "delete = False" + "\r\n" + "For k = 1 To trn.StringCount" + "\r\n" + "On Error Resume Next" + "\r\n" + "Dim tString As PslTransString" + "\r\n" + "Set tString = trn.String(k)" + "\r\n" + "If StrComp(tString.SourceText,tString.Text) <> 0 And tString.State(pslStateTranslated) = False And tString.State(pslStateReadOnly) = False Then" + "\r\n" + "logoutput = \"Find one source and translation are not identical in untranslated state. Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "tString.Text = tString.SourceText" + "\r\n" + "End If" + "\r\n" + "If tString.State(pslStateTranslated) = True And tString.State(pslStateReadOnly) = False And tString.State(pslStateReview) = True And tString.State(pslStateAutoTranslated) = True Then" + "\r\n" + "If tString.State(pslStateLocked) = True Then" + "\r\n" + "logoutput = \"Find one green locked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "Else" + "\r\n" + "logoutput = \"Find one green unlocked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "End If" + "\r\n" + "End If" + "\r\n" + "Next k" + "\r\n" + "trn.Save" + "\r\n" + "Else" + "\r\n" + "For k = 1 To trn.StringCount" + "\r\n" + "On Error Resume Next" + "\r\n" + "Dim tString1 As PslTransString" + "\r\n" + "Set tString1 = trn.String(k)" + "\r\n" + "If tString1.State(pslStateTranslated) = True And tString1.State(pslStateReadOnly) = False And tString1.State(pslStateReview) = True And tString1.State(pslStateAutoTranslated) = False Then" + "\r\n" + "delete = False" + "\r\n" + "ElseIf tString1.State(pslStateTranslated) = True And tString1.State(pslStateReadOnly) = False And tString1.State(pslStateReview) = True And tString1.State(pslStateAutoTranslated) = True Then" + "\r\n" + "If tString1.State(pslStateLocked) = True Then" + "\r\n" + "logoutput = \"Find one green locked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "Else" + "\r\n" + "logoutput = \"Find one green unlocked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "End If" + "\r\n" + "End If" + "\r\n" + "Next k" + "\r\n" + "End If" + "\r\n" + "If (delete = True) And (j = h) Then" + "\r\n" + "prj.SourceLists.Remove(i)" + "\r\n" + "i = i - 1" + "\r\n" + "ElseIf (j = h) Then" + "\r\n" + "delete = True" + "\r\n" + "End If" + "\r\n" + "Next trn" + "\r\n" + "If prj.Languages.Count = 0 Or prj.SourceLists.Count = 0 Then" + "\r\n" + "Dim deleteFile As String" + "\r\n" + "deleteFile = prj.Location & \"\\\" + prj.Name & \".lpu\"" + "\r\n" + "prj.Close()" + "\r\n" + "Dim FileSys" + "\r\n" + "Set FileSys = CreateObject(\"Scripting.FileSystemObject\")" + "\r\n" + "FileSys.DeleteFile(deleteFile)" + "\r\n" + "End If" + "\r\n" + "End Function" + "\r\n" + "Function AAC(prj,objFile2)" + "\r\n" + "Dim Lang As String" + "\r\n" + "Dim trn As PslTransList" + "\r\n" + "Dim i,j,h As Integer" + "\r\n" + "Dim LangNum As Integer" + "\r\n" + "Dim logoutput As String" + "\r\n" + "logoutput = \"Begin to process file \" & prj.Name" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "'Remove the language sets" + "\r\n" + "'The pointer of each string list of each language" + "\r\n" + "'It goes thought only one string list" + "\r\n" + "i = 0" + "\r\n" + "h = 0" + "\r\n" + "'The pointer of language" + "\r\n" + "j = 1" + "\r\n" + "LangNum = prj.Languages.Count" + "\r\n" + "For Each trn In prj.TransLists" + "\r\n" + "i = i + 1" + "\r\n" + "If ( i > LangNum) Then" + "\r\n" + "Exit For" + "\r\n" + "End If" + "\r\n" + "Lang = trn.Language.LangCode" + "\r\n" + "If ((StrComp(Lang,\"sve\") = 0) Or (StrComp(Lang,\"fin\") = 0) Or (StrComp(Lang, \"dan\") = 0) Or (StrComp(Lang,\"nor\") = 0) Or (StrComp(Lang,\"plk\") = 0) Or (StrComp(Lang,\"nld\") = 0)) Then" + "\r\n" + "j = j + 1" + "\r\n" + "h = h + 1" + "\r\n" + "Else" + "\r\n" + "prj.Languages.Remove(j)" + "\r\n" + "End If" + "\r\n" + "Next trn" + "\r\n" + "'Delete those source lists that are all translated and validated" + "\r\n" + "Dim delete As Boolean" + "\r\n" + "delete = True" + "\r\n" + "'The pointer of each string list of each language" + "\r\n" + "j = 0" + "\r\n" + "'The pointer of each string list" + "\r\n" + "i = 1" + "\r\n" + "For Each trn In prj.TransLists" + "\r\n" + "j = j + 1" + "\r\n" + "If(j > h) Then" + "\r\n" + "j = 1" + "\r\n" + "i = i + 1" + "\r\n" + "End If" + "\r\n" + "Dim k As Integer" + "\r\n" + "If (trn.TransRate <> 100) Then" + "\r\n" + "delete = False" + "\r\n" + "For k = 1 To trn.StringCount" + "\r\n" + "On Error Resume Next" + "\r\n" + "Dim tString As PslTransString" + "\r\n" + "Set tString = trn.String(k)" + "\r\n" + "If StrComp(tString.SourceText,tString.Text) <> 0 And tString.State(pslStateTranslated) = False And tString.State(pslStateReadOnly) = False Then" + "\r\n" + "logoutput = \"Find one source and translation are not identical in untranslated state. Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "tString.Text = tString.SourceText" + "\r\n" + "End If" + "\r\n" + "If tString.State(pslStateTranslated) = True And tString.State(pslStateReadOnly) = False And tString.State(pslStateReview) = True And tString.State(pslStateAutoTranslated) = True Then" + "\r\n" + "If tString.State(pslStateLocked) = True Then" + "\r\n" + "logoutput = \"Find one green locked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "Else" + "\r\n" + "logoutput = \"Find one green unlocked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "End If" + "\r\n" + "End If" + "\r\n" + "Next k" + "\r\n" + "trn.Save" + "\r\n" + "Else" + "\r\n" + "For k = 1 To trn.StringCount" + "\r\n" + "On Error Resume Next" + "\r\n" + "Dim tString1 As PslTransString" + "\r\n" + "Set tString1 = trn.String(k)" + "\r\n" + "If tString1.State(pslStateTranslated) = True And tString1.State(pslStateReadOnly) = False And tString1.State(pslStateReview) = True And tString1.State(pslStateAutoTranslated) = False Then" + "\r\n" + "delete = False" + "\r\n" + "ElseIf tString1.State(pslStateTranslated) = True And tString1.State(pslStateReadOnly) = False And tString1.State(pslStateReview) = True And tString1.State(pslStateAutoTranslated) = True Then" + "\r\n" + "If tString1.State(pslStateLocked) = True Then" + "\r\n" + "logoutput = \"Find one green locked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "Else" + "\r\n" + "logoutput = \"Find one green unlocked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "End If" + "\r\n" + "End If" + "\r\n" + "Next k" + "\r\n" + "End If" + "\r\n" + "If (delete = True) And (j = h) Then" + "\r\n" + "prj.SourceLists.Remove(i)" + "\r\n" + "i = i - 1" + "\r\n" + "ElseIf (j = h) Then" + "\r\n" + "delete = True" + "\r\n" + "End If" + "\r\n" + "Next trn" + "\r\n" + "If prj.Languages.Count = 0 Or prj.SourceLists.Count = 0 Then" + "\r\n" + "Dim deleteFile As String" + "\r\n" + "deleteFile = prj.Location & \"\\\" + prj.Name & \".lpu\"" + "\r\n" + "prj.Close()" + "\r\n" + "Dim FileSys" + "\r\n" + "Set FileSys = CreateObject(\"Scripting.FileSystemObject\")" + "\r\n" + "FileSys.DeleteFile(deleteFile)" + "\r\n" + "End If" + "\r\n" + "End Function" + "\r\n" + "Function TOIN(prj,objFile2)" + "\r\n" + "Dim Lang As String" + "\r\n" + "Dim trn As PslTransList" + "\r\n" + "Dim i,j,h As Integer" + "\r\n" + "Dim LangNum As Integer" + "\r\n" + "Dim logoutput As String" + "\r\n" + "logoutput = \"Begin to process file \" & prj.Name" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "i = 0" + "\r\n" + "h = 0" + "\r\n" + "j = 1" + "\r\n" + "LangNum = prj.Languages.Count" + "\r\n" + "For Each trn In prj.TransLists" + "\r\n" + "i = i + 1" + "\r\n" + "If ( i > LangNum) Then" + "\r\n" + "Exit For" + "\r\n" + "End If" + "\r\n" + "Lang = trn.Language.LangCode" + "\r\n" + "If ((StrComp(Lang,\"jpn\") = 0) Or (StrComp(Lang,\"kor\") = 0)) Then" + "\r\n" + "j = j + 1" + "\r\n" + "h = h + 1" + "\r\n" + "Else" + "\r\n" + "prj.Languages.Remove(j)" + "\r\n" + "End If" + "\r\n" + "Next trn" + "\r\n" + "'Delete those source lists that are all translated and validated" + "\r\n" + "Dim delete As Boolean" + "\r\n" + "delete = True" + "\r\n" + "'The pointer of each string list of each language" + "\r\n" + "j = 0" + "\r\n" + "'The pointer of each string list" + "\r\n" + "i = 1" + "\r\n" + "For Each trn In prj.TransLists" + "\r\n" + "j = j + 1" + "\r\n" + "If(j > h) Then" + "\r\n" + "j = 1" + "\r\n" + "i = i + 1" + "\r\n" + "End If" + "\r\n" + "Dim k As Integer" + "\r\n" + "If (trn.TransRate <> 100) Then" + "\r\n" + "delete = False" + "\r\n" + "For k = 1 To trn.StringCount" + "\r\n" + "On Error Resume Next" + "\r\n" + "Dim tString As PslTransString" + "\r\n" + "Set tString = trn.String(k)" + "\r\n" + "If StrComp(tString.SourceText,tString.Text) <> 0 And tString.State(pslStateTranslated) = False And tString.State(pslStateReadOnly) = False Then" + "\r\n" + "logoutput = \"Find one source and translation are not identical in untranslated state. Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "tString.Text = tString.SourceText" + "\r\n" + "End If" + "\r\n" + "If tString.State(pslStateTranslated) = True And tString.State(pslStateReadOnly) = False And tString.State(pslStateReview) = True And tString.State(pslStateAutoTranslated) = True Then" + "\r\n" + "If tString.State(pslStateLocked) = True Then" + "\r\n" + "logoutput = \"Find one green locked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "Else" + "\r\n" + "logoutput = \"Find one green unlocked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "End If" + "\r\n" + "End If" + "\r\n" + "Next k" + "\r\n" + "trn.Save" + "\r\n" + "Else" + "\r\n" + "For k = 1 To trn.StringCount" + "\r\n" + "On Error Resume Next" + "\r\n" + "Dim tString1 As PslTransString" + "\r\n" + "Set tString1 = trn.String(k)" + "\r\n" + "If tString1.State(pslStateTranslated) = True And tString1.State(pslStateReadOnly) = False And tString1.State(pslStateReview) = True And tString1.State(pslStateAutoTranslated) = False Then" + "\r\n" + "delete = False" + "\r\n" + "ElseIf tString1.State(pslStateTranslated) = True And tString1.State(pslStateReadOnly) = False And tString1.State(pslStateReview) = True And tString1.State(pslStateAutoTranslated) = True Then" + "\r\n" + "If tString1.State(pslStateLocked) = True Then" + "\r\n" + "logoutput = \"Find one green locked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "Else" + "\r\n" + "logoutput = \"Find one green unlocked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "End If" + "\r\n" + "End If" + "\r\n" + "Next k" + "\r\n" + "End If" + "\r\n" + "If (delete = True) And (j = h) Then" + "\r\n" + "prj.SourceLists.Remove(i)" + "\r\n" + "i = i - 1" + "\r\n" + "ElseIf (j = h) Then" + "\r\n" + "delete = True" + "\r\n" + "End If" + "\r\n" + "Next trn" + "\r\n" + "If prj.Languages.Count = 0 Or prj.SourceLists.Count = 0 Then" + "\r\n" + "Dim deleteFile As String" + "\r\n" + "deleteFile = prj.Location & \"\\\" + prj.Name & \".lpu\"" + "\r\n" + "prj.Close()" + "\r\n" + "Dim FileSys" + "\r\n" + "Set FileSys = CreateObject(\"Scripting.FileSystemObject\")" + "\r\n" + "FileSys.DeleteFile(deleteFile)" + "\r\n" + "End If" + "\r\n" + "End Function" + "\r\n" + "Function LIOX_Self(prj,objFile2)" + "\r\n" + "Dim Lang As String" + "\r\n" + "Dim trn As PslTransList" + "\r\n" + "Dim i,j,h As Integer" + "\r\n" + "Dim LangNum As Integer" + "\r\n" + "Dim logoutput As String" + "\r\n" + "logoutput = \"Begin to process file \" & prj.Name" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "i = 0" + "\r\n" + "j = 1" + "\r\n" + "h = 0" + "\r\n" + "LangNum = prj.Languages.Count" + "\r\n" + "For Each trn In prj.TransLists" + "\r\n" + "i = i + 1" + "\r\n" + "If ( i > LangNum) Then" + "\r\n" + "Exit For" + "\r\n" + "End If" + "\r\n" + "Lang = trn.Language.LangCode" + "\r\n" + "If ((StrComp(Lang,\"eti\") = 0) Or (StrComp(Lang,\"lth\") = 0) Or (StrComp(Lang, \"lvi\") = 0) Or (StrComp(Lang, \"ptg\") = 0) ) Then" + "\r\n" + "j = j + 1" + "\r\n" + "h = h + 1" + "\r\n" + "Else" + "\r\n" + "prj.Languages.Remove(j)" + "\r\n" + "End If" + "\r\n" + "Next trn" + "\r\n" + "'Delete those source lists that are all translated and validated" + "\r\n" + "Dim delete As Boolean" + "\r\n" + "delete = True" + "\r\n" + "j = 0" + "\r\n" + "i = 1" + "\r\n" + "For Each trn In prj.TransLists" + "\r\n" + "j = j + 1" + "\r\n" + "If(j > h) Then" + "\r\n" + "j = 1" + "\r\n" + "i = i + 1" + "\r\n" + "End If" + "\r\n" + "Dim k As Integer" + "\r\n" + "If (trn.TransRate <> 100) Then" + "\r\n" + "delete = False" + "\r\n" + "For k = 1 To trn.StringCount" + "\r\n" + "On Error Resume Next" + "\r\n" + "Dim tString As PslTransString" + "\r\n" + "Set tString = trn.String(k)" + "\r\n" + "If StrComp(tString.SourceText,tString.Text) <> 0 And tString.State(pslStateTranslated) = False And tString.State(pslStateReadOnly) = False Then" + "\r\n" + "logoutput = \"Find one source and translation are not identical in untranslated state. Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "tString.Text = tString.SourceText" + "\r\n" + "End If" + "\r\n" + "If tString.State(pslStateTranslated) = True And tString.State(pslStateReadOnly) = False And tString.State(pslStateReview) = True And tString.State(pslStateAutoTranslated) = True Then" + "\r\n" + "If tString.State(pslStateLocked) = True Then" + "\r\n" + "logoutput = \"Find one green locked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "Else" + "\r\n" + "logoutput = \"Find one green unlocked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "End If" + "\r\n" + "End If" + "\r\n" + "Next k" + "\r\n" + "trn.Save" + "\r\n" + "Else" + "\r\n" + "For k = 1 To trn.StringCount" + "\r\n" + "On Error Resume Next" + "\r\n" + "Dim tString1 As PslTransString" + "\r\n" + "Set tString1 = trn.String(k)" + "\r\n" + "If tString1.State(pslStateTranslated) = True And tString1.State(pslStateReadOnly) = False And tString1.State(pslStateReview) = True And tString1.State(pslStateAutoTranslated) = False Then" + "\r\n" + "delete = False" + "\r\n" + "ElseIf tString1.State(pslStateTranslated) = True And tString1.State(pslStateReadOnly) = False And tString1.State(pslStateReview) = True And tString1.State(pslStateAutoTranslated) = True Then" + "\r\n" + "If tString1.State(pslStateLocked) = True Then" + "\r\n" + "logoutput = \"Find one green locked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "Else" + "\r\n" + "logoutput = \"Find one green unlocked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "End If" + "\r\n" + "End If" + "\r\n" + "Next k" + "\r\n" + "End If" + "\r\n" + "If (delete = True) And (j = h) Then" + "\r\n" + "prj.SourceLists.Remove(i)" + "\r\n" + "i = i - 1" + "\r\n" + "ElseIf (j = h) Then" + "\r\n" + "delete = True" + "\r\n" + "End If" + "\r\n" + "Next trn" + "\r\n" + "If prj.Languages.Count = 0 Or prj.SourceLists.Count = 0 Then" + "\r\n" + "Dim deleteFile As String" + "\r\n" + "deleteFile = prj.Location & \"\\\" + prj.Name & \".lpu\"" + "\r\n" + "prj.Close()" + "\r\n" + "Dim FileSys" + "\r\n" + "Set FileSys = CreateObject(\"Scripting.FileSystemObject\")" + "\r\n" + "FileSys.DeleteFile(deleteFile)" + "\r\n" + "End If" + "\r\n" + "End Function" + "\r\n" + "Function LIOX_main(prj,objFile2)" + "\r\n" + "Dim Lang As String" + "\r\n" + "Dim trn As PslTransList" + "\r\n" + "Dim i,j,h As Integer" + "\r\n" + "Dim LangNum As Integer" + "\r\n" + "Dim logoutput As String" + "\r\n" + "logoutput = \"Begin to process file \" & prj.Name" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "i = 0" + "\r\n" + "j = 1" + "\r\n" + "h = 0" + "\r\n" + "LangNum = prj.Languages.Count" + "\r\n" + "For Each trn In prj.TransLists" + "\r\n" + "i = i + 1" + "\r\n" + "If ( i > LangNum) Then" + "\r\n" + "Exit For" + "\r\n" + "End If" + "\r\n" + "Lang = trn.Language.LangCode" + "\r\n" + "If ((StrComp(Lang,\"ita\") = 0) Or (StrComp(Lang,\"ptb\") = 0) Or (StrComp(Lang, \"rom\") = 0) Or (StrComp(Lang,\"ara\") = 0) Or (StrComp(Lang,\"csy\") = 0) Or (StrComp(Lang, \"deu\") = 0) Or (StrComp(Lang,\"fra\") = 0) Or (StrComp(Lang,\"heb\") = 0) Or (StrComp(Lang, \"rus\") = 0) Or (StrComp(Lang,\"trk\") = 0) Or (StrComp(Lang,\"ell\") = 0) Or (StrComp(Lang, \"esp\") = 0)) Then" + "\r\n" + "j = j + 1" + "\r\n" + "h = h + 1" + "\r\n" + "Else" + "\r\n" + "prj.Languages.Remove(j)" + "\r\n" + "End If" + "\r\n" + "Next trn" + "\r\n" + "'Delete those source lists that are all translated and validated" + "\r\n" + "Dim delete As Boolean" + "\r\n" + "delete = True" + "\r\n" + "j = 0" + "\r\n" + "i = 1" + "\r\n" + "For Each trn In prj.TransLists" + "\r\n" + "j = j + 1" + "\r\n" + "If(j > h) Then" + "\r\n" + "j = 1" + "\r\n" + "i = i + 1" + "\r\n" + "End If" + "\r\n" + "Dim k As Integer" + "\r\n" + "If (trn.TransRate <> 100) Then" + "\r\n" + "delete = False" + "\r\n" + "For k = 1 To trn.StringCount" + "\r\n" + "On Error Resume Next" + "\r\n" + "Dim tString As PslTransString" + "\r\n" + "Set tString = trn.String(k)" + "\r\n" + "If StrComp(tString.SourceText,tString.Text) <> 0 And tString.State(pslStateTranslated) = False And tString.State(pslStateReadOnly) = False Then" + "\r\n" + "logoutput = \"Find one source and translation are not identical in untranslated state. Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "tString.Text = tString.SourceText" + "\r\n" + "End If" + "\r\n" + "If tString.State(pslStateTranslated) = True And tString.State(pslStateReadOnly) = False And tString.State(pslStateReview) = True And tString.State(pslStateAutoTranslated) = True Then" + "\r\n" + "If tString.State(pslStateLocked) = True Then" + "\r\n" + "logoutput = \"Find one green locked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "Else" + "\r\n" + "logoutput = \"Find one green unlocked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "End If" + "\r\n" + "End If" + "\r\n" + "Next k" + "\r\n" + "trn.Save" + "\r\n" + "Else" + "\r\n" + "For k = 1 To trn.StringCount" + "\r\n" + "On Error Resume Next" + "\r\n" + "Dim tString1 As PslTransString" + "\r\n" + "Set tString1 = trn.String(k)" + "\r\n" + "If tString1.State(pslStateTranslated) = True And tString1.State(pslStateReadOnly) = False And tString1.State(pslStateReview) = True And tString1.State(pslStateAutoTranslated) = False Then" + "\r\n" + "delete = False" + "\r\n" + "ElseIf tString1.State(pslStateTranslated) = True And tString1.State(pslStateReadOnly) = False And tString1.State(pslStateReview) = True And tString1.State(pslStateAutoTranslated) = True Then" + "\r\n" + "If tString1.State(pslStateLocked) = True Then" + "\r\n" + "logoutput = \"Find one green locked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "Else" + "\r\n" + "logoutput = \"Find one green unlocked string in Language: \" & trn.Language.LangCode & \" Number: \" & tString.Number & \" in Stringlist: \" & trn.Title" + "\r\n" + "objFile2.writeLine(logoutput)" + "\r\n" + "PSL.Output(logoutput)" + "\r\n" + "End If" + "\r\n" + "End If" + "\r\n" + "Next k" + "\r\n" + "End If" + "\r\n" + "If (delete = True) And (j = h) Then" + "\r\n" + "prj.SourceLists.Remove(i)" + "\r\n" + "i = i - 1" + "\r\n" + "ElseIf (j = h) Then" + "\r\n" + "delete = True" + "\r\n" + "End If" + "\r\n" + "Next trn" + "\r\n" + "If prj.Languages.Count = 0 Or prj.SourceLists.Count = 0 Then" + "\r\n" + "Dim deleteFile As String" + "\r\n" + "deleteFile = prj.Location & \"\\\" + prj.Name & \".lpu\"" + "\r\n" + "prj.Close()" + "\r\n" + "Dim FileSys" + "\r\n" + "Set FileSys = CreateObject(\"Scripting.FileSystemObject\")" + "\r\n" + "FileSys.DeleteFile(deleteFile)" + "\r\n" + "End If" + "\r\n" + "End Function" + "\r\n"; File file = new File(MacroFolder + "\\PslLpuSplitter_v3.bas"); // if file doesnt exists, then create it if (!file.exists()) { file.createNewFile();//from w w w. j a va2 s. c o m } FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write(content); bw.close(); }
From source file:com.thoughtworks.go.server.service.PipelineConfigServicePerformanceTest.java
private void takeHeapDump(File dumpDir, int i) { InMemoryStreamConsumer outputStreamConsumer = inMemoryConsumer(); CommandLine commandLine = CommandLine.createCommandLine("jmap").withArgs("-J-d64", String.format("-dump:format=b,file=%s/%s.hprof", dumpDir.getAbsoluteFile(), i), ManagementFactory.getRuntimeMXBean().getName().split("@")[0]); LOGGER.info(commandLine.describe()); int exitCode = commandLine.run(outputStreamConsumer, new NamedProcessTag("thread" + i)); LOGGER.info(outputStreamConsumer.getAllOutput()); assertThat(exitCode, is(0));/*from w w w . j a v a 2 s . c o m*/ LOGGER.info("Heap dump available at " + dumpDir.getAbsolutePath()); }
From source file:com.google.enterprise.connector.common.AbstractCommandLineApp.java
/** * Locate the Connector Manager WEB-INF directory, relative to dir. *//* w ww . j av a2 s. c o m*/ protected File locateWebInf(File dir) { String path = cmDirsMap.get(dir.getName().toLowerCase()); if (path != null) { File webinf = new File(dir, path); if (webinf.exists() && webinf.isDirectory()) { return webinf.getAbsoluteFile(); } } return null; }
From source file:com.enjoyxstudy.selenium.autoexec.AutoExecServer.java
/** * @throws IOException/*w w w. jav a 2 s .c o m*/ * @throws SVNException */ private void exportSuiteRepository() throws IOException, SVNException { File suiteDir = configuration.getSuiteDir(); if (!suiteDir.isAbsolute()) { suiteDir = suiteDir.getAbsoluteFile(); } if (suiteDir.exists()) { log.info("Delete suite directory."); FileUtils.deleteDirectory(suiteDir); } SVNUtils.export(configuration.getSuiteRepo(), suiteDir, configuration.getSuiteRepoUsername(), configuration.getSuiteRepoPassword()); log.info("Suite Export repository[" + configuration.getSuiteRepo() + "] dist=[" + suiteDir.getPath() + "]"); }
From source file:io.druid.segment.loading.LocalDataSegmentFinder.java
private void recursiveSearchSegments(Set<DataSegment> segments, File workingDir, boolean updateDescriptor) throws SegmentLoadingException { for (File file : workingDir.listFiles()) { if (file.isDirectory()) { recursiveSearchSegments(segments, file, updateDescriptor); } else if (file.getName().equals("descriptor.json")) { final File indexZip = new File(file.getParentFile(), "index.zip"); if (indexZip.exists()) { try { final DataSegment dataSegment = mapper.readValue(FileUtils.readFileToString(file), DataSegment.class); log.info("Found segment [%s] located at [%s]", dataSegment.getIdentifier(), indexZip.getAbsoluteFile()); final Map<String, Object> loadSpec = dataSegment.getLoadSpec(); if (!loadSpec.get("type").equals(LocalDataStorageDruidModule.SCHEME) || !loadSpec.get("path").equals(indexZip.getAbsoluteFile())) { loadSpec.put("type", LocalDataStorageDruidModule.SCHEME); loadSpec.put("path", indexZip.getAbsolutePath()); if (updateDescriptor) { log.info("Updating loadSpec in descriptor.json at [%s] with new path [%s]", file.getAbsolutePath(), indexZip.toString()); FileUtils.writeStringToFile(file, mapper.writeValueAsString(dataSegment)); }//from w w w.ja va2 s.c o m } segments.add(dataSegment); } catch (IOException e) { throw new SegmentLoadingException(e, "Failed to read descriptor.json for segment located at [%s]", file.getAbsoluteFile()); } } else { throw new SegmentLoadingException( "index.zip didn't exist at [%s] while descripter.json exists!?", indexZip.getAbsoluteFile()); } } } }