Wednesday, 31 October 2012

CONFIGURING DATASOURCE IN TOMCAT 6

//CONFIGURING DATASOURCE IN TOMCAT 6




STEP 1: Include the following Resource element inside GlobalNamingResources element in server.xml located in apache_tomcat_root/conf
<GlobalNamingResources>
……………………….
<Resource auth="Container" type="javax.sql.DataSource" driverClassName="com.ibm.db2.jcc.DB2Driver"                 url="jdbc:db2://localhost/ACETEST" name="jdbc/SAMPLETEST"     username="db2admin"     password="db2admin" />
…………………………….

  </GlobalNamingResources>
 //url={your database server url}
 //  name={your datasource  name} 
 //  username/password={your database username/password}

STEP 2: Include the following ResourceLink element inside Context element in context.xml located in apache_tomcat_root/conf
<Context>
………………….
<ResourceLink name="jdbc/SAMPLETEST" global="jdbc/SAMPLETEST" type="javax.sql.DataSource"/>
……………………
</Context>

STEP 3: Use the datasource to get the connection
 //code to access the datasource
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource) envCtx.lookup("jdbc/SAMPLETEST");
Connection c = ds.getConnection();


Saturday, 27 October 2012

dijit tooltip example

//dijit tooltip example

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html dir="ltr">
   
    <head>
        <style type="text/css">
            body, html { font-family:helvetica,arial,sans-serif; font-size:90%; }
        </style>
//importing required css
      <link rel="stylesheet" href="<%=request.getContextPath() + "/dojo1.4.3/dijit/themes/tundra/tundra.css"%>" />
       
       <script language="JavaScript" src="<%=request.getContextPath() +"/dojo1.4.3/dojo/dojo.js"%>" djconfig="parseOnLoad:true"></script>  //making parse on load true 
        <script>
            dojo.require("dijit.Tooltip");
            dojo.addOnLoad(function() {
                // create a new Tooltip and connect it to tooltipId
                new dijit.Tooltip({
                    connectId: ["tooltipId"],//to which dom id tool tip should connect
                    label: "<b>dijit toolTip example</b>" //this content will be displayed in tool tip
                });
       
            });
        </script>       
    </head>
   
    <body class="tundra">
        <span id="tooltipId" >
            Hover over this text
        </span>
     
    </body>

</html>

output:-

TabContainer programatic in dojo

//Programatic tabContainer in dojo

<!DOCTYPE html>
<html >
<head>
//including required css files
<link rel="stylesheet" href="<%=request.getContextPath() + "/dojo1.4.3/dijit/themes/tundra/tundra.css"%>" />//including tundra css
<link rel="stylesheet" href="<%=request.getContextPath() + "/dojo1.4.3/dijit/themes/tundra/layout/TabContainer.css"%>" />//including tabcontainer css
<link rel="stylesheet" href="<%=request.getContextPath() + "/dojo1.4.3/dijit/themes/tundra/layout/ContentPane.css"%>" />//including contentPane css
<script language="JavaScript" src="<%=request.getContextPath() +"/dojo1.4.3/dojo/dojo.js"%>" djconfig="parseOnLoad:true"></script> //declaring parse on load true  
<script>
//importing required js files
dojo.require("dojo.parser");
dojo.require("dijit.layout.TabContainer");
dojo.require("dijit.layout.ContentPane");
dojo.ready(function(){
    var tc = new dijit.layout.TabContainer({//creating main tabContainer
        style: "height: 100%; width: 100%;"
    }, "progTab");

    var cp1 = new dijit.layout.ContentPane({//creating first tab inside the container
         title: "Home",
         content: "Welcome to dojo "
    });
    tc.addChild(cp1);//appending content pane to tabContainer

    var cp2 = new dijit.layout.ContentPane({//creating second tab inside the container
         title: "Contactus",
         content: "chennai"
    });
    tc.addChild(cp2);//appending content pane to tabContainer

    tc.startup();//Starting tabContainer
});
</script>
</head>
<body class="tundra">
   <div style="width: 350px; height: 290px">
    <div id="progTab"></div>//finally all content will be placed here
</div>
</body>
</html>

output:-

TabContainer in dojo

//Example for tabContainer in dojo


<!DOCTYPE html>
<html >
<head>
//import required css
<link rel="stylesheet" href="<%=request.getContextPath() + "/dojo1.4.3/dijit/themes/tundra/tundra.css"%>" />
<link rel="stylesheet" href="<%=request.getContextPath() + "/dojo1.4.3/dijit/themes/tundra/layout/TabContainer.css"%>" />
<link rel="stylesheet" href="<%=request.getContextPath() + "/dojo1.4.3/dijit/themes/tundra/layout/ContentPane.css"%>" />
<script language="JavaScript" src="<%=request.getContextPath() +"/dojo1.4.3/dojo/dojo.js"%>" djconfig="parseOnLoad:true"></script>    //enabling add on load
<script>
dojo.require("dojo.parser");
dojo.require("dijit.layout.TabContainer");
dojo.require("dijit.layout.ContentPane");
</script>
</head>
<body class="tundra">//apply the tundra css style
    <div style="width: 350px; height: 300px">//you can change height and width
    <div dojoType="dijit.layout.TabContainer" style="width: 100%; height: 100%;">//our main container
        <div dojoType="dijit.layout.ContentPane" title="Home" selected="true">
            Welcome to dojo tutorial //content inside the tabs
        </div>
        <div dojoType="dijit.layout.ContentPane" title="AboutUs">//individual tabs
            software develpper//content inside the tabs
        </div>
        <div dojoType="dijit.layout.ContentPane" title="Contact us" closable="true">//tabs can be closed
            chennai//content inside the tabs
        </div>
    </div>
</div>
</body>
</html>


output:-

dojox enhanced data grid

//best example for dojox enhanced data grid


<!DOCTYPE html>
<html >
<head>
//include requiredcss files
<link rel="stylesheet" href="<%=request.getContextPath() + "/dojo1.4.3/dojox/grid/enhanced/resources/EnhancedGrid.css"%>" type="text/css">
<link rel="stylesheet" href="<%=request.getContextPath() + "/dojo1.4.3/dojox/grid/enhanced/resources/tundraEnhancedGrid.css"%>" />
<link rel="stylesheet" href="<%=request.getContextPath() + "/dojo1.4.3/dojox/grid/enhanced/resources/EnhancedGrid_rtl.css"%>" type="text/css">
<style>
#grid {
    width: auto;
    height: 10em;
}</style>
<script language="JavaScript" src="<%=request.getContextPath() +"/dojo1.4.3/dojo/dojo.js"%>" djconfig="parseOnLoad:true"></script>
<script>
//importing reqired js files
dojo.require("dojox.grid.EnhancedGrid");
dojo.require("dojo.data.ItemFileWriteStore");

dojo.ready(function(){
    /*set up data store*/
    var itemData={"identifier":"studentId",
                   "items":[{"studentId":"244","studentName":"krishna","stream":"cse","result":"pass"},
                            {"studentId":"245","studentName":"kittu","stream":"ece","result":"pass"},
                            {"studentId":"246","studentName":"arush","stream":"cse","result":"fail"},
                            {"studentId":"247","studentName":"rakesh","stream":"cse","result":"pass"},
                            {"studentId":"248","studentName":"puneeth","stream":"cse","result":"fail"},
                            {"studentId":"249","studentName":"vidhehi","stream":"it","result":"fail"}]};
    var store = new dojo.data.ItemFileWriteStore({data: itemData});

    /*set up layout*/
    var layout = [[
      {'name': 'Student Id', 'field': 'studentId','width':'auto'},
      {'name': 'Student Name', 'field': 'studentName','width':'auto'},
      {'name': 'Stream', 'field': 'stream','width':'auto'},
      {'name': 'Result', 'field': 'result', 'width':' auto'}
    ]];

    /*create a new grid:*/
    var grid = new dojox.grid.EnhancedGrid({
        id: 'grid',
        store: store,
        structure: layout,
        rowSelector: '20px'},
      document.createElement('div'));

    /*append the new grid to the div*/

    dojo.byId("gridDiv").appendChild(grid.domNode);

    /*Call startup() to render the grid*/
    grid.startup();
});</script>
</head>
<body class="tundra">
    <div id="gridDiv"></div>//finally the grid will be shown here
</body>
</html>


output:-

Friday, 26 October 2012

SaxParser example

//Sax parser example


package com.apress.sax;

import org.xml.sax.*;
import javax.xml.parsers.*;
import org.xml.sax.helpers.DefaultHandler;
import java.io.*;

public class SAXParserApp {

    public static void main(String argv[]) {

        SAXParserApp saxParserApp = new SAXParserApp();
        saxParserApp.parseDocument();//c

    }

    public void parseDocument() {

        try {
            SAXParserFactory factory = SAXParserFactory.newInstance();
            SAXParser saxParser = factory.newSAXParser();
            DefaultHandler handler = new CustomSAXHandler();
            saxParser.parse(new File("catalog.xml"), handler);
        } catch (SAXException e) {
        } catch (ParserConfigurationException e) {
        } catch (IOException e) {
        }
    }

    private class CustomSAXHandler extends DefaultHandler {
        public CustomSAXHandler() {
        }

        public void startDocument() throws SAXException {
            System.out.println("Event Type: Start Document");
        }

        public void endDocument() throws SAXException {
            System.out.println("Event Type: End Document");
        }

        public void startElement(String uri, String localName, String qName,
                Attributes attributes) throws SAXException {
            System.out.println("Event Type: Start Element");
            System.out.println("Element Name:" + qName);
            for (int i = 0; i < attributes.getLength(); i++) {
                System.out.println("Attribute Name:" + attributes.getQName(i));
                System.out.println("Attribute Value:" + attributes.getValue(i));
            }

        }

        public void endElement(String uri, String localName, String qName)
                throws SAXException {
            System.out.println("Event Type: End Element");
        }

        public void characters(char[] ch, int start, int length)
                throws SAXException {
            System.out.println("Event Type:  Text");
            String str = (new String(ch, start, length));
            System.out.println(str);
        }
       
        public void error(SAXParseException e)
        throws SAXException{
            System.out.println("Error: "+e.getMessage());
        }

        public void fatalError(SAXParseException e)
             throws SAXException{
            System.out.println("Fatal Error: "+e.getMessage());
        }

        public void warning(SAXParseException e)
          throws SAXException{
            System.out.println("Warning: "+e.getMessage());
        }
    }

}

DomParser example

//Example of dom parser

package com.apress.dom;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
import java.io.*;

public class DOMParser {

    public static void main(String argv[]) {
        try {
            // Create a DocumentBuilderFactory
            DocumentBuilderFactory factory = DocumentBuilderFactory
                    .newInstance();
            File xmlFile = new File("catalog.xml");//our xml file
            // Create a DocumentBuilder
            DocumentBuilder builder = factory.newDocumentBuilder();
            // Parse an XML document
            Document document = builder.parse(xmlFile);
            // Retrieve Root Element
            Element rootElement = document.getDocumentElement();//getting root element
            System.out.println("Root Element is: " + rootElement.getTagName());
            visitNode(null, rootElement);//passing root element to recurcive visitnode function

        } catch (SAXException e) {
            System.out.println(e.getMessage());

        } catch (ParserConfigurationException e) {
            System.out.println(e.getMessage());

        } catch (IOException e) {
            System.out.println(e.getMessage());
        }
    }

    public static void visitNode(Element previousNode, Element visitNode) {//parsing xml
        if (previousNode != null) {
            System.out.println("Element " + previousNode.getTagName()
                    + " has element:");
        }
        System.out.println("Element Name: " + visitNode.getTagName());
        if (visitNode.hasAttributes()) {
            System.out.println("Element " + visitNode.getTagName()
                    + " has attributes: ");
            NamedNodeMap attributes = visitNode.getAttributes();

            for (int j = 0; j < attributes.getLength(); j++) {
                Attr attribute = (Attr) (attributes.item(j));
                System.out.println("Attribute:" + attribute.getName()
                        + " with value " + attribute.getValue());

            }
        }
        // Obtain a NodeList of nodes in an Element node.

        NodeList nodeList = visitNode.getChildNodes();
        for (int i = 0; i < nodeList.getLength(); i++) {
            Node node = nodeList.item(i);
            // Retrieve Element Nodes
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                Element element = (Element) node;
                visitNode(visitNode, element);
            } else if (node.getNodeType() == Node.TEXT_NODE) {
                String str = node.getNodeValue().trim();
                if (str.length() > 0) {
                    System.out.println("Element Text: " + str);

                }
            }
        }
    }
}

Sunday, 21 October 2012

Jdbc Example Program

//the aim of bellow program is to make a sample jdbc program

//Bellowis my dao database class which has a createConnection() method which returns me connection object
public class oracleDAO {
    public static final String DRIVER = "oracle.jdbc.driver.OracleDriver";//database driver name

    public static final String DBURL = "jdbc:oracle:thin:@localhost:1521:XE";//database url

    public static final String DBUSER = "system";//database userid

    public static final String DBPASS = "system";//database password

    // method to create Oracle connections
    public static Connection createConnection() {
        // Use DRIVER and DBURL to create a connection
        // Recommend connection pool implementation/usage
        Connection conn=null;
        try {

            Class.forName("oracle.jdbc.driver.OracleDriver");//invoking the driver

            conn = DriverManager.getConnection(DBURL,DBUSER,DBPASS);//getting connection by passing database url , database password
            System.out.println("DATABASE CONNECTION ESTABLISHED!n\n");

        }

        catch (ClassNotFoundException ce) {

            System.out
                    .println("Sorry error in loading class.....Class not found.");
        }

        catch (SQLException se) {

            System.out
                    .println("\t!!!!!!!!!!DATABASE CONNECTION IS NOT ESTABLISHED!!!!!!!!!!!\n\n");
        }

        return conn;
    }
}









//Bellow is my bean were i will store the data from front end at servlet and pass to database layer

public class LoginBean {
    public String username;
    public String password;
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }

}


//Below is my class which access the database and get the details of login table and checks for username and password and returns true or false based on the credentials which was created by me in oracle database


import java.sql.*;

import javax.swing.text.html.HTMLDocument.Iterator;


import com.tcs.practice.dto.LoginBean;

public class CheckLogin {

    public String checkUserCredential(LoginBean ob) {
        String dbUsername="";
        String dbPassword="";
    try{
        Connection con = oracleDAO.createConnection();//getting connection object
        Statement st=con.createStatement();//getting statement
        ResultSet s = st.executeQuery("select * from login");//firring a sql querry
        //Iterator it = s.i
        while (s.next()) //iterating through the result set
         {
         dbUsername=s.getString("username");//getting the username column value
         dbPassword=s.getString("password");//getting the password column value
         System.out.println("username" + s.getString("username"));
         }
    }
        catch(Exception e){
            e.printStackTrace();
            }
       if(dbUsername.equals(ob.getUsername()) && dbPassword.equals(ob.getPassword()))
        return "true";
       else
         return "false";
    }
}





css Horizontal Drop Dopwn


Simple Css Horizontal  Drop Dopwn best example


<html>
<head>
<style>
ul
{
list-style-type: none;
}
li
{
float:left;
position:relative;
}
ul li a
{
text-align: center;
height:30px;
width:150px;
text-decoration:none;
display:block;
color:#00;
border:solid;
}
ul ul
{
 position:absolute;
 visibility : hidden;
}
ul li:hover ul
{
visibility: visible;
}
</style>
</head>
<body>
<ul>
<li><a href="#">About Us</a>
<ul>
<li><a href="#">Link1</a></li>
<li><a href="#">Link2</a></li>
<li><a href="#">Link3</a></li>
<li><a href="#">Link4</a></li>
</ul>
</li>
<li><a href="#">Trading and Financial Product</a>
<ul>
<li><a href="#">Link1</a></li>
<li><a href="#">Link2</a></li>
<li><a href="#">Link3</a></li>
<li><a href="#">Link4</a></li>
</ul>
</li>
<li><a href="#">Network Engineering</a>
<ul>
<li><a href="#">Link1</a></li>
<li><a href="#">Link2</a></li>
<li><a href="#">Link3</a></li>
<li><a href="#">Link4</a></li>
</ul>
</li>
<li><a href="#">Graphic Design</a>
<ul>
<li><a href="#">Link1</a></li>
<li><a href="#">Link2</a></li>
<li><a href="#">Link3</a></li>
<li><a href="#">Link4</a></li>
</ul>
</li>
<li><a href="#">Services</a>
<ul>
<li><a href="#">Link1</a></li>
<li><a href="#">Link2</a></li>
<li><a href="#">Link3</a></li>
<li><a href="#">Link4</a></li>
</ul>
</li>
</ul>
</body>
</html>

Saturday, 20 October 2012

HttpClient example


//Sample example for using httpclient and firing a getmethod and parsing the response with abdera parser

public class testUrl {
public static void main(String args[]){
    String sourceMethod = "getMessageBoard";
    Response response = null;
    ResponseBuilder builder = null;
    System.out.println("entering ");
    try {
        HttpClient client = new HttpClient();//getting httpclient object
        GetMethod method = new GetMethod("your feed url for getting blogs xml of connections or any feed url");  //preparing the get method   
        int status = client.executeMethod(method); //firing the get url
        System.out.println("Get status is: " + status); //printing the status

        String responseData = method.getResponseBodyAsString();
        System.out.println("Response Data is: " + responseData); //printing the response stream
        Parser parser = Abdera.getNewParser(); //getting parser object
        try {

            InputStream in = method.getResponseBodyAsStream();//geting response data as stream and parsing it

            Document<Feed> doc = parser.parse(in); //passing inputstream to parse function
            JSONArray data = FeedParser.atomparse(doc);// parse function is given bellow
            JSONObject finalJsonObject = new JSONObject();

            finalJsonObject.put("items", data);
            String responseString = finalJsonObject.toString();
            builder = Response.ok(responseString , MediaType.APPLICATION_JSON);//this is useful for making your application as rest other wise you can omit this line and bellow line
            response = builder.build();    //you can send this response using rest api or send to jsp for printing by iterating

        } catch (Exception e) {
            e.printStackTrace();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
   
}
}

//Bellow is the parser class for getting json array of required content from blogs xml by parsing it
public class FeedParser {

    public static JSONArray atomparse(Document<Feed> commDom) {
        JSONArray blogList = null;
        try {

            blogList = new JSONArray();

            Feed feed = commDom.getRoot();
            List<Entry> requiredEntries = feed.getEntries();

            for (Entry entry : requiredEntries) {

                JSONObject blog = new JSONObject();
                // System.out.println("-- starting of entry --");
                List<Element> elements = entry.getElements();
                for (Element allEntries : elements) {
                    if (allEntries.getQName().getLocalPart().equals("link")) {
                        String attrValue = allEntries.getAttributeValue("rel");
                        if (attrValue.equals("alternate")) {
                            System.out.println("link -> "
                                    + allEntries.getAttributeValue("href"));
                            blog.put("link",
                                    allEntries.getAttributeValue("href"));
                        }
                    }
                    if (allEntries.getQName().getLocalPart().equals("rank")) {
                        System.out.println("snx:rank -> " +
                         allEntries.getText());
                        System.out.println("individual scheme values"+allEntries.getAttributeValue("scheme"));
                        if(allEntries.getAttributeValue("scheme").contains("hit")){
                        System.out.println("number of visits"+allEntries.getText());
                        blog.put("Visits",allEntries.getText());                               
                        }
                        else if(allEntries.getAttributeValue("scheme").contains("comment")){
                        System.out.println("number of comments"+allEntries.getText());   
                        blog.put("Comments",allEntries.getText());
                        }
                        //blog.put("summary", allEntries.getText());
                    }
                    if (allEntries.getQName().getLocalPart().equals("summary")) {
                        // System.out.println("summary -> " +
                        // allEntries.getText());
                        blog.put("summary", allEntries.getText());
                    }
                    if (allEntries.getQName().getLocalPart().equals("updated")) {
                        String reqTime = allEntries.getText();//parsing date
                        String dateString = reqTime.substring(0,
                                reqTime.indexOf('T'));
                        SimpleDateFormat dateFormat = new SimpleDateFormat(
                                "yyyy-MM-dd");
                        String reqDate = "";
                        String converted = "";
                        try {
                            Date convertedDate = dateFormat.parse(dateString);
                            reqDate = convertedDate.toString();
                            converted = reqDate.substring(3,
                                    reqDate.indexOf(':') - 3);
                        } catch (java.text.ParseException e) {

                            e.printStackTrace();
                        }

                        blog.put("updated", converted);
                    }
                    if (allEntries.getQName().getLocalPart().equals("title")) {
                        // System.out.println("title -> " +
                        // allEntries.getText());
                        blog.put("title", allEntries.getText());
                    }

                    if (allEntries.getQName().getLocalPart().equals("author")) {
                        List<Element> objectElements = allEntries.getElements();
                        for (Element allElements : objectElements) {
                            if (allElements.getQName().getLocalPart()
                                    .equals("name")) {
                                // System.out.println("author  -> "
                                // + allElements.getText());
                                blog.put("author", allElements.getText());
                            }

                        }
                    }
                }
                // System.out.println("-- ending of entry --");
                blogList.add(blog);
            }

        } catch (Exception e) {
            System.out.println(e);
        }

        return blogList;
        // End of Function
    }
}

Abdera Atom feed parser eample


//sample code to parse a atom feed by passing blogs/profiles/community xmls requires abdera jar files

import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import org.apache.abdera.Abdera;
import org.apache.abdera.model.Element;
import org.apache.abdera.model.Entry;
import org.apache.abdera.model.Document;
import org.apache.abdera.model.Feed;
import org.apache.abdera.parser.ParseException;
import org.apache.abdera.parser.Parser;

public class Test {

    private static void readTags(String path) {
        System.out.println("Parsing File:" + path);
        System.out.println(" getting updera");
        Abdera abdera = new Abdera();
        Parser parser = abdera.getParser();
        URL localFileURL;
        Document<Feed> commDom = null;
        try {
            localFileURL = new URL(new File(path).toURI().toString());//getting our file
            commDom = parser.parse(localFileURL.openStream());//passing xml as a stream
        } catch (NoClassDefFoundError e) {
            e.printStackTrace();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        Feed feed = commDom.getRoot();//getting the feed root element
        List<Entry> requiredEntries = feed.getEntries();//getting entries in a feed
        for (Entry entry : requiredEntries) {
            System.out.println("-- starting of entry --");
            List<Element> elements = entry.getElements();
            for (Element allEntries : elements) {
                if (allEntries.getQName().getLocalPart().equals("link")) {//searching for our match element
                    String attrValue=allEntries.getAttributeValue("rel");
                    if(attrValue.equals("alternate"))
                    System.out.println("link hai -> " + allEntries.getAttributeValue("href"));
                }
                if (allEntries.getQName().getLocalPart().equals("rank")) {
                    System.out.println("individual scheme values"+allEntries.getAttributeValue("scheme"));
                    if(allEntries.getAttributeValue("scheme").contains("hit")){
                    System.out.println("number of visits:-"+allEntries.getText()); //prints no.of visits  
                    }
                    else if(allEntries.getAttributeValue("scheme").contains("comment")){
                    System.out.println("number of comments:-"+allEntries.getText());   //prints no.of comments
                    }
                    //blog.put("summary", allEntries.getText());
                }
                if (allEntries.getQName().getLocalPart().equals("summary")) {
                    System.out.println("summary -> " + allEntries.getText());//prints the summary
                }
               
                if (allEntries.getQName().getLocalPart().equals("author")) {
                    List<Element> objectElements = allEntries.getElements();
                    for (Element allElements : objectElements) {
                        if (allElements.getQName().getLocalPart()
                                .equals("name")) {
                            System.out.println("author  -> "
                                    + allElements.getText());//printing content inside the element
                        }
                    }
                }
            }
            System.out.println("-- ending of entry --");
        }

    }

    /**
     * @param args
     */
    public static void main(String[] args) {
        String profileTagsPath = "D:\\blogs.xml"; //this can be any atom feed xml given by connections
        readTags(profileTagsPath);
        System.out.println("parsing completed");
    }

}

Lotus connections 3.0 API


//use full urls for getting atom feeds for connections

 
profiles:->{no handle}

1)Getting profile information of particular user by passing user id
https://x.y.com/profiles/atom/profile.do?userid=56AF1BEE-9CE1-4BAE-956F-8DC882B868C9

message board:->

1)getting all message board data

https://x.y.com/profiles/atom/mv/theboard/entries/all.do

2)getting message board of profiles

https://x.y.com/profiles/atom/mv/theboard/entries.do?email=p%40a.com
--------------------------------------------------------------------------------
Communities:-> {no handle}

1)getting community service document->from this you can get urls

https://x.y.com/communities/service/atom/service

2)getting atom feed of all public communities

https://x.y.com/communities/service/atom/communities/all

3)getting atom feed of my communities

https://x.y.com/communities/service/atom/communities/my

4)getting feed of particular community by passing community id

https://x.y.com/communities/service/atom/community/instance?communityUuid=97a426bf-644a-4477-ab87-9300fa80f851

5)getting the members of a particular community

https://x.y.com/communities/service/atom/community/members?communityUuid=97a426bf-644a-4477-ab87-9300fa80f851

6)getting blogs of a community by givving community id

https://x.y.com/blogs/97a426bf-644a-4477-ab87-9300fa80f851/feed/entries/atom

7)getting community xml by passing the community id

https://x.y.com/communities/service/atom/community/instance?communityUuid=e55aba29-552d-4fea-9d6c-13c5e9dd5ea7

--------------------------------------------------------------------------------
Blogs:-> {welcome:->is my handle}

1)getting all the blogs

https://x.y.com/blogs/welcome/feed/entries/atom


2)Top five recently updated  posts in all blogs

https://x.y.com/blogs/welcome/feed/featured/atom

3)Recent comments of blogs

https://x.y.com/blogs/welcome/feed/comments/atom

Custom single threaded java server

 package com.diffengine.csv; import java.io.*; import java.net.*; import java.util.Date; public class Server { public static void main(Str...