Saturday 30 July 2016

Chikmagalur : Weekend Getaway from Bangalore

If planning for a best, short & relaxed weekend getaway from Bangalore then Chikmagalur is a good destination.


Driving to Chikmagalur:


Driving ourself to Chikmagalur itself is a wonderful experience. Bangalore > Nelamangala > Kunigal > CR Pattana > Hassan > Belur > Chikmagalur. From Bangalore till Hassan, it is NH75 road  with proper marking. There are not many restaurants or coffee shop as we see in Bangalore <> Mysore road but few are there. Kamat and A2B are couple of chain hotels we could find. Beware of another hotel in the same name as Kamat which is not the original Kamat chain. I think it is near CR pattana or before CR pattana, we could see lots of people selling fresh cucumber, it was so fresh and watery and damn cheap; it is a must try in my opinion. After Hassan, its a SH road no clear marking but a good one. As we approach chikmagalur, we could see lots of vegetable farm, greenish lands, continuous mountain range.




Place of Stay:


Chikmagalur is famous for it homestay type accommodation instead of hotels. And the budget of homestay ranges from few hundreds to 10000 depending on the type of stay we choose. There are stays which will be inside dense forest and in coffee estates. Uphill to Western Ghat  is another wonderful & enjoyable drive. Since I went in monsoon time, two sides of the road are full green, full of fog. If we switch off the engine, then it will be a pin drop silence and we get very fresh & finest air to breathe. If people behind you are honking, leave them and enjoy the slow drive with scenic view.

Place where we stayed is Jhari-EcoStay (http://www.jhari.in/), this like any other home stay provide all 3 times food and hi-tea. One unique thing about this home stay is, natural waterfalls is part of this homestay which is private and for guests use only.

Private waterfalls for guests use
For stay in this place, we need to have a prior booking. This property has lots of other activities like carom, shuttle, trekking, camp fire etc.

Leisure area near the waterfalls

One of the room in Jhari-EcoStay

Other places near the property are Mullayanagiri & Bababudan giri. Mullayanagiri is the highest peak in Karnataka, driving is not so easy as we approach the top. It would be better if we stop the vehicle a KM before the peak and go by walk. If we go by walk, we can enjoy the chill weather and the mist. 




Souvenirs:


Things to buy from Chikmagalur are mainly coffee powder, spices like elachi & pepper. We can also buy fresh vegetables from road sides, also lots of nursery's are there and we can buy few plants. 


Tuesday 5 July 2016

Using MDS (MetaData Service) API to list all the deployed composites in SOA

The jar mdsrt.jar contains all the necessary API to explore contents inside MDS (MetaData Store). Unfortunately there is no javadoc for the classes inside this jar, atleast I couldn't find couple of blog links to understand the usage of some MDS APIs.

In this blog, my intention is to show how to read a file using MDS API.

The first task is to write the adf-mds-confix.xml file which contains the configuration information to connect to MDS and the <metadata-namespaces> contains the name of the folders whose sub-folders or files that will be accessed using MDS API.

<?xml version = '1.0' encoding = 'UTF-8'?>
 <adf-config xmlns="http://xmlns.oracle.com/adf/config">
    <adf-mds-config xmlns="http://xmlns.oracle.com/adf/mds/config">
       <mds-config version="11.1.1.000" xmlns="http://xmlns.oracle.com/mds/config">
                <persistence-config>
                         <metadata-namespaces>
                                 <namespace path="/soa/shared" metadata-store-usage="soa-infra-store">
                                 </namespace>
                                 <namespace path="/apps" metadata-store-usage="soa-infra-store"/>
                         </metadata-namespaces>
                         <metadata-store-usages>
                                <metadata-store-usage id="soa-infra-store">
                                        <metadata-store xmlns="http://xmlns.oracle.com/mds/config"
                                                                        class-name="oracle.mds.persistence.stores.db.DBMetadataStore">

                                                        <property name="jndi-datasource" value="jdbc/mds/owsm"/>

                                                          <property name="partition-name" value="soa-infra"/>
                                         </metadata-store>
                                  </metadata-store-usage>
                          </metadata-store-usages>

      </persistence-config>
 </mds-config>
     </adf-mds-config>
  </adf-config>




    /**
     * This API returns the list of deployed composited in SOA server
     * 
     * @return list of composites
     */
    public List<Composite> getDeployedComposites() {
        List<Composite> deployedList = new ArrayList<>();
        try {
            // Read the adf-mds-config.xml config file which has the configuration information for reading a file from MDS            
            File adfConfigPath = new File(configPath.toString());
            MDSConfig config = new MDSConfig(adfConfigPath.toURL());
            
            // Create MDS instance & Session
            MDSInstance mdsInstance = MDSInstance.getOrCreateInstance("TargetInstance", config);
            MDSSession mdsSession = mdsInstance.createSession(new SessionOptions(null, null, new CustConfig(new CustClassListMapping[0])), null);
            
            // Form a query which reads the deployed-composites.xml file
            NameQueryImpl query = new NameQueryImpl(mdsSession, ConditionFactory.createNameCondition("/deployed-composites", "deployed-composites.xml", true));
            Iterator<DocumentResult> r = query.execute();
            while(r.hasNext()) {
                DocumentResult dr = r.next();                
                if (dr.getAbsoluteName().endsWith(".xml")) {
                    MetadataObject mdObj = mdsSession.getMetadataObject(dr.getAbsoluteName());
                    
                    // Get the DOM object of the deployed-compisite.xml
                    Document doc = mdObj.getDocument(true);
                    
                    // Access the composite name from the xml
                    // eg: <composite-series name="default/ScheduledProcessFlow" default="default/ScheduledProcessFlow!2.0">
                    NodeList nList = doc.getElementsByTagName("composite-series");
                    for (int i=0;i<nList.getLength();i++) {
                            Node node = nList.item(i);
                            String str = node.getAttributes().getNamedItem("default").getNodeValue();
                            
                            // Add composite details to the list
                            deployedList.add(getCompositeObj(str));
                    }                    
                    break;
                }
            }
        } catch(Exception ex) {
           throw new RuntimeException("Unable to read the deployed-composites.xml file " + "\n" + ex.getMessage());
        }
        return deployedList;

    }


Some blog links which I referred


http://oraclemw.blogspot.in/2011/04/working-with-oracle-mds-repository.html

http://amulyamishras-tech-blog.blogspot.in/2013/07/adf-nds-use-mds-api-to-remove.html
http://www.oracle.com/technetwork/developer-tools/jdev/metadataservices-fmw-11gr1-130345.pdf