Tadashi Okoshi
slash****@users*****
2005年 11月 22日 (火) 23:03:01 JST
Index: affelio/lib/Affelio/Managing/ApplicationManager.pm
diff -u affelio/lib/Affelio/Managing/ApplicationManager.pm:1.11 affelio/lib/Affelio/Managing/ApplicationManager.pm:1.12
--- affelio/lib/Affelio/Managing/ApplicationManager.pm:1.11 Sun Nov 20 21:19:52 2005
+++ affelio/lib/Affelio/Managing/ApplicationManager.pm Tue Nov 22 23:03:00 2005
@@ -14,12 +14,13 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# $Id: ApplicationManager.pm,v 1.11 2005/11/20 12:19:52 slash5234 Exp $
+# $Id: ApplicationManager.pm,v 1.12 2005/11/22 14:03:00 slash5234 Exp $
package Affelio::Managing::ApplicationManager;
{
use strict;
use lib("../../../extlib");
+ use Error qw(:try);
use DBI;
use Jcode;
use lib("../../");
@@ -60,6 +61,8 @@
my $install_name = shift;
my $install_title = shift;
+ debug_print("ApplicationManager::install_app start.");
+
#############################
#Read .cfg file
#############################
@@ -69,6 +72,8 @@
throw Affelio::exception::("Could not open /apps/$install_name/AF_app.cfg");
}
+ debug_print("ApplicationManager::install_app opened config file");
+
#############################
#prep data
#############################
@@ -84,6 +89,8 @@
my $action_types = $cfg->{application}->{action_types};
my $action_types_desc = $cfg->{application}->{action_types_desc};
+ debug_print("ApplicationManager::install_app data prep done.");
+
#############################
#DB access
#############################
@@ -102,10 +109,20 @@
throw Affelio::exception::DBException($af->getDB->errstr);
}
+ debug_print("ApplicationManager::install_app DB access done.");
+
+ #############################
+ #loadl_application
+ #############################
+ $af->getAM->load_applications();
+
#############################
#prep app_perm_table
#############################
$af->getAM->prepare_app_perm_table($install_name);
+
+ debug_print("ApplicationManager::intsall_app prep app table done.");
+ debug_print("ApplicationManager::install_app end.");
}
@@ -116,6 +133,8 @@
my $self = shift;
my $af = $self->{af};
+ debug_print("ApplicationManager::load_apps: start.");
+
##############################
#Access apps DB
##############################
@@ -129,6 +148,8 @@
throw Affelio::exception::DBException($af->getDB->errstr);
}
+ debug_print("ApplicationManager::load_apps: Access Apps DB done.");
+
##################################
#For each application in DB...
##################################
@@ -180,6 +201,8 @@
debug_print("\tinst_name=$self->{apps}->{$t_inst_name}->{install_name}\n");
debug_print("\tinst_title=$self->{apps}->{$t_inst_name}->{install_title}\n");
}#while
+
+ debug_print("ApplicationManager::load_apps: end.");
}
@@ -351,18 +374,22 @@
my $query = "SELECT * FROM " . $my_table_name;
eval{
- my $sth = $af->getDB()->prepare($query);
+ my $sth = $af->getDB->prepare($query);
my @dummy = $sth->execute();
};
if($@){
- #############################################
+ debug_print("AppManager::check_table: [$@]");
+
+ #############################################
#Table of this application does not exist!
#Thus, we will make the table
+
my $create_table_SQL="CREATE TABLE $my_table_name (pid INTEGER, type TEXT, target_id TEXT, ";
my $new_rec_SQL="insert into $my_table_name(pid, type, target_id,";
my $num_action_types
= @{ $self->{apps}->{$caller}->{action_types} };
+
my $i;
for($i=0; $i < $num_action_types; $i++){
$create_table_SQL .=
@@ -372,14 +399,13 @@
$new_rec_SQL .=
${ $self->{apps}->{$caller}->{action_types} }[$i];
$new_rec_SQL .= ",";
-
}
chop($create_table_SQL); #Delete "," at the end.
$create_table_SQL .= ") ";
chop($new_rec_SQL); #Delete "," at the end.
$new_rec_SQL .= ")";
- debug_print("AppManager::check_table: create_SQL = [".$create_table_SQL."]");
+ debug_print("AppManager::check_table: create_SQL = [". $create_table_SQL. "]");
my $sth = $af->getDB()->prepare($create_table_SQL) or
throw Affelio::exception::DBException("cannot create table");