org.zanata.client.commands.push
Class AbstractPushStrategy

java.lang.Object
  extended by org.zanata.client.commands.push.AbstractCommonPushStrategy<PushOptions>
      extended by org.zanata.client.commands.push.AbstractPushStrategy
Direct Known Subclasses:
AbstractGettextPushStrategy, PropertiesStrategy, XliffStrategy, XmlStrategy

public abstract class AbstractPushStrategy
extends AbstractCommonPushStrategy<PushOptions>

NB: you must initialise this object with init() after setPushOptions()

Author:
Alex Eng aeng@redhat.com

Constructor Summary
AbstractPushStrategy(org.zanata.rest.StringSet extensions, String fileExtension)
           
 
Method Summary
protected  String docNameToFilename(String docName)
           
protected  String docNameToFilename(String docName, LocaleMapping locale)
           
abstract  Set<String> findDocNames(File srcDir, List<String> includes, List<String> excludes, boolean useDefaultExclude, boolean caseSensitive, boolean excludeLocaleFilenames)
           
 org.zanata.rest.StringSet getExtensions()
           
 String getFileExtension()
           
 String[] getSrcFiles(File srcDir, List<String> includes, List<String> excludes, boolean excludeLocaleFilenames, boolean useDefaultExclude, boolean isCaseSensitive)
          Scan srcDir to return a list of all source files.
 void init()
           
 boolean isTransOnly()
          Indicates if this strategy must work without access to source files.
abstract  org.zanata.rest.dto.resource.Resource loadSrcDoc(File sourceDir, String docName)
           
abstract  void visitTranslationResources(String docName, org.zanata.rest.dto.resource.Resource srcDoc, PushCommand.TranslationResourcesVisitor visitor)
           
 
Methods inherited from class org.zanata.client.commands.push.AbstractCommonPushStrategy
getOpts, getSrcFiles, setPushOptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPushStrategy

public AbstractPushStrategy(org.zanata.rest.StringSet extensions,
                            String fileExtension)
Method Detail

findDocNames

public abstract Set<String> findDocNames(File srcDir,
                                         List<String> includes,
                                         List<String> excludes,
                                         boolean useDefaultExclude,
                                         boolean caseSensitive,
                                         boolean excludeLocaleFilenames)
                                  throws IOException
Throws:
IOException

loadSrcDoc

public abstract org.zanata.rest.dto.resource.Resource loadSrcDoc(File sourceDir,
                                                                 String docName)
                                                          throws IOException
Throws:
IOException

visitTranslationResources

public abstract void visitTranslationResources(String docName,
                                               org.zanata.rest.dto.resource.Resource srcDoc,
                                               PushCommand.TranslationResourcesVisitor visitor)
                                        throws IOException
Throws:
IOException

isTransOnly

public boolean isTransOnly()
Indicates if this strategy must work without access to source files. No attempt should be made to read, write or push source documents for a trans-only strategy.

Returns:
true if this strategy only allows interactions with translation files.

getSrcFiles

public String[] getSrcFiles(File srcDir,
                            List<String> includes,
                            List<String> excludes,
                            boolean excludeLocaleFilenames,
                            boolean useDefaultExclude,
                            boolean isCaseSensitive)
Scan srcDir to return a list of all source files.

Parameters:
srcDir - base directory in which to find source files
includes - empty to find all source files, non-empty to find only the documents in this list
excludes -
excludeLocaleFilenames - adds entries to excludes to ignore any file with a locale id suffix before the file extension.
useDefaultExclude - true to also exclude a set of default excludes for common temp file and source control filenames
isCaseSensitive - case sensitive search for includes and excludes options
Returns:
document paths for source files found in srcDir

docNameToFilename

protected String docNameToFilename(String docName)

docNameToFilename

protected String docNameToFilename(String docName,
                                   LocaleMapping locale)

getExtensions

public org.zanata.rest.StringSet getExtensions()

getFileExtension

public String getFileExtension()

init

public void init()


Copyright © 2013 Zanata Project. All Rights Reserved.