AnsweredAssumed Answered

Branding Spark using Ant Builder / IzPack and AdvancedInstaller

Question asked by MJMC on Nov 19, 2012
Latest reply on Aug 28, 2014 by rjeedimalla

Hi

 

After spending hours/days braning spark and building packaging it to an msi all for free (as some alternatives cost money)

I thought I would post how I did it. I will try answer any questions or issues I came across

 

Hope this is of SOME help, to SOMEONE!

Some how to documents here are old and dated.

-------------------------------------------------------------------------------- --------------------------------------------------------------------

 

Scope:

This document will help you setup a secure and free open source instantmessenger server & client, branded with your own company logos fullycustomisable. The environment of this document is:

Ubuntu 10.04 Server 64Bit VM  & Windows 7 32Bit clients.

You will need to install the following free software (details givenbelow)

MySQL / Java RE / Notepad++ / TortoiseSVN / Ant Builder / IzPack /Launch4J / AdvancedInstaller

 

MySQLSetup

Step 1: sudoapt-get install mysql-server

Step 2: JDBC Driver is bundled with Openfire so we don’t need to worryabout it, you need to use the following values later on (ignore for now):

driver: com.mysql.jdbc.Driver

server: jdbc:mysql://[YOUR_HOST]/[DATABASE_NAME]

Step 3: Using MySQL 4.1.18 or later create a db for Openfire Tables

                mysqladmincreate [dbname]    //creates the database dbname, call yours anything

                catopenfire_mysql.sql | mysql [dbname];            //imports the schema file

 

OpenfireServer Setup

Step 1: Ensuring MySQL is installed, install Java JRE (Java 5 or later,I installed 7)

                sudoadd-apt-repository "deb http://archive.canonical.com/ lucid partner"

                sudoapt-get update

sudo apt-get install sun-java7-jre sun-java7-pluginsun-java7-fonts

                java –version //To confirm install & Java Version

 

Step 2: Download Openfire

wget http://www.igniterealtime.org/downloads/download-landing.jsp?file=openfire/openf ire_3_7_1.tar.gz

//This tar.gz does NOT include JAVA JRE so be sureto follow Step 2

 

Step 3: Extract Openfire to /opt

tar-xzvf openfire_3_0_0.tar.gz
mv openfire /opt

 

Step 4: Start the Openfire Service

                # ./opt/openfire/bin/openfirestart

 

Step 5: Launch the Openfire Admin Console to test

                http://127.0.0.1:9090 or http://server.name:9090

 

Step 6: Go through Openfire Server Wizard

                Page 1 LanguageSelection

                                -Select Language

                Page 2: ServerSettings

                                -Domain: server.name

                                -Admin Console Port: 9090

                                -Secure Admin Port : 9091

                Page 3: DatabaseSettings

                                -Standard Database Connection

                                                -Database Driver: MySQL

                                                -JDBC Driver Class: com.mysql.jdbc.Driver

                                                -Database URL: jdbc.mysql://localhost:3306/openfire

                                                -Username / PasswordYour MySQLUsername & Password

                Page 4: ProfileSettings

                                -DirectoryServer (LDAP)

                                -Server Type: Active Directory

                                -Host: IP Address of your AD server   Port:289

                                -Administrator DN: uid=Administrator,ou=OU Name,dc=company,dc=local

                                -Password= AdministratorPassword

                                //Selectusers for AD to be administrators

//more infoon AD setup:  here

 

 

Rebrandingof the Spark Client.

 

For the below example, we are going to rebrand spark and call ourclient “MyMessenger” havingspaces in your Client name can throw up problems later on so it’s easier toleave it out for now. Do not use underscores either.

 

Step 1: Download TortoiseSVNClient and Notepad++

Step 2 : Download the Source Code of Spark using TortoiseSVN, copy thesource code and create a copy in a folder on your desktop “MyMessenger” – we aregoing to work from here now.

Do NOThave spaces in this folder , this caused me problems later on.

svn cohttp://svn.igniterealtime.org/svn/repos/spark/trunk spark

Step 3: Using Notepad++ open the following files. Find and replace all “Spark”with “MyMessenger”

 

  1. 1.     build\build.xml
  2. 2.     src\resources\i18n\spark_i18n.properties (for English)
  3. 3.     src\java\org\jivesoftware\launcher\Installer.java
  4. 4.     src\java\org\jivesoftware\resource\default.properties (also enteryour server name for the value of HOST_NAME)
  5. 5.     src\java\org\jivesoftware\resource\spark.properties (also replace"1.0" in "Version 1.0 Release" with the version of Sparkyou're building)
  6. 6.     src\plugins\fastpath\src\resources\fastpath.properties (also replace"1.0" in "Version 1.0 Release" with the version of Sparkyou're building)

 

 

Step 4: Using Gimp / Photoshop / Paint.NET etc replace the followingimages – be sure to keep the dimensions, with your own cooperate images.

 

  1. 1.    spark.gif
  2. 2.    spark.ico
  3. 3.    spark_100.jpg (100 x 100)
  4. 4.    spark-16x16.png
  5. 5.    spark-32x32.png
  6. 6.    spark-60x60.png
  7. 7.    spark-64x64.png
  8. 8.    spark.png (244 x 188)
  9. 9.    away.png (16 x 16)
  10. 10.  DoNotDisturb.png (16 x 16)
  11. 11.  message.icns

 

Step 5: Install Apache Ant

                Follow theinstructions here forthe installation of Ant

The most importantpart is step 4, set environmental variables JAVA_HOME to your Java Enviroment, Set ANT_HOME to the directory you unzipped Ant to. Skipping this stepwill cause Ant not to run correctly. Steps 5&6 I didn’t do.

 

Step 6: Ok you now have replaced the spark images with your companybranding. We will launch MyMessenger to see how it looks. To do this:

Open command prompt & cd to your build folder:

Desktop\MyMessenger-Code\build>ant release  //Launch Ant

Desktop\MyMessenger-Code\target\build\bin>startup.bat //Run MyMessenger

 

Step 7: Once you’re happy, close MyMessenger & Download and Install izpack and launch4j

Step 8: Make the following changes to \build\build.xml

                <propertyname="installer.izpack.dir" value="c:\\ProgramFiles\\IzPack"/>

                <propertyname="launch4j.dir" location="c:\\ProgramFiles\\Launch4j" />

Step 9: Now compile and create your exe file

                From\MyMessenger\Build type the following:

                MyMessenger\build>antinstaller.izpack

                Yourcode should compile giving the final message “Build Successful”

Remember if your folder name is MyMessenger or My_Messenger it won’tcompile.

You will notice now you have two newfolders. \MyMessenger\Installer which contains your jar file and\MyMessenger\target which is your main folder containing your exe file \pluggins

Your executable file is located in \MyMessenger\target\build.   //starter.exe is needed, don’t delete

You will also notice your newly compiled exe is called Spark.exe, letschange this

 

  

Step 10: Changing compiler to makeMyMessenger.exe

For me this was very trialand error, but my advice would be – make a change, run ant installer.izpack andbe sure it says “Build Successful” then make another etc…

 

                In\MyMessenger\build\build.xml Ctrl&F and locate “Installer Ant Script”

                Rename thefollowing from Spark to MyMessenger

                installer.app_name

                installer.app_short_name

installer.product_name

 

In \MyMessenger\build\installer\izpack\launch4j.xmlchange the following lines:

<outfile>C:\Users\xxxxxx\Desktop\MyMessenger/target/build//MyMessenger.exe</outfile>

<errTitle>MyMessenger </errTitle>

<fileDescription>MyMessenger </fileDescription>

<copyright>http://www.yourcompany.com</copyright>

<productVersion>2.6.0.0</productVersion>

    <txtProductVersion>2.6.0</txtProductVersion>

    <productName>MyMessenger</productName>

    <companyName>Company Name - You</companyName>

    <internalName> MyMessenger </internalName>

    <originalFilename> MyMessenger.exe</originalFilename>

You can change more but I THINK these are the basics for now. Run antinstaller.izpack again.

 

Step 11: Default Properties

This file is very important.From here you can customize what users can and cannot do. It is very wellcommented and self-explained. For example, I have hardcoded in HOST_NAME anddisabled it to be changed. This way the user doesn’t have to enter the host.Many changes are available.

\MyMessenger\src\java\org\jivesoftware\resource\default.properties

I have also black listed the OTR (Off the Record) pluggin, that allowsencrypted off the record chats:

PLUGIN_BLACKLIST_CLASS = org.jivesoftware.spark.otrplug.OTRPlugin

From here we can also remove buttons that aren’tneeded in a cooperate setting. Such as creating accounts etc.

 

 

 

EXAMPLE ERRORS:

Build Failed:

C:\Users\......\build.xml868:com.izforge.izpack.compiler.CompilerException:….C:\Users\.../build/installer/spark-izpack.xml:76

The Errors can often be frustrating but the compiler points you in theright direction, in the above example, if you go to spark-izpack.xml and go to line 76, I still had spark.exe referenced ratherthan MyMessenger.exe

 

 

 

FinalStep: Package MSI for deployment

 

Let’s package up our exe and build files and create an msi fordeployment.

Download AdvancedInstaller

Advanced installer is free to create basic msi files. So lets createNEW – Installer – Simple

 

-Product Details: Enter as much information here as you require

-Install Parameters: Application Folder: [ProgramFilesFolder][ProductName]and the same under Application Shortcut Folder

-Files & folders : Application Folder – Right Click – Add Folderand add the \MyMessenger\target folder. Select the entire Target folder as youneed the plugins etc.

-Application Shortcut Folder:  Select Application Shortcut Folder – right clickwhitespace on right pane – New Shortcut to – Installed File – Select yourMyMessenger.exe file.

-Desktop – same step as above. This will create a shortcut toMyMessenger on the desktop for the users.

Everything else is fine as is. Save As in MyMessenger Folder

Select Build – once built go to \MyMessenger\Project –SetupFile whereyou will find your msi ready to deploy.

 

Good Luck!

Outcomes