You can create your custom mediator project using Developer Studio (previously known as carbon studio) and then include your mediator logic in that class mediator project[1]. Then create a C-App project in Developer Studio which includes your Class mediator as a C-App artifact[2].
Once you export this C-App project,you will get a CAR file which contains your Class mediator[3]. Once you deploy this CAR file in the ESB, it will automatically deploy the Class mediator OSGi bundle in the ESB and you can use the class mediator right away.
When you update the class mediator logic you can re-export the C-App project and simply replace the existing CAR file in the ESB with the new CAR file. Then your previous class mediator OSGi bundle will be removed from the ESB. But due to an limitation in the Equinox OSGi implementation you won't be able to use the new version of the class mediator until you restart the server.
So all you need to do is, replace the existing CAR file with the newer version of the CAR file and restart the ESB server. ESB server will take care of the deployment of OSGi bundle in to the system.
Since we have implemented support to deploy C-App to Carbon Server via Eclipse itself [4], you can use that approach as well. What you need to do is, add the ESB server to Eclipse instance and deploy the C-App which contains the class mediator via Eclipse itself. When you follow that approach you can update the logic in the class mediator and redeploy the newer version of the CAR file to server via Eclipse [5].
It is even possible to debug your Class mediator inside Developer Studio by following the guide in [6].
[1]. http://wso2.org/project/developer-studio/2.0.1/docs/server_extensions_category.html#CustomMediator
[2]. http://wso2.org/project/developer-studio/2.0.1/docs/packaging.html#Distribution
[3]. http://wso2.org/project/developer-studio/2.0.1/docs/testing_deploying_category.html#CarGen
[4]. http://wso2.org/project/developer-studio/2.0.1/docs/testing_deploying_category.html#Deploy
[5]. http://wso2.org/project/developer-studio/2.0.1/docs/testing_deploying_category.html#Redeploy
[6]. http://wso2.org/project/developer-studio/2.0.1/docs/testing_deploying_category.html#debug
Hope this helps!
Harshana