directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r640507 - /directory/daemon/branches/bigbang/plugin/src/main/java/org/apache/directory/daemon/installers/CreateImageCommand.java
Date Mon, 24 Mar 2008 18:38:19 GMT
Author: felixk
Date: Mon Mar 24 11:38:17 2008
New Revision: 640507

URL: http://svn.apache.org/viewvc?rev=640507&view=rev
Log:
Throw exception if combination of osname and osarch is not supported

Modified:
    directory/daemon/branches/bigbang/plugin/src/main/java/org/apache/directory/daemon/installers/CreateImageCommand.java

Modified: directory/daemon/branches/bigbang/plugin/src/main/java/org/apache/directory/daemon/installers/CreateImageCommand.java
URL: http://svn.apache.org/viewvc/directory/daemon/branches/bigbang/plugin/src/main/java/org/apache/directory/daemon/installers/CreateImageCommand.java?rev=640507&r1=640506&r2=640507&view=diff
==============================================================================
--- directory/daemon/branches/bigbang/plugin/src/main/java/org/apache/directory/daemon/installers/CreateImageCommand.java
(original)
+++ directory/daemon/branches/bigbang/plugin/src/main/java/org/apache/directory/daemon/installers/CreateImageCommand.java
Mon Mar 24 11:38:17 2008
@@ -49,8 +49,8 @@
         this.target = target;
         initializeFiltering();
     }
-    
-    
+
+
     public Properties getFilterProperties()
     {
         return filterProperties;
@@ -118,8 +118,8 @@
         {
             try
             {
-                MojoHelperUtils.copyAsciiFile( mymojo, filterProperties,
-                    getClass().getResourceAsStream( "LICENSE" ), licenseTarget, false );
+                MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream(
"LICENSE" ),
+                    licenseTarget, false );
             }
             catch ( IOException e )
             {
@@ -167,17 +167,17 @@
         }
 
         // copy over the REQUIRED logger artifact
-/*
-        try
-        {
-            FileUtils.copyFile( mymojo.getLogger().getFile(), layout.getLogger() );
-        }
-        catch ( IOException e )
-        {
-            throw new MojoFailureException( "Failed to copy logger.jar " + mymojo.getLogger().getFile()
-                + " into position " + layout.getLogger() );
-        }
-*/
+        /*
+                try
+                {
+                    FileUtils.copyFile( mymojo.getLogger().getFile(), layout.getLogger()
);
+                }
+                catch ( IOException e )
+                {
+                    throw new MojoFailureException( "Failed to copy logger.jar " + mymojo.getLogger().getFile()
+                        + " into position " + layout.getLogger() );
+                }
+        */
 
         // copy over the REQUIRED daemon.jar file 
         try
@@ -216,7 +216,7 @@
             catch ( IOException e )
             {
                 log.error( "Failed to copy logger configuration file " + target.getLoggerConfigurationFile()
-                        + " into position " + layout.getLoggerConfigurationFile(), e );
+                    + " into position " + layout.getLoggerConfigurationFile(), e );
             }
         }
 
@@ -230,7 +230,7 @@
             catch ( IOException e )
             {
                 log.error( "Failed to copy server configuration file " + target.getServerConfigurationFile()
-                        + " into position " + layout.getConfigurationFile(), e );
+                    + " into position " + layout.getConfigurationFile(), e );
             }
         }
 
@@ -238,78 +238,129 @@
         // Copy Wrapper Files
         // -------------------------------------------------------------------
 
-        if ( target.getOsName().equals( "linux" ) && target.getOsArch().equals( "i386"
) && target.getDaemonFramework().equals("tanuki"))
+        if ( target.getDaemonFramework().equalsIgnoreCase( "tanuki" ) )
         {
-            try
+            if ( target.getOsName().equalsIgnoreCase( "linux" ) )
             {
-                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "wrapper/bin/wrapper-linux-x86-32"
),
-                        new File( layout.getBinDirectory(), target.getApplication().getName()
) );
-                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "wrapper/lib/libwrapper-linux-x86-32.so"
),
-                        new File( layout.getLibDirectory(), "libwrapper.so" ) );
+                if ( target.getOsArch().equals( "i386" ) )
+                {
+                    try
+                    {
+                        MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
+                            "wrapper/bin/wrapper-linux-x86-32" ), new File( layout.getBinDirectory(),
target
+                            .getApplication().getName() ) );
+                        MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
+                            "wrapper/lib/libwrapper-linux-x86-32.so" ), new File( layout.getLibDirectory(),
+                            "libwrapper.so" ) );
+                    }
+                    catch ( IOException e )
+                    {
+                        throw new MojoFailureException( "Failed to copy Tanuki binary files
to lib and bin directories" );
+                    }
+                }
+                else
+                {
+                    if ( target.getOsArch().equals( "x86_64" ) )
+                    {
+                        try
+                        {
+                            MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
+                                "wrapper/bin/wrapper-linux-x86-64" ), new File( layout.getBinDirectory(),
target
+                                .getApplication().getName() ) );
+                            MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
+                                "wrapper/lib/libwrapper-linux-x86-64.so" ), new File( layout.getLibDirectory(),
+                                "libwrapper.so" ) );
+                        }
+                        catch ( IOException e )
+                        {
+                            throw new MojoFailureException(
+                                "Failed to copy Tanuki binary files to lib and bin directories"
);
+                        }
+                    }
+                    else
+                    {
+                        throw new MojoFailureException( "OsName='linux' supports only OsArc='[i386|x86_64]'"
);
+                    }
+                }
             }
-            catch ( IOException e )
+            else
             {
-                throw new MojoFailureException( "Failed to copy Tanuki binary files to lib
and bin directories");
+                throw new MojoFailureException( "Only OsName='linux' supported for configured
daemon framework" );
             }
         }
-
-
-        if ( target.getOsName().equals( "linux" ) && target.getOsArch().equals( "x86_64"
) && target.getDaemonFramework().equals("tanuki"))
-        {
-            try
-            {
-                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "wrapper/bin/wrapper-linux-x86-64"
),
-                        new File( layout.getBinDirectory(), target.getApplication().getName()
) );
-                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "wrapper/lib/libwrapper-linux-x86-64.so"
),
-                        new File( layout.getLibDirectory(), "libwrapper.so" ) );
-            }
-            catch ( IOException e )
-            {
-                throw new MojoFailureException( "Failed to copy Tanuki binary files to lib
and bin directories");
-            }
-        }
-
-        // now copy over the jsvc executable renaming it to the mymojo.getApplicationName()

-        if ( target.getOsName().equals( "sunos" ) && target.getOsArch().equals( "sparc"
) )
-        {
-            File executable = new File( layout.getBinDirectory(), target.getApplication().getName()
);
-            try
-            {
-                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "jsvc_solaris_sparc"
), executable );
-            }
-            catch ( IOException e )
-            {
-                throw new MojoFailureException( "Failed to copy jsvc executable file "
-                    + getClass().getResource( "jsvc_solaris_sparc" ) + " into position "
+ executable.getAbsolutePath() );
-            }
-        }
-
-        if ( target.getOsName().equals( "sunos" ) && target.getOsArch().equals( "i386"
) )
-        {
-            File executable = new File( layout.getBinDirectory(), target.getApplication().getName()
);
-            try
-            {
-                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "jsvc_solaris_i386"
), executable );
-            }
-            catch ( IOException e )
-            {
-                throw new MojoFailureException( "Failed to copy jsvc executable file "
-                    + getClass().getResource( "jsvc_solaris_i386" ) + " into position " +
executable.getAbsolutePath() );
-            }
-        }
-
-        // now copy over the jsvc executable renaming it to the mymojo.getApplicationName()

-        if ( target.getOsName().equals( "macosx" ) && target.getOsArch().equals(
"ppc" ) )
+        else
         {
-            File executable = new File( layout.getBinDirectory(), target.getApplication().getName()
);
-            try
+            // now copy over the jsvc executable renaming it to the mymojo.getApplicationName()

+            if ( target.getOsName().equalsIgnoreCase( "sunos" ) )
             {
-                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "jsvc_macosx_ppc"
), executable );
-            }
-            catch ( IOException e )
-            {
-                throw new MojoFailureException( "Failed to copy jsvc executable file "
-                    + getClass().getResource( "jsvc_macosx_ppc" ) + " into position " + executable.getAbsolutePath()
);
+                if ( target.getOsArch().equalsIgnoreCase( "sparc" ) )
+                {
+                    File executable = new File( layout.getBinDirectory(), target.getApplication().getName()
);
+                    try
+                    {
+                        MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "jsvc_solaris_sparc"
),
+                            executable );
+                    }
+                    catch ( IOException e )
+                    {
+                        throw new MojoFailureException( "Failed to copy jsvc executable file
"
+                            + getClass().getResource( "jsvc_solaris_sparc" ) + " into position
"
+                            + executable.getAbsolutePath() );
+                    }
+                }
+                else
+                {
+                    if ( target.getOsArch().equals( "i386" ) )
+                    {
+                        File executable = new File( layout.getBinDirectory(), target.getApplication().getName()
);
+                        try
+                        {
+                            MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
"jsvc_solaris_i386" ),
+                                executable );
+                        }
+                        catch ( IOException e )
+                        {
+                            throw new MojoFailureException( "Failed to copy jsvc executable
file "
+                                + getClass().getResource( "jsvc_solaris_i386" ) + " into
position "
+                                + executable.getAbsolutePath() );
+                        }
+                    }
+                    else
+                    {
+                        throw new MojoFailureException( "OsName='sunos' supports only OsArc='[sparc|i386]'"
);
+                    }
+                }
+            }
+            else
+            {
+                // now copy over the jsvc executable renaming it to the mymojo.getApplicationName()
+                if ( target.getOsName().equalsIgnoreCase( "macosx" ) )
+                {
+                    if ( target.getOsArch().equalsIgnoreCase( "ppc" ) )
+                    {
+                        File executable = new File( layout.getBinDirectory(), target.getApplication().getName()
);
+                        try
+                        {
+                            MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
"jsvc_macosx_ppc" ),
+                                executable );
+                        }
+                        catch ( IOException e )
+                        {
+                            throw new MojoFailureException( "Failed to copy jsvc executable
file "
+                                + getClass().getResource( "jsvc_macosx_ppc" ) + " into position
"
+                                + executable.getAbsolutePath() );
+                        }
+                    }
+                    else
+                    {
+                        throw new MojoFailureException( "OsName='macosx' supports only OsArc='[ppc]'"
);
+                    }
+                }
+                else
+                {
+                    throw new MojoFailureException( "OsName='" + target.getOsName()
+                        + "' is not supported for build process." );
+                }
             }
         }
 
@@ -360,10 +411,10 @@
             catch ( IOException e )
             {
                 log.error( "Failed to notice file " + noticeFile.getAbsolutePath() + " into
position "
-                        + noticeFileTarget.getAbsolutePath(), e );
+                    + noticeFileTarget.getAbsolutePath(), e );
             }
         }
-        
+
         processPackagedFiles( target, mymojo.getPackagedFiles() );
     }
 }



Mime
View raw message