verinec.adaptation
Class Distribute

java.lang.Object
  extended by verinec.adaptation.Distribute

public class Distribute
extends Object

This class analyzes translation output and does the distribution.

The different target methods like cp or scp are not implemented here but each in an own class. The implementations of the actual distributors are determined using the DistributorFactory.

Version:
$Revision: 1042 $
Author:
david.buchmann at unifr.ch
See Also:
Custom Translators Howto

Field Summary
private  IDistributorFactory distFact
           
 
Constructor Summary
Distribute()
          Create a distributor with the default method to determine IDistributorFactory
Distribute(IDistributorFactory distFact)
          Get an instance to distribute configuration.
 
Method Summary
static IDistributorFactory createFactory()
          Create the distributor factory according to the rules: If the system property verinec.adaptation.distributorfactory is set, tries to instantiate that class with forname.
 void distributeAll(Element configuration)
          Execute the content of all nodes in the passed configuration.
 void distributeService(Element service)
          Distribute a single service, using its tr:target and DistributorFactory.
private  void processCommands(Element commands, IDistributor dist)
          Processes all commands inside a pre- or post-process tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

distFact

private IDistributorFactory distFact
Constructor Detail

Distribute

public Distribute(IDistributorFactory distFact)
Get an instance to distribute configuration.

Parameters:
distFact - The factory to be used to retrieve distributors.

Distribute

public Distribute()
           throws VerinecException
Create a distributor with the default method to determine IDistributorFactory

Throws:
VerinecException - If creating the default factory fails.
See Also:
createFactory()
Method Detail

createFactory

public static IDistributorFactory createFactory()
                                         throws VerinecException
Create the distributor factory according to the rules: If the system property verinec.adaptation.distributorfactory is set, tries to instantiate that class with forname. That class has to implement the IDistributorFactory interface. If there is no such system property, instantiates PropDistFactory

Returns:
The factory to create distributors
Throws:
VerinecException - If the factory can not be instantiated.

distributeAll

public void distributeAll(Element configuration)
                   throws VerinecException
Execute the content of all nodes in the passed configuration.

Parameters:
configuration - The XML containing all the information to distribute.
Throws:
VerinecException - if distributeService fails

distributeService

public void distributeService(Element service)
                       throws VerinecException
Distribute a single service, using its tr:target and DistributorFactory.

Parameters:
service - A service tag containing results to distribute.
Throws:
VerinecException - if the distribution fails for some reason.

processCommands

private void processCommands(Element commands,
                             IDistributor dist)
                      throws VerinecException
Processes all commands inside a pre- or post-process tag. Calls dist.execute for each command element within the parameter.

Parameters:
commands - A pre- or post-process tag containing commands to be executed.
dist - The distributor for the current target, which will also care for the execute.
Throws:
VerinecException - if executing a command fails.

Copyright © 2005 Verinec, DIUF