RSE
Release 1.0

org.eclipse.rse.dstore.universal.miners.filesystem
Class FileClassifier

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.eclipse.rse.dstore.universal.miners.filesystem.FileClassifier
All Implemented Interfaces:
Runnable

public class FileClassifier
extends Thread


Nested Class Summary
protected  class FileClassifier.Pair
           
 
Field Summary
protected  String _systemShell
           
static String defaultType
           
static String fileSep
           
static String STR_ARCHIVE
           
static String STR_DIRECTORY
           
static String STR_DOT_A
           
static String STR_DOT_SO
           
static String STR_DOT_SO_DOT
           
static String STR_EXECUTABLE
           
static String STR_EXECUTABLE_BINARY
           
static String STR_EXECUTABLE_SCRIPT
           
static String STR_MODULE
           
static String STR_OBJECT_MODULE
           
static String STR_SCRIPT
           
static String STR_SHARED_OBJECT
           
static String STR_SYMBOLIC_LINK
           
static String symbolicLinkStr
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
FileClassifier(org.eclipse.dstore.core.model.DataElement subject)
           
 
Method Summary
protected  String classify(File parentFile, String line, String specialEncoding, boolean resolveLink)
          Classifies from the given line of classification output.
protected  void classifyChildren(File parentFile, String files, boolean resolveLinks)
          Classifies the children of a given file.
 String classifyFile(File aFile)
          Classify a file.
protected  void classifyVirtualChildren(String parentPath)
          Classify virtual children.
protected  String readLine(DataInputStream stream, String encoding)
           
protected  List readLines(DataInputStream stream, String encoding)
           
protected  String resolveSymbolicLink(File parentFile, String originalName, String fulltype, String symbolicLinkStr, boolean resolveLink, String specialEncoding)
           
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

symbolicLinkStr

public static final String symbolicLinkStr
See Also:
Constant Field Values

fileSep

public static final String fileSep

defaultType

public static final String defaultType
See Also:
Constant Field Values

STR_SYMBOLIC_LINK

public static final String STR_SYMBOLIC_LINK
See Also:
Constant Field Values

STR_SHARED_OBJECT

public static final String STR_SHARED_OBJECT
See Also:
Constant Field Values

STR_OBJECT_MODULE

public static final String STR_OBJECT_MODULE
See Also:
Constant Field Values

STR_MODULE

public static final String STR_MODULE
See Also:
Constant Field Values

STR_ARCHIVE

public static final String STR_ARCHIVE
See Also:
Constant Field Values

STR_EXECUTABLE

public static final String STR_EXECUTABLE
See Also:
Constant Field Values

STR_SCRIPT

public static final String STR_SCRIPT
See Also:
Constant Field Values

STR_EXECUTABLE_SCRIPT

public static final String STR_EXECUTABLE_SCRIPT
See Also:
Constant Field Values

STR_EXECUTABLE_BINARY

public static final String STR_EXECUTABLE_BINARY
See Also:
Constant Field Values

STR_DOT_A

public static final String STR_DOT_A
See Also:
Constant Field Values

STR_DOT_SO

public static final String STR_DOT_SO
See Also:
Constant Field Values

STR_DOT_SO_DOT

public static final String STR_DOT_SO_DOT
See Also:
Constant Field Values

STR_DIRECTORY

public static final String STR_DIRECTORY
See Also:
Constant Field Values

_systemShell

protected String _systemShell
Constructor Detail

FileClassifier

public FileClassifier(org.eclipse.dstore.core.model.DataElement subject)
Method Detail

run

public void run()

classify

protected String classify(File parentFile,
                          String line,
                          String specialEncoding,
                          boolean resolveLink)
Classifies from the given line of classification output.

Parameters:
parentFile - the parent file.
line - the line of output to parse.
specialEncoding - a special encoding, if there is one.
resolveLink - resolve link.
Returns:
the classification.

resolveSymbolicLink

protected String resolveSymbolicLink(File parentFile,
                                     String originalName,
                                     String fulltype,
                                     String symbolicLinkStr,
                                     boolean resolveLink,
                                     String specialEncoding)

classifyFile

public String classifyFile(File aFile)
Classify a file. It classifies the file by running "sh -c file ".

Parameters:
aFile - the file to classify.
Returns:
the classification.

readLines

protected List readLines(DataInputStream stream,
                         String encoding)
                  throws Exception
Throws:
Exception

readLine

protected String readLine(DataInputStream stream,
                          String encoding)
                   throws Exception
Throws:
Exception

classifyChildren

protected void classifyChildren(File parentFile,
                                String files,
                                boolean resolveLinks)
Classifies the children of a given file.

Parameters:
parentFile - the parent file.
files - the files to classify. Specify "*" to classify all files.
resolveLinks - resolve links if possible.

classifyVirtualChildren

protected void classifyVirtualChildren(String parentPath)
Classify virtual children.


RSE
Release 1.0

Copyright (c) IBM Corporation and others 2000, 2006. All Rights Reserved.