[Affelio-cvs 608] CVS update: affelio/lib

Back to archive index

Tadashi Okoshi slash****@users*****
2005年 10月 25日 (火) 02:39:54 JST


Index: affelio/lib/Affelio.pm
diff -u affelio/lib/Affelio.pm:1.20 affelio/lib/Affelio.pm:1.21
--- affelio/lib/Affelio.pm:1.20	Mon Oct 24 20:37:26 2005
+++ affelio/lib/Affelio.pm	Tue Oct 25 02:39:54 2005
@@ -14,7 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
-# $Id: Affelio.pm,v 1.20 2005/10/24 11:37:26 slash5234 Exp $
+# $Id: Affelio.pm,v 1.21 2005/10/24 17:39:54 slash5234 Exp $
 
 package Affelio;
 {
@@ -107,6 +107,7 @@
 	my $perm = "";
 	my $am = "";
 	my $alm = "";
+	my $farm_con = "";
 
 	###################################
 	#Blessing
@@ -124,7 +125,8 @@
 		    alm => $alm,
 		    mode => $mode,
 		    guest_owner_switch => $guest_owner_switch,
-		    caller => $caller
+		    caller => $caller,
+		    farm_con => $farm_con
 		    };
 
 	bless $self, $class;
@@ -439,6 +441,43 @@
 
     }
 
+    ######################################################################
+    #get_farm_connecter{
+    #
+    ######################################################################
+    sub get_farm_connecter{
+	my $self = shift;
+	if( !(self->{farm_con}) ){
+	    my $Config = Config::Tiny->new();
+
+	    $Config = Config::Tiny->read($self->{cfg_path});
+	    if($@ || !$Config){
+		throw Affelio::exception::SystemException("affelio.cfg not found");
+	    }
+
+	    $self->{farm__connecter} = $Config->{affelio_farm}->{farm_connecter};
+	    if(($self->{farm__connecter} eq "" )
+	       || !($self->{farm__connecter}) ){
+		return("");
+	    }
+
+	    my ($con_type, $con_arg) = split(':', $self->{farm__connecter});
+	    my $con_class = "Affelio::Backbone::FarmConnecter::" . $con_type;
+
+	    eval "use $con_class";
+	    if($@){
+		throw Affelio::exception::SystemException("Could not load [$con_class].");
+	    }
+	    
+	    eval "$self->{farm_con} = new $con_class()";
+	    if($@){
+		throw Affelio::exception::SystemException("Could not instantiate [$con_class].");
+	    }
+
+	}
+	   
+	return($self->{farm_con});
+    }
 
     ######################################################################
     #read_site_config


Affelio-cvs メーリングリストの案内
Back to archive index