Deprecated: Function split() is deprecated in /storage/content/94/122194/onecmdb.org/public_html/wiki/includes/Parser.php on line 2719 Deprecated: Function split() is deprecated in /storage/content/94/122194/onecmdb.org/public_html/wiki/includes/Parser.php on line 2773 Deprecated: Function split() is deprecated in /storage/content/94/122194/onecmdb.org/public_html/wiki/includes/Parser.php on line 2773 Developer's manual V1.4 - OneCMDB

Developer's manual V1.4

From OneCMDB

Contents

OneCMDB Source Code

When installing OneCMDB the source code is placed in the installation directory in the directory /src.
The source code will soon be available from CVS at Sourceforge.

Building

OneCMDB is built using Ant.
Building scripts will be available from CVS at Sourceforge.

Programming OneCMDB

The Java API available to program against OneCMDB Core is described in the following document: OneCMDB Core Java API V1.4

The Webservices interface is described in this document: OneCMDB Web Services V1.4.

SQL Database

OneCMDB Single user edition uses HSQLDB. Currently the connection to the database is locked by the thread doing a query, limiting multi-usage. This limitation will be removed in the forthcoming OneCMDB Team Edition.

Supported Databases

Besides HSQLDB, OneCMDB runs with MYSQL.

Configuring the Database to use

You configure what database to use in the following configuration file:

<onecmdb_install_dir>/tomcat-5.5.17/webapps/ROOT/WEB-INF/classes/datasource.xml

HSQLDB

HSQLDB is used default, so the HSQLDB driver is included in the distribution.
For HSQLDB the datasource.xml should contain the following:

<bean id="dataSource"
		class="org.onecmdb.core.internal.storage.DataSourceWrapper"
		destroy-method="close" >
		<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
		<property name="url" value="jdbc:hsqldb:hsql://localhost" />
		<property name="username" value="sa" />
		<property name="password" value="" />
		
		<property name="initialSize" value="0" />
		<property name="maxActive" value="8" />
		<property name="minIdle" value="0" />
		<property name="maxIdle" value="8" />

		<property name="connectionProperties">
			<props>
				<prop key="shutdown">false</prop>
			</props>
		</property>
</bean>
<bean id="hibernateProperties" class="org.onecmdb.core.internal.storage.HibernateProperty">
		<property name="properties">
			<props>
				<prop key="hibernate.dialect">org.onecmdb.core.internal.storage.hibernate.hsql.HypersonicSQL18Dialect</prop>
				<prop key="show_sql">true</prop>
				<prop key="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</prop>
				<prop key="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</prop>
				<prop key="hibernate.hbm2ddl.auto">update</prop>
			</props>
		</property>
	</bean>

MySQL

For MySQL a jar containing the driver needs to be uploded to

<onecmdb_install_dir>/tomcat-5.5.17/webapps/ROOT/WEB-INF/lib

The datasource.xml should contain the following:

<bean id="dataSource"
		class="org.onecmdb.core.internal.storage.DataSourceWrapper"
		destroy-method="close" >
		<property name="driverClassName" value="com.mysql.jdbc.Driver" />
		<property name="url" value="jdbc:mysql://localhost/onecmdb" />
		<property name="username" value="root" />
		<property name="password" value="" />
		
		<property name="initialSize" value="0" />
		<property name="maxActive" value="8" />
		<property name="minIdle" value="0" />
		<property name="maxIdle" value="8" />

		<property name="connectionProperties">
			<props>
				<prop key="shutdown">false</prop>
			</props>
		</property>
</bean>
<bean id="hibernateProperties" class="org.onecmdb.core.internal.storage.HibernateProperty">
		<property name="properties">
			<props>
				<prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop>
				<prop key="show_sql">true</prop>
				<prop key="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</prop>
				<prop key="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</prop>
				<prop key="hibernate.hbm2ddl.auto">update</prop>
			</props>
		</property>
</bean>

This assumes that MySQL database is running on the same machine (localhost) with a created database called onecmdb.

MS SQL

NOTE: OneCMDB version 1.3 is required to use MS SQL.

For MS SQL a jar containing the driver needs to be uploded to

<onecmdb_install_dir>/tomcat-5.5.17/webapps/ROOT/WEB-INF/lib

The datasource.xml should contain the following:

<bean id="dataSource"
	class="org.apache.commons.dbcp.BasicDataSource"
	destroy-method="close">
	<property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
	<property name="url" value="jdbc:sqlserver://localhost:1340;databaseName=onecmdb" />
	<property name="username" value="sa" />
	<property name="password" value="1qaz1qaz" />
		
	<property name="initialSize">
		<value>5</value>
	</property>
</bean>
	
<bean id="hibernateProperties" class="org.onecmdb.core.internal.storage.HibernateProperty">
	<property name="properties">
		<props>
			<prop key="hibernate.dialect">
				org.hibernate.dialect.SQLServerDialect
			</prop>
			<prop key="show_sql">false</prop>
					
			<prop key="transaction.factory_class">
				org.hibernate.transaction.JDBCTransactionFactory
			</prop>
					
			<prop key="hibernate.cache.provider_class">
				org.hibernate.cache.HashtableCacheProvider
			</prop>
					
			<prop key="hibernate.hbm2ddl.auto">
				update
			</prop>
		</props>
	</property>
</bean>

This assumes that MS SQL database is running on the same machine (localhost) with a created database called onecmdb.

Performance Enhancements: Creating database indexes

NOTE: This is not required for OneMCDB version 1.3, since it's created automatically.

Follow this procedure to improve HSQL performance:

  1. Move to HSQL installation directory: <onecmdb_install_dir>/hsqldb-1.8.0.4/bin
  2. Run HSQL client (requires java): runUtil.bat DatabaseManagerSwing
  3. Connect using your HSQL settings.
  4. Enter following SQL commands:
create index derivedFromId_ci_idx on CI (derivedFromId);
create index derivedFromId_atr_idx on Attribute (derivedFromId);
create index alias_ci_idx on CI (alias);
create index alias_atr_idx on Attribute (alias);
create index ownerid_alias_atr_idx on Attribute (ownerId, alias);
create index rfc_target_and_type_idx on RFC (targetId, RFC_TYPE);
create index valueAsString_atr_idx on Attribute (valueAsString);

Follow this procedure to improve MySQL performance:

  1. Use relevant MySQL client tool
  2. Connect using you MySQL settings:
  3. Enter following SQL commands:
create index derivedFromId_ci_idx on CI (derivedFromId);
create index derivedFromId_atr_idx on Attribute (derivedFromId);
create index alias_ci_idx on CI (alias);
create index alias_atr_idx on Attribute (alias);
create index ownerid_alias_atr_idx on Attribute (ownerId, alias);
create index rfc_target_and_type_idx on RFC (targetId, RFC_TYPE);
create index valueAsString_atr_idx on Attribute (valueAsString(64));

It's only the last SQL statement that differ between HSQL and MySQL.

The CMDB Model

The CMDB model to use is specified by one or several files containing the definition of the datamodel in XML.

Configuring the model to use at startup

OneCMDB will check whether model file(s) are previously read or not when it starts. If not, it loads the model file(s and inject entries into the database. The configuration file pointing out the model file is:

<onecmdb_install_dir>/tomcat-5.5.17/webapps/ROOT/WEB-INF/classes/provider.xml

In the file you find the following setting:

<beans default-dependency-check="none">
	<bean id="defaultProvider" class="org.onecmdb.core.utils.xml.XmlParser">
		<property name="URLs">
			<list>
				<!-- The datacenter schema -->
				<value>res:Model.xml</value>
			</list>
		</property>
	</bean>
</beans>

The Model Replacy Utility writes new content in the Model.xml file.

The default model we currently provide includes both templates and instances. If you prefer you may split it into two or more files in your production environment. Then you need two list entries in provider.xml, one for the template file and one for the instance file. Note however that this will cause the Model Replace Utility to malfunction.

Path to the model file is:

<onecmdb_install_dir>/tomcat-5.5.17/webapps/ROOT/WEB-INF/classes/Model.xml

The XML description

To be added.

Available models

The Models sections contains descriptions of the different CMDB models available.

OneCMDB GUI Configuration

Setting browsing start point for GUI User mode

The OneCMDB GUI web application needs a instance define as "start point" for browsing in user mode. Else the GUI get the ROOT template as start point. You set the start point in following file:

<onecmdb_install_dir>/tomcat-5.5.17/webapps/ROOT/WEB-INF/classes/onecmdb-servlet.xml<br><br>

See following section in the file:

<bean name="/index.mvc" class="org.onecmdb.web.SiteController"
		init-method="init">
		<property name="commandClass"><value>org.onecmdb.web.SiteCommand</value></property>
		<property name="commandName"><value>site</value></property>
		<property name="bindOnNewForm" value="true" />
		<property name="siteView" value="site" />
		<property name="sessionForm" value="true" />
		<property name="oneCmdb"><ref parent="onecmdb"/></property>
		<-- initial objects -->
		<property name="dataCenter" value="Root/Ci/Folder/DataCenterFolder/DataCenter" />
		<property name="refsBase"  value="Root/Reference/MyDataCenterRef" />
		<property name="templateBase"  value="Root/Ci" />
</bean>
Community and support