org.zanata.client.commands.pull
Interface PullStrategy

All Known Implementing Classes:
AbstractGettextPullStrategy, AbstractPullStrategy, GettextDirStrategy, GettextPullStrategy, OfflinePoStrategy, PropertiesStrategy, UTF8PropertiesStrategy, XliffStrategy, XmlStrategy

public interface PullStrategy

Strategy for converting documents from Zanata to a local file type. Every implementation must have a public constructor which accepts PullOptions.


Method Summary
 org.zanata.rest.StringSet getExtensions()
          Which extensions (eg gettext, comment) does this strategy need to fetch from the server?
 File getTransFileToWrite(String docName, LocaleMapping localeMapping)
          Provides the file reference that will be used to write a Translation file for a given Resource.
 boolean isTransOnly()
          Indicates if this strategy must work without access to source files.
 boolean needsDocToWriteTrans()
          Does this strategy need the source document (Resource) when writing translations?
 void writeSrcFile(org.zanata.rest.dto.resource.Resource docWithLocalName)
           
 org.zanata.common.io.FileDetails writeTransFile(org.zanata.rest.dto.resource.Resource docWithLocalName, String docName, LocaleMapping localeMapping, org.zanata.rest.dto.resource.TranslationsResource targetDoc)
          pre: docWithLocalName.getName() must match docName if docWithLocalName is not null
 

Method Detail

getExtensions

org.zanata.rest.StringSet getExtensions()
Which extensions (eg gettext, comment) does this strategy need to fetch from the server?

Returns:

isTransOnly

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.

needsDocToWriteTrans

boolean needsDocToWriteTrans()
Does this strategy need the source document (Resource) when writing translations?

Returns:

getTransFileToWrite

File getTransFileToWrite(String docName,
                         LocaleMapping localeMapping)
Provides the file reference that will be used to write a Translation file for a given Resource. Ideally, this method should be used by concrete implementations of the strategy to write the file.

Parameters:
docName - may be null if needsDocToWriteTrans() returns false
localeMapping - Locale mapping to use.
Returns:
A File reference (might not exist physically) to which a Translation Resource will be written.

writeSrcFile

void writeSrcFile(org.zanata.rest.dto.resource.Resource docWithLocalName)
                  throws IOException
Parameters:
docWithLocalName -
Throws:
IOException

writeTransFile

org.zanata.common.io.FileDetails writeTransFile(org.zanata.rest.dto.resource.Resource docWithLocalName,
                                                String docName,
                                                LocaleMapping localeMapping,
                                                org.zanata.rest.dto.resource.TranslationsResource targetDoc)
                                                throws IOException
pre: docWithLocalName.getName() must match docName if docWithLocalName is not null

Parameters:
docWithLocalName - may be null if needsDocToWriteTrans() returns false
docName - may be null if needsDocToWriteTrans() returns false
localeMapping -
targetDoc -
Returns:
Details of the file that was written. May be null if the Strategy cannot provide details.
Throws:
IOException


Copyright © 2013 Zanata Project. All Rights Reserved.