org.usergrid.tools
Class ExportingToolBase

java.lang.Object
  extended by org.usergrid.tools.ToolBase
      extended by org.usergrid.tools.ExportingToolBase
Direct Known Subclasses:
Export, Metrics

public abstract class ExportingToolBase
extends ToolBase

Author:
zznate

Field Summary
protected  String baseOutputDirName
           
protected  org.slf4j.Logger logger
           
protected  UUID orgId
           
protected static String OUTPUT_DIR
          Output dir option: -outputDir
protected static File outputDir
           
protected  long startTime
           
 
Fields inherited from class org.usergrid.tools.ToolBase
cass, embedded, emf, managementService, MAX_ENTITY_FETCH, PATH_REPLACEMENT, properties, smf
 
Constructor Summary
ExportingToolBase()
           
 
Method Summary
protected  void applyOrgId(org.apache.commons.cli.CommandLine line)
           
protected  File createCollectionsDir(String applicationName)
           
protected  File createDir(File parent, String dirName)
           
protected  File createDir(String dirName)
           
 org.apache.commons.cli.Options createOptions()
           
protected  File createOutputFile(File parent, String type, String name)
           
protected  File createOutputFile(String type, String name)
           
protected  File createOutputParentDir()
           
protected  org.codehaus.jackson.JsonGenerator getJsonGenerator(File outFile)
           
protected  org.codehaus.jackson.JsonGenerator getJsonGenerator(String outFile)
           
protected  void prepareBaseOutputFileName(org.apache.commons.cli.CommandLine line)
           
protected  String prepareOutputFileName(String type, String name)
           
protected  void writeOutput(PrintWriter out, String content)
          Write the string onto the writer and check if verbose is enabled to log also an echo of what is being written to the writer.
 
Methods inherited from class org.usergrid.tools.ToolBase
getToolName, printCliHelp, runTool, setCassandraService, setEntityManagerFactory, setManagementService, setProperties, setServiceManagerFactory, setupCassandra, startEmbedded, startSpring, startTool, teardownEmbedded
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected org.slf4j.Logger logger

outputDir

protected static File outputDir

OUTPUT_DIR

protected static final String OUTPUT_DIR
Output dir option: -outputDir

See Also:
Constant Field Values

baseOutputDirName

protected String baseOutputDirName

orgId

protected UUID orgId

startTime

protected long startTime
Constructor Detail

ExportingToolBase

public ExportingToolBase()
Method Detail

createOptions

public org.apache.commons.cli.Options createOptions()
Overrides:
createOptions in class ToolBase

prepareBaseOutputFileName

protected void prepareBaseOutputFileName(org.apache.commons.cli.CommandLine line)

applyOrgId

protected void applyOrgId(org.apache.commons.cli.CommandLine line)

writeOutput

protected void writeOutput(PrintWriter out,
                           String content)
Write the string onto the writer and check if verbose is enabled to log also an echo of what is being written to the writer.

Parameters:
out - PrintWriter
content - string to be written

createOutputParentDir

protected File createOutputParentDir()

createOutputFile

protected File createOutputFile(String type,
                                String name)

createOutputFile

protected File createOutputFile(File parent,
                                String type,
                                String name)

createCollectionsDir

protected File createCollectionsDir(String applicationName)

createDir

protected File createDir(String dirName)

createDir

protected File createDir(File parent,
                         String dirName)

prepareOutputFileName

protected String prepareOutputFileName(String type,
                                       String name)
Parameters:
type - just a label such us: organization, application.
name -
Returns:
the file name concatenated with the type and the name of the collection

getJsonGenerator

protected org.codehaus.jackson.JsonGenerator getJsonGenerator(String outFile)
                                                       throws IOException
Throws:
IOException

getJsonGenerator

protected org.codehaus.jackson.JsonGenerator getJsonGenerator(File outFile)
                                                       throws IOException
Throws:
IOException


Copyright © 2012. All Rights Reserved.