Click here to Skip to main content
15,888,320 members
Articles / Operating Systems / Windows

Software Project Cost Estimates Using COCOMO II Model

Rate me:
Please Sign up or sign in to vote.
4.57/5 (18 votes)
10 Jan 200514 min read 355.8K   4.6K   68  
Describes simple COCOMO II cost estimation steps for a real software project.
package db_provider;

import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;

//--------------------------------------------------------------------
// Provides metadata and general information about database
//--------------------------------------------------------------------

public class MetadataViewer extends ConnectionPoolHandler 
{
    public String getDBName()
	{ 	    
	    return "Database 1.0";  
	}
	    
	public String getDBSize()
	{ 	    
	    return "Function getDBSize() is not currently implemented";  
	}
	
	public String getDBMSName()
    {
    	String dbversion = null;
    	
    	try
		{
    	    DatabaseMetaData dbmd = conn.getMetaData();
    	    
            //PostgreSQL 7.4.5
    	    dbversion = dbmd.getDatabaseProductName() + " " + dbmd.getDatabaseProductVersion();
    	    
    	    return dbversion; 
		}
    	catch (SQLException e)
		{
		    System.err.println("SQLException: " + e.getMessage());
		} 
    	return "Get DB Version Error!";        
    }
    
    public String getJDBCDriverName()
    {
    	String jdbcversion = null;
    	
    	try
		{
    	    DatabaseMetaData dbmd = conn.getMetaData();
    	    
            //PostgreSQL Native Driver, PostgreSQL 7.4.4 JDBC3 with SSL (build 215), 7, 4
    	    jdbcversion = dbmd.getDriverName() + ", " + dbmd.getDriverVersion() + ", " + dbmd.getDriverMajorVersion() + ", " + dbmd.getDriverMinorVersion();
    	    
    	    return jdbcversion; 
		}
    	catch (SQLException e)
		{
		    System.err.println("SQLException: " + e.getMessage());
		} 
    	return "Get JDBC Version Error!";        
    }
 
    public /*protected*/ ResultSet getTableNames()
    { 	    
     	ResultSet rs = null;
     	String[] tt = { "TABLE" };
    	
      	try
		{
    	    DatabaseMetaData dbmd = conn.getMetaData();
    	    rs = dbmd.getTables(null,null,"%", tt);	    
		}
    	catch (SQLException e)
		{
		    System.err.println("SQLException: " + e.getMessage());
		} 
   	
    	return rs;  
    }
    
    public /*protected*/ ResultSet getIndexNames()
    { 	    
     	ResultSet rs = null;
     	String[] tt = { "INDEX" };
    	
      	try
		{
    	    DatabaseMetaData dbmd = conn.getMetaData();    	    
      	    rs = dbmd.getTables(null,null,"%", tt);
 		}
    	catch (SQLException e)
		{
		    System.err.println("SQLException: " + e.getMessage());
		} 
   	
    	return rs;  
    }
    
    public /*protected*/ String getConnectionString()
    {
    	String connectionstring = null;
    	
    	try
		{
    	    DatabaseMetaData dbmd = conn.getMetaData();
    	    
            //jdbc:postgresql://localhost:5432/database
    	    connectionstring = dbmd.getURL();
    	    
    	    return connectionstring; 
		}
    	catch (SQLException e)
		{
		    System.err.println("SQLException: " + e.getMessage());
		} 
    	return "Get Connection String Error!";        
    }
    
    public int getMaxConnections()
    { 	    
    	int iMax;
    	
    	try
		{
    	    DatabaseMetaData dbmd = conn.getMetaData();
    	    
      	    //8192
    	    iMax = dbmd.getMaxConnections();
    	    //iMax = dbmd.getC.getConnection();
    	    
    	    return iMax; 
		}
    	catch (SQLException e)
		{
		    System.err.println("SQLException: " + e.getMessage());
		} 
    	return 0;  
    }
    
    public /*protected*/ String getConnectionCount()
    { 	    
    	return "Function getConnectionCount() is not currently implemented";  
    }
    
    public /*protected*/ String getUserCount()
    { 	    
    	return "Function getUserCount() is not currently implemented";  
    }
 
    public /*protected*/ String getCPUUsed()
    { 	    
    	return "Function getCPUUsed() is not currently implemented";  
    }
    
    public /*protected*/ String getMemoryUsed()
    { 	    
    	return "Function getMemoryUsed() is not currently implemented";  
    }  
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Russian Federation Russian Federation
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions