Commit aced8cce authored by Marco De Marco's avatar Marco De Marco
Browse files

State machine added

parent 7aa2873a
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@
#include <Configuration.h>
#include <PlainServer.h>
#include <SSLServer.h>
#include <bits/c++config.h> //@todo: controllare

#include <boost/filesystem.hpp>

@@ -604,7 +603,8 @@ void MetadataExporter::importExportedTables(std::vector<std::string>& exportedTa
        std::string schema = exportedTables.at(i).substr(0, found);
        std::string table = exportedTables.at(i).substr(found+1, std::string::npos);

        INFO_STREAM << "SCHEMA: " << schema << " TABLE: " << table << endl;
        INFO_STREAM << "MetadataExporter::importExportedTables() schema "
            << schema << " table " << table << endl;

        exportedTablesMap.insert(std::pair<const std::string, const std::string> (schema, table));
    }
@@ -635,10 +635,12 @@ void MetadataExporter::importAuthorisedUsers(std::vector<std::string>& authorise
        std::string password = authorisedUsers.at(i).substr(found+1, std::string::npos);

        #ifdef VERBOSE_DEBUG
            INFO_STREAM << "USER: " << user << " PASSWORD: " << password << endl;
            INFO_STREAM << "MetadataExporter::importAuthorisedUsers() user "
                << user << " password " << password << endl;
        #endif

        authorisedUsersMap.insert(std::pair<const std::string, const std::string>(user, password));
        authorisedUsersMap.insert(std::pair<const std::string,
            const std::string>(user, password));
    }
}

@@ -659,7 +661,7 @@ void MetadataExporter::checkIfFileExists(std::string fileName)
        throw std::invalid_argument(errorStream.str());
    }

    DEBUG_STREAM << "FILE: " << fileName << " -> OK" << endl;
    INFO_STREAM << "MetadataExporter::checkIfFileExists() " << fileName << endl;
}

/*----- PROTECTED REGION END -----*/	//	MetadataExporter::namespace_ending
+13 −0
Original line number Diff line number Diff line
@@ -110,6 +110,8 @@
        <type xsi:type="pogoDsl:VoidType"/>
      </argout>
      <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
      <excludedStates>ON</excludedStates>
      <excludedStates>FAULT</excludedStates>
    </commands>
    <commands name="Off" description="Deactivate fits importer" execMethod="off" displayLevel="OPERATOR" polledPeriod="0">
      <argin description="">
@@ -119,7 +121,18 @@
        <type xsi:type="pogoDsl:VoidType"/>
      </argout>
      <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
      <excludedStates>OFF</excludedStates>
      <excludedStates>FAULT</excludedStates>
    </commands>
    <states name="ON" description="Metadata exporter is in ON state (ready to incoming connections)">
      <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
    </states>
    <states name="OFF" description="Metadata exporter is in OFF state (not ready for incoming connections)">
      <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
    </states>
    <states name="FAULT" description="Metadata exporter is in FAULT state (an error occurred)">
      <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
    </states>
    <preferences docHome="./doc_html" makefileHome="/usr/local/tango-8.1.2/share/pogo/preferences"/>
  </classes>
</pogoDsl:PogoSystem>
+15 −2
Original line number Diff line number Diff line
@@ -41,6 +41,9 @@
//================================================================
//  States  |  Description
//================================================================
//  ON      |  Metadata exporter is in ON state (ready to incoming connections)
//  OFF     |  Metadata exporter is in OFF state (not ready for incoming connections)
//  FAULT   |  Metadata exporter is in FAULT state (an error occurred)


namespace MetadataExporter_ns
@@ -61,10 +64,15 @@ namespace MetadataExporter_ns
//--------------------------------------------------------
bool MetadataExporter::is_On_allowed(TANGO_UNUSED(const CORBA::Any &any))
{
	//	Not any excluded states for On command.
	//	Compare device state with not allowed states.
	if (get_state()==Tango::ON ||
		get_state()==Tango::FAULT)
	{
	/*----- PROTECTED REGION ID(MetadataExporter::OnStateAllowed) ENABLED START -----*/
	
	/*----- PROTECTED REGION END -----*/	//	MetadataExporter::OnStateAllowed
		return false;
	}
	return true;
}

@@ -76,10 +84,15 @@ bool MetadataExporter::is_On_allowed(TANGO_UNUSED(const CORBA::Any &any))
//--------------------------------------------------------
bool MetadataExporter::is_Off_allowed(TANGO_UNUSED(const CORBA::Any &any))
{
	//	Not any excluded states for Off command.
	//	Compare device state with not allowed states.
	if (get_state()==Tango::OFF ||
		get_state()==Tango::FAULT)
	{
	/*----- PROTECTED REGION ID(MetadataExporter::OffStateAllowed) ENABLED START -----*/
	
	/*----- PROTECTED REGION END -----*/	//	MetadataExporter::OffStateAllowed
		return false;
	}
	return true;
}

+1 −1
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ protected:
    //Acceptor for incoming connection
    boost::shared_ptr<boost::asio::ip::tcp::acceptor> m_acceptor_sp;

    //Handler for all threads
    //Thread group container shared pointer
    boost::shared_ptr<boost::thread_group> m_threadGroup_sp;

    //Tango state property mutex
+1 −1

File changed.

Contains only whitespace changes.

+14 −14

File changed.

Contains only whitespace changes.

Loading