2. The tutorial of the Chatroom

The tutorial of the chat room bases on the demo/chatroom to introduce the design and implementation methods of the limax application.


  • 2.1 Compile

    1. Go to demo/chatroom/chatserver directory, run ant. Then the chatserver.jar is generated in the bin directory.

    2. Import the demo/chatroom/chatserver project via eclipse.


  • 2.2 Run

    • Run in the eclipse --- For debug analysis

      1. Run the limax.auany.Main of the auany project.

      2. Run the limax.globalid.Main of the globalid project.

      3. Run the limax.switcher.Main of the limax project.

      4. Run the chat.chatserver.Main of the chatserver project. The enableCommand is added into the execution parameter.

      After executing the above 4 applications, the server finishes the launch. The execution order of the 4 applications is necessary.


    • Run in the ant script --- For release

      1. Create the directory structure


      bin/
      bin/auany.jar
      bin/limax.jar
      bin/globalid.jar
      bin/chatserver.jar
      auany/
      auany/service-auany.xml
      auany/zdb/
      globalid/
      globalid/service-globalid.xml
      globalid/zdb/
      switcher/
      switcher/service-switcher.xml
      chatserver
      chatserver/service-chatserver.xml
      chatserver/zdb/
      build.xml
      

      The four server-xxx.xml files in the bin directory come from the root directory of each project. The zdb empty directory should be created in the auany, globalid and chatserver directories.

      build.xml:


      <?xml version="1.0" encoding="UTF-8"?>
      <project name="chat" default="run">
          <target name="auany">
                  <java dir="auany" fork="true" spawn="true" jar="bin/auany.jar" classpath="bin/limax.jar:bin/auany.jar"/>
          </target>
          <target name="globalid">
                  <java dir="globalid" fork="true" spawn="true" jar="bin/globalid.jar" classpath="bin/limax.jar:bin/globalid.jar"/>
          </target>
          <target name="switcher">
                  <java dir="switcher" fork="true" spawn="true" classname="limax.switcher.Main" classpath="bin/limax.jar"/>
          </target>
          <target name="chatserver">
                  <java dir="chatserver" fork="true" spawn="true" classname="chat.chatserver.Main" classpath="bin/limax.jar:bin/chatserver.jar">
                      <arg value="enableCommand"/>
                  </java>
          </target>
          <target name="run" depends="auany, globalid, switcher, chatserver">
          </target>
      </project>	
      

      2. Execute ant run to launch all the programs on time.

      If it needs to execute in multiple machines, please refer the operation management part of the limax manual, correctly configure the service-xxx.xml and implement the own launch script by referring the above methods.


Prev Next