Location: PHPKode > projects > Entier Studio > entierstudio/studio/classes/procs/proc.ComponentPublicationAgent.php
<?php
/**
 * Entier Studio
 *
 * LICENSE
 *
 *	Copyright 2006 Entier Studio team.
 *
 *	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    entier.studio
 * @copyright  Copyright (c) 2006 Entier Studio team. All rights reserved.
 * @version	   $Id: proc.ComponentPublicationAgent.php 82 2008-01-18 18:04:17Z yannromefort $
 */
//-----------------------------------------------------------------------------
//	namespace
if (!defined("DefComponentPublicationAgent")) {
    //-------------------------------------------------------------------------
    //	Define
    define("DefComponentPublicationAgent", "1");
    //-------------------------------------------------------------------------
    //	Class
    class ComponentPublicationAgent {
        //---------------------------------------------------------------------
        //	Attributes
        
        /**
         * DataSourceManager         
         * @var	object
         */
        var $m_manager = NULL;
		/**
         * Pathname hash
         * @var	array         
         */
        var $m_pathList = array();
        /**
         * Save flag
         * @var	boolean
         * @see
         */
        var $m_saveFlag = true;
        //---------------------------------------------------------------------
        //	Constructor        
        /**
         *
         * @param	boolean
         */
        function ComponentPublicationAgent($saveFlag = true) {
            //
            $this->m_saveFlag = $saveFlag;
        }
        //----------------------------------------------------------------------
        //	Properties
        
        /**
         *
         */
        function PublisherGetResource() {
            //
            return ($this->m_manager->fetchObject());
        }
        /**
         *
         * @return	integer
         */
        function errorNumber() {
            //
            return ($this->m_manager->errorNumber());
        }
        //---------------------------------------------------------------------
        //	Methods
        
        /**
         * Attach a relevant target manager
         *
         * @access	public
         *
         * @param	array		name="resource"
         * @return	boolean
         */
        //
        function startResourceManager($resource) {
            //
            $OBJRURLHOST = $resource["OBJRURLHOST"];
            $OBJRURLPORT = $resource["OBJRURLPORT"];
            $OBJRURLUSER = $resource["OBJRURLUSER"];
            $OBJRURLPASS = $resource["OBJRDECPASS"];
            $OBJRURLNAME = $resource["OBJRURLNAME"];
            $DIRRACCCODE = $resource["DIRRACCCODE"];
            //
            if ("" == $DIRRACCCODE)
			    return (false);
            //
            $className = $DIRRACCCODE . "Manager";
            $classFile = @strtolower($DIRRACCCODE) . ".manager.php";
            //
            @include_once (FRAMEWORK_DIR . $classFile);
            if (@class_exists($className) == false)
			    return (false);
            //
            $this->m_manager = new $className($OBJRURLHOST, $OBJRURLPORT, $OBJRURLUSER, $OBJRURLPASS, $OBJRURLNAME);
            //
            return ($this->m_manager->openSource());
        }
        /**
         * Detach a relevant target manager
         *
         * @access	public
         *
         * @return	boolean
         */
        //
        function closeResourceManager() {
            //
            if (is_object($this->m_manager))
			    return ($this->m_manager->closeSource());
            //
            return (false);
        }
        /**
         * Find resource by name and type
         *
         * @access	public
         *
         * @param	string		name="name"
         * @param	string		name="type"
         * @return	boolean
         */
        //
        function findResource($name, $type) {
            //
			if( isset($this->m_pathList["$name"]) && (true === $this->m_pathList["$name"]))
			    return(true);
			$this->m_pathList["$name"] = $this->m_manager->selectObject($name, $type);
            return ($this->m_pathList["$name"]);
        }
        /**
         * Post resource by name and type with todo
         *
         * @access	public
         *
         * @param	string		name="name"
         * @param	string		name="type"
         * @param	string		name="todo"
         * @return	boolean
         */
        //
        function postResource($name, $type, $todo) {
            //
            if (!empty($this->m_saveFlag)) 
				$todo[FILEMAN_SAVE] = $this->m_saveFlag;
			$this->m_pathList["$name"] = $this->m_manager->createObject($name, $type, $todo);
            return ($this->m_pathList["$name"]);
        }
    };
    //	Class
    //-------------------------------------------------------------------------
    
}
//	namespace
//-----------------------------------------------------------------------------
?>
Return current item: Entier Studio