![]() |
Command line tools |
version 7.1 feedback: 2step@zentense.com |
![]() |
1. compile |
![]() Figure 1: Files involved in 2step compilation This compile a 2step application from command line. You can also compile a 2step application from administration, where you also have the option of using an external Java compiler as jikes (by default, the javac compiler shipped with Java SDK is used). But the best way for compiling a 2step applications is using the 2step development plugin for Eclipse. Usually 2step will detect Java compiler, but you can override default detection defining the system property JAVA_HOME as in the next example: java -DJAVA_HOME=/usr/local/java -jar 2step.jar compileYou can also put the file tools.jar in the environment variable CLASSPATH: export CLASSPATH=/usr/local/java/lib/tools.jar java -jar 2step.jar compileWithout arguments, the application in the current directory will be compiled (if the current program working directory has not any 2step application, then compilation will obviously fail). Compilation of a 2step application is complex because it involves many files, as you can see in figure 1. In the figure white files are files written by developer (Java and 2step sources, model definition if any and I18N texts if any), and the rest of files are subproducts of compilation automatically generated by Java compiler, 2step compiler, or 2step runtime during application execution. Fortunately all of this process is done automatically by 2step compiler and is transparent to developer. A 2step application compilation is divided in four stages:
If you want to compile a 2step application that resides in a directory other than the current working one, then you may pass the application directory as the next argument when invoking the compilation: java -jar 2step.jar compile /path/to/applicationAnd finally, if you have specified the application directory, then you can put extra directories or JAR files to be passed to the compiler as the last argument. |
![]() |
2. compilemodel |
| This compiles a model file and generates corresponding ModelInit.java. It usually is done automatically by 2step compiler. By default tries to compile the default model for the application in the current working directory, but a different file may be specified as an argument. |
![]() |
3. geoip |
|
GeoIP is a database that maps IPs to different locations. 2step is
integrated with the GeoIP countries file, which is free, and can be
obtained from Maxmind. The file
is usually named GeoIP.dat. It is not shipped with 2step release, because
the IP countries database is not static and changes over time, so it is
recommended that you get the last version directly from Maxmind.
2step uses the GeoIP database (if available) for knowing which country each IP that is served comes from, and generate accurate countries statistics for each web application. You can use the command line simply for accessing directly GeoIP database. You can do that invoking 2step command line tools with geoip argument, the path to the GeoIP.dat file as the next argument, and the IP to be resolved as the last argument: java -jar 2step.jar /path/to/GeoIP.dat 62.57.145.236 |
![]() |
4. get |
|
This command allows to execute a template or action of an application directly
from command line, without any server involved in the process. The output is dumped
directly to the standard output. This is useful for
creating and executing 2step applications without web interface. For instance,
this document you are reading, was generated this way, with an small 2step application
that uses some templates to generate automatically some parts of the document.
Without arguments, it tries to load a 2step application stored in the current working directory, and, if successful, tries to execute the main action. The request parameters can optionally be specified as an argument (the last one), and, finally, the application directory may be specified if it is not the current working one. The next sample tries to execute a foo template, with a parameter, from an application located in the /path/to/application directory: java -jar 2step.jar get /path/to/application tplt=foo¶m1=yes |
![]() |
5. loadtest |
This command allows to perform a load test on a 2step application. For that, it needs
an argument that is the name of a properties file that describes how the load test will be
performed. The properties in the file are:
|
![]() |
6. log |
|
This tool analyzes log files (whose name is passed as last argument), generates the corresponding
2step.year.stats if they did not exist, and present some statistics to output stream.
The stats file is the file where all the statistics that can be seen from administration area
are stored. Each year a new stats file is generated.
The main use of this command is for regenerating a stats file. For doing so, just delete the stats file and issue this command with the name of the today's log file to regenerate the stats file. |
![]() |
7. md5 |
| It takes one argument which is the word to be cyphered with the MD5 algorithm that is used for cyphering passwords if Encrypt passwords is checked on general setup. |
![]() |
8. war |
|
This commands generates a WAR file (Web Application Archive) that is a standard for installing web applications
in servlets engine. WARs are not needed for installing a 2step application
in the built-in servlet engine, but are needed for other ones, as Tomcat.
For generating a WAR file just issue this command and a WAR file will be generated
for the 2step application in the current working directory.
If the application resides in another directory different than the current one, just pass the application directory as an argument. There is an optional second argument which is the 2step home directory. This second argument is intended only when you want to generate WAR files for a remote server where 2step home directory is different from the one at the local machine.
| |||||