Wso2 Building API Manager From CodeBase

How to build Wso2 API Manager (C5) from Code Base.

     Prerequisite installations before building :- 
  • Apache Maven.
  • Java (latest version). 
      
      Following Should be downloaded :-
  • carbon-ampigt (C5).
  • product-apim   (C5).
      Please note C5 means:-Branch C5 in GitHub Repositories  


Start Building 

First build the carbon-ampigt and then should build the product-apim.

Maven build by command "mvn clean install"


     This screenshot is after building the product-apim successfully .


  
     This screenshot is after building the product-apim successfully.


After building the "Product-apim" Inside the Product folder a new folder called target is generated inside it there is a .zip named "wso2apim-3.0.0-SNAPSHOT.zip". Unzip this it and move into the folder,


above is the screenshot of the file structure .


 After unziping move to the "bin folder" inside it we can find a .sh file named "carbon.sh".



Next step is to up the server move to the console and type "sh carbon.sh"
then the server starts and its up and running.





The server has started now move on to the browser and lets check how we can look at the API store page.
which will take into the login Page .




The default username and password is "admin" so you can login into the API Manger Store.



And inside view will look like this as we have not published any API before hand.


Note :- This Post helps you to easily setup up the API Manager from codebase and steps are being mention very clear in each step and if we need to edit the codebase of the API Manager it is available in the following path "carbon-apimgt-C5/components/web/apps". 
where you can edit the code and make a built to edit code must have good knowledge about UUF-Framework and handlebars js .





More tutorials About Wso2 API manager and UUF-Framework are coming Soon.



    
        

Basics Of Threads by ravindu

What is a thread?
There are two ways to create a thread:
  1. By extending Thread class
  2. By implementing Runnable interface.

Thread class provide constructors and methods to create and perform operations on a thread .Thread class extends Object class and implements Runnable interface.

Creating a thread
Thread t = new Thread();


By extending Thread class
The only disadvantage of this way is you can only inherit one class .
Class Downloder extends Threds{
Public void run(){ // always the executing code should be inside the run method
Filedownloder fd= new Filedownloder();
Fd.downlode();
}
}
To invoke the run method we should start the thread
Thread t = new Thread();
t.start(); we should call the start method in order to call the run()




By implementing Runnable interface.
Here the problem of inheritance is overcome.
Class downloader implement runnable{
}
Public void run(){
Filedownloder fd =new Filedownloder(){
Fd.downloder();
}
}
Invoking the run method
downloder d= new downloader();
Thread t=new Thread(d);
t.start();



Abstract Class

The most important cases in java abstraction  
  • Abstract classes may or may not contain abstract methods ie., methods with out body ( public void get(); )
  • But, if a class have at least one abstract method, then the class must be declared abstract.
  • If a class is declared abstract it cannot be instantiated (an object cannot be created ).
  • To use an abstract class you have to inherit it from another class, provide implementations to the abstract methods in it.
  • If you inherit an abstract class you have to provide implementations to all the abstract methods in it.
Final keyword

Final keyword

Final Keyword tutorial Report By:-Ravindu Perera 2014259
Case 1

How to stop a variable from changing?
public class Tutorial {
public static void main(String[] args) {
Test test = new Test();
System.out.println(test.p1);
}
}

class Test {
public final double p1 = 3.14;

Test() {
p1 = 2.14;//due to the finall keyword the intialised value cannot change
}
}

here because the variable made final so we cannot change the variable it is made a constant.





Case 2
How to stop a method from being overriden when it is inherited?
public class finalMethod {

final void data() {
System.out.println("I have 1 GB");
}

}

class tre extends finalMethod {
void data() {//here the method is not being allowed to ovrride
System.out.println("I have 5GB");
}
public static void main(String []args){
}
}
because the method uses the keyword final the extened class will be not allow to overrride the method as final keyword stops it.












Case 3
How to prevent a class from being inherited?
public final class finalMethod {

final void data() {
System.out.println("I have 1 GB");
}

}

class tre extends finalMethod {//the final keyword prevents inheritance
void data() {
System.out.println("I have 5GB");
}
public static void main(String []args){
}
}

in this code the final keyword is being used to prevent the superclass being inherited to the subclass so an error message is being shown.