Rakai Kayuwangi

Sri Maharaja Rakai Kayuwangi Dyah Lokapala Sri Sajjanotsawatunggadewa was the seventh monarch of the Medang Kingdom of Central Java period (commonly referred as Mataram Kingdom) who ruled between 856 and 885. He is commonly known as Dyah Lokapala, King Lokapala, or Rakai Kayuwangi. King Lokapala was described as a valiant king that defeated his enemies. 
Early life.
Rakai Kayuwangi was the youngest son of Rakai Pikatan from his queen consort Pramodawardhani. His name at birth was Dyah Lokapala (according to the Wantil or Shivagrha inscription inscription) or Mpu Lokapala (according to the Argapura inscription). In the Mantyasih inscription dated to 907, he is named as Rakai Kayuwangi. 
The name Lokapala is probably linked to the Lokapala, the Hindu guardian gods of directions. "Loka" means place, while "pala" means fruit. The name "kayuwangi" literally means "fragrant wood" which refers to aromatic sandalwood, a fragrant wood considered as a valuable timber in ancient Java. The name Rakai Kayuwangi is actually a title. Historians suggest that before he ascended to become Maharaja of Java, Prince Lokapala was the "Rakai" (ancient Javanese title equate to Lord or Duke) of Kayuwangi province.
Rule.
According to the Shivagrha inscription issued by King Lokapala on 12 November 856, he inaugurated a grand Shiva temple which is identified by historians as the Prambanan temple compound. According to this inscription, the temple was built to honor Lord Shiva, and its original name was "Shiva-grha" (the House of Shiva).
According to the Shivagrha inscription, Dyah Lokapala was chosen as the successor of his father, namely Sang Jatiningrat, which was the title Rakai Pikatan had assumed after he abdicated and retreated as a brahmin. The eldest child of Pikatan and Pramodhawardhani was Rakai Gurunwangi Dyah Saladu. However, despite being the eldest, Gurunwangi was not selected as Pikatan's successor. It was Lokapala, the youngest son, that was promoted as the royal successor, because of his heroic merits in defeating his father's enemies, who made a stronghold on the hill of Ratu Boko. King Lokapala reigned for about 30 years, and was succeeded by Dyah Tagwas in 885.