Category: GSoC (17 posts)

Aug 26 2019

My GSOC19 Experience

Hello there! My name is Divyansh Jain. I am a student at Mahatma Jyoti Rao Phoole University. I have been selected as an Android developer for the XWiki organization and I've finished working on their XWiki Android Authenticator application in GSOC19.

Preparations before applying for the GSOC19

I've been contributing to the open-source project throughout the year, and once the GSOC announced the organization's name I started searching for the organization and then I found the XWiki. I started understanding how the app works, it's known issues at Jira, what the organization expects from a developer during the GSOC. I started by cloning the project, ran the app into the device, understood the project and then fixed some bugs. I opened two PR's and started talking to the listed mentors. They accepted my PR. And then I started working on the proposal.

I wrote all the things that I understood about this organization, how the app works, it's data flow diagram, and describe how I will cover all the open issues.

The day when I got selected

I wasn't expecting to get selected. But the day my name was announced, I immediately thanked my mentors for selecting me. And to this day I'm truly thankful to them for selecting me.

During my first evaluation period, I started by fixing some known bugs and begin migrating the app code from Java to Kotlin. All my previous open-source experience helped me to quickly find the bug, what's causing it and how to fix it. As I was migrating the code, I started to understand more about the app flow which really helped in the coming tasks. Before the first evaluation, I released v0.6.

Second Evaluation, Adding multiple account support and fixed some more bugs, I thought I'll finish this task soon but then I realized there's a whole lot of work to do. In this task after discussing with my mentor, I've implemented the room DB to save user sync info and added support for multiple account sync and some minor improvements in the app, implementing DB increased the app performance. And hence successfully releasing v.0.7,

Third Evaluation, Adding support for OpenID Connect & pagination in users list. XWiki already has support for OIDC login what's left was to add support for it. This particular task was a head-scratcher. But thanks to my mentors to, they helped me when I got stuck and now finally XWiki Authenticator supports OIDC login. Now the apps requesting XWiki user info can access info when the user logs in and give the consent to share the info with the requesting app. Also while adding the new XWiki account, now the users have the choice to either login using old login pass or the new OIDC login. Here while implementing the OIDC login, I changed the authorization method so now for old/login pass I've implemented preemptive login and for OIDC  I've implemented uses bearer_token for authentication when making API call. And recently successfully released v1.0

Here's what I've done so far.

  1. Rewritten the whole app code from Java to Kotlin.
  2. Fixed: Contacts synchronizing improperly 
  3. Fixed: Forcing a synchronization does not work 
  4. Fixed: Wrong synchronization status
  5. Added support for adding multiple XWiki accounts.
  6. Once the preferences screen is opened you can choose to edit the preferences of other XWiki accounts too.
  7. After users and groups, the list is loaded it's stored in DB so it will load instantaneously next time you open the app. 
  8. Fixed: Clicking on the save button does not close the activity. 
  9. Fixed: SocketTimeoutException crash.
  10. OIDC support: Now other apps can request to access the XWiki user info and secondly new OIDC login method where the app first checks if OIDC is supported in your instance and if it's supported the app will launch a webview displaying the login and after login in the browser and giving the consent, the user is logged in.
  11. As the "all users list" consists of many users, I've added pagination support. So now when the user scrolls the list halfway down, it'll automatically load the rest of the users.
  12. Fixed: SSLHandshakeException crash
  13. Reduced the app size, through following Google's recommendation to reduce the app size.

How to use the result of my work

You have several ways to get application "XWiki Android authenticator":

Google play .

My commits .

XWiki CI (Jenkins) .

Github Release .

Also, you can get sources of application and compile it by yourself. For this:

Open the link, https://github.com/xwiki-contrib/android-authenticator . And click on "Clone" and copy the link (usually, it is command git clone ...). After this action, you will have a project on the master branch.
Open the folder and create  local.properties  file with content SDK.dir=%ANDROID_HOME% (here %ANDROID_HOME% is the path to SDK location)
You can import project in Android Studio or build the app by command ./gradlew clean cleanBuildCache build

What was not done

  1. Edit Contact Activity Improvement.
  2. Publish the app on F-Droid.
  3. Provide a library for easy implementation of dedicated XWiki authenticator

Apart from these three tasks, all the issues are done and with some major improvement in the app.

Links to issues which I've completed and resolved

ANDAUTH-63 .
ANDAUTH-62 .
ANDAUTH-54 .
ANDAUTH-57 .
ANDAUTH-38 .
ANDAUTH-58 .
ANDAUTH-61 .
ANDAUTH-59 .
ANDAUTH-55 .
ANDAUTH-53 .
ANDAUTH-43 .
ANDAUTH-47 .
ANDAUTH-48 .
ANDAUTH-49 .
ANDAUTH-27 .

Afterword

I'm truly thankful to my mentor Thomas  and Aleksei Ovsiannikov . Both my mentors were always available and helped when I needed and gave me valuable advice and suggestions.

My GSOC journey with XWiki

Mentors:

I want to thank my mentors Shubham Jain, Neha Gupta and XWiki organisation for giving me such an opportunity and helping me out throughout my journey of GSOC. I also want to also thank Vincent Massol for helping me out in one of my dependent project.

A little bit about me

My name is Ashish Sharma, I am 23 and I am a final year student from Bharati Vidyapeeth's College of Engineering, India. I have participated in GSoC'19 program as a student in XWiki and worked on "Helm chart for XWiki".

What did I expect from GSoC 2019

This was my first Google Summer of Code and the concept to contribute for 3 months in an open-source organisation was exciting for me. I got an opportunity to work remotely on a project. I was curious to explore how an open-source organisation work. Anyway, I have expected new experience in remote internship, open source project contributing, Google Summer of Code participating and international only remote communication.

In this post I want to describe what I have finished and what is not completed yet and why.

Description

This project focoused on creating a helm chart that would deploy xwiki on Kubernetes by using helm templating. The deployment should be configurable to be scalacble, highly available and roboust.

You can find the project code at

https://github.com/xwiki-contrib/xwiki-helm and

The issue tracker can be found

https://jira.xwiki.org/projects/HELM/issues

How to use the result of my work

git clone https://github.com/xwiki-contrib/xwiki-helm
cd xwiki-helm-chart
helm dependency update
helm --debug upgrade -i --force xwiki -f ./values.yaml .

Read about prerequite

Milestones

Milestones 1:

Creating a basic helm chart

  • Understanding xwiki's docker structure.
  • Understanding and taking the decision for using the correct resource to host xwiki.
  • So I started up using the StatefulSet, clusterIP service and ingress.
  • Added values files which help in making the chart dynamically configurable.
  • Then we neded to support multiple databases and was in a need of a solution that don't require to deploy database externally, so a good standard for adding dependency for other services like database were needed.
  • So we decided to add database as a helm dependency, that helped us to templatise the databases in our application which makes deploying databases easier, we don't need to deploy the chart seprately.
  • So we added support for database mysql and postgress through dependency and also given option for user to deploy it's own external database.

Milestestone 2:

Adding support for ISTIO and other features

  • Till now we have a chart that would deploy our standalone application, now we need
  • Added support for ISTIO
  • Till now the helm were taking values from values file, we needed a way to manage our envoirnment variable that we pass to our container, and we also need to secure the sensetive variables like db password. For that I used Kubernetes resources configMaops and Secrets. These help us save and manage our variable securely and properly.
  • XWiki-helm also needed an optional feature to havdle Pod disruption, if the users have a heavy dependency on xwiki. This features make the xwiki chart user configure the minimum number of pods that should be running while pods are been destroyed due to any reason.
  • A need for shared file storage were needed, secially when serviec provider like GKE does not provide ReadWriteMany option, so to run xwiki on cluster we need different database solution like Rook, I had researched about it and also written a blog on how to set up Rook on GKE for shared file system

Milestone 3:

Adding support for clustering,HA and Unit testing

  • While moving towards HA and clustering we got to know that XWiki need shared file storage for clustering which was not available in StatefulSet, so we made a desicion to migrate to Deployment.
  • We needed to add test-cases so I added unit-testing.
  • Clustering was required to take xwiki on HA. For that we need docker to enable option to configure clustering, so first I made changes in docker project and provided option to configure JGroups.
  • Then I needed to provide the option in helm. For that I had to face another challenge to how to pass configuration files needed by JGroup from my helm chart to the container. For that I took the file in ConfigMaps and mounted the file to the xwiki pods. Also provided option to enable and disable JGroups.
  • While enabling clustering we need to know which pods are avialable to accept request and which are dead so that we can route traffic accordingly, for that I needed to configure liveliness and readiness probes, so that kubernetes always get updated with the state of the container and if the container crashes it could restart the pod.
  • XWiki uses solr and the docker it embededs solr internally, but as suggested by XWiki for performance improvement solr should be externalised, so I tried to add it as a dependency but failed due to an immature helm chart of solr, and how the xwiki configures solr, it was not possible with the current solr chart state. So for now I have exposed the basic parameter and the user has to manually setup solr and pass the url of the solr.

Jun 26 2019

Reasons to choose Kotlin

Hello there! My name is Divyansh Jain. I am a student of Mahatma Jyoti Rao Phoole University. I have been selected as the Android developer for the XWiki organization and I am working on their XWiki Android Authenticator application in GSOC19.

XWiki android Authenticator aims to integrate a wiki instance in Android accounts, mainly including the synchronization of contacts and the XWiki authenticator. By synchronizing contacts of your company on your phone, it becomes easier to communicate and collaborate with each other.

Ever since the start of my work on the XWiki Android Authenticator app, I have been constantly learning new things. In the first week, I migrated most of the XWiki Android Application code from Java to Kotlin. And on this page, I would like to share my understanding of Kotlin that I have gained so far.
 

Getting started with Kotlin

Kotlin is officially supported by Google for mobile development on Android. It was released in Android Studio 3.0 on October 2017. At first, I was a bit afraid to switch to Kotlin since I feared that the code might crash and not run properly, but as I read the documentation, I started understanding the nuances of the language which made the switch from Java to Kotlin an easier process. I started realizing the advantages of Kotlin over Java. Some of them being:

Java Interoperability

I started with migrating the whole XWiki Android Authenticator app code from Java to Kotlin. I was replacing one Java file at a time, and while migrating I saw that Kotlin worked with Java smoothly. Though it required some direct imports, there were no errors in running the app on the device.

Changed variable declaration

In Java, we declare string for instance, String str = "Hello";.

In Kotlin, we declare string for instance, val str = "Hello" or val str: String = "Hello". Here val declares a read-only property or local variable whereas var declares a mutable property or local variable.

The final keyword is default in class

In Kotlin final is a default. E.g.

            
class Button {
   fun click() = print("Click")
}

class displayToast : Button() {  // Error
   override fun click() = print("Toast Displayed") // Error
}

In the above example, class displayToast can’t inherit Button class because it is final. Moreover, it can’t override click(), because it is final in Button.

open class Button {
   open fun click() = print("Click")
   fun doubleClick() = print("Double Click")
}

class displayToast () : Button {           // Inheritance is now possible
   override fun click() = print("Toast Displayed") // Now it works
   override fun displayToast () = print("Toast Displayed") // Error
}

In order to inherit and override, we put “open” keyword that allows inheritance and overriding.

Fun keyword for defining functions

Now in Kotlin, there is a new way to define functions. E.g.

fun displayToast() { } //with no arguments inside functions

fun addDigitis (a: int, b: int) : String { }  //with arguments inside function

It is same as the Java parameterized method or empty method.

The when expression

The "switch-case" is replaced with the much more readable and flexible "when" expression: E.g.

int x = 3
when (x) {
   1 -> print("x is 1")
   2 -> print("x is 2")
   3, 4 -> print("x is 3 or 4")
   in 5..10 -> print("x is 5, 6, 7, 8, 9, or 10")
   else -> print("x is out of range")
}

It works without the argument too.

Static keywords

For declaring static methods & variables, you can put them above the class name, then you can use them by importing directly in other classes.

Null Safety

One of the biggest flaws in Java is the way it handles “null,” leading to the dreaded NulPointerException (NPE). Kotlin resolves this by distinguishing between non-null types and nullable types. Types are non-null by default, and can be made nullable by adding a safe call ‘?’. E.g.

var a: String = "abc"
a = null                // compile error

var b: String? = "xyz"
b = null                // no problem

Conclusion

So after seeing, reading and migrating the code from Java to Kotlin, in my honest opinion, I do not see any reason to not choose Kotlin over Java. For instance, we need to write less code as compared to Java, we don't have to face the dreaded ‘NPE’ error anymore, interoperability with existing Java files, smart casts while declaring variables and many more. We've given the fair amount of our time to Java, but it's time to let it go and welcome our new friend Kotlin.

Happy Reading.

Aug 23 2018

Google Summer of Code 2018 Wrap-Up

This is the eleventh year XWiki has participated in the Google Summer of Code program. XWiki had 12 mentors involved at various levels and 3 successful projects implemented. ...

Aug 13 2018

My GSOC adventure with XWiki and Dokuwiki

The project focused on improving the existing DokuWiki importer that imports instances of DokuWiki to XWiki by using some intermediate common events based on Filter Stream Framework. In the previous Dokuwiki importer module already supported basic functionalities. Improvements like support for handling unserializing of files with no metadata, lists, image-link, interwiki-link, macro support and other syntax-parser bug resolution. ...

Aug 08 2018

My GSoC 2018

Aleksei Ovsiannikov summary of experience in participating in GSoC 2018 and open source projects contributing.  ...

Jan 30 2018

Google Code-in 2017 Statistics

Here are some statistics from the Google Code-in 2017 edition: 12 mentors, 380 successful students, 489 successful tasks, 154 merged PRs, 11 issues fixed, 23 contributors, 181 translations improved, 9 repos improved, etc. ...

Jan 22 2018

Google Code-in 2017 Wrap-Up

After being mentors for Google Summer of Code (GSoC) program for more than 10 years, we decided also to mentor pre-university students in the Google Code-in program. We had 489 successfully completed tasks thanks to 380 students and 12 mentors involved in the program. This was the first year we participated as an organization. ...

Dec 27 2017

What happened in 2017?

As the last blog post of the year, this article summarize the main events that happened during the past twelve months inside of the XWiki project. ...

Mar 01 2016

XWiki is participating in Google Summer of Code 2016

XWiki has been accepted as a mentoring organization for Google Summer of Code 2016. Since its inception in 2005, the program has brought together over 10,900 successful student participants from over 103 countries worldwide and over 500 open source organizations, all for the love of code. This is our 9th time participating in the program and we are pretty excited about it. We value the participation in the program since it allows us to meet and discuss ideas with smart students from around the world. ...

Tags:
Created by Sergiu Dumitriu on 2011/03/29
    

Get Connected