incubator-lokahi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tob...@apache.org
Subject svn commit: r392982 [6/25] - in /incubator/lokahi/lokahi/trunk: ./ conf/ database/ docs/ lib/ src/ src/java/ src/java/lokahi/ src/java/lokahi/core/ src/java/lokahi/core/agent/ src/java/lokahi/core/agent/callable/ src/java/lokahi/core/agent/callable/con...
Date Mon, 10 Apr 2006 16:20:11 GMT
Added: incubator/lokahi/lokahi/trunk/database/procs.sql
URL: http://svn.apache.org/viewcvs/incubator/lokahi/lokahi/trunk/database/procs.sql?rev=392982&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/database/procs.sql (added)
+++ incubator/lokahi/lokahi/trunk/database/procs.sql Mon Apr 10 09:19:33 2006
@@ -0,0 +1,1946 @@
+CREATE OR REPLACE PROCEDURE sp_am_delete_apache (v_aId IN NUMBER,
+	   	  		  							    v_return OUT NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM AM_CONTAINER
+	WHERE CONTAINER_ID=v_aId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE SP_AM_DELETE_POOL (v_pId IN NUMBER,
+	   	  		  							    v_return OUT NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM AM_POOL
+	WHERE POOL_ID=v_pId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_delete_vhost (v_vhId IN NUMBER,
+	   	  		  							    v_return OUT NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM AM_VHOST
+	WHERE VHOST_ID=v_vhId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+	DELETE FROM TMC_REL_VHOST_CONTEXT
+	WHERE VHOST_ID=v_vhId;
+	DELETE FROM AM_REL_VHOST_IP
+	where VHOST_ID=v_vhId;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_delete_worker (v_wId IN NUMBER,
+	   	  		  							    v_return OUT NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM AM_WORKER
+	WHERE worker_ID=v_wId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_delete_worker_pool
+		  						   ( v_poolId		 	IN  NUMBER,
+								   	 v_workerId	 		IN 	NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+	DELETE FROM AM_REL_POOL_WORKER
+	WHERE POOL_id=v_poolId
+	AND worker_id=v_workerId;
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_drop_apache (
+	   	  		  							   v_return OUT NUMBER,
+	   	  		  							   v_aId IN NUMBER
+	   	  		  							   )
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM AM_CONTAINER
+	WHERE CONTAINER_ID=v_aId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_drop_entity (
+	   	  		  							  v_return OUT NUMBER,
+	   	  		  							  v_vhId IN NUMBER
+	   	  		  							  )
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM AM_VHOST
+	WHERE VHOST_ID=v_vhId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+	DELETE FROM TMC_REL_VHOST_CONTEXT
+	WHERE VHOST_ID=v_vhId;
+	DELETE FROM AM_REL_VHOST_IP
+	where VHOST_ID=v_vhId;
+END;
+/
+CREATE OR REPLACE PROCEDURE SP_AM_DROP_POOL (v_return OUT NUMBER,
+	   	  		  							    v_pId IN NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM AM_POOL
+	WHERE POOL_ID=v_pId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_Drop_vhosts_rel_project
+		  						   ( v_pId		 	IN NUMBER,
+								   	 v_vId	 		IN NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	DELETE FROM AM_REL_ENTITY_PROJECT
+		   	WHERE vhost_ID = v_vId
+			AND	  PROJECT_ID = v_pId;
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_drop_vhost_rel_CTXT
+	   	  		  								(
+												v_return OUT NUMBER,
+												v_vId IN NUMBER,
+												v_CId IN NUMBER
+												)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_REL_VHOST_CONTEXT
+	WHERE CONTEXT_ID=v_CId
+	AND	  VHOST_ID=v_vId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_drop_vhost_rel_ip
+	   	  		  								(
+												v_return OUT NUMBER,
+												v_vId IN NUMBER,
+												v_ipId IN NUMBER
+												)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM AM_REL_VHOST_IP
+	WHERE IP_ID=v_ipId
+	AND	  VHOST_ID=v_vId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_drop_worker (v_return OUT NUMBER,
+	   	  		  							   v_wId IN NUMBER )
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM AM_WORKER
+	WHERE worker_ID=v_wId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_store_apache
+		  						   ( v_id		OUT	NUMBER,
+								   	 v_name	 	IN 	VARCHAR2,
+									 v_sysU		IN 	VARCHAR2,
+									 v_sysG		IN 	VARCHAR2,
+									 v_start	IN 	VARCHAR2,
+									 v_stop		IN 	VARCHAR2,
+									 v_restart	IN	VARCHAR2,
+									 v_fork		IN	NUMBER,
+									 v_envVar	IN	VARCHAR2,
+									 v_pidFile	IN	VARCHAR2,
+									 v_sRoot	IN	VARCHAR2,
+									 v_logLoc	IN	VARCHAR2,
+									 v_mainId	IN	NUMBER
+				     			   	)
+AS
+BEGIN
+		   	INSERT INTO AM_CONTAINER (container_id, CONTAINER_NAME, sys_user, sys_group, start_command, stop_command, restart_command, fork_wait, env_varibles, pidfile_location, server_root, log_location, main_id)
+		   	VALUES ( am_apache_seq.NEXTVAL, v_name, v_sysU, v_sysG, v_start, v_stop, v_restart, v_fork, v_envVar, v_pidFile, v_sRoot, v_logLoc, v_mainId);
+			-- get the newly added id
+			v_id:=f_last_sequence_number('am_apache_seq');
+
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_store_file_backup
+		  						   ( v_id		IN	NUMBER
+				     			   	)
+AS
+BEGIN
+		   	INSERT INTO TMC_FILE_ARCHIVE (job_ID)
+		   	VALUES (v_id);
+
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_store_pool
+		  						   ( v_id	 	OUT NUMBER,
+									 v_name		IN	VARCHAR2,
+									 v_eId		IN 	NUMBER
+									 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO
+			AM_POOL (pool_id, pool_name, env_Id)
+		   	VALUES ( am_pool_seq.NEXTVAL, v_name, v_eId);
+			-- get the newly added jobid
+			v_id:=f_last_sequence_number('am_pool_seq');
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_store_vhost
+		  						   ( v_id		OUT	NUMBER,
+								   	 v_name	 	IN 	VARCHAR2,
+									 v_stateId	IN 	NUMBER,
+									 v_envId	IN 	NUMBER,
+									 v_hpId		IN	NUMBER,
+									 v_catch	IN	NUMBER,
+									 v_nameb	IN	NUMBER,
+									 v_exPid	IN	NUMBER,
+									 v_entry	IN	BLOB
+				     			   	)
+AS
+BEGIN
+		   	INSERT INTO AM_VHOST (vhost_id, vhost_NAME, state_id, env_id, hosting_pool_id, catchall, namebased, ex_PROJECT_ID, vhost_entry)
+		   	VALUES ( am_vhost_seq.NEXTVAL, v_name, v_stateId, v_envId, v_hpId, v_catch, v_nameb, v_exPid, v_entry);
+			-- get the newly added id
+			v_id:=f_last_sequence_number('am_vhost_seq');
+
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_store_vhosts_rel_context
+		  						   ( v_vId		 	IN NUMBER,
+								   	 v_cId	 		IN NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO TMC_REL_VHOST_CONTEXT (vhost_id, Context_id)
+		   	VALUES ( v_vId, v_cId);
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_store_vhosts_rel_IP
+		  						   ( v_vId		 	IN NUMBER,
+								   	 v_ipId	 		IN NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO AM_REL_VHOST_IP (vhost_id, ip_id)
+		   	VALUES ( v_vId, v_ipId);
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_store_vhosts_rel_project
+		  						   ( v_pId		 	IN NUMBER,
+								   	 v_vId	 		IN NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO AM_REL_ENTITY_PROJECT (vhost_id, project_id)
+		   	VALUES ( v_vId, v_pId);
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_store_worker
+		  						   ( v_id		OUT	NUMBER,
+								   	 v_aId	 	IN 	NUMBER,
+									 v_hId		IN 	NUMBER,
+									 v_sId		IN 	NUMBER
+				     			   	)
+AS
+
+CURSOR cv IS   select worker_id from AM_WORKER where
+   hardware_id = v_hId and
+   container_id =v_aId;
+w_id number;
+
+BEGIN
+
+   OPEN cv ;
+   fetch cv into w_id;
+   IF(cv%NOTFOUND) THEN
+   		    dbms_output.put_line('No Rows with the value of that type.. now inserting');
+		   	INSERT INTO AM_WORKER (worker_id, container_id, hardware_id, state_id)
+		   	VALUES ( am_worker_seq.NEXTVAL, v_aId,v_hId,v_sId);
+			-- get the newly added id
+			v_id:=f_last_sequence_number('am_worker_seq');
+			dbms_output.put_line('Inserted Values' || v_id ||'-' || v_aid || '-' || v_hid ||'-' || v_sid);
+   ELSE
+     v_id:= w_id;
+	 dbms_output.put_line('Found worker Id ' || w_id );
+   END IF;
+
+   CLOSE cv;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_store_worker_pool
+		  						   ( v_poolId		 	IN  NUMBER,
+								   	 v_workerId	 		IN 	NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+	INSERT INTO AM_REL_POOL_WORKER (POOL_ID, WORKER_ID)
+	Values (v_poolId, v_workerId);
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_update_apache
+		  						   ( v_id		IN	NUMBER,
+								   	 v_name	 	IN 	VARCHAR2,
+									 v_sysU		IN 	VARCHAR2,
+									 v_sysG		IN 	VARCHAR2,
+									 v_start	IN 	VARCHAR2,
+									 v_stop		IN 	VARCHAR2,
+									 v_restart	IN	VARCHAR2,
+									 v_fork		IN	NUMBER,
+									 v_envVar	IN	VARCHAR2,
+									 v_pidFile	IN	VARCHAR2,
+									 v_sRoot	IN	VARCHAR2,
+									 v_logLoc	IN	VARCHAR2,
+									 v_mainId	IN	NUMBER
+				     			   	)
+AS
+BEGIN
+    	UPDATE AM_CONTAINER am
+		SET am.CONTAINER_NAME=v_name,
+		 	am.sys_user=v_sysU,
+		 	am.sys_group=v_sysG,
+		 	am.start_command=v_start,
+		    am.stop_command=v_stop,
+			am.restart_command=v_restart,
+			am.fork_wait=v_fork,
+			am.env_varibles=v_envVar,
+			am.pidfile_location=v_pidFile,
+			am.server_root=v_sRoot,
+			am.log_location=v_logLoc,
+			am.main_id=v_mainId
+		WHERE container_id=v_id;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_update_pool
+		  						   ( v_id	 	IN	NUMBER,
+									 v_name		IN	VARCHAR2,
+									 v_eId		IN 	NUMBER
+									 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+    	UPDATE AM_POOL
+		SET pool_name=v_name, ENV_ID=v_eId
+		WHERE pool_id=v_id;
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_update_vhost
+		  						   ( v_id		IN	NUMBER,
+								   	 v_name	 	IN 	VARCHAR2,
+									 v_stateId	IN 	NUMBER,
+									 v_envId	IN 	NUMBER,
+									 v_hpId		IN	NUMBER,
+									 v_catch	IN	NUMBER,
+									 v_nameb	IN	NUMBER,
+									 v_exPid	IN	NUMBER,
+									 v_entry	IN	BLOB
+				     			   	)
+AS
+BEGIN
+    	UPDATE AM_VHOST
+		SET vhost_name=v_name, state_id=v_stateId, env_id=v_envId, ex_PROJECT_ID=v_exPid,
+		 hosting_pool_id=v_hpId, catchall=v_catch, namebased=v_nameb, VHOST_ENTRY=v_entry
+		WHERE vhost_id=v_id;
+
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_am_update_worker
+		  						   ( v_id		IN	NUMBER,
+								   	 v_aId	 	IN 	NUMBER,
+									 v_hId		IN 	NUMBER,
+									 v_sId		IN 	NUMBER
+				     			   	)
+AS
+BEGIN
+    	UPDATE AM_Worker aw
+		SET aw.CONTAINER_Id=v_aId,
+			aw.HARDWARE_ID=v_hId,
+			aw.STATE_ID=v_sId
+		Where aw.WORKER_ID=v_id;
+
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_add_hardware_ip (
+	   	  		  					v_hardId IN NUMBER,
+	   	  		  				  	v_ipId 	IN NUMBER)
+AS
+BEGIN
+   INSERT INTO TMC_REL_HARDWARE_IP (hardware_id, ip_id)
+   VALUES	(v_hardId, v_ipId);
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_add_job (
+	   	  		  					v_instanceId IN NUMBER,
+									v_functionId  IN NUMBER,
+	   	  		  				  	v_poolId 	IN NUMBER,
+									v_serverId IN NUMBER,
+									v_parentId	 IN NUMBER,
+									v_state	 IN NUMBER,
+									v_options	IN VARCHAR2,
+									v_pk		OUT NUMBER,
+									v_result IN BLOB)
+AS
+BEGIN
+    	INSERT INTO TMC_JOB (job_id, pool_id, server_id, parent_id, start_time,
+			   state_id, options, instance_id, function_id, result)
+		VALUES	(tmc_job_seq.NEXTVAL, v_poolId, v_serverId, v_parentId, SYSDATE,
+				v_state, v_options, v_instanceId, v_functionId, v_result);
+		  	-- get the newly added job ID
+			v_pk:=f_last_sequence_number('tmc_job_seq');
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_add_job2 (
+	   	  		  					v_pk	  IN NUMBER,
+									v_name    IN VARCHAR2,
+									v_state	  IN NUMBER)
+AS
+BEGIN
+	 UPDATE TMC_JOB j SET j.JOB_NAME=v_name, j.STATE_ID=v_state WHERE j.JOB_ID=v_pk;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_add_jobpool
+		  						   (
+								     v_seq				OUT NUMBER,
+									 v_projectid	 	IN 	NUMBER,
+									 v_userid			IN 	NUMBER,
+									 v_stateid			IN 	NUMBER,
+									 v_options			IN 	VARCHAR2,
+									 v_functionid		IN 	NUMBER
+				     			   	)
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO TMC_JOB_POOL (job_pool_id, project_id, user_id, start_time,
+				   state_id, options, function_id)
+		   	VALUES ( tmc_jobpool_seq.NEXTVAL, v_projectid, v_userid, SYSDATE, v_stateid,
+				   v_options, v_functionid);
+			-- get the newly added jobid
+			v_seq:=f_last_sequence_number('tmc_jobpool_seq');
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_add_template (
+	   	  		  					v_inst IN VARCHAR2,
+	   	  		  				  	v_name 	IN VARCHAR2,
+	   	  		  				  	v_id OUT NUMBER,
+									v_blob IN BLOB)
+AS
+BEGIN
+   INSERT INTO TMC_TEMPLATE_TABLE (tmc_instance, template_id, template_name, template_block, status)
+   VALUES	(v_inst, tmc_template_seq.NEXTVAL, v_name, v_blob, 'adding');
+
+   SELECT template_id INTO v_id FROM TMC_TEMPLATE_TABLE WHERE tmc_instance=v_inst AND
+   template_name=v_name AND status='adding';
+
+   -- reset status column
+   UPDATE TMC_TEMPLATE_TABLE SET status='' WHERE status='adding';
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_delete_alert
+	   	  		  								(v_id IN NUMBER,
+												v_return OUT NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_ALERTs
+	WHERE ALERT_ID=v_id;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_delete_alert_rel
+	   	  		  								(v_id IN NUMBER,
+												v_return OUT NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_REL_ALERT_PROJECT
+	WHERE ALERT_ID=v_id;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_delete_enviroment
+	   	  		  								(v_id IN NUMBER,
+												v_return OUT NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_ENV
+	WHERE ENV_ID=v_id;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_delete_ex_project
+	   	  		  								(v_id IN NUMBER,
+												v_return OUT NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_ex_project
+	WHERE ex_project_ID=v_id;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_delete_function
+	   	  		  								(v_id IN NUMBER,
+												v_return OUT NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_FUNCTION
+	WHERE FUNCTION_ID=v_id;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_delete_hardware (v_hardId IN NUMBER,
+	   	  		  							    v_return OUT NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_HARDWARE
+	WHERE HARDWARE_ID=v_hardId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_delete_hardware_ip
+	   	  		  								(v_hardId IN NUMBER,
+												v_ipId	   IN NUMBER,
+	   	  		  							    v_return OUT NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_REL_HARDWARE_IP
+	WHERE HARDWARE_ID=v_hardId AND IP_ID=v_ipId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_delete_help_item
+		  			      ( v_Id		 	IN  NUMBER,
+						    v_return 		OUT NUMBER
+				     	      )
+AS
+BEGIN
+DECLARE
+  BEGIN
+    DELETE FROM TMC_HELP_ITEM
+    WHERE HELP_ITEM_id=v_Id;
+    IF SQL%NOTFOUND THEN v_return:=1;
+    END IF;
+  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE SP_TMC_DELETE_HOSTINGPOOL (v_hpId IN NUMBER,
+	   	  		  							    v_return OUT NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_HOSTING_POOL
+	WHERE HOSTING_POOL_ID=v_hpId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_delete_instance (v_instanceId IN NUMBER,
+	   	  		  							    v_return OUT NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_INSTANCE
+	WHERE INSTANCE_ID=v_instanceId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_delete_ip
+	   	  		  								(v_id IN NUMBER,
+												v_return OUT NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_IP
+	WHERE IP_ID=v_id;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+	DELETE FROM AM_REL_VHOST_IP
+	WHERE IP_ID=v_id;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_delete_project
+	   	  		  								(
+												v_return OUT NUMBER,
+												v_id IN NUMBER
+												)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_PROJECT
+	WHERE PROJECT_ID=v_id;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_delete_state (v_return OUT NUMBER,
+	   	  		  							     v_stateId IN NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_State
+	WHERE STATE_ID=v_stateId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE  sp_tmc_delete_user
+	   	  		  								(v_id IN NUMBER,
+												v_return OUT NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_USER
+	WHERE USER_ID=v_id;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_delete_user_abil
+	   	  		  								(v_id IN NUMBER,
+												v_projectId IN NUMBER)
+
+AS
+BEGIN
+	DELETE FROM TMC_REL_FUNCTION_USER
+	WHERE USER_ID=v_id
+	AND PROJECT_ID=v_projectId;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_delete_user_proj
+		  						   ( v_uId		 	IN  NUMBER,
+								   	 v_pId	 		IN 	NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+	DELETE FROM TMC_REL_USER_PROJECT
+	WHERE user_id=v_uId
+	AND project_id=v_pId;
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_delete_vhost_rel_CTXT
+	   	  		  								(v_vId IN NUMBER,
+												v_CId IN NUMBER,
+												v_return OUT NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_REL_VHOST_CONTEXT
+	WHERE CONTEXT_ID=v_CId
+	AND	  VHOST_ID=v_vId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_delete_vhost_rel_ip
+	   	  		  								(v_vId IN NUMBER,
+												v_ipId IN NUMBER,
+												v_return OUT NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM AM_REL_VHOST_IP
+	WHERE IP_ID=v_ipId
+	AND	  VHOST_ID=v_vId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_drop_alert
+	   	  		  								(v_return OUT NUMBER,
+												v_id IN NUMBER
+												)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_ALERTs
+	WHERE ALERT_ID=v_id;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_drop_alert_rel
+	   	  		  								(
+												v_return OUT NUMBER,
+												v_id IN NUMBER
+												)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_REL_ALERT_PROJECT
+	WHERE ALERT_ID=v_id;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_drop_environment
+	   	  		  								(v_return OUT NUMBER,
+												 v_id IN NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_ENV
+	WHERE ENV_ID=v_id;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_drop_function
+	   	  		  								(v_return OUT NUMBER,
+												 v_id IN NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_FUNCTION
+	WHERE FUNCTION_ID=v_id;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_drop_help_item
+		  			      (
+						    v_return 	OUT NUMBER,
+						    v_Id		IN  NUMBER
+
+				     	      )
+AS
+BEGIN
+DECLARE
+  BEGIN
+    DELETE FROM TMC_HELP_ITEM
+    WHERE HELP_ITEM_id=v_Id;
+    IF SQL%NOTFOUND THEN v_return:=1;
+    END IF;
+  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE SP_TMC_DROP_HOSTINGPOOL (
+	   	  		  								v_return OUT NUMBER,
+	   	  		  								v_hpId IN NUMBER
+	   	  		  							    )
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_HOSTING_POOL
+	WHERE HOSTING_POOL_ID=v_hpId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_drop_instance (
+	   	  		  								 v_return OUT NUMBER,
+	   	  		  								 v_instanceId IN NUMBER
+	   	  		  							     )
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_INSTANCE
+	WHERE INSTANCE_ID=v_instanceId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_drop_ip
+	   	  		  								(
+												v_return OUT NUMBER,
+												v_id IN NUMBER
+												)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_IP
+	WHERE IP_ID=v_id;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+	DELETE FROM AM_REL_VHOST_IP
+	WHERE IP_ID=v_id;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_drop_server (
+	   	  		  							    v_return OUT NUMBER,
+												v_hardId IN NUMBER
+	   	  		  							    )
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_HARDWARE
+	WHERE HARDWARE_ID=v_hardId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_drop_state (v_return OUT NUMBER,
+	   	  		  							     v_stateId IN NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_State
+	WHERE STATE_ID=v_stateId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_drop_user
+	   	  		  								(v_return OUT NUMBER,
+												v_id IN NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TMC_USER
+	WHERE USER_ID=v_id;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_finalize_jobpool (
+	   	  		  					v_pk IN NUMBER,
+									v_stateId  IN NUMBER)
+
+AS
+BEGIN
+    	UPDATE TMC_JOB_POOL jp
+		SET jp.FINISH_TIME=SYSDATE, jp.STATE_ID=v_stateId
+		WHERE job_pool_id=v_pk;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_job_update (
+	   	  		  					returnVal OUT NUMBER,
+	   	  		  					v_pk 	  IN  NUMBER,
+									v_stateId IN  NUMBER
+									)
+AS
+Begin
+DECLARE
+	currentState TMC_JOB.state_id%TYPE;
+BEGIN
+	SELECT TMC_JOB.state_id INTO currentState FROM TMC_JOB WHERE TMC_JOB.job_id=v_pk;
+	IF v_stateId >= currentState THEN
+    		UPDATE TMC_JOB
+			SET state_id=v_stateId, finish_time=SYSDATE
+			WHERE job_id=v_pk;
+		returnVal := 1;
+	ELSE
+		returnVal := 0;
+	END IF;
+END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_TMC_prep_ALERT_ENTRY (
+	   	  		  					v_Id IN NUMBER,
+									v_result IN BLOB)
+AS
+BEGIN
+    	UPDATE TMC_ALERTS
+		set ALERT_CONTENTS=v_result
+		WHERE ALERT_ID=v_Id;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_prep_FILE_BACKUP (
+	   	  		  					v_Id IN NUMBER,
+									v_result IN BLOB)
+AS
+BEGIN
+    	UPDATE TMC_FILE_ARCHIVE
+		set file_contents=v_result
+		WHERE job_ID=v_Id;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_prep_file_content (
+	   	  		  					v_Id IN NUMBER,
+									v_result IN BLOB)
+AS
+BEGIN
+    	UPDATE TMC_FILES
+		set file_content=v_result
+		WHERE File_ID=v_Id;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_TMC_prep_job (
+	   	  		  					v_Id IN NUMBER,
+									v_result IN BLOB)
+AS
+BEGIN
+    	UPDATE TMC_JOB
+		set result=v_result
+		WHERE job_ID=v_Id;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_alert
+		  						   ( v_id		OUT	NUMBER,
+								   	 v_title 	IN 	VARCHAR2,
+									 v_subId	IN 	NUMBER,
+									 v_link		IN	VARCHAR2,
+									 v_content	IN	BLOB
+				     			   	)
+AS
+BEGIN
+		   	INSERT INTO TMC_ALERTS (alert_id, alert_title, submitter_id, submision_date, alert_link, alert_contents)
+		   	VALUES ( TMC_ALERT_SEQ.NEXTVAL, v_title, v_subId, SYSDATE, v_link, v_content);
+			-- get the newly added id
+			v_id:=f_last_sequence_number('tmc_alert_seq');
+
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_alert_rel
+		  						   ( v_id		in	NUMBER,
+									 v_projId	IN 	NUMBER
+				     			   	)
+AS
+BEGIN
+		   	INSERT INTO TMC_REL_ALERT_PROJECT (alert_id, project_id)
+		   	VALUES (v_id, v_projId);
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_enviroment
+		  						   ( v_seq		 	OUT NUMBER,
+								   	 v_name	 		IN 	VARCHAR2,
+									 v_comments		IN 	VARCHAR2
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO TMC_ENV (env_id, env_name, comments)
+		   	VALUES ( tmc_enviroment_seq.NEXTVAL, v_name, v_comments);
+			-- get the newly added id
+			v_seq:=f_last_sequence_number('tmc_enviroment_seq');
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_ex_project
+		  						   ( v_seq		 	OUT NUMBER,
+								   	 v_name	 		IN 	VARCHAR2
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO TMC_EX_PROJECT (ex_project_id, ex_project_name)
+		   	VALUES ( tmc_ex_project_seq.NEXTVAL, v_name);
+			-- get the newly added id
+			v_seq:=f_last_sequence_number('tmc_ex_project_seq');
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_file
+		  						   ( v_id		OUT	NUMBER,
+								   	 v_name	 	IN 	VARCHAR2,
+									 v_descrip	IN 	VARCHAR2,
+									 v_path		IN 	VARCHAR2
+				     			   	)
+AS
+BEGIN
+		   	INSERT INTO TMC_FILES (file_id, file_name, file_descriptor, file_path)
+		   	VALUES ( tmc_file_seq.NEXTVAL, v_name, v_descrip, v_path);
+			-- get the newly added id
+			v_id:=f_last_sequence_number('tmc_file_seq');
+
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_file_backup
+		  						   ( v_id		IN	NUMBER
+				     			   	)
+AS
+BEGIN
+		   	INSERT INTO TMC_FILE_ARCHIVE (job_ID)
+		   	VALUES (v_id);
+
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_function
+		  						   ( v_seq		 	OUT NUMBER,
+								   	 v_name	 		IN 	VARCHAR2,
+									 v_command		IN 	VARCHAR2
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO TMC_FUNCTION (function_id, function_name, function_command)
+		   	VALUES ( tmc_function_seq.NEXTVAL, v_name, v_command);
+			-- get the newly added id
+			v_seq:=f_last_sequence_number('tmc_function_seq');
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_hardware
+		  						   ( v_seq		 	OUT NUMBER,
+								   	 v_name	 		IN 	VARCHAR2,
+									 v_location		IN 	VARCHAR2,
+									 v_comments		IN 	VARCHAR2,
+									 v_instance		IN 	NUMBER,
+									 v_env			IN 	NUMBER,
+									 v_status		IN	NUMBER,
+									 v_defaultIp	IN	NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO TMC_HARDWARE (hardware_id, hardware_name, physical_location,
+				   comments, instance_id, env_id, status_id, default_ip_id)
+		   	VALUES ( tmc_hardware_seq.NEXTVAL, v_name, v_location, v_comments, v_instance,
+				   v_env, v_status, v_defaultIp);
+			-- get the newly added id
+			v_seq:=f_last_sequence_number('tmc_hardware_seq');
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_help_item
+		  				  ( h_Id  OUT NUMBER,
+		  				    h_title IN VARCHAR2,
+						    h_valid IN NUMBER,
+						    h_function IN NUMBER,
+						    h_summary IN VARCHAR2,
+							h_content IN BLOB
+				     		  )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO TMC_HELP_ITEM(HELP_ITEM_ID,HELP_ITEM_TITLE,VALID,FUNCTION_ID,SUMMARY,CONTENT)
+		   	VALUES ( TMC_HELP_SEQ.NEXTVAL,h_title ,h_valid, h_function, h_summary,h_content);
+			h_Id:=f_last_sequence_number('TMC_HELP_SEQ');
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_help_rel_keyword
+		  			 	 (  h_Id  IN NUMBER,
+					    	    k_Id  IN NUMBER
+				     	 	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO TMC_REL_HELP_KEYWORD (help_item_id, keyword_id)
+		   	VALUES ( h_Id, k_Id);
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_help_rel_topic
+		  			 	 (  h_Id  IN NUMBER,
+					    	    t_Id  IN NUMBER,
+					    	    s_Id  IN NUMBER
+				     	 	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO TMC_REL_HELP_TOPIC (help_item_id, topic_id, subtopic_id)
+		   	VALUES ( h_Id, t_Id, s_Id);
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_hostingpool
+		  						   ( v_seq		 	OUT NUMBER,
+								   	 v_name	 		IN 	VARCHAR2,
+									 v_envId		IN 	NUMBER,
+									 v_ampId		IN	NUMBER,
+									 v_tmpId		IN	NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO TMC_HOSTING_POOL (HOSTING_POOL_id, HOSTING_POOL_name, ENV_ID)
+		   	VALUES ( tmc_hosting_seq.NEXTVAL, v_name, v_envId);
+			-- get the newly added id
+			v_seq:=f_last_sequence_number('tmc_hosting_seq');
+			INSERT INTO TMC_REL_HOSTING_MODULES (HOSTING_POOL_ID, AM_POOL_ID, TM_POOL_ID)
+			VALUES (v_seq, v_ampId, v_tmpId);
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_instance
+		  						   ( v_seq		 	OUT NUMBER,
+								   	 v_name	 		IN 	VARCHAR2,
+									 v_comments		IN 	VARCHAR2
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO TMC_INSTANCE (instance_id, instance_name, comments)
+		   	VALUES ( tmc_instance_seq.NEXTVAL, v_name, v_comments);
+			-- get the newly added id
+			v_seq:=f_last_sequence_number('tmc_instance_seq');
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_ip
+		  						   ( v_seq		 	OUT NUMBER,
+								   	 v_name	 		IN 	VARCHAR2
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO TMC_IP (ip_id, ip)
+		   	VALUES ( tmc_ip_seq.NEXTVAL, v_name);
+			-- get the newly added id
+			v_seq:=f_last_sequence_number('tmc_ip_seq');
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_job (
+	   	  		  					v_pk		OUT NUMBER,
+	   	  		  					v_instanceId IN NUMBER,
+									v_functionId  IN NUMBER,
+	   	  		  				  	v_poolId 	IN NUMBER,
+									v_serverId IN NUMBER,
+									v_parentId	 IN NUMBER,
+									v_state	 IN NUMBER,
+									v_options	IN VARCHAR2
+									)
+AS
+BEGIN
+    	INSERT INTO TMC_JOB (job_id, pool_id, server_id, parent_id, start_time,
+			   state_id, options, instance_id, function_id)
+		VALUES	(tmc_job_seq.NEXTVAL, v_poolId, v_serverId, v_parentId, SYSDATE,
+				v_state, v_options, v_instanceId, v_functionId);
+		  	-- get the newly added job ID
+			v_pk:=f_last_sequence_number('tmc_job_seq');
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_jobpool
+		  						   ( v_projectid	 	IN NUMBER,
+									 v_userid			IN NUMBER,
+									 v_stateid			IN NUMBER,
+									 v_options			IN VARCHAR2,
+									 v_functionid		IN NUMBER,
+				     			   	 v_seq				OUT NUMBER)
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO TMC_JOB_POOL (job_pool_id, project_id, user_id, start_time,
+				   state_id, options, function_id)
+		   	VALUES ( tmc_jobpool_seq.NEXTVAL, v_projectid, v_userid, SYSDATE, v_stateid,
+				   v_options, v_functionid);
+			-- get the newly added jobid
+			v_seq:=f_last_sequence_number('tmc_jobpool_seq');
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_keyword
+   						   ( k_kId 	OUT NUMBER,
+      					   	     k_wrd	 		IN varchar2
+  				     		   )
+  AS
+ CURSOR cv IS     select keyword_id from TMC_KEYWORD where
+ keyword_name like k_wrd;
+ w_id number;
+
+ BEGIN
+    OPEN cv ;
+	fetch cv into w_id;
+    IF(cv%NOTFOUND) THEN
+  	  		INSERT INTO TMC_KEYWORD(keyword_id, keyword_name)
+		   	VALUES ( TMC_KEYWORD_SEQ.NEXTVAL, k_wrd);
+			k_kId:=f_last_sequence_number('TMC_KEYWORD_SEQ');
+    ELSE
+       k_kId:= w_id;
+    END IF;
+    CLOSE cv;
+ END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_project
+		  						   ( v_seq		 	OUT NUMBER,
+								   	 v_name	 		IN 	VARCHAR2
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO TMC_PROJECT (project_id, project_name)
+		   	VALUES ( tmc_project_seq.NEXTVAL, v_name);
+			-- get the newly added id
+			v_seq:=f_last_sequence_number('tmc_project_seq');
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_state
+		  						   ( v_seq		 	OUT NUMBER,
+								   	 v_name	 		IN 	VARCHAR2,
+									 v_color		IN 	VARCHAR2
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO TMC_STATE (state_id, state_name, state_color)
+		   	VALUES ( tmc_state_seq.NEXTVAL, v_name, v_color);
+			-- get the newly added id
+			v_seq:=f_last_sequence_number('tmc_state_seq');
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_topic
+ 						   ( t_Id   OUT NUMBER,
+    					   	     t_name IN varchar2
+				     		   )
+AS
+
+ CURSOR cv IS     select topic_id from TMC_TOPIC where
+ topic_name like t_name;
+ w_id number;
+
+ BEGIN
+    OPEN cv ;
+	fetch cv into w_id;
+    IF(cv%NOTFOUND) THEN
+		   	INSERT INTO TMC_TOPIC(topic_id, topic_name)
+		   	VALUES ( TMC_TOPIC_SEQ.NEXTVAL , t_name);
+		   	t_Id:=f_last_sequence_number('TMC_TOPIC_SEQ');
+    ELSE
+       t_id:= w_id;
+    END IF;
+    CLOSE cv;
+ END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_user
+		  						   ( v_seq		 	OUT NUMBER,
+								   	 v_name	 		IN 	VARCHAR2,
+									 v_fn			IN 	VARCHAR2,
+									 v_ln			IN 	VARCHAR2,
+									 v_email		IN 	VARCHAR2,
+									 v_comments		IN 	VARCHAR2,
+									 v_jobTitle		IN 	VARCHAR2,
+									 v_state		IN	NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO TMC_USER (user_id, user_name, first_name, last_name, email, comments, job_title, state_id)
+		   	VALUES ( tmc_user_seq.NEXTVAL, v_name, v_fn, v_ln, v_email, v_comments, v_jobTitle, v_state);
+			-- get the newly added id
+			v_seq:=f_last_sequence_number('tmc_user_seq');
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_user_abil
+		  						   ( v_userId	 	IN	NUMBER,
+								   	 v_objectId 	IN 	NUMBER,
+									 v_objectType	IN 	NUMBER,
+									 v_projectId	IN	NUMBER,
+									 v_functionId	IN	NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO TMC_REL_FUNCTION_USER (user_id, function_id, object_id, object_type, project_id)
+		   	VALUES ( v_userId, v_functionId, v_objectId, v_objectType, v_projectId);
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_store_user_proj
+		  						   ( v_uId		 	IN  NUMBER,
+								   	 v_pId	 		IN 	NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO TMC_REL_USER_PROJECT (user_id, project_id)
+		   	VALUES ( v_uId, v_pId);
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_TEST_update_job (
+	   	  		  					returnVal OUT NUMBER,
+	   	  		  					v_pk 	  IN  NUMBER,
+									v_stateId IN  NUMBER,
+									v_result  IN  BLOB)
+AS
+	currentState TMC_JOB.state_id%TYPE;
+BEGIN
+	returnVal := -1;
+	SELECT TMC_JOB.state_id INTO currentState FROM TMC_JOB WHERE TMC_JOB.job_id=v_pk;
+	IF v_stateId >= currentState THEN
+    		UPDATE TMC_JOB
+			SET state_id=v_stateId, finish_time=SYSDATE, result=v_result
+			WHERE job_id=v_pk;
+		returnVal := 1;
+	ELSE
+		returnVal := 0;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_update_alert
+  		  				  ( v_Id  IN NUMBER,
+  		  				    v_title IN VARCHAR2,
+  						    v_link IN VARCHAR2,
+  						    v_subid IN NUMBER,
+							v_content IN BLOB
+  				     		  )
+  AS
+  BEGIN
+  DECLARE
+  	  BEGIN
+
+	    	UPDATE TMC_Alerts
+			SET ALERT_TITLE=v_title,
+				ALERT_LINK=v_link,
+				SUBMITTER_ID=v_subid,
+				ALERT_CONTENTS=v_content,
+				Submision_date=SYSDATE
+			WHERE ALERT_ID=v_Id;
+  	  END;
+  END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_update_enviroment
+		  						   ( v_id		 	IN	NUMBER,
+								   	 v_name	 		IN 	VARCHAR2,
+									 v_comments		IN 	VARCHAR2
+				     			   	 )
+AS
+BEGIN
+    	UPDATE TMC_ENV
+		SET env_name=v_name, comments=v_comments
+		WHERE env_id=v_id;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_update_file
+		  						   ( v_id		 	IN	NUMBER,
+								   	 v_name	 		IN 	VARCHAR2,
+									 v_descrip		IN 	VARCHAR2,
+									 v_path			IN	VARCHAR2
+				     			   	 )
+AS
+BEGIN
+    	UPDATE TMC_FILES f
+		SET f.file_name=v_name, f.file_descriptor=v_descrip, f.file_path=v_path
+		WHERE file_id=v_id;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_update_function
+		  						   ( v_id		 	IN	NUMBER,
+								   	 v_name	 		IN 	VARCHAR2,
+									 v_command		IN 	VARCHAR2
+				     			   	 )
+AS
+BEGIN
+    	UPDATE TMC_FUNCTION f
+		SET f.Function_name=v_name, f.function_command=v_command
+		WHERE function_id=v_id;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_update_hardware
+		  						   ( v_id		 	IN	NUMBER,
+								   	 v_name	 		IN 	VARCHAR2,
+									 v_location		IN 	VARCHAR2,
+									 v_comments		IN 	VARCHAR2,
+									 v_instance		IN 	NUMBER,
+									 v_env			IN 	NUMBER,
+									 v_status		IN	NUMBER,
+									 v_defaultIp	IN	NUMBER
+				     			   	 )
+AS
+BEGIN
+    	UPDATE TMC_HARDWARE
+		SET hardware_name=v_name, physical_location=v_location, comments=v_comments,
+			instance_id=v_instance, env_id=v_env, status_id=v_status, default_ip_id=v_defaultIp
+		WHERE hardware_id=v_id;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_update_help_item
+  		  				  ( h_Id  IN NUMBER,
+  		  				    h_title IN VARCHAR2,
+  						    h_valid IN NUMBER,
+  						    h_function IN NUMBER,
+  						    h_summary IN VARCHAR2,
+							h_content IN BLOB
+  				     		  )
+  AS
+  BEGIN
+  DECLARE
+  	  BEGIN
+
+	    	UPDATE TMC_HELP_ITEM
+			SET HELP_ITEM_TITLE=h_title,
+				VALID=h_valid,
+				FUNCTION_ID=h_function,
+				SUMMARY=h_summary,
+				CONTENT=h_content
+			WHERE HELP_ITEM_ID=h_Id;
+  	  END;
+  END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_update_hostingpool
+		  						   ( v_id		 	IN	NUMBER,
+								   	 v_name	 		IN 	VARCHAR2,
+									 v_envId		IN 	NUMBER,
+									 v_ampId		IN	NUMBER,
+									 v_tmpId		IN	NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+	    UPDATE TMC_HOSTING_POOL
+		SET HOSTING_POOL_NAME=v_name,
+			ENV_ID=v_envId
+		WHERE HOSTING_pool_id=v_id;
+		UPDATE TMC_REL_HOSTING_MODULES
+		SET AM_POOL_ID=v_ampId,
+			TM_POOL_ID=v_tmpId
+		WHERE HOSTING_POOL_ID=v_id;
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_update_instance
+		  						   ( v_id		 	IN	NUMBER,
+								   	 v_name	 		IN 	VARCHAR2,
+									 v_comments		IN 	VARCHAR2
+				     			   	 )
+AS
+BEGIN
+    	UPDATE TMC_INSTANCE
+		SET instance_name=v_name, comments=v_comments
+		WHERE instance_id=v_id;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_update_ip
+		  						   ( v_id		 	IN	NUMBER,
+								   	 v_name	 		IN 	VARCHAR2
+				     			   	 )
+AS
+BEGIN
+    	UPDATE TMC_IP
+		SET ip=v_name
+		WHERE ip_id=v_id;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_update_job (
+	   	  		  					returnVal OUT NUMBER,
+	   	  		  					v_pk 	  IN  NUMBER,
+									v_stateId IN  NUMBER,
+									v_result  IN  BLOB)
+AS
+Begin
+DECLARE
+	currentState TMC_JOB.state_id%TYPE;
+BEGIN
+	SELECT TMC_JOB.state_id INTO currentState FROM TMC_JOB WHERE TMC_JOB.job_id=v_pk;
+	IF v_stateId >= currentState THEN
+    		UPDATE TMC_JOB
+			SET state_id=v_stateId, finish_time=SYSDATE, result=v_result
+			WHERE job_id=v_pk;
+		returnVal := 1;
+	ELSE
+		returnVal := 0;
+	END IF;
+END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_update_jobpool (
+	   	  		  					v_pk IN NUMBER,
+									v_name  IN VARCHAR2,
+		  						    v_projectid	 	IN NUMBER,
+									 v_userid			IN NUMBER,
+									 v_stateid			IN NUMBER,
+									 v_options			IN VARCHAR2,
+									 v_functionid		IN NUMBER)
+
+AS
+BEGIN
+    	UPDATE TMC_JOB_POOL
+		SET job_pool_name=v_name,
+			project_ID=v_projectid,
+			user_ID=v_userid,
+			state_id=v_stateid,
+			options=v_options,
+			function_id=v_functionId
+		WHERE job_pool_id=v_pk;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_update_project
+		  						   ( v_id		 	IN	NUMBER,
+								   	 v_name	 		IN 	VARCHAR2
+									 )
+AS
+BEGIN
+    	UPDATE TMC_project
+		SET project_name=v_name
+		WHERE project_id=v_id;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tmc_update_state
+		  						   ( v_id		 	IN	NUMBER,
+								   	 v_name	 		IN 	VARCHAR2,
+									 v_color		IN 	VARCHAR2
+				     			   	 )
+AS
+BEGIN
+    	UPDATE TMC_State
+		SET state_name=v_name, state_color=v_color
+		WHERE state_id=v_id;
+END;
+/
+CREATE OR REPLACE PROCEDURE SP_TMC_UPDATE_USER
+		  						   ( v_id		 	IN  NUMBER,
+								   	 v_name	 		IN 	VARCHAR2,
+									 v_fn			IN 	VARCHAR2,
+									 v_ln			IN 	VARCHAR2,
+									 v_email		IN 	VARCHAR2,
+									 v_comments		IN 	VARCHAR2,
+									 v_jobTitle		IN 	VARCHAR2,
+									 v_state		IN	NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	UPDATE TMC_USER
+		   	SET user_name=v_name, first_name=v_fn, last_name=v_ln, email=v_email, comments=v_comments, job_title=v_jobTitle, state_ID=v_state
+			WHERE user_id=v_id;
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tm_delete_entity
+		  						   ( v_Id		 	IN  NUMBER,
+								   	 v_return 		OUT NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+	DELETE FROM TM_ENTITY
+	WHERE ENTITY_id=v_Id;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+	DELETE FROM TMC_REL_VHOST_CONTEXT
+	where CONTEXT_ID=v_id;
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tm_delete_pool
+		  						   ( v_Id		 	IN  NUMBER,
+								   	 v_return 		OUT NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+	DELETE FROM TM_pool
+	WHERE pool_id=v_Id;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+	DELETE FROM TM_REL_pool_worker
+	where pool_ID=v_id;
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tm_delete_worker_pool
+		  						   ( v_poolId		 	IN  NUMBER,
+								   	 v_workerId	 		IN 	NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+	DELETE FROM TM_REL_POOL_WORKER
+	WHERE POOL_id=v_poolId
+	AND worker_id=v_workerId;
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tm_drop_ctxt_rel_project
+		  						   ( v_pId		 	IN NUMBER,
+								   	 v_cId	 		IN NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	delete from TM_REL_ENTITY_PROJECT
+		   	where entity_id = v_cId
+			AND	  project_id = v_pId;
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tm_drop_entity
+		  						   ( v_return 		OUT NUMBER,
+								   	 v_Id		 	IN  NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+	DELETE FROM TM_ENTITY
+	WHERE ENTITY_id=v_Id;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+	DELETE FROM TMC_REL_VHOST_CONTEXT
+	where CONTEXT_ID=v_id;
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tm_drop_pool
+		  						   ( v_return 		OUT NUMBER,
+								   	 v_Id		 	IN  NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+	DELETE FROM TM_pool
+	WHERE pool_id=v_Id;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+	DELETE FROM TM_REL_pool_worker
+	where pool_ID=v_id;
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE SP_TM_DROP_SERVER (v_return OUT NUMBER,
+	   	  		  							   v_tId IN NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TM_CONTAINER
+	WHERE CONTAINER_ID=v_tId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tm_drop_worker (v_return OUT NUMBER,
+	   	  		  							   v_wId IN NUMBER)
+
+AS
+BEGIN
+	v_return:=0;
+	DELETE FROM TM_WORKER
+	WHERE worker_ID=v_wId;
+	IF SQL%NOTFOUND THEN v_return:=1;
+	END IF;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tm_prep_container_ENTRY (
+	   	  		  					v_Id IN NUMBER,
+									v_result IN BLOB)
+AS
+BEGIN
+    	UPDATE TM_CONTAINER
+		set conf_entry=v_result
+		WHERE container_ID=v_Id;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tm_store_ctxt_rel_project
+		  						   ( v_pId		 	IN NUMBER,
+								   	 v_cId	 		IN NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO TM_REL_ENTITY_PROJECT (entity_id, project_id)
+		   	VALUES ( v_cId, v_pId);
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tm_store_entity
+		  						   ( v_seq				OUT NUMBER,
+								     v_enitiyName	 	IN VARCHAR2,
+									 v_docBase			IN VARCHAR2,
+									 v_envId			IN NUMBER,
+									 v_stateId			IN NUMBER,
+									 v_poolId			IN NUMBER,
+									 v_xml				IN VARCHAR2,
+									 v_exPid			IN NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO
+			TM_ENTITY (entity_id, entity_name, doc_base, entity_state_id, env_id, tomcat_pool_id, entity_defin, ex_project_id)
+		   	VALUES ( tm_entity_id.NEXTVAL, v_enitiyName, v_docBase, v_stateId,v_envId, v_poolId, v_xml, v_exPid);
+			-- get the newly added jobid
+			v_seq:=f_last_sequence_number('tm_entity_id');
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tm_store_pool
+		  						   ( v_id	 	OUT NUMBER,
+									 v_name		IN	VARCHAR2,
+									 v_eId		IN 	NUMBER
+									 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+		   	INSERT INTO
+			TM_POOL (pool_id, pool_name, env_Id)
+		   	VALUES ( tm_pool_seq.NEXTVAL, v_name, v_eId);
+			-- get the newly added jobid
+			v_id:=f_last_sequence_number('tm_pool_seq');
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tm_store_tomcat4
+		  						   ( v_id		 	OUT	NUMBER,
+								   	 v_name	 		IN 	VARCHAR2,
+									 v_baseLocation	IN 	VARCHAR2,
+									 v_tomcatHome	IN 	VARCHAR2,
+									 v_httpPort		IN 	NUMBER,
+									 v_sysUser		IN 	VARCHAR2,
+									 v_sysGroup		IN	VARCHAR2,
+									 v_descrip		IN	VARCHAR2,
+									 v_tt			IN	NUMBER,
+									 v_javaHome		IN	VARCHAR2,
+									 v_startClass	IN	VARCHAR2,
+									 v_outLog		IN	VARCHAR2,									 
+									 v_entry		IN	BLOB
+				     			   	 )
+AS
+BEGIN
+
+	 		INSERT INTO TM_CONTAINER tc (tc.CONTAINER_ID, tc.CONTAINER_NAME, tc.BASE_LOCATION, tc.TOMCAT_HOME, tc.HTTP_PORT, tc.SYS_USER, tc.SYS_GROUP, tc.TOMCAT_TYPE, tc.DESCRIPTION,tc.STD_OUT_LOG, tc.START_CLASS, tc.JAVA_HOME, tc.CONF_ENTRY)
+		   	VALUES ( tm_tomcat4_seq.NEXTVAL, v_name, v_baseLocation, v_tomcatHome, v_httpPort, v_sysUser, v_sysGroup, v_tt, v_descrip, v_outLog, v_startClass, v_javaHome, v_entry);
+			-- get the newly added id
+			v_id:=f_last_sequence_number('tm_tomcat4_seq');
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tm_store_worker
+ 		  						   ( v_id	 	OUT NUMBER,
+ 									 v_hId		IN	NUMBER,
+ 									 v_sId		IN 	NUMBER,
+ 									 v_tId		IN	NUMBER
+ 									 )
+ AS
+
+ CURSOR cv IS     select worker_id from TM_WORKER where
+    hardware_id = v_hId and
+    container_id = v_tId;
+
+ w_id number;
+
+
+ BEGIN
+
+    OPEN cv ;
+
+	fetch cv into w_id;
+
+    IF(cv%NOTFOUND) THEN
+ 		   	INSERT INTO TM_WORKER (worker_id, hardware_id, state_Id, container_id)
+			VALUES ( tm_worker_seq.NEXTVAL, v_hId, v_sId, v_tId);
+ 			-- get the newly added jobid
+ 			v_id:=f_last_sequence_number('tm_worker_seq');
+    ELSE
+       v_id:= w_id;
+    END IF;
+
+    CLOSE cv;
+ END;
+/
+CREATE OR REPLACE PROCEDURE sp_tm_store_worker_pool
+		  						   ( v_poolId		 	IN  NUMBER,
+								   	 v_workerId	 		IN 	NUMBER
+				     			   	 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+	INSERT INTO TM_REL_POOL_WORKER (POOL_ID, WORKER_ID)
+	Values (v_poolId, v_workerId);
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tm_update_entity
+		  						   ( v_id	 	IN	NUMBER,
+									 v_name		IN	VARCHAR2,
+									 v_docbase	IN 	VARCHAR2,
+									 v_envId	IN	NUMBER,
+									 v_stateId	IN	NUMBER,
+									 V_tpId		IN	NUMBER,
+									 v_xml		IN	VARCHAR2,
+									 v_exPid	IN	NUMBER
+									 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+    	UPDATE TM_ENTITY
+		SET entity_name=v_name, ENV_ID=v_envId, DOC_BASE=v_docbase, ex_project_id=v_exPid,
+			ENTITY_STATE_ID=v_stateId, TOMCAT_POOL_ID=v_tpid, entity_defin=v_xml
+		WHERE entity_id=v_id;
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tm_update_pool
+		  						   ( v_id	 	IN	NUMBER,
+									 v_name		IN	VARCHAR2,
+									 v_eId		IN 	NUMBER
+									 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+    	UPDATE TM_POOL
+		SET pool_name=v_name, ENV_ID=v_eId
+		WHERE pool_id=v_id;
+	  END;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tm_update_tomcat4
+		  						   ( v_id		 	IN	NUMBER,
+								   	 v_name	 		IN 	VARCHAR2,
+									 v_baseLocation	IN 	VARCHAR2,
+									 v_tomcatHome	IN 	VARCHAR2,
+									 v_httpPort		IN 	NUMBER,
+									 v_sysUser		IN 	VARCHAR2,
+									 v_sysGroup		IN	VARCHAR2,
+									 v_descrip		IN	VARCHAR2,
+									 v_tt			IN	NUMBER,
+									 v_javaHome		IN	VARCHAR2,
+									 v_startClass	IN	VARCHAR2,
+									 v_stdOutLog	IN	VARCHAR2,
+									 v_entry		IN	BLOB
+				     			   	 )
+AS
+BEGIN
+    	UPDATE TM_CONTAINER tc
+		SET tc.CONTAINER_NAME=v_name,
+			tc.BASE_LOCATION=v_baseLocation,
+			tc.TOMCAT_HOME=v_tomcatHome,
+			tc.HTTP_PORT=v_httpPort,
+			tc.SYS_USER=v_sysUser,
+			tc.SYS_GROUP=v_sysGroup,
+			tc.DESCRIPTION=v_descrip,
+			tc.TOMCAT_TYPE=v_tt,
+			tc.JAVA_HOME=v_javaHome,
+			tc.START_CLASS=v_startClass,
+			tc.STD_OUT_LOG=v_stdOutLog,
+			tc.conf_entry=v_entry
+
+		WHERE tc.CONTAINER_ID=v_id;
+END;
+/
+CREATE OR REPLACE PROCEDURE sp_tm_update_worker
+			  					   ( v_id	 	IN  NUMBER,
+									 v_hId		IN	NUMBER,
+									 v_sId		IN 	NUMBER,
+									 v_tId		IN	NUMBER
+									 )
+AS
+BEGIN
+DECLARE
+	  BEGIN
+	    UPDATE TM_WORKER
+		SET hardware_id=v_hId,
+			state_id=v_sId,
+			container_id=v_tId
+		WHERE worker_id=v_id;
+	  END;
+END;
+/
+CREATE OR REPLACE procedure sp_update_admin_jvm_role (	v_prim		IN varchar2,
+											v_back		IN varchar2,
+											v_alt		IN varchar2,
+											v_inst		IN NUMBER)
+AS
+BEGIN
+	UPDATE tmc_admin
+	SET primary_jvm=v_prim,
+		backup_jvm=v_back,
+		alternate_jvm=v_alt
+	WHERE INSTANCE_ID=v_inst;
+	if sql%notfound then
+	   INSERT INTO tmc_admin (primary_jvm, backup_jvm, alternate_jvm, instance_ID)
+	   values (v_prim, v_back, v_alt, v_inst);
+	end if;
+END;
+/

Added: incubator/lokahi/lokahi/trunk/database/sequences.sql
URL: http://svn.apache.org/viewcvs/incubator/lokahi/lokahi/trunk/database/sequences.sql?rev=392982&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/database/sequences.sql (added)
+++ incubator/lokahi/lokahi/trunk/database/sequences.sql Mon Apr 10 09:19:33 2006
@@ -0,0 +1,55 @@
+CREATE SEQUENCE AM_APACHE_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE AM_POOL_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE AM_VHOST_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE AM_WORKER_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_ALERT_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_ENVIROMENT_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_EX_PROJECT_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_FILE_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_FUNCTION_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_HARDWARE_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_HELP_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_HOSTING_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_HPE_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_INSTANCE_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_IP_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_JOBPOOL_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_JOB_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_KEYWORD_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_PROJECT_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_STATE_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_TEMPLATE_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_TOPIC_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_USER_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TMC_VHOST_GP_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TM_ENTITY_ID INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TM_POOL_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TM_TOMCAT4_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
+
+CREATE SEQUENCE TM_WORKER_SEQ INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE NOCACHE NOORDER;
\ No newline at end of file

Added: incubator/lokahi/lokahi/trunk/database/tables.sql
URL: http://svn.apache.org/viewcvs/incubator/lokahi/lokahi/trunk/database/tables.sql?rev=392982&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/database/tables.sql (added)
+++ incubator/lokahi/lokahi/trunk/database/tables.sql Mon Apr 10 09:19:33 2006
@@ -0,0 +1,311 @@
+
+CREATE TABLE AM_CONTAINER ( CONTAINER_ID NUMBER NOT NULL, CONTAINER_NAME VARCHAR2(100) NOT NULL, SERVER_ROOT VARCHAR2(300), LOG_LOCATION VARCHAR2(300), SYS_USER VARCHAR2(8), SYS_GROUP VARCHAR2(8), START_COMMAND VARCHAR2(4000), STOP_COMMAND VARCHAR2(4000), RESTART_COMMAND VARCHAR2(4000), FORK_WAIT NUMBER, PIDFILE_LOCATION VARCHAR2(300), ENV_VARIBLES VARCHAR2(4000), MAIN_ID NUMBER ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE AM_POOL ( POOL_ID NUMBER NOT NULL, POOL_NAME VARCHAR2(40) NOT NULL, ENV_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE AM_REL_CONTAINER_FILE ( CONTAINER_ID NUMBER NOT NULL, FILE_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE AM_REL_ENTITY_PROJECT ( PROJECT_ID NUMBER NOT NULL, VHOST_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE AM_REL_POOL_WORKER ( POOL_ID NUMBER NOT NULL, WORKER_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE AM_REL_VHOST_IP ( VHOST_ID NUMBER NOT NULL, IP_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE AM_VHOST ( VHOST_ID NUMBER NOT NULL, VHOST_ENTRY BLOB, VHOST_NAME VARCHAR2(60) NOT NULL, ENV_ID NUMBER, STATE_ID NUMBER, HOSTING_POOL_ID NUMBER, NAMEBASED NUMBER DEFAULT 1, CATCHALL NUMBER DEFAULT 0, EX_PROJECT_ID NUMBER DEFAULT 0 ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE AM_WORKER ( WORKER_ID NUMBER NOT NULL, STATE_ID NUMBER, HARDWARE_ID NUMBER NOT NULL, CONTAINER_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_ADMIN ( LOCK_USERS NUMBER, PRIMARY_JVM VARCHAR2(60), BACKUP_JVM VARCHAR2(60), ALTERNATE_JVM VARCHAR2(2000), OLD_KEY VARCHAR2(30), CURRENT_KEY VARCHAR2(30), KEY_LAST_ROTATED DATE, INSTANCE_ID NUMBER ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_ALERTS ( ALERT_ID NUMBER NOT NULL, ALERT_CONTENTS BLOB, SUBMISION_DATE DATE, SUBMITTER_ID NUMBER NOT NULL, ALERT_TITLE VARCHAR2(200), ALERT_LINK VARCHAR2(4000) ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_CONTROLLER ( INSTANCE_ID NUMBER NOT NULL, CONTROLLER_NAME VARCHAR2(400) NOT NULL, CONTROLLER_ID NUMBER NOT NULL, LAST_CHECK_IN DATE NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_ENV ( ENV_ID NUMBER NOT NULL, ENV_NAME VARCHAR2(400) NOT NULL, COMMENTS VARCHAR2(400) ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_EX_PROJECT ( EX_PROJECT_ID NUMBER NOT NULL, EX_PROJECT_NAME VARCHAR2(40) NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_FILES ( FILE_ID NUMBER NOT NULL, FILE_NAME VARCHAR2(100) NOT NULL, FILE_CONTENT BLOB, FILE_DESCRIPTOR VARCHAR2(100), FILE_PATH VARCHAR2(2000) ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_FILE_ARCHIVE ( JOB_ID NUMBER NOT NULL, FILE_CONTENTS BLOB ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_FUNCTION ( FUNCTION_ID NUMBER NOT NULL, FUNCTION_NAME VARCHAR2(50) NOT NULL, FUNCTION_COMMAND VARCHAR2(50), MODULE_ID NUMBER ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_HARDWARE ( HARDWARE_NAME VARCHAR2(60) NOT NULL, PHYSICAL_LOCATION VARCHAR2(500), COMMENTS VARCHAR2(4000), HARDWARE_ID NUMBER NOT NULL, INSTANCE_ID NUMBER, ENV_ID NUMBER, STATUS_ID NUMBER, DEFAULT_IP_ID NUMBER ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_HARDWARE_POOL ( HARDWARE_POOL_NAME VARCHAR2(60) NOT NULL, HARDWARE_POOL_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_HELP_ITEM ( HELP_ITEM_ID NUMBER NOT NULL, HELP_ITEM_TITLE VARCHAR2(50) NOT NULL, VALID NUMBER, FUNCTION_ID NUMBER DEFAULT 0 NOT NULL, CONTENT BLOB NOT NULL, SUMMARY VARCHAR2(250) NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_HOSTING_POOL ( HOSTING_POOL_ID NUMBER NOT NULL, HOSTING_POOL_NAME VARCHAR2(60) NOT NULL, ENV_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_INSTANCE ( INSTANCE_ID NUMBER NOT NULL, INSTANCE_NAME VARCHAR2(100) NOT NULL, COMMENTS VARCHAR2(4000) ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_IP ( IP VARCHAR2(15) NOT NULL, IP_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_JOB ( JOB_ID NUMBER NOT NULL, POOL_ID NUMBER NOT NULL, JOB_NAME VARCHAR2(400), SERVER_ID NUMBER NOT NULL, PARENT_ID NUMBER DEFAULT -1, START_TIME DATE, FINISH_TIME DATE, STATE_ID NUMBER DEFAULT 0, OPTIONS VARCHAR2(4000), INSTANCE_ID NUMBER NOT NULL, FUNCTION_ID NUMBER NOT NULL, RESULT BLOB ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_JOB_POOL ( JOB_POOL_ID NUMBER NOT NULL, JOB_POOL_NAME VARCHAR2(400), PROJECT_ID NUMBER DEFAULT 0, USER_ID NUMBER DEFAULT 0, START_TIME DATE, FINISH_TIME DATE, STATE_ID NUMBER DEFAULT 0, FUNCTION_ID NUMBER NOT NULL, OPTIONS VARCHAR2(4000) ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_KEYWORD ( KEYWORD_ID NUMBER NOT NULL, KEYWORD_NAME VARCHAR2(50) NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_PROJECT ( PROJECT_ID NUMBER NOT NULL, PROJECT_NAME VARCHAR2(500) NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_REL_ALERT_PROJECT ( ALERT_ID NUMBER NOT NULL, PROJECT_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_REL_FUNCTION_USER ( USER_ID NUMBER NOT NULL, FUNCTION_ID NUMBER NOT NULL, OBJECT_ID NUMBER NOT NULL, OBJECT_TYPE NUMBER NOT NULL, PROJECT_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_REL_HARDWARE_FILE ( HARDWARE_ID NUMBER NOT NULL, FILE_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_REL_HARDWARE_IP ( HARDWARE_ID NUMBER NOT NULL, IP_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_REL_HARDWARE_POOL ( HARDWARE_ID NUMBER NOT NULL, POOL_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_REL_HELP_KEYWORD ( HELP_ITEM_ID NUMBER NOT NULL, KEYWORD_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_REL_HELP_TOPIC ( HELP_ITEM_ID NUMBER NOT NULL, TOPIC_ID NUMBER NOT NULL, SUBTOPIC_ID NUMBER ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_REL_HOSTING_MODULES ( HOSTING_POOL_ID NUMBER NOT NULL, TM_POOL_ID NUMBER DEFAULT -1, AM_POOL_ID NUMBER DEFAULT -1 ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_REL_USER_EXPROJ ( USER_ID INTEGER NOT NULL, EX_PROJECT_ID INTEGER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_REL_USER_PROJECT ( PROJECT_ID NUMBER NOT NULL, USER_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_REL_VHOST_CONTEXT ( CONTEXT_ID NUMBER NOT NULL, VHOST_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_STATE ( STATE_ID NUMBER NOT NULL, STATE_NAME VARCHAR2(100) NOT NULL, STATE_COLOR VARCHAR2(30) ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_TEMPLATE_TABLE ( TMC_INSTANCE VARCHAR2(30) NOT NULL, TEMPLATE_ID NUMBER NOT NULL, TEMPLATE_NAME VARCHAR2(100) NOT NULL, TEMPLATE_BLOCK BLOB, STATUS VARCHAR2(15) ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_TIMESTAMP_TABLE ( TABLE_NAME VARCHAR2(30), TIME_MODIFIED DATE, TMC_INSTANCE VARCHAR2(30) ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_TOPIC ( TOPIC_ID NUMBER NOT NULL, TOPIC_NAME VARCHAR2(50) ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TMC_USER ( FIRST_NAME VARCHAR2(30), LAST_NAME VARCHAR2(30), JOB_TITLE VARCHAR2(100), COMMENTS VARCHAR2(2000), EMAIL VARCHAR2(60), USER_ID NUMBER NOT NULL, USER_NAME VARCHAR2(30) NOT NULL, STATE_ID NUMBER DEFAULT 8, PASSWORD VARCHAR2(32) ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TM_CONTAINER ( CONTAINER_ID NUMBER NOT NULL, CONTAINER_NAME VARCHAR2(40), BASE_LOCATION VARCHAR2(100), TOMCAT_HOME VARCHAR2(100), HTTP_PORT NUMBER, SYS_USER VARCHAR2(8), SYS_GROUP VARCHAR2(8), CONF_ENTRY BLOB, TOMCAT_TYPE NUMBER DEFAULT 4, DESCRIPTION VARCHAR2(100), STD_OUT_LOG VARCHAR2(40), START_CLASS VARCHAR2(40), JAVA_HOME VARCHAR2(40) ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TM_ENTITY ( ENTITY_ID NUMBER NOT NULL, ENTITY_NAME VARCHAR2(60) NOT NULL, DOC_BASE VARCHAR2(500) NOT NULL, ENTITY_STATE_ID NUMBER NOT NULL, ENV_ID NUMBER NOT NULL, TOMCAT_POOL_ID NUMBER, ENTITY_DEFIN VARCHAR2(4000), EX_PROJECT_ID NUMBER DEFAULT 0 ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TM_POOL ( POOL_ID NUMBER NOT NULL, POOL_NAME VARCHAR2(40) NOT NULL, ENV_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TM_REL_CONTAINER_FILE ( CONTAINER_ID NUMBER NOT NULL, FILE_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TM_REL_ENTITY_PROJECT ( PROJECT_ID NUMBER NOT NULL, ENTITY_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TM_REL_POOL_WORKER ( POOL_ID NUMBER NOT NULL, WORKER_ID NUMBER NOT NULL ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE TABLE TM_WORKER ( WORKER_ID NUMBER NOT NULL, CONTAINER_ID NUMBER NOT NULL, HARDWARE_ID NUMBER NOT NULL, STATE_ID NUMBER ) LOGGING NOCACHE NOPARALLEL;
+
+
+CREATE UNIQUE INDEX AM_VHOSTID_PK ON AM_VHOST (VHOST_ID) LOGGING NOPARALLEL;
+
+
+CREATE INDEX FK_FUNCTION_ID ON TMC_HELP_ITEM (FUNCTION_ID) LOGGING NOPARALLEL;
+
+
+CREATE INDEX FK_SUBTOPIC_ID ON TMC_REL_HELP_TOPIC (SUBTOPIC_ID) LOGGING NOPARALLEL;
+
+
+CREATE INDEX FK_TOPIC_ID ON TMC_REL_HELP_TOPIC (TOPIC_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_AM_CONTAINER ON AM_CONTAINER (CONTAINER_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_AM_POOL ON AM_POOL (POOL_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_AM_WORKER ON AM_WORKER (WORKER_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_FILE_ID ON TMC_FILES (FILE_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_PROJECT ON TMC_PROJECT (PROJECT_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_TMC_ALERTS ON TMC_ALERTS (ALERT_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_TMC_CONTROLLER ON TMC_CONTROLLER (CONTROLLER_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_TMC_ENV ON TMC_ENV (ENV_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_TMC_EX_PROJECT ON TMC_EX_PROJECT (EX_PROJECT_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_TMC_HELP_ITEM ON TMC_HELP_ITEM (HELP_ITEM_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_TMC_HOSTING_POOL ON TMC_HOSTING_POOL (HOSTING_POOL_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_TMC_INSTANCE ON TMC_INSTANCE (INSTANCE_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_TMC_IP ON TMC_IP (IP_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_TMC_JOB ON TMC_JOB (JOB_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_TMC_JOB_POOL ON TMC_JOB_POOL (JOB_POOL_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_TMC_KEYWORD ON TMC_KEYWORD (KEYWORD_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_TMC_REL_HELP_KEYWORD ON TMC_REL_HELP_KEYWORD (HELP_ITEM_ID, KEYWORD_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_TMC_STATE ON TMC_STATE (STATE_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_TMC_TOPIC ON TMC_TOPIC (TOPIC_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_TM_CONTAINER ON TM_CONTAINER (CONTAINER_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_TM_POOL ON TM_POOL (POOL_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_TM_WORKER ON TM_WORKER (WORKER_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX PK_USERID ON TMC_USER (USER_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX TMC_SERVERID_PK ON TMC_HARDWARE (HARDWARE_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX TMC_TEMPLATE_TABLE_ID ON TMC_TEMPLATE_TABLE (TEMPLATE_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX TM_CONTEXT_TABLE_CTXTID ON TM_ENTITY (ENTITY_ID) LOGGING NOPARALLEL;
+
+
+CREATE UNIQUE INDEX UNQ_TIMESTAMP_TABLE ON TMC_TIMESTAMP_TABLE (TMC_INSTANCE, TABLE_NAME) LOGGING NOPARALLEL;
+
+
+ALTER TABLE AM_CONTAINER ADD (  CONSTRAINT PK_AM_CONTAINER PRIMARY KEY (CONTAINER_ID));
+
+ALTER TABLE AM_POOL ADD (  CONSTRAINT PK_AM_POOL PRIMARY KEY (POOL_ID));
+
+ALTER TABLE AM_VHOST ADD (  CONSTRAINT AM_VHOSTID_PK PRIMARY KEY (VHOST_ID));
+
+ALTER TABLE AM_WORKER ADD (  CONSTRAINT PK_AM_WORKER PRIMARY KEY (WORKER_ID));
+
+ALTER TABLE TMC_ALERTS ADD (  CONSTRAINT PK_TMC_ALERTS PRIMARY KEY (ALERT_ID));
+
+ALTER TABLE TMC_CONTROLLER ADD (  CONSTRAINT PK_TMC_CONTROLLER PRIMARY KEY (CONTROLLER_ID));
+
+ALTER TABLE TMC_ENV ADD (  CONSTRAINT PK_TMC_ENV PRIMARY KEY (ENV_ID));
+
+ALTER TABLE TMC_EX_PROJECT ADD (  CONSTRAINT PK_TMC_EX_PROJECT PRIMARY KEY (EX_PROJECT_ID),  UNIQUE (EX_PROJECT_NAME));
+
+ALTER TABLE TMC_FILES ADD (  CONSTRAINT PK_FILE_ID PRIMARY KEY (FILE_ID));
+
+ALTER TABLE TMC_FUNCTION ADD (  PRIMARY KEY (FUNCTION_ID));
+
+ALTER TABLE TMC_HARDWARE ADD (  CONSTRAINT TMC_SERVERID_PK PRIMARY KEY (HARDWARE_ID));
+
+ALTER TABLE TMC_HARDWARE_POOL ADD (  PRIMARY KEY (HARDWARE_POOL_ID));
+
+ALTER TABLE TMC_HELP_ITEM ADD (  CONSTRAINT PK_TMC_HELP_ITEM PRIMARY KEY (HELP_ITEM_ID),  UNIQUE (HELP_ITEM_TITLE));
+
+ALTER TABLE TMC_HOSTING_POOL ADD (  CONSTRAINT PK_TMC_HOSTING_POOL PRIMARY KEY (HOSTING_POOL_ID));
+
+ALTER TABLE TMC_INSTANCE ADD (  CONSTRAINT PK_TMC_INSTANCE PRIMARY KEY (INSTANCE_ID));
+
+ALTER TABLE TMC_IP ADD (  CONSTRAINT PK_TMC_IP PRIMARY KEY (IP_ID));
+
+ALTER TABLE TMC_JOB ADD (  CONSTRAINT PK_TMC_JOB PRIMARY KEY (JOB_ID));
+
+ALTER TABLE TMC_JOB_POOL ADD (  CONSTRAINT PK_TMC_JOB_POOL PRIMARY KEY (JOB_POOL_ID));
+
+ALTER TABLE TMC_KEYWORD ADD (  CONSTRAINT PK_TMC_KEYWORD PRIMARY KEY (KEYWORD_ID),  UNIQUE (KEYWORD_NAME));
+
+ALTER TABLE TMC_PROJECT ADD (  CONSTRAINT PK_PROJECT PRIMARY KEY (PROJECT_ID));
+
+ALTER TABLE TMC_REL_HELP_KEYWORD ADD (  CONSTRAINT PK_TMC_REL_HELP_KEYWORD PRIMARY KEY (HELP_ITEM_ID, KEYWORD_ID));
+
+ALTER TABLE TMC_REL_HELP_TOPIC ADD (  UNIQUE (HELP_ITEM_ID));
+
+ALTER TABLE TMC_STATE ADD (  CONSTRAINT PK_TMC_STATE PRIMARY KEY (STATE_ID));
+
+ALTER TABLE TMC_TEMPLATE_TABLE ADD (  CONSTRAINT TMC_TEMPLATE_TABLE_ID PRIMARY KEY (TEMPLATE_ID));
+
+ALTER TABLE TMC_TIMESTAMP_TABLE ADD (  CONSTRAINT UNQ_TIMESTAMP_TABLE UNIQUE (TMC_INSTANCE, TABLE_NAME));
+
+ALTER TABLE TMC_TOPIC ADD (  CONSTRAINT PK_TMC_TOPIC PRIMARY KEY (TOPIC_ID),  UNIQUE (TOPIC_NAME));
+
+ALTER TABLE TMC_USER ADD (  CONSTRAINT PK_USERID PRIMARY KEY (USER_ID),  UNIQUE (USER_NAME));
+
+ALTER TABLE TM_CONTAINER ADD (  CONSTRAINT PK_TM_CONTAINER PRIMARY KEY (CONTAINER_ID));
+
+ALTER TABLE TM_ENTITY ADD (  CONSTRAINT TM_CONTEXT_TABLE_CTXTID PRIMARY KEY (ENTITY_ID));
+
+ALTER TABLE TM_POOL ADD (  CONSTRAINT PK_TM_POOL PRIMARY KEY (POOL_ID),  UNIQUE (POOL_NAME));
+
+ALTER TABLE TM_WORKER ADD (  CONSTRAINT PK_TM_WORKER PRIMARY KEY (WORKER_ID));
+
+ALTER TABLE AM_REL_CONTAINER_FILE ADD (  CONSTRAINT CONT_ID_REL FOREIGN KEY (CONTAINER_ID) REFERENCES AM_CONTAINER (CONTAINER_ID) ON DELETE CASCADE);
+
+ALTER TABLE AM_REL_ENTITY_PROJECT ADD (  CONSTRAINT PROJECT_ID_FK2 FOREIGN KEY (PROJECT_ID) REFERENCES TMC_PROJECT (PROJECT_ID) ON DELETE CASCADE DISABLE,  CONSTRAINT VHOST_ID_FK FOREIGN KEY (VHOST_ID) REFERENCES AM_VHOST (VHOST_ID) ON DELETE CASCADE DISABLE);
+
+ALTER TABLE TMC_REL_HELP_TOPIC ADD (  CONSTRAINT FK_REL_HELP_ITEM_ID FOREIGN KEY (HELP_ITEM_ID) REFERENCES TMC_HELP_ITEM (HELP_ITEM_ID) ON DELETE CASCADE,  CONSTRAINT FK_SUBTOPIC_ID FOREIGN KEY (SUBTOPIC_ID) REFERENCES TMC_TOPIC (TOPIC_ID) ON DELETE CASCADE,  CONSTRAINT FK_TOPIC_ID FOREIGN KEY (TOPIC_ID) REFERENCES TMC_TOPIC (TOPIC_ID) ON DELETE CASCADE);
+
+ALTER TABLE TM_REL_ENTITY_PROJECT ADD (  CONSTRAINT ENTITY_ID_FK FOREIGN KEY (ENTITY_ID) REFERENCES TM_ENTITY (ENTITY_ID) ON DELETE CASCADE DISABLE,  CONSTRAINT PROJECT_ID_FK FOREIGN KEY (PROJECT_ID) REFERENCES TMC_PROJECT (PROJECT_ID) ON DELETE CASCADE DISABLE);
+

Added: incubator/lokahi/lokahi/trunk/database/triggers.sql
URL: http://svn.apache.org/viewcvs/incubator/lokahi/lokahi/trunk/database/triggers.sql?rev=392982&view=auto
==============================================================================
    (empty)

Added: incubator/lokahi/lokahi/trunk/database/views.sql
URL: http://svn.apache.org/viewcvs/incubator/lokahi/lokahi/trunk/database/views.sql?rev=392982&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/database/views.sql (added)
+++ incubator/lokahi/lokahi/trunk/database/views.sql Mon Apr 10 09:19:33 2006
@@ -0,0 +1,100 @@
+CREATE OR REPLACE FORCE VIEW AM_ENTITY_VIEW
+(VHOST_ID, ENV_ID, STATE_ID, VHOST_NAME, VHOST_ENTRY, 
+ HOSTING_POOL_ID, NAMEBASED, CATCHALL, EX_PROJECT_ID, POOL_ID, 
+ POOL_NAME, POOL_ENV_ID)
+AS 
+SELECT vh.VHOST_ID, vh.ENV_ID, vh.STATE_ID, vh.VHOST_NAME, vh.VHOST_ENTRY, vh.HOSTING_POOL_ID, vh.NAMEBASED, vh.CATCHALL,  vh.EX_PROJECT_ID, p.POOL_ID, p.POOL_NAME, p.ENV_ID as POOL_ENV_ID
+FROM AM_VHOST vh, TMC_REL_HOSTING_MODULES rel, am_POOL p
+where vh.hosting_POOL_ID=rel.HOSTING_POOL_ID
+AND   p.POOL_ID=rel.AM_POOL_ID;
+
+
+CREATE OR REPLACE FORCE VIEW AM_WORKER_VIEW
+(WORKER_ID, CONTAINER_ID, STATE_ID, HARDWARE_ID, CONTAINER_NAME, 
+ SERVER_ROOT, LOG_LOCATION, SYS_USER, SYS_GROUP, START_COMMAND, 
+ STOP_COMMAND, RESTART_COMMAND, FORK_WAIT, PIDFILE_LOCATION, ENV_VARIBLES, 
+ MAIN_ID, HARDWARE_NAME, PHYSICAL_LOCATION, COMMENTS, INSTANCE_ID, 
+ ENV_ID, HARDWARE_STATE_ID, DEFAULT_IP_ID)
+AS 
+SELECT
+  w.worker_id,
+  container_id,
+  w.state_id,
+  hardware_id,
+  c.container_name,
+  c.server_root,
+  c.log_location,
+  c.sys_user,
+  c.sys_group,
+  c.start_command,
+  c.stop_command,
+  c.restart_command,
+  c.fork_wait,
+  c.pidfile_location,
+  c.env_varibles,
+  c.main_id,
+  h.hardware_name,
+  h.physical_location,
+  h.comments,
+  h.instance_id,
+  h.env_id,
+  h.status_id as hardware_state_id,
+  h.default_ip_id
+FROM
+  ((AM_WORKER w join AM_Container c using (container_ID)) JOIN TMC_HARDWARE h using (HARDWARE_ID));
+
+
+CREATE OR REPLACE FORCE VIEW TM_ENTITY_VIEW
+(ENTITY_ID, ENTITY_NAME, DOC_BASE, ENTITY_STATE_ID, ENV_ID, 
+ TOMCAT_POOL_ID, ENTITY_DEFIN, POOL_NAME, EX_PROJECT_ID, POOL_ENV_ID)
+AS 
+SELECT
+  entity_id,
+  entity_name,
+  doc_base,
+  entity_state_id,
+  e.env_id,
+  tomcat_pool_id,
+  entity_defin,
+  pool_name,
+  EX_PROJECT_ID,
+  p.env_id as pool_env_id
+FROM
+  TM_ENTITY e JOIN TM_POOL p on e.TOMCAT_POOL_ID = p.POOL_ID;
+
+
+CREATE OR REPLACE FORCE VIEW TM_WORKER_VIEW
+(WORKER_ID, CONTAINER_ID, STATE_ID, HARDWARE_ID, CONTAINER_NAME, 
+ BASE_LOCATION, TOMCAT_HOME, HTTP_PORT, SYS_USER, SYS_GROUP, 
+ TOMCAT_TYPE, DESCRIPTION, CONF_ENTRY, STD_OUT_LOG, JAVA_HOME, 
+ START_CLASS, HARDWARE_NAME, PHYSICAL_LOCATION, COMMENTS, INSTANCE_ID, 
+ ENV_ID, STATUS_ID, DEFAULT_IP_ID)
+AS 
+SELECT
+  w.worker_id,
+  container_id,
+  w.state_id,
+  hardware_id,
+  c.container_name,
+  c.base_location,
+  c.tomcat_home,
+  c.http_PORT,
+  c.sys_user,
+  c.sys_group,
+  c.tomcat_type,
+  c.description,
+  c.conf_entry,
+  c.std_out_log,
+  c.java_home,
+  c.start_class,
+  h.hardware_name,
+  h.physical_location,
+  h.comments,
+  h.instance_id,
+  h.env_id,
+  h.status_id,
+  h.default_ip_id
+FROM
+  ((TM_WORKER w join TM_Container c using (container_ID)) JOIN TMC_HARDWARE h using (HARDWARE_ID));
+
+

Added: incubator/lokahi/lokahi/trunk/docs/README.TXT
URL: http://svn.apache.org/viewcvs/incubator/lokahi/lokahi/trunk/docs/README.TXT?rev=392982&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/docs/README.TXT (added)
+++ incubator/lokahi/lokahi/trunk/docs/README.TXT Mon Apr 10 09:19:33 2006
@@ -0,0 +1,43 @@
+Requirements:  Tomcat 5.5.9, Oracle 9i, JDK 1.5, ant 1.6.5 or later.
+
+Build instructions:
+1.	untar the tarball.
+2.	edit the ‘tomcat.home’ property in the build.properties file to point to your installation of tomcat.
+3.	download and add the proper classes12.jar, from the oracle website, to the lib directory.
+4.	verify that JAVA_HOME is properly set to point to jdk1.5 in your shell.
+5.	run ‘ant’ to build the package.
+
+Database setup:
+1.	run the build/database/*.sql scripts against your database to set up the schema.
+2.	create a user, instance.  (ok, so we need a script to do this, java!)
+
+Agent install:
+1.	copy the files in ./build/agent to a directory on each server.
+2.	start the agent buy running:  $JAVA_HOME/bin/java –classpath “$JAVA_HOME/lib/tools.jar:$AGENT_HOME/tmc.jar:$AGENT_HOME/log4j-1.2.8.jar” tmc.agent.TMCAgent start
+
+Console install:
+1.	in build/gui/WEB-INF/log4j.xml set this line to a valid path: <param name="File" value="/www/httpd/logs/websites/tmc_log4j.log"/>
+2.	in build/gui/WEB-INF/classes/tmc/ApplicationResources.properties:  application.root should be set to the context path, and rss.link.location should be set to <website>/<context>/rss/alert
+3.	in build/gui/WEB-INF/classes/tmc.properties set these:
+
+#context name
+application.root=/tmc
+#full site app is being hosted at
+application.full.url=http://tmcg2.sourceforge.net/tmc/
+#full site for controller access
+AGENT_REPLY_TO_ADDRESS=https://tmcg2.sourceforge.net/tmc/services/TmcJob
+#full url for the rest servlet
+rest.servlet.url=http://tmcg2.sourceforge.net/tmc/rest/
+#authentication Module to use
+AuthenticateModule=tmc.authentication.NoAuthentication
+#database info
+tmc.database.uri=jdbc:oracle:thin:@some.server.net:PORT:SCHEMA
+tmc.database.user=tmc
+tmc.database.password=tmc
+tmc.database.driver=oracle.jdbc.driver.OracleDriver
+#instance for this controller
+tmc.instance.name=WHS Intranet
+#location of properties files
+prop.location=/websites/tmcg2.sourceforge.net/java/tmc
+
+4. define the context in tomcat’s server.xml file and start tomcat.
\ No newline at end of file

Added: incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/AbstractAgentTask.java
URL: http://svn.apache.org/viewcvs/incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/AbstractAgentTask.java?rev=392982&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/AbstractAgentTask.java (added)
+++ incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/AbstractAgentTask.java Mon Apr 10 09:19:33 2006
@@ -0,0 +1,69 @@
+/*
+* Copyright 2006  The Apache Software Foundation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package lokahi.core.agent;
+
+import lokahi.core.agent.dao.TaskType;
+import lokahi.core.agent.interfaces.AgentTask;
+
+import java.util.concurrent.FutureTask;
+
+/**
+ * @author Stephen Toback
+ * @version $Id: AbstractAgentTask.java,v 1.1 2006/03/02 19:19:44 drtobes Exp $
+ */
+public abstract class AbstractAgentTask<V> implements AgentTask {
+  protected FutureTask<V> task;
+  private int jobId;
+  private TaskType type;
+
+  public int getJobId() {
+    return jobId;
+  }
+
+  protected void setJobId(int id) {
+    this.jobId = id;
+  }
+
+  public boolean isDone() {
+    return task.isDone();
+  }
+
+  public boolean cancel(boolean mayInterruptIfRunning) {
+    return task.cancel(mayInterruptIfRunning);
+  }
+
+  public boolean isCanceled() {
+    return task.isCancelled();
+  }
+
+  public Runnable getRunnable() {
+    return task;
+  }
+
+  public TaskType getType() {
+    return type;
+  }
+
+  protected void setType(TaskType t) {
+    this.type = t;
+  }
+
+}
+
+
+
+
+

Added: incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/JobSOAP.java
URL: http://svn.apache.org/viewcvs/incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/JobSOAP.java?rev=392982&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/JobSOAP.java (added)
+++ incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/JobSOAP.java Mon Apr 10 09:19:33 2006
@@ -0,0 +1,82 @@
+/*
+* Copyright 2006  The Apache Software Foundation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package lokahi.core.agent;
+
+import lokahi.core.agent.dao.AgentJob;
+import lokahi.core.agent.job.ScheduledJob;
+import lokahi.core.common.database.DerbyBroker;
+import lokahi.core.common.interfaces.TMCBroker;
+import lokahi.core.common.util.PropertiesFile;
+import org.apache.axis.AxisFault;
+import org.apache.log4j.Logger;
+
+import java.sql.SQLException;
+
+/**
+ * @author Stephen Toback
+ * @version $Id: JobSOAP.java,v 1.1 2006/03/02 19:19:44 drtobes Exp $
+ */
+public class JobSOAP {
+  static final Logger logger = Logger.getLogger(JobSOAP.class);
+
+  public String scheduleJob(byte[] attach, String key, String jobName, String parentName, String details, String returnTo, String returnEndpoint, String returnMethod) throws AxisFault {
+    String attachment = new String(attach);
+    AgentJob j = new ScheduledJob(jobName, parentName, details, returnTo, returnEndpoint, returnMethod, attachment);
+    return this.handleJob(j);
+  }
+
+  public String scheduleJob(String key, String jobName, String parentName, String details, String returnTo, String returnEndpoint, String returnMethod) throws AxisFault {
+    if (logger.isInfoEnabled())
+      logger.info("Received Job: " + jobName + "with details: " + details);
+    AgentJob j = new ScheduledJob(jobName, parentName, details, returnTo, returnEndpoint, returnMethod);
+    return this.handleJob(j);
+  }
+
+  private String handleJob(AgentJob j) throws AxisFault {
+    try {
+      AgentJob.store(j);
+      return PropertiesFile.getConstantValue("tmc.agent.store.success");
+    } catch (SQLException e) {
+      if (logger.isInfoEnabled()) {
+        logger.info("Exception: " + e.getMessage());
+      }
+      throw new AxisFault("Error in scheduling Job: ", e);
+    }
+  }
+
+  public static String scheduleJob(String key, String algorithim, AgentJob... jobs) throws SQLException {
+    boolean flag = true;
+    String ret = PropertiesFile.getConstantValue("tmc.agent.store.success");
+    TMCBroker<AgentJob> broker = new DerbyBroker<AgentJob>();
+    if (authenticate(key, algorithim)) {
+      for (AgentJob j : jobs) {
+        broker.save("", j);
+      }
+    }
+    if (!flag) ret = PropertiesFile.getConstantValue("tmc.agent.store.failure");
+    return ret;
+  }
+
+  private static boolean authenticate(String key, String algorithim) {
+    return true;
+  }
+
+}
+
+
+
+
+

Added: incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/TMCAgent.java
URL: http://svn.apache.org/viewcvs/incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/TMCAgent.java?rev=392982&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/TMCAgent.java (added)
+++ incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/TMCAgent.java Mon Apr 10 09:19:33 2006
@@ -0,0 +1,86 @@
+/*
+* Copyright 2006  The Apache Software Foundation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package lokahi.core.agent;
+
+import lokahi.core.agent.runnable.JobScheduler;
+import lokahi.core.common.database.DerbyBroker;
+import org.apache.axis.transport.http.SimpleAxisServer;
+import org.apache.log4j.Logger;
+
+import javax.net.ServerSocketFactory;
+import javax.net.ssl.SSLServerSocketFactory;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.sql.SQLException;
+
+/**
+ * @author Stephen Toback
+ * @version $Id: TMCAgent.java,v 1.1 2006/03/02 19:19:44 drtobes Exp $
+ */
+public class TMCAgent {
+  static final Logger logger = Logger.getLogger(TMCAgent.class);
+  private static volatile boolean run = false;
+
+  private TMCAgent() {
+  }
+
+  public static void main(String[] args) { //todo write the 'bootstrappage'
+    //check to see if starting or stopping;
+
+    try {
+      init();
+      //holding pattern;
+      destroy();
+    } catch (IOException e) {
+      if (logger.isInfoEnabled()) {
+        logger.info("Exception: " + e.getMessage());
+      }
+    } catch (SQLException e) {
+      if (logger.isInfoEnabled()) {
+        logger.info("Exception: " + e.getMessage());
+      }
+    }
+
+  }
+
+  public static void init() throws IOException {
+    //todo init log4j!
+
+    int port = 5665;
+    SimpleAxisServer sas = new SimpleAxisServer();
+    ServerSocketFactory sf = SSLServerSocketFactory.getDefault();
+    ServerSocket ss = sf.createServerSocket(port);
+    sas.setServerSocket(ss);
+
+    DerbyBroker.initalize();
+
+    //start the Job Scheduler
+    new Thread(new JobScheduler(), "JobScheduler");
+  }
+
+  public static void destroy() throws SQLException {
+    //stop the Job Scheduler
+    JobScheduler.setRun(false);
+
+    DerbyBroker.shutDown();
+  }
+
+}
+
+
+
+
+

Added: incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/callable/MakeDirCallable.java
URL: http://svn.apache.org/viewcvs/incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/callable/MakeDirCallable.java?rev=392982&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/callable/MakeDirCallable.java (added)
+++ incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/callable/MakeDirCallable.java Mon Apr 10 09:19:33 2006
@@ -0,0 +1,39 @@
+/*
+* Copyright 2006  The Apache Software Foundation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package lokahi.core.agent.callable;
+
+import java.io.File;
+import java.util.concurrent.Callable;
+
+/**
+ * @author Stephen Toback
+ * @version $Id: MakeDirCallable.java,v 1.1 2006/03/02 19:19:40 drtobes Exp $
+ */
+public class MakeDirCallable implements Callable<Boolean> {
+  private File directory;
+
+  public MakeDirCallable(String dir) {
+    this.directory = new File(dir);
+  }
+
+  public Boolean call() throws Exception {
+    boolean ret = directory.exists();  //if it already exists return true.
+    if (!ret) {
+      ret = directory.mkdirs();
+    }
+    return ret;
+  }
+}
\ No newline at end of file

Added: incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/callable/PutFileCallable.java
URL: http://svn.apache.org/viewcvs/incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/callable/PutFileCallable.java?rev=392982&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/callable/PutFileCallable.java (added)
+++ incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/callable/PutFileCallable.java Mon Apr 10 09:19:33 2006
@@ -0,0 +1,42 @@
+/*
+* Copyright 2006  The Apache Software Foundation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package lokahi.core.agent.callable;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.util.concurrent.Callable;
+
+/**
+ * @author Stephen Toback
+ * @version $Id: PutFileCallable.java,v 1.1 2006/03/02 19:19:40 drtobes Exp $
+ */
+public class PutFileCallable implements Callable<Boolean> {
+  private String fileContents;
+  private File path;
+
+  public PutFileCallable(String content, String path) {
+    this.fileContents = content;
+    this.path = new File(path);
+  }
+
+  public Boolean call() throws Exception {
+    FileWriter fw = new FileWriter(path, false);
+    fw.write(fileContents);
+    fw.flush();
+    fw.close();
+    return true;
+  }
+}
\ No newline at end of file

Added: incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/callable/context/AddContextCallable.java
URL: http://svn.apache.org/viewcvs/incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/callable/context/AddContextCallable.java?rev=392982&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/callable/context/AddContextCallable.java (added)
+++ incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/callable/context/AddContextCallable.java Mon Apr 10 09:19:33 2006
@@ -0,0 +1,45 @@
+/*
+* Copyright 2006  The Apache Software Foundation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package lokahi.core.agent.callable.context;
+
+import lokahi.core.agent.interfaces.AgentTomcat;
+
+import java.util.concurrent.Callable;
+
+/**
+ * @author Stephen Toback
+ * @version $Id: AddContextCallable.java,v 1.1 2006/03/02 19:19:39 drtobes Exp $
+ */
+public class AddContextCallable implements Callable<Boolean> {
+  private AgentTomcat tc;
+  private String contextName;
+  private String docBase;
+
+  public AddContextCallable(AgentTomcat tc, String contextName, String docBase) {
+    this.tc = tc;
+    this.contextName = contextName;
+    this.docBase = docBase;
+  }
+
+  public Boolean call() throws Exception {
+    return tc.addContext(contextName, docBase);
+  }
+}
+
+
+
+
+

Added: incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/callable/context/GetSessionsCallable.java
URL: http://svn.apache.org/viewcvs/incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/callable/context/GetSessionsCallable.java?rev=392982&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/callable/context/GetSessionsCallable.java (added)
+++ incubator/lokahi/lokahi/trunk/src/java/lokahi/core/agent/callable/context/GetSessionsCallable.java Mon Apr 10 09:19:33 2006
@@ -0,0 +1,43 @@
+/*
+* Copyright 2006  The Apache Software Foundation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package lokahi.core.agent.callable.context;
+
+import lokahi.core.agent.interfaces.AgentTomcat;
+
+import java.util.concurrent.Callable;
+
+/**
+ * @author Stephen Toback
+ * @version $Id: GetSessionsCallable.java,v 1.1 2006/03/02 19:19:39 drtobes Exp $
+ */
+public class GetSessionsCallable implements Callable<String> {
+  private AgentTomcat tc;
+  private String contextName;
+
+  public GetSessionsCallable(AgentTomcat tc, String contextName) {
+    this.tc = tc;
+    this.contextName = contextName;
+  }
+
+  public String call() throws Exception {
+    return tc.getSessions(contextName);
+  }
+}
+
+
+
+
+



Mime
View raw message