[jboss-svn-commits] JBL Code SVN: r18749 - in labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin: src and 12 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Mar 7 00:16:41 EST 2008
Author: steve.ebersole at jboss.com
Date: 2008-03-07 00:16:40 -0500 (Fri, 07 Mar 2008)
New Revision: 18749
Added:
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/Factory.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/PoSynchronizer.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/PotSynchronizer.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/TranslationBuilder.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/gettext/
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/gettext/PoSynchronizerImpl.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/gettext/PotSynchronizerImpl.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/gettext/TranslationBuilderImpl.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/ExecutionException.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/Executor.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/ProcessOutputManager.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/StreamBridge.java
Removed:
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/antlr/
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/Action.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/ActionException.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/TranslateXmlAction.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/UpdatePoAction.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/UpdatePotAction.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/process/
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jgettext/
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/ExecutionException.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/Executor.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/ProcessOutputManager.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/StreamBridge.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/test/
Modified:
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/pom.xml
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/AbstractDocBookMojo.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/CleanPoMojo.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/CleanPotMojo.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/Format.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/GenerationMojo.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/Options.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/PackageMojo.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/ResourceMojo.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/TranslationMojo.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/UpdatePoMojo.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/UpdatePotMojo.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/properties/CompositeMavenProjectProperties.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/properties/PropertiesException.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/properties/PropertiesHelper.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/resource/ResourceDelegate.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/resource/ResourceException.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/resources/META-INF/plexus/components.xml
Log:
committing months of local work :)
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/pom.xml
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/pom.xml 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/pom.xml 2008-03-07 05:16:40 UTC (rev 18749)
@@ -70,27 +70,10 @@
</configuration>
</plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>antlr-maven-plugin</artifactId>
- <version>2.0</version>
- <dependencies>
- <dependency>
- <groupId>antlr</groupId>
- <artifactId>antlr</artifactId>
- <version>${antlr.version}</version>
- </dependency>
- </dependencies>
- <configuration>
- <grammars>catalog.g</grammars>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>2.3</version>
+ </plugin>
</plugins>
</build>
@@ -247,4 +230,4 @@
<antlr.version>2.7.6</antlr.version>
</properties>
-</project>
+</project>
\ No newline at end of file
Deleted: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/Action.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/Action.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/Action.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Red Hat Author(s): Steve Ebersole
- */
-package org.jboss.jdocbook;
-
-/**
- * An action defines a small piece of executable funtionality.
- *
- * @author Steve Ebersole
- */
-public interface Action {
- /**
- * Perform the underlying functionality.
- */
- public void perform();
-}
Added: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/Factory.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/Factory.java (rev 0)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/Factory.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -0,0 +1,58 @@
+/*
+ * jDocBook, processing of DocBook sources as a Maven plugin
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.jboss.jdocbook.i18n;
+
+import org.jboss.jdocbook.i18n.gettext.PoSynchronizerImpl;
+import org.jboss.jdocbook.i18n.gettext.PotSynchronizerImpl;
+import org.jboss.jdocbook.i18n.gettext.TranslationBuilderImpl;
+
+/**
+ * Factory for various i18n components. Statically bound to "gettext" versions.
+ *
+ * @author Steve Ebersole
+ */
+public class Factory {
+ private static final PotSynchronizer potSynchronizer = new PotSynchronizerImpl();
+ private static final PoSynchronizer poSynchronizer = new PoSynchronizerImpl();
+ private static final TranslationBuilder translationBuilder = new TranslationBuilderImpl();
+
+ /**
+ * Disallow instantiation
+ */
+ private Factory() {
+ }
+
+ public static PotSynchronizer getPotSynchronizer() {
+ return potSynchronizer;
+ }
+
+ public static PoSynchronizer getPoSynchronizer() {
+ return poSynchronizer;
+ }
+
+ public static TranslationBuilder getTranslationBuilder() {
+ return translationBuilder;
+ }
+}
Added: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/PoSynchronizer.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/PoSynchronizer.java (rev 0)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/PoSynchronizer.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -0,0 +1,52 @@
+/*
+ * jDocBook, processing of DocBook sources as a Maven plugin
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.jboss.jdocbook.i18n;
+
+import java.io.File;
+import java.util.Locale;
+
+import org.jboss.jdocbook.Options;
+import org.jboss.jdocbook.JDocBookProcessException;
+
+/**
+ * Contract for synchronizing (creating/updating) PortableObject (PO) file(s)
+ * for a given translation corresponding to the POT templates in the given
+ * POT-directory.
+ *
+ * @author Steve Ebersole
+ */
+public interface PoSynchronizer {
+ /**
+ * Perform the synchronization on the the PO files.
+ *
+ * @param potDirectory The directory containing the POT files.
+ * @param translationDirectory The directory containing the translation PO files.
+ * @param translationLocale The locale of the translation
+ * @param options The user options
+ * @throws JDocBookProcessException unable to synchronize POT files
+ */
+ public void synchronizePo(File potDirectory, File translationDirectory, Locale translationLocale, Options options)
+ throws JDocBookProcessException;
+}
Added: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/PotSynchronizer.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/PotSynchronizer.java (rev 0)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/PotSynchronizer.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -0,0 +1,53 @@
+/*
+ * jDocBook, processing of DocBook sources as a Maven plugin
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.jboss.jdocbook.i18n;
+
+import java.io.File;
+
+import org.jboss.jdocbook.JDocBookProcessException;
+import org.jboss.jdocbook.Options;
+
+/**
+ * Contract for synchronizing (creating/updating) PortableObjectTemplate (POT)
+ * file(s) from a given master source file.
+ * <p/>
+ * Any XIncludes contained in the master source file are followed and processed
+ * as well.
+ *
+ * @author Steve Ebersole
+ */
+public interface PotSynchronizer {
+ /**
+ * Perform the synchronization on the the POT files pertaining to the given
+ * master DocBook source.
+ *
+ * @param masterFile The DocBook source
+ * @param templateDirectory The directory where POT files are contained.
+ * @param options The user options
+ * @throws JDocBookProcessException unable to synchronize POT files
+ */
+ public void synchronizePot(File masterFile, File templateDirectory, Options options) throws JDocBookProcessException;
+
+}
Added: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/TranslationBuilder.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/TranslationBuilder.java (rev 0)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/TranslationBuilder.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -0,0 +1,49 @@
+/*
+ * jDocBook, processing of DocBook sources as a Maven plugin
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.jboss.jdocbook.i18n;
+
+import java.io.File;
+
+import org.jboss.jdocbook.Options;
+import org.jboss.jdocbook.JDocBookProcessException;
+
+/**
+ * Contract for applying the translators work (PO file) back into XML in
+ * preparation for XSLT processing.
+ *
+ * @author Steve Ebersole
+ */
+public interface TranslationBuilder {
+ /**
+ *
+ * @param masterFile The master DocBook source
+ * @param poDirectory The directory containing PO files
+ * @param targetDirectory The directory into which to generate the translated XML
+ * @param options The user options
+ * @throws JDocBookProcessException unable to apply PO translations
+ */
+ public void buildTranslation(File masterFile, File poDirectory, File targetDirectory, Options options)
+ throws JDocBookProcessException;
+}
Deleted: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/ActionException.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/ActionException.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/ActionException.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Red Hat Author(s): Steve Ebersole
- */
-package org.jboss.jdocbook.i18n.actions;
-
-import org.jboss.jdocbook.JDocBookProcessException;
-
-/**
- * Used to indicate an error performing an {@link org.jboss.jdocbook.Action}.
- *
- * @author Steve Ebersole
- */
-public class ActionException extends JDocBookProcessException {
- private static final long serialVersionUID = 5590768273066409640L;
-
- public ActionException(String message) {
- super( message );
- }
-
- public ActionException(String message, Throwable cause) {
- super( message, cause );
- }
-}
Deleted: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/TranslateXmlAction.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/TranslateXmlAction.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/TranslateXmlAction.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Red Hat Author(s): Steve Ebersole
- */
-package org.jboss.jdocbook.i18n.actions;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import org.jboss.jdocbook.Action;
-import org.jboss.jdocbook.Options;
-import org.jboss.jdocbook.i18n.actions.process.Executor;
-import org.jboss.jdocbook.util.I18nUtils;
-import org.jboss.jdocbook.util.XIncludeHelper;
-import org.jboss.jdocbook.util.FileUtils;
-
-/**
- * Action to render the translators work back into XML in preparation for XSLT processing.
- * <p/>
- * NOTE : The processing here is based on po2xml from the poxml library.
- *
- * @author Steve Ebersole
- */
-public class TranslateXmlAction implements Action {
- private final File masterFile;
- private final File poDirectory;
- private final File targetDirectory;
- private final Options options;
-
- public TranslateXmlAction(File masterFile, File poDirectory, File targetDirectory, Options options) {
- this.masterFile = masterFile;
- this.poDirectory = poDirectory;
- this.targetDirectory = targetDirectory;
- this.options = options;
- }
-
- public void perform() {
- po2xml( masterFile, poDirectory, targetDirectory );
- }
-
- protected void po2xml(File masterFile, File translationDirectory, File translatedWorkDirectory) {
- options.getLog().trace( "starting translation [" + masterFile + "]" );
- if ( !masterFile.exists() ) {
- options.getLog().info( "skipping translation; master file did not exist : {0}", masterFile );
- return;
- }
-
- final String poFileName = I18nUtils.determinePoFileName( masterFile );
- final File poFile = new File( translationDirectory, poFileName );
- if ( !poFile.exists() ) {
- throw new ActionException( "Unable to locate PO file for [" + masterFile.getName() + "] in [" + translationDirectory.getName() + "]" );
- }
- final File translatedFile = new File( translatedWorkDirectory, masterFile.getName() );
- generateTranslatedXML( masterFile, poFile, translatedFile );
-
- // Note : recursion below accounts for inclusions within inclusions
- final File sourceBasedir = masterFile.getParentFile();
- for ( File inclusion : XIncludeHelper.locateInclusions( masterFile ) ) {
- options.getLog().trace( "starting translation of inclusion [" + inclusion + "]" );
- final String relativity = FileUtils.determineRelativity( inclusion, sourceBasedir );
- options.getLog().trace( "determined relativity : " + relativity );
- final File relativeTranslationDir = ( relativity == null )
- ? translationDirectory
- : new File( translationDirectory, relativity );
- final File relativeWorkDir = ( relativity == null )
- ? translatedWorkDirectory
- : new File( translatedWorkDirectory, relativity );
- po2xml( inclusion, relativeTranslationDir, relativeWorkDir );
- }
- }
-
- private void generateTranslatedXML(File sourceFile, File poFile, File translatedFile) {
- if ( !sourceFile.exists() ) {
- options.getLog().trace( "skipping translation; source file did not exist : {0}", sourceFile );
- return;
- }
- if ( !poFile.exists() ) {
- options.getLog().trace( "skipping translation; PO file did not exist : {0}", poFile );
- return;
- }
-
- if ( translatedFile.exists()
- && translatedFile.lastModified() >= sourceFile.lastModified()
- && translatedFile.lastModified() >= poFile.lastModified() ) {
- options.getLog().trace( "skipping translation; up-to-date : {0}", translatedFile );
- return;
- }
-
- translatedFile.getParentFile().mkdirs();
- final String cmd = "po2xml " + FileUtils.resolveFullPathName( sourceFile ) + " " + FileUtils.resolveFullPathName( poFile );
- try {
- final FileOutputStream xmlStream = new FileOutputStream( translatedFile );
- try {
- options.getLog().trace( "<execute>" + cmd + "</execution>" );
- Executor.execute( cmd, xmlStream );
- }
- finally {
- try {
- xmlStream.flush();
- xmlStream.close();
- }
- catch ( IOException ignore ) {
- // intentionally empty...
- }
- }
- }
- catch ( IOException e ) {
- throw new ActionException( "unable to open output stream for translated XML file [" + translatedFile + "]" );
- }
- }
-}
Deleted: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/UpdatePoAction.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/UpdatePoAction.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/UpdatePoAction.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Red Hat Author(s): Steve Ebersole
- */
-package org.jboss.jdocbook.i18n.actions;
-
-import java.io.File;
-import java.util.Locale;
-
-import org.jboss.jdocbook.Action;
-import org.jboss.jdocbook.Options;
-import org.jboss.jdocbook.i18n.actions.process.Executor;
-import org.jboss.jdocbook.util.VCSDirectoryExclusionFilter;
-import org.jboss.jdocbook.util.I18nUtils;
-import org.jboss.jdocbook.util.FileUtils;
-
-/**
- * Update translatable entries in a translation's PO files based on the state of the POT files.
- * <p/>
- * NOTE : The processing here is based on either the msgmerge or msginit commands from the GNU gettext package.
- *
- * @author Steve Ebersole
- */
-public class UpdatePoAction implements Action {
- private final File potDirectory;
- private final File translationDirectory;
- private final Locale translationLocale;
- private final Options options;
-
- /**
- * Construct an action ready to perform updates to the PO files for a given translation corresponding to the POT
- * templates in the given POT-directory.
- *
- * @param potDirectory The directory containing the POT files.
- * @param translationDirectory The directory containing the translation PO files.
- * @param translationLocale The locale of the translation
- * @param options The user options
- */
- public UpdatePoAction(File potDirectory, File translationDirectory, Locale translationLocale, Options options) {
- this.potDirectory = potDirectory;
- this.translationDirectory = translationDirectory;
- this.translationLocale = translationLocale;
- this.options = options;
- }
-
- /**
- * {@inheritDoc}
- */
- public void perform() {
- msgmerge( potDirectory, translationDirectory, translationLocale );
- }
-
- /**
- * Update the PO files contained in the given translation-directory based on their corresponding POT file
- * from the template-directory.
- *
- * @param templateDirectory The directory containind POT files.
- * @param translationDirectory The PO files directory.
- * @param locale The translation locale.
- */
- protected void msgmerge(File templateDirectory, File translationDirectory, Locale locale) {
- if ( !templateDirectory.exists() ) {
- options.getLog().info( "skipping PO updates; POT directory did not exist : {0}", potDirectory );
- return;
- }
- File[] files = templateDirectory.listFiles( new VCSDirectoryExclusionFilter() );
- for ( int i = 0, X = files.length; i < X; i++) {
- if ( files[i].isDirectory() ) {
- msgmerge(
- new File( templateDirectory, files[i].getName() ),
- new File( translationDirectory, files[i].getName() ),
- translationLocale
- );
- }
- else {
- if ( I18nUtils.isPotFile( files[i] ) ) {
- File translation = new File( translationDirectory, I18nUtils.determinePoFileName( files[i] ) );
- updateTranslation( files[i], translation, locale );
- }
- }
- }
- }
-
- private void updateTranslation(File template, File translation, Locale locale) {
- if ( !template.exists() ) {
- options.getLog().trace( "skipping PO updates; POT file did not exist : {0}", template );
- return;
- }
-
- if ( translation.lastModified() >= template.lastModified() ) {
- options.getLog().trace( "skipping PO updates; up-to-date : {0}", translation );
- return;
- }
-
- final String cmd;
- if ( translation.exists() ) {
- cmd = "msgmerge --quiet --backup=none --update " + FileUtils.resolveFullPathName( translation )
- + " " + FileUtils.resolveFullPathName( template );
- }
- else {
- translation.getParentFile().mkdirs();
- cmd = "msginit --no-translator -l " + locale
- + " -i " + FileUtils.resolveFullPathName( template )
- + " -o " + FileUtils.resolveFullPathName( translation );
- }
- Executor.execute( cmd );
- }
-}
Deleted: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/UpdatePotAction.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/UpdatePotAction.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/UpdatePotAction.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Red Hat Author(s): Steve Ebersole
- */
-package org.jboss.jdocbook.i18n.actions;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import org.jboss.jdocbook.Action;
-import org.jboss.jdocbook.Options;
-import org.jboss.jdocbook.i18n.actions.process.Executor;
-import org.jboss.jdocbook.util.I18nUtils;
-import org.jboss.jdocbook.util.XIncludeHelper;
-import org.jboss.jdocbook.util.FileUtils;
-
-/**
- * Update the PortableObjectTemplate (POT) file(s) from a given master source file.
- * <p/>
- * Any XIncludes contained in the master source file are followed and processed as well.
- *
- * @author Steve Ebersole
- */
-public class UpdatePotAction implements Action {
- private final File master;
- private final File templateDirectory;
- private final Options options;
-
- /**
- * Construct an action ready to perform updates on the POT files pertaining to a given master DocBook source.
- *
- * @param master The DocBook source
- * @param templateDirectory The directory where POT files are contained.
- * @param options The user options
- */
- public UpdatePotAction(File master, File templateDirectory, Options options) {
- this.templateDirectory = templateDirectory;
- this.master = master;
- this.options = options;
- }
-
- /**
- * {@inheritDoc}
- */
- public void perform() throws ActionException {
- xml2pot( master, templateDirectory );
- }
-
- void xml2pot(File masterFile, File templateDirectory) throws ActionException {
- if ( !masterFile.exists() ) {
- options.getLog().info( "skipping POT updates; master file did not exist : {0}", masterFile );
- return;
- }
- final File sourceBasedir = masterFile.getParentFile();
- final String potFileName = I18nUtils.determinePotFileName( masterFile );
- final File potFile = new File( templateDirectory, potFileName );
- updatePortableObjectTemplate( masterFile, potFile );
-
- // Note : recursion below accounts for inclusions within inclusions
- for ( File inclusion : XIncludeHelper.locateInclusions( masterFile ) ) {
- final String relativity = FileUtils.determineRelativity( inclusion, sourceBasedir );
- final File relativeTemplateDir = ( relativity == null ) ? templateDirectory : new File(
- templateDirectory,
- relativity
- );
- xml2pot( inclusion, relativeTemplateDir );
- }
- }
-
- private void updatePortableObjectTemplate(File sourceFile, File template) {
- if ( !sourceFile.exists() ) {
- options.getLog().trace( "skipping POT update; source file did not exist : {0}", sourceFile );
- return;
- }
-
- if ( template.exists() && template.lastModified() >= sourceFile.lastModified() ) {
- options.getLog().trace( "skipping POT update; up-to-date : {0}", template );
- return;
- }
-
- template.getParentFile().mkdirs();
-// supposedly the RH DocBot stuff uses xml2pot...
-// executeXml2po( sourceFile, template );
- executeXml2pot( sourceFile, template );
- }
-
-// private void executeXml2po(File sourceFile, File template) {
-// final String cmd = "xml2po -o " + I18nUtils.resolveFullPathName( template ) + " " + I18nUtils.resolveFullPathName( sourceFile );
-// Executor.execute( cmd );
-// }
-
- private void executeXml2pot(File sourceFile, File template) {
- final String cmd = "xml2pot " + FileUtils.resolveFullPathName( sourceFile );
-
- try {
- final FileOutputStream xmlStream = new FileOutputStream( template );
- try {
- options.getLog().trace( "updating POT file {0}", template );
- Executor.execute( cmd, xmlStream );
- }
- finally {
- try {
- xmlStream.flush();
- xmlStream.close();
- }
- catch ( IOException ignore ) {
- // intentionally empty...
- }
- }
- }
- catch ( IOException e ) {
- throw new ActionException( "unable to open output stream for POT file [" + template + "]" );
- }
- }
-}
Added: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/gettext/PoSynchronizerImpl.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/gettext/PoSynchronizerImpl.java (rev 0)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/gettext/PoSynchronizerImpl.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -0,0 +1,99 @@
+/*
+ * jDocBook, processing of DocBook sources as a Maven plugin
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.jboss.jdocbook.i18n.gettext;
+
+import java.io.File;
+import java.util.Locale;
+
+import org.jboss.jdocbook.JDocBookProcessException;
+import org.jboss.jdocbook.Options;
+import org.jboss.jdocbook.i18n.PoSynchronizer;
+import org.jboss.jdocbook.util.FileUtils;
+import org.jboss.jdocbook.util.I18nUtils;
+import org.jboss.jdocbook.util.VCSDirectoryExclusionFilter;
+import org.jboss.maven.shared.process.Executor;
+
+/**
+ * Implementation of the {@link PoSynchronizer} contract based on system calls
+ * to either the 'msgmerge' or the 'msginit' commands (both part of the GNU
+ * gettext package).
+ *
+ * @author Steve Ebersole
+ */
+public class PoSynchronizerImpl implements PoSynchronizer {
+ /**
+ * {@inheritDoc}
+ */
+ public void synchronizePo(File potDirectory, File translationDirectory, Locale translationLocale, Options options)
+ throws JDocBookProcessException {
+ if ( !potDirectory.exists() ) {
+ options.getLog().info( "skipping PO updates; POT directory did not exist : {0}", potDirectory );
+ return;
+ }
+ File[] files = potDirectory.listFiles( new VCSDirectoryExclusionFilter() );
+ for ( int i = 0, X = files.length; i < X; i++) {
+ if ( files[i].isDirectory() ) {
+ // recurse into the directory by calling back into ourselves with the sub-dir
+ synchronizePo(
+ new File( potDirectory, files[i].getName() ),
+ new File( translationDirectory, files[i].getName() ),
+ translationLocale,
+ options
+ );
+ }
+ else {
+ if ( I18nUtils.isPotFile( files[i] ) ) {
+ File translation = new File( translationDirectory, I18nUtils.determinePoFileName( files[i] ) );
+ updateTranslation( files[i], translation, translationLocale, options );
+ }
+ }
+ }
+ }
+
+ private void updateTranslation(File template, File translation, Locale translationLocale, Options options) {
+ if ( !template.exists() ) {
+ options.getLog().trace( "skipping PO updates; POT file did not exist : {0}", template );
+ return;
+ }
+
+ if ( translation.lastModified() >= template.lastModified() ) {
+ options.getLog().trace( "skipping PO updates; up-to-date : {0}", translation );
+ return;
+ }
+
+ final String cmd;
+ if ( translation.exists() ) {
+ cmd = "msgmerge --quiet --backup=none --update " + FileUtils.resolveFullPathName( translation )
+ + " " + FileUtils.resolveFullPathName( template );
+ }
+ else {
+ translation.getParentFile().mkdirs();
+ cmd = "msginit --no-translator -l " + translationLocale
+ + " -i " + FileUtils.resolveFullPathName( template )
+ + " -o " + FileUtils.resolveFullPathName( translation );
+ }
+ Executor.execute( cmd );
+ }
+}
Added: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/gettext/PotSynchronizerImpl.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/gettext/PotSynchronizerImpl.java (rev 0)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/gettext/PotSynchronizerImpl.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -0,0 +1,108 @@
+/*
+ * jDocBook, processing of DocBook sources as a Maven plugin
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.jboss.jdocbook.i18n.gettext;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import org.jboss.jdocbook.JDocBookProcessException;
+import org.jboss.jdocbook.Options;
+import org.jboss.jdocbook.i18n.PotSynchronizer;
+import org.jboss.jdocbook.util.FileUtils;
+import org.jboss.jdocbook.util.I18nUtils;
+import org.jboss.jdocbook.util.XIncludeHelper;
+import org.jboss.maven.shared.process.Executor;
+
+/**
+ * Implementation of the {@link PotSynchronizer} contract based on system calls
+ * to the xml2pot command (part of the KDE poxml package).
+ *
+ * @author Steve Ebersole
+ */
+public class PotSynchronizerImpl implements PotSynchronizer {
+ /**
+ * {@inheritDoc}
+ */
+ public void synchronizePot(File masterFile, File templateDirectory, Options options) throws JDocBookProcessException {
+ if ( !masterFile.exists() ) {
+ options.getLog().info( "skipping POT updates; master file did not exist : {0}", masterFile );
+ return;
+ }
+ final File sourceBasedir = masterFile.getParentFile();
+ final String potFileName = I18nUtils.determinePotFileName( masterFile );
+ final File potFile = new File( templateDirectory, potFileName );
+ updatePortableObjectTemplate( masterFile, potFile, options );
+
+ // Note : recursion below accounts for inclusions within inclusions
+ for ( File inclusion : XIncludeHelper.locateInclusions( masterFile ) ) {
+ final String relativity = FileUtils.determineRelativity( inclusion, sourceBasedir );
+ final File relativeTemplateDir = ( relativity == null ) ? templateDirectory : new File(
+ templateDirectory,
+ relativity
+ );
+ synchronizePot( inclusion, relativeTemplateDir, options );
+ }
+ }
+
+ private void updatePortableObjectTemplate(File masterFile, File potFile, Options options) {
+ if ( !masterFile.exists() ) {
+ options.getLog().trace( "skipping POT update; source file did not exist : {0}", masterFile );
+ return;
+ }
+
+ if ( potFile.exists() && potFile.lastModified() >= masterFile.lastModified() ) {
+ options.getLog().trace( "skipping POT update; up-to-date : {0}", potFile );
+ return;
+ }
+
+ potFile.getParentFile().mkdirs();
+ executeXml2pot( masterFile, potFile, options );
+ }
+
+ private void executeXml2pot(File masterFile, File potFile, Options options) {
+ final String cmd = "xml2pot " + FileUtils.resolveFullPathName( masterFile );
+
+ try {
+ final FileOutputStream xmlStream = new FileOutputStream( potFile );
+ try {
+ options.getLog().trace( "updating POT file {0}", potFile );
+ Executor.execute( cmd, xmlStream );
+ }
+ finally {
+ try {
+ xmlStream.flush();
+ xmlStream.close();
+ }
+ catch ( IOException ignore ) {
+ // intentionally empty...
+ }
+ }
+ }
+ catch ( IOException e ) {
+ throw new JDocBookProcessException( "unable to open output stream for POT file [" + potFile + "]" );
+ }
+ }
+}
Added: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/gettext/TranslationBuilderImpl.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/gettext/TranslationBuilderImpl.java (rev 0)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/gettext/TranslationBuilderImpl.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -0,0 +1,120 @@
+/*
+ * jDocBook, processing of DocBook sources as a Maven plugin
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.jboss.jdocbook.i18n.gettext;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import org.jboss.jdocbook.JDocBookProcessException;
+import org.jboss.jdocbook.Options;
+import org.jboss.jdocbook.i18n.TranslationBuilder;
+import org.jboss.jdocbook.util.FileUtils;
+import org.jboss.jdocbook.util.I18nUtils;
+import org.jboss.jdocbook.util.XIncludeHelper;
+import org.jboss.maven.shared.process.Executor;
+
+/**
+ * Implementation of the {@link org.jboss.jdocbook.i18n.TranslationBuilder} contract based on system calls
+ * to the 'po2xml' command (part of the KDE poxml package).
+ *
+ * @author Steve Ebersole
+ */
+public class TranslationBuilderImpl implements TranslationBuilder {
+ /**
+ * {@inheritDoc}
+ */
+ public void buildTranslation(File masterFile, File poDirectory, File targetDirectory, Options options)
+ throws JDocBookProcessException {
+ options.getLog().trace( "starting translation [" + masterFile + "]" );
+ if ( !masterFile.exists() ) {
+ options.getLog().info( "skipping translation; master file did not exist : {0}", masterFile );
+ return;
+ }
+
+ final String poFileName = I18nUtils.determinePoFileName( masterFile );
+ final File poFile = new File( poDirectory, poFileName );
+ if ( !poFile.exists() ) {
+ throw new JDocBookProcessException( "Unable to locate PO file for [" + masterFile.getName() + "] in [" + poDirectory.getName() + "]" );
+ }
+ final File translatedFile = new File( targetDirectory, masterFile.getName() );
+ generateTranslatedXML( masterFile, poFile, translatedFile, options );
+
+ // Note : recursion below accounts for inclusions within inclusions
+ final File sourceBasedir = masterFile.getParentFile();
+ for ( File inclusion : XIncludeHelper.locateInclusions( masterFile ) ) {
+ options.getLog().trace( "starting translation of inclusion [" + inclusion + "]" );
+ final String relativity = FileUtils.determineRelativity( inclusion, sourceBasedir );
+ options.getLog().trace( "determined relativity : " + relativity );
+ final File relativeTranslationDir = ( relativity == null )
+ ? poDirectory
+ : new File( poDirectory, relativity );
+ final File relativeWorkDir = ( relativity == null )
+ ? targetDirectory
+ : new File( targetDirectory, relativity );
+ buildTranslation( inclusion, relativeTranslationDir, relativeWorkDir, options );
+ }
+ }
+
+ private void generateTranslatedXML(File masterFile, File poFile, File translatedFile, Options options) {
+ if ( !masterFile.exists() ) {
+ options.getLog().trace( "skipping translation; source file did not exist : {0}", masterFile );
+ return;
+ }
+ if ( !poFile.exists() ) {
+ options.getLog().trace( "skipping translation; PO file did not exist : {0}", poFile );
+ return;
+ }
+
+ if ( translatedFile.exists()
+ && translatedFile.lastModified() >= masterFile.lastModified()
+ && translatedFile.lastModified() >= poFile.lastModified() ) {
+ options.getLog().trace( "skipping translation; up-to-date : {0}", translatedFile );
+ return;
+ }
+
+ translatedFile.getParentFile().mkdirs();
+ final String cmd = "po2xml " + FileUtils.resolveFullPathName( masterFile ) + " " + FileUtils.resolveFullPathName( poFile );
+ try {
+ final FileOutputStream xmlStream = new FileOutputStream( translatedFile );
+ try {
+ options.getLog().trace( "<execute>" + cmd + "</execution>" );
+ Executor.execute( cmd, xmlStream );
+ }
+ finally {
+ try {
+ xmlStream.flush();
+ xmlStream.close();
+ }
+ catch ( IOException ignore ) {
+ // intentionally empty...
+ }
+ }
+ }
+ catch ( IOException e ) {
+ throw new JDocBookProcessException( "unable to open output stream for translated XML file [" + translatedFile + "]" );
+ }
+ }
+}
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/AbstractDocBookMojo.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/AbstractDocBookMojo.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/AbstractDocBookMojo.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,17 +1,26 @@
/*
- * Copyright © 2007 Red Hat Middleware, LLC. All rights reserved.
+ * jDocBook, processing of DocBook sources as a Maven plugin
*
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * Lesser General Public License, as published by the Free Software Foundation.
*
- * Red Hat Author(s): Steve Ebersole
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
*/
package org.jboss.maven.plugins.jdocbook;
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/CleanPoMojo.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/CleanPoMojo.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/CleanPoMojo.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,17 +1,26 @@
/*
- * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ * jDocBook, processing of DocBook sources as a Maven plugin
*
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * Lesser General Public License, as published by the Free Software Foundation.
*
- * Red Hat Author(s): Steve Ebersole
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
*/
package org.jboss.maven.plugins.jdocbook;
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/CleanPotMojo.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/CleanPotMojo.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/CleanPotMojo.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,17 +1,26 @@
/*
- * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ * jDocBook, processing of DocBook sources as a Maven plugin
*
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * Lesser General Public License, as published by the Free Software Foundation.
*
- * Red Hat Author(s): Steve Ebersole
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
*/
package org.jboss.maven.plugins.jdocbook;
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/Format.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/Format.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/Format.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,17 +1,26 @@
/*
- * Copyright © 2007 Red Hat Middleware, LLC. All rights reserved.
+ * jDocBook, processing of DocBook sources as a Maven plugin
*
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * Lesser General Public License, as published by the Free Software Foundation.
*
- * Red Hat Author(s): Steve Ebersole
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
*/
package org.jboss.maven.plugins.jdocbook;
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/GenerationMojo.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/GenerationMojo.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/GenerationMojo.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,17 +1,26 @@
/*
- * Copyright © 2007 Red Hat Middleware, LLC. All rights reserved.
+ * jDocBook, processing of DocBook sources as a Maven plugin
*
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * Lesser General Public License, as published by the Free Software Foundation.
*
- * Red Hat Author(s): Steve Ebersole
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
*/
package org.jboss.maven.plugins.jdocbook;
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/Options.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/Options.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/Options.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,17 +1,26 @@
/*
- * Copyright © 2007 Red Hat Middleware, LLC. All rights reserved.
+ * jDocBook, processing of DocBook sources as a Maven plugin
*
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * Lesser General Public License, as published by the Free Software Foundation.
*
- * Red Hat Author(s): Steve Ebersole
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
*/
package org.jboss.maven.plugins.jdocbook;
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/PackageMojo.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/PackageMojo.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/PackageMojo.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,17 +1,26 @@
/*
- * Copyright © 2007 Red Hat Middleware, LLC. All rights reserved.
+ * jDocBook, processing of DocBook sources as a Maven plugin
*
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * Lesser General Public License, as published by the Free Software Foundation.
*
- * Red Hat Author(s): Steve Ebersole
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
*/
package org.jboss.maven.plugins.jdocbook;
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/ResourceMojo.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/ResourceMojo.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/ResourceMojo.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,17 +1,26 @@
/*
- * Copyright © 2007 Red Hat Middleware, LLC. All rights reserved.
+ * jDocBook, processing of DocBook sources as a Maven plugin
*
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * Lesser General Public License, as published by the Free Software Foundation.
*
- * Red Hat Author(s): Steve Ebersole
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
*/
package org.jboss.maven.plugins.jdocbook;
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/TranslationMojo.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/TranslationMojo.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/TranslationMojo.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,24 +1,33 @@
/*
- * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ * jDocBook, processing of DocBook sources as a Maven plugin
*
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * Lesser General Public License, as published by the Free Software Foundation.
*
- * Red Hat Author(s): Steve Ebersole
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
*/
package org.jboss.maven.plugins.jdocbook;
import java.util.Locale;
import org.jboss.jdocbook.JDocBookProcessException;
-import org.jboss.jdocbook.i18n.actions.TranslateXmlAction;
+import org.jboss.jdocbook.i18n.Factory;
/**
* Responsible for translating the DocBook source based on the translator's PO files.
@@ -35,12 +44,12 @@
for ( I18nSource source : getI18nSources() ) {
if ( requestedLocale == null || requestedLocale.equals( source.getLocale() ) ) {
getLog().info( "Processing translation [" + stringify( source.getLocale() ) + "]" );
- new TranslateXmlAction(
+ Factory.getTranslationBuilder().buildTranslation(
masterTranslationDescriptor.resolveDocumentFile(),
source.resolvePoDirectory(),
source.resolveTranslatedXmlDirectory(),
options
- ).perform();
+ );
}
}
}
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/UpdatePoMojo.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/UpdatePoMojo.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/UpdatePoMojo.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,17 +1,26 @@
/*
- * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ * jDocBook, processing of DocBook sources as a Maven plugin
*
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * Lesser General Public License, as published by the Free Software Foundation.
*
- * Red Hat Author(s): Steve Ebersole
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
*/
package org.jboss.maven.plugins.jdocbook;
@@ -19,7 +28,7 @@
import java.util.Locale;
import org.jboss.jdocbook.JDocBookProcessException;
-import org.jboss.jdocbook.i18n.actions.UpdatePoAction;
+import org.jboss.jdocbook.i18n.Factory;
/**
* UpdatePoMojo implementationslatable strings from the master translation source into the POT files.
@@ -36,7 +45,8 @@
for ( I18nSource source : sources ) {
if ( translationLocale == null || translationLocale.equals( source.getLocale() ) ) {
getLog().info( "Updating PO file [" + stringify( source.getLocale() ) + "]" );
- new UpdatePoAction( potDirectory, source.resolvePoDirectory(), source.getLocale(), options ).perform();
+ Factory.getPoSynchronizer()
+ .synchronizePo( potDirectory, source.resolvePoDirectory(), source.getLocale(), options );
}
}
}
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/UpdatePotMojo.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/UpdatePotMojo.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/UpdatePotMojo.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,22 +1,31 @@
/*
- * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ * jDocBook, processing of DocBook sources as a Maven plugin
*
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * Lesser General Public License, as published by the Free Software Foundation.
*
- * Red Hat Author(s): Steve Ebersole
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
*/
package org.jboss.maven.plugins.jdocbook;
import org.jboss.jdocbook.JDocBookProcessException;
-import org.jboss.jdocbook.i18n.actions.UpdatePotAction;
+import org.jboss.jdocbook.i18n.Factory;
/**
@@ -30,6 +39,6 @@
public class UpdatePotMojo extends AbstractDocBookMojo {
protected void doExecute() throws JDocBookProcessException {
MasterTranslationDescriptor master = getMasterTranslationDescriptor();
- new UpdatePotAction( master.resolveDocumentFile(), potDirectory, options ).perform();
+ Factory.getPotSynchronizer().synchronizePot( master.resolveDocumentFile(), potDirectory, options );
}
}
Copied: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process (from rev 16410, labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/process)
Deleted: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/ExecutionException.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/process/ExecutionException.java 2007-11-07 17:17:20 UTC (rev 16410)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/ExecutionException.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Red Hat Author(s): Steve Ebersole
- */
-package org.jboss.jdocbook.i18n.actions.process;
-
-/**
- * Used to indicate problems performing an execution (sys call).
- *
- * @author Steve Ebersole
- */
-public class ExecutionException extends RuntimeException {
- private static final long serialVersionUID = -8773360957835742679L;
-
- public ExecutionException(String message) {
- super( message );
- }
-
- public ExecutionException(String message, Throwable cause) {
- super( message, cause );
- }
-}
Copied: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/ExecutionException.java (from rev 18748, labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/process/ExecutionException.java)
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/ExecutionException.java (rev 0)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/ExecutionException.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -0,0 +1,42 @@
+/*
+ * jDocBook, processing of DocBook sources as a Maven plugin
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.jboss.maven.shared.process;
+
+/**
+ * Used to indicate problems performing an execution (sys call).
+ *
+ * @author Steve Ebersole
+ */
+public class ExecutionException extends RuntimeException {
+ private static final long serialVersionUID = -8773360957835742679L;
+
+ public ExecutionException(String message) {
+ super( message );
+ }
+
+ public ExecutionException(String message, Throwable cause) {
+ super( message, cause );
+ }
+}
Deleted: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/Executor.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/process/Executor.java 2007-11-07 17:17:20 UTC (rev 16410)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/Executor.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Red Hat Author(s): Steve Ebersole
- */
-package org.jboss.jdocbook.i18n.actions.process;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * Responsible for performing system call executions and coordinating error checking, process I/O, etc.
- *
- * @author Steve Ebersole
- */
-public class Executor {
- /**
- * Shorthand for {@link #execute(String, java.io.OutputStream, java.io.OutputStream)} using
- * {@link System#out} and {@link System#err} for the process's stdout and errout, respectively.
- *
- * @param cmd The command to execute.
- */
- public static void execute(String cmd) {
- execute( cmd, System.out, System.err );
- }
-
- /**
- * Shorthand for {@link #execute(String, java.io.OutputStream, java.io.OutputStream)} using
- * {@link System#err} for the process's errout and the given <tt>out</tt> for its stdout.
- *
- * @param cmd The command to execute.
- * @param out The stream to which to pipe the process's stdout.
- */
- public static void execute(String cmd, OutputStream out) {
- execute( cmd, out, System.err );
- }
-
- /**
- * Perform the given cmd as a System call, piping the {@link Process#getOutputStream() input} of the resulting
- * process to our {@link System#in}, its {@link Process#getOutputStream() stdout} to the given <tt>out</tt> stream
- * and its {@link Process#getOutputStream() errout} to the given <tt>err</tt> stream.
- *
- * @param cmd The command to execute.
- * @param out The stream to which to pipe the process's stdout.
- * @param err The stream to which to pipe the process's errout.
- */
- public static void execute(String cmd, OutputStream out, OutputStream err) {
- ProcessOutputManager outputManager = null;
- try {
- Process cmdProcess = Runtime.getRuntime().exec( cmd );
- outputManager = new ProcessOutputManager( cmdProcess, out, err );
- try {
- cmdProcess.waitFor();
- }
- catch ( InterruptedException e ) {
- throw new ExecutionException( "unable to obtain appropriate runtime environment", e );
- }
- if ( cmdProcess.exitValue() != 0 ) {
- // assume problem...
- throw new ExecutionException( "there was a problem executing command; check output" );
- }
- }
- catch ( IOException e ) {
- throw new ExecutionException( "unable to obtain appropriate runtime environment", e );
- }
- finally {
- if ( outputManager != null ) {
- outputManager.stop();
- }
- }
- }
-}
Copied: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/Executor.java (from rev 18748, labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/process/Executor.java)
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/Executor.java (rev 0)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/Executor.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -0,0 +1,91 @@
+/*
+ * jDocBook, processing of DocBook sources as a Maven plugin
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.jboss.maven.shared.process;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * Responsible for performing system call executions and coordinating error checking, process I/O, etc.
+ *
+ * @author Steve Ebersole
+ */
+public class Executor {
+ /**
+ * Shorthand for {@link #execute(String, java.io.OutputStream, java.io.OutputStream)} using
+ * {@link System#out} and {@link System#err} for the process's stdout and errout, respectively.
+ *
+ * @param cmd The command to execute.
+ */
+ public static void execute(String cmd) {
+ execute( cmd, System.out, System.err );
+ }
+
+ /**
+ * Shorthand for {@link #execute(String, java.io.OutputStream, java.io.OutputStream)} using
+ * {@link System#err} for the process's errout and the given <tt>out</tt> for its stdout.
+ *
+ * @param cmd The command to execute.
+ * @param out The stream to which to pipe the process's stdout.
+ */
+ public static void execute(String cmd, OutputStream out) {
+ execute( cmd, out, System.err );
+ }
+
+ /**
+ * Perform the given cmd as a System call, piping the {@link Process#getOutputStream() input} of the resulting
+ * process to our {@link System#in}, its {@link Process#getOutputStream() stdout} to the given <tt>out</tt> stream
+ * and its {@link Process#getOutputStream() errout} to the given <tt>err</tt> stream.
+ *
+ * @param cmd The command to execute.
+ * @param out The stream to which to pipe the process's stdout.
+ * @param err The stream to which to pipe the process's errout.
+ */
+ public static void execute(String cmd, OutputStream out, OutputStream err) {
+ ProcessOutputManager outputManager = null;
+ try {
+ Process cmdProcess = Runtime.getRuntime().exec( cmd );
+ outputManager = new ProcessOutputManager( cmdProcess, out, err );
+ try {
+ cmdProcess.waitFor();
+ }
+ catch ( InterruptedException e ) {
+ throw new ExecutionException( "unable to obtain appropriate runtime environment", e );
+ }
+ if ( cmdProcess.exitValue() != 0 ) {
+ // assume problem...
+ throw new ExecutionException( "there was a problem executing command; check output" );
+ }
+ }
+ catch ( IOException e ) {
+ throw new ExecutionException( "unable to obtain appropriate runtime environment", e );
+ }
+ finally {
+ if ( outputManager != null ) {
+ outputManager.stop();
+ }
+ }
+ }
+}
Deleted: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/ProcessOutputManager.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/process/ProcessOutputManager.java 2007-11-07 17:17:20 UTC (rev 16410)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/ProcessOutputManager.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Red Hat Author(s): Steve Ebersole
- */
-package org.jboss.jdocbook.i18n.actions.process;
-
-import java.io.OutputStream;
-
-/**
- * ProcessOutputManager implementation
- *
- * @author Steve Ebersole
- */
-public class ProcessOutputManager {
- private final StreamBridge outputBridge;
- private StreamBridge errorBridge;
-
- public ProcessOutputManager(Process process, OutputStream out, OutputStream err) {
- outputBridge = new StreamBridge( process.getInputStream(), out );
- errorBridge = new StreamBridge( process.getErrorStream(), err );
-
- Thread outputStreamThread = new Thread( outputBridge );
- outputStreamThread.setDaemon( true );
- outputStreamThread.start();
-
- Thread errorStreamThread = new Thread( errorBridge );
- errorStreamThread.setDaemon( true );
- errorStreamThread.start();
- }
-
- public void stop() {
- outputBridge.stop();
- errorBridge.stop();
- }
-}
Copied: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/ProcessOutputManager.java (from rev 18748, labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/process/ProcessOutputManager.java)
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/ProcessOutputManager.java (rev 0)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/ProcessOutputManager.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -0,0 +1,55 @@
+/*
+ * jDocBook, processing of DocBook sources as a Maven plugin
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.jboss.maven.shared.process;
+
+import java.io.OutputStream;
+
+/**
+ * ProcessOutputManager implementation
+ *
+ * @author Steve Ebersole
+ */
+public class ProcessOutputManager {
+ private final StreamBridge outputBridge;
+ private StreamBridge errorBridge;
+
+ public ProcessOutputManager(Process process, OutputStream out, OutputStream err) {
+ outputBridge = new StreamBridge( process.getInputStream(), out );
+ errorBridge = new StreamBridge( process.getErrorStream(), err );
+
+ Thread outputStreamThread = new Thread( outputBridge );
+ outputStreamThread.setDaemon( true );
+ outputStreamThread.start();
+
+ Thread errorStreamThread = new Thread( errorBridge );
+ errorStreamThread.setDaemon( true );
+ errorStreamThread.start();
+ }
+
+ public void stop() {
+ outputBridge.stop();
+ errorBridge.stop();
+ }
+}
Deleted: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/StreamBridge.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/process/StreamBridge.java 2007-11-07 17:17:20 UTC (rev 16410)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/StreamBridge.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Red Hat Author(s): Steve Ebersole
- */
-package org.jboss.jdocbook.i18n.actions.process;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * Bridges an input stream to an output stream.
- * <p/>
- * This is used in system call handling because the output of the created process is actually represented as an input
- * stream to our java process. Generally we need to 'pipe' this to an output stream (the console for example).
- *
- * @author Steve Ebersole
- */
-public class StreamBridge implements Runnable {
- private static final int DEF_BUFFER_SIZE = 512;
-
- private final InputStream inputStream;
- private final OutputStream outputStream;
- private final int bufferSize;
-
- private boolean stopped = false;
-
- public StreamBridge(InputStream inputStream, OutputStream outputStream) {
- this( inputStream, outputStream, DEF_BUFFER_SIZE );
- }
-
- public StreamBridge(InputStream inputStream, OutputStream outputStream, int bufferSize) {
- this.inputStream = inputStream;
- this.outputStream = outputStream;
- this.bufferSize = bufferSize;
- }
-
- public void run() {
- final byte[] buf = new byte[bufferSize];
- int length;
- try {
- while ( true ) {
- length = inputStream.read( buf );
- if ( ( length <= 0 ) || stopped ) {
- break;
- }
- outputStream.write( buf, 0, length );
- outputStream.flush();
- }
- outputStream.flush();
- }
- catch ( IOException ignore ) {
- // ???
- }
- finally {
- synchronized (this) {
- notifyAll();
- }
- }
- }
-
- synchronized void stop() {
- stopped = true;
- notifyAll();
- }
-
-}
Copied: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/StreamBridge.java (from rev 18748, labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/jdocbook/i18n/actions/process/StreamBridge.java)
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/StreamBridge.java (rev 0)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/process/StreamBridge.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -0,0 +1,87 @@
+/*
+ * jDocBook, processing of DocBook sources as a Maven plugin
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.jboss.maven.shared.process;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * Bridges an input stream to an output stream.
+ * <p/>
+ * This is used in system call handling because the output of the created process is actually represented as an input
+ * stream to our java process. Generally we need to 'pipe' this to an output stream (the console for example).
+ *
+ * @author Steve Ebersole
+ */
+public class StreamBridge implements Runnable {
+ private static final int DEF_BUFFER_SIZE = 512;
+
+ private final InputStream inputStream;
+ private final OutputStream outputStream;
+ private final int bufferSize;
+
+ private boolean stopped = false;
+
+ public StreamBridge(InputStream inputStream, OutputStream outputStream) {
+ this( inputStream, outputStream, DEF_BUFFER_SIZE );
+ }
+
+ public StreamBridge(InputStream inputStream, OutputStream outputStream, int bufferSize) {
+ this.inputStream = inputStream;
+ this.outputStream = outputStream;
+ this.bufferSize = bufferSize;
+ }
+
+ public void run() {
+ final byte[] buf = new byte[bufferSize];
+ int length;
+ try {
+ while ( true ) {
+ length = inputStream.read( buf );
+ if ( ( length <= 0 ) || stopped ) {
+ break;
+ }
+ outputStream.write( buf, 0, length );
+ outputStream.flush();
+ }
+ outputStream.flush();
+ }
+ catch ( IOException ignore ) {
+ // ???
+ }
+ finally {
+ synchronized (this) {
+ notifyAll();
+ }
+ }
+ }
+
+ synchronized void stop() {
+ stopped = true;
+ notifyAll();
+ }
+
+}
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/properties/CompositeMavenProjectProperties.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/properties/CompositeMavenProjectProperties.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/properties/CompositeMavenProjectProperties.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,17 +1,26 @@
/*
- * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ * jDocBook, processing of DocBook sources as a Maven plugin
*
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * Lesser General Public License, as published by the Free Software Foundation.
*
- * Red Hat Author(s): Steve Ebersole
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
*/
package org.jboss.maven.shared.properties;
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/properties/PropertiesException.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/properties/PropertiesException.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/properties/PropertiesException.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,17 +1,26 @@
/*
- * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ * jDocBook, processing of DocBook sources as a Maven plugin
*
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * Lesser General Public License, as published by the Free Software Foundation.
*
- * Red Hat Author(s): Steve Ebersole
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
*/
package org.jboss.maven.shared.properties;
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/properties/PropertiesHelper.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/properties/PropertiesHelper.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/properties/PropertiesHelper.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,17 +1,26 @@
/*
- * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ * jDocBook, processing of DocBook sources as a Maven plugin
*
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * Lesser General Public License, as published by the Free Software Foundation.
*
- * Red Hat Author(s): Steve Ebersole
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
*/
package org.jboss.maven.shared.properties;
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/resource/ResourceDelegate.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/resource/ResourceDelegate.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/resource/ResourceDelegate.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,17 +1,26 @@
/*
- * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ * jDocBook, processing of DocBook sources as a Maven plugin
*
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * Lesser General Public License, as published by the Free Software Foundation.
*
- * Red Hat Author(s): Steve Ebersole
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
*/
package org.jboss.maven.shared.resource;
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/resource/ResourceException.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/resource/ResourceException.java 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/shared/resource/ResourceException.java 2008-03-07 05:16:40 UTC (rev 18749)
@@ -1,17 +1,26 @@
/*
- * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ * jDocBook, processing of DocBook sources as a Maven plugin
*
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * Lesser General Public License, as published by the Free Software Foundation.
*
- * Red Hat Author(s): Steve Ebersole
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
*/
package org.jboss.maven.shared.resource;
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/resources/META-INF/plexus/components.xml
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/resources/META-INF/plexus/components.xml 2008-03-07 05:11:11 UTC (rev 18748)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/resources/META-INF/plexus/components.xml 2008-03-07 05:16:40 UTC (rev 18749)
@@ -2,7 +2,7 @@
<components>
- <!-- Defines the lifecycle associated with the 'docbook' packaging -->
+ <!-- Defines the lifecycle associated with the 'jdocbook' packaging -->
<component>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
More information about the jboss-svn-commits
mailing list