<commit_before>= Obtaining JCloudScale source code =

If you want to experiment with the code itself, you can check out the code via:

 git clone https://github.com/xLeitix/jcloudscale.git

Make sure to have Git, Java 7 and Maven 3 installed.

You can run the end-to-end tests of JCloudScale via

 mvn clean verify -P local-tests

Finally, a small sample application is also included. You can run it with the following command:

 cd core; mvn clean install -Dskiptests; cd ..; cd ext/samples/SentimentAnalysis; mvn clean compile exec:exec

If you don't want to mess with the JCloudScale source code, following documentation explains how to work with the binaries using [http://maven.apache.org/ maven].

= Introduction =

If you want to try out JCloudScale with your own application and don't have time for [[Documentation.wiki| Documentation]], here's the illustrative example that shows complete JCloudScale integration process. Our example will be an application for prime numbers searching. The original ("un-cloudified") version of this application can be found at [[0.initialSampleApplication.zip?raw=true| 0.initialSampleApplication]]. 

This application represents a typical scalable application, which will allow us to demonstrate the main features and usage scenarios of the JCloudScale framework.
The application is built with the [http://maven.apache.org/ Maven] ideology in mind, but can be run in [http://www.eclipse.org/  Eclipse] as well. The main goal of the application is to calculate the amount of prime numbers within a specified integer range. With the default configuration, the application is supposed to execute in less than 30 seconds on modern hardware, however you can play with it and configure running time to fit your needs or wishes. 
You can run the application from the console with <code>mvn compile exec:exec</code> or <code>mvn test exec:exec</code> to run tests as well. (<code>mvn clean compile exec:exec</code>/ <code>mvn clean test exec:exec</code> in case you want to clean and recompile application first).

The application consists of two main packages: <code>prime.searcher</code>, which represents the prime numbers searching algorithm, and <code>prime.scheduler</code>, which parallelizes the initial task to use desired amount of threads. The application entry point is in the class <code>prime.Main</code> that defines search scope and used algorithms.
Look through the code and play with it: the sample should be reasonably easy to understand.
After this you should be ready to walk through these few easy steps to move this application to the cloud. To understand JCloudScale better, we encourage you to apply all following modifications yourself to the clean application provided above. However, after each step there is a link to the updated version of the application as well.

= Step 1: Applying JCloudScale to the Application =

The presented application is simple and nicely scalable, but whenever you try to increase the range for prime numbers search, you hit the problem that the execution will take very long even on a multi-core machine, independently of the amount of threads you spawn. The only option we have to be able to scale further and receive results faster is to scale out our application by distributing it over multiple nodes, e.g., using the cloud computing paradigm. 

To be able to use any features of JCloudScale, we should apply some modifications to the Maven Project File (<code>pom.xml</code>). 

== Adding JCloudScale Dependency ==
At first, we have to add the JCloudScale dependency. To do this, we open the projects pom.xml file and insert the following code into the <code><dependencies></code> section. The position of this particular dependency does not matter for maven. Also you may need to change version to match the one you actually target:

<pre><code>
&lt;dependency&gt;<br/>	&lt;groupId&gt;jcloudscale&lt;/groupId&gt;<br/>	&lt;artifactId&gt;jcloudscale.core&lt;/artifactId&gt;<br/>	&lt;version&gt;0.4.0&lt;/version&gt;<br/>&lt;/dependency&gt;
</code></pre>

In addition, as JCloudScale is not registered in public maven repositories, you need to add a reference to the TU Wien Infosys maven repository to the root of the pom.xml file (not into <code><dependencies></code> section, but create a new <code><repositories></code> section):

 <repositories>
 	<repository>
 		<id>infosys-repository</id>
 		<url>http://www.infosys.tuwien.ac.at/mvn</url>
 	</repository>
 </repositories>

Now you can try to build the project again and maven should download all necessary dependencies. As we did not change the code yet, application execution should not change. In case you have any problems, ensure that you have access to the repository (you can try to open the repository link in browser) and read carefully the error message that maven provided after the build.

== Applying JCloudScale Aspects ==
After we added necessary dependencies and ensured that everything still works, its time to configure AspectJ. As mentioned in the introduction, JCloudScale is using AspectJ to weave the appropriate cloud management code into the application. This happens as a separate weaving step after compilation of the actual application. To allow this, we have to add new plugin configuration to the <code><plugins></code> section within section <code><build></code>:

 <plugin>
 	<groupId>org.codehaus.mojo</groupId>
 	<artifactId>aspectj-maven-plugin</artifactId>
 	<version>1.4</version>
 	<configuration>
 		<source>1.7</source>
 		<target>1.7</target>
 		<complianceLevel>1.7</complianceLevel>
 		<verbose>true</verbose>
 	</configuration>
 	<executions>
 		<execution>
 			<configuration>
 				<XnoInline>true</XnoInline><commit_msg>Attempt to fix documentation issue with closing xml tags<commit_after>= Obtaining JCloudScale source code =

If you want to experiment with the code itself, you can check out the code via:

 git clone https://github.com/xLeitix/jcloudscale.git

Make sure to have Git, Java 7 and Maven 3 installed.

You can run the end-to-end tests of JCloudScale via

 mvn clean verify -P local-tests

Finally, a small sample application is also included. You can run it with the following command:

 cd core; mvn clean install -Dskiptests; cd ..; cd ext/samples/SentimentAnalysis; mvn clean compile exec:exec

If you don't want to mess with the JCloudScale source code, following documentation explains how to work with the binaries using [http://maven.apache.org/ maven].

= Introduction =

If you want to try out JCloudScale with your own application and don't have time for [[Documentation.wiki| Documentation]], here's the illustrative example that shows complete JCloudScale integration process. Our example will be an application for prime numbers searching. The original ("un-cloudified") version of this application can be found at [[0.initialSampleApplication.zip?raw=true| 0.initialSampleApplication]]. 

This application represents a typical scalable application, which will allow us to demonstrate the main features and usage scenarios of the JCloudScale framework.
The application is built with the [http://maven.apache.org/ Maven] ideology in mind, but can be run in [http://www.eclipse.org/  Eclipse] as well. The main goal of the application is to calculate the amount of prime numbers within a specified integer range. With the default configuration, the application is supposed to execute in less than 30 seconds on modern hardware, however you can play with it and configure running time to fit your needs or wishes. 
You can run the application from the console with <code>mvn compile exec:exec</code> or <code>mvn test exec:exec</code> to run tests as well. (<code>mvn clean compile exec:exec</code>/ <code>mvn clean test exec:exec</code> in case you want to clean and recompile application first).

The application consists of two main packages: <code>prime.searcher</code>, which represents the prime numbers searching algorithm, and <code>prime.scheduler</code>, which parallelizes the initial task to use desired amount of threads. The application entry point is in the class <code>prime.Main</code> that defines search scope and used algorithms.
Look through the code and play with it: the sample should be reasonably easy to understand.
After this you should be ready to walk through these few easy steps to move this application to the cloud. To understand JCloudScale better, we encourage you to apply all following modifications yourself to the clean application provided above. However, after each step there is a link to the updated version of the application as well.

= Step 1: Applying JCloudScale to the Application =

The presented application is simple and nicely scalable, but whenever you try to increase the range for prime numbers search, you hit the problem that the execution will take very long even on a multi-core machine, independently of the amount of threads you spawn. The only option we have to be able to scale further and receive results faster is to scale out our application by distributing it over multiple nodes, e.g., using the cloud computing paradigm. 

To be able to use any features of JCloudScale, we should apply some modifications to the Maven Project File (<code>pom.xml</code>). 

== Adding JCloudScale Dependency ==
At first, we have to add the JCloudScale dependency. To do this, we open the projects pom.xml file and insert the following code into the <code><dependencies></code> section. The position of this particular dependency does not matter for maven. Also you may need to change version to match the one you actually target:

 <dependency>
 	<groupId>jcloudscale</groupId>
 	<artifactId>jcloudscale.core</artifactId>
 	<version>0.4.0</version>
 </dependency>

In addition, as JCloudScale is not registered in public maven repositories, you need to add a reference to the TU Wien Infosys maven repository to the root of the pom.xml file (not into <code><dependencies></code> section, but create a new <code><repositories></code> section):

 <repositories>
 	<repository>
 		<id>infosys-repository</id>
 		<url>http://www.infosys.tuwien.ac.at/mvn</url>
 	</repository>
 </repositories>

Now you can try to build the project again and maven should download all necessary dependencies. As we did not change the code yet, application execution should not change. In case you have any problems, ensure that you have access to the repository (you can try to open the repository link in browser) and read carefully the error message that maven provided after the build.

== Applying JCloudScale Aspects ==
After we added necessary dependencies and ensured that everything still works, its time to configure AspectJ. As mentioned in the introduction, JCloudScale is using AspectJ to weave the appropriate cloud management code into the application. This happens as a separate weaving step after compilation of the actual application. To allow this, we have to add new plugin configuration to the <code><plugins></code> section within section <code><build></code>:

 <plugin>
 	<groupId>org.codehaus.mojo</groupId>
 	<artifactId>aspectj-maven-plugin</artifactId>
 	<version>1.4</version>
 	<configuration>
 		<source>1.7</source>
 		<target>1.7</target>
 		<complianceLevel>1.7</complianceLevel>
 		<verbose>true</verbose>
 	</configuration>
 	<executions>
 		<execution>
 			<configuration>
 				<XnoInline>true</XnoInline>
{'fraction_non_alphanumeric': 0.06720477276715213, 'fraction_numerical': 0.0031584488506755572, 'mean_word_length': 4.7804259634888435, 'pattern_counts': {'":': 0, '<': 141, '<?xml version=': 0, '>': 141, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 7}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7618397', 'n_tokens_mistral': 2972, 'n_tokens_neox': 2794, 'n_words': 1532}