Example #1
0
CORBA::Boolean
TAO_CEC_ProxyPullSupplier::consumer_non_existent (
      CORBA::Boolean_out disconnected)
{
  CORBA::Object_var consumer;
  {
    ACE_GUARD_THROW_EX (
        ACE_Lock, ace_mon, *this->lock_,
        CORBA::INTERNAL ());

    disconnected = 0;
    if (this->is_connected_i () == 0)
      {
        disconnected = 1;
        return 0;
      }
    if (CORBA::is_nil (this->nopolicy_consumer_.in ()))
      {
        return 0;
      }
    consumer = CORBA::Object::_duplicate (this->nopolicy_consumer_.in ());
  }

#if (TAO_HAS_MINIMUM_CORBA == 0)
  return consumer->_non_existent ();
#else
  return 0;
#endif /* TAO_HAS_MINIMUM_CORBA */
}
Example #2
0
CORBA::Boolean
TAO_EC_ProxyPushSupplier::consumer_non_existent (
      CORBA::Boolean_out disconnected)
{
  CORBA::Object_var consumer;
  {
    ACE_GUARD_THROW_EX (
        ACE_Lock, ace_mon, *this->lock_,
        CORBA::INTERNAL ());

    disconnected = false;
    if (!this->is_connected_i ())
      {
        disconnected = true;
        return false;
      }

    consumer = CORBA::Object::_duplicate (this->consumer_.in ());
  }

#if (TAO_HAS_MINIMUM_CORBA == 0)
  return consumer->_non_existent ();
#else
  return false;
#endif /* TAO_HAS_MINIMUM_CORBA */
}
acsdaemon::ServiceState ACSServiceController::getActualState() {
    try {
        ACS_SHORT_LOG((LM_DEBUG, "Evaluating state of ACS service with Corba URI '%s'.", corbaloc.c_str()));
        CORBA::Object_var obj = getContext()->getORB()->string_to_object(corbaloc.c_str());
        if (CORBA::is_nil(obj.in())) {
            ACS_SHORT_LOG((LM_ERROR, "Failed to parse Corba URI '%s' for ACS service '%s'!", corbaloc.c_str(), desc->getACSServiceName()));
            return acsdaemon::DEFUNCT;
        }

        obj = acsQoS::Timeout::setObjectTimeout(CORBA_TIMEOUT, obj.in());

        if (obj->_non_existent()) {
        	if (state != acsdaemon::NOT_EXISTING)
        	{
				if (desc->getName()) {
					ACS_SHORT_LOG((LM_ERROR, "ACS service '%s' with name '%s' doesn't exist.", desc->getACSServiceName(), desc->getName()));
				} else {
					ACS_SHORT_LOG((LM_ERROR, "ACS service '%s' doesn't exist.", desc->getACSServiceName()));
				}
        	}
            return acsdaemon::NOT_EXISTING;
        }
    	if (desc->getName()) {
            ACS_SHORT_LOG((LM_DEBUG, "ACS service '%s' with name '%s' responded.", desc->getACSServiceName(), desc->getName()));
    	} else {
	        ACS_SHORT_LOG((LM_DEBUG, "ACS service '%s' responded.", desc->getACSServiceName()));
	    }
        return getContext()->getDetailedServiceState(desc, obj.in()); // acsdaemon::RUNNING;
//    } catch(CORBA::OBJECT_NOT_EXIST &ex) {
    } catch(CORBA::TRANSIENT &ex) {
    	if (state != acsdaemon::NOT_EXISTING)
    	{
			if (desc->getName()) {
				ACS_SHORT_LOG((LM_ERROR, "ACS service '%s' with name '%s' doesn't exist.", desc->getACSServiceName(), desc->getName()));
			} else {
				ACS_SHORT_LOG((LM_ERROR, "ACS service '%s' doesn't exist.", desc->getACSServiceName()));
			}
    	}
        return acsdaemon::NOT_EXISTING;
    } catch(CORBA::Exception &ex) {
//        ACS_SHORT_LOG((LM_ERROR, "Failed."));
//        ACE_PRINT_EXCEPTION (ex, ACE_TEXT ("Caught unexpected exception:"));
    	if (state != acsdaemon::DEFUNCT)
    	{
			if (desc->getName()) {
				ACS_SHORT_LOG((LM_ERROR, "ACS service '%s' with name '%s' is defunct.", desc->getACSServiceName(), desc->getName()));
			} else {
				ACS_SHORT_LOG((LM_ERROR, "ACS service '%s' is defunct.", desc->getACSServiceName()));
			}
    	}
        return acsdaemon::DEFUNCT;
    }
}
CORBA::Boolean
TAO_CEC_ProxyPushSupplier::consumer_non_existent (
      CORBA::Boolean_out disconnected)
{
  CORBA::Object_var consumer;
  {
    ACE_GUARD_THROW_EX (
        ACE_Lock, ace_mon, *this->lock_,
        CORBA::INTERNAL ());

    disconnected = 0;
    if (this->is_connected_i () == 0)
      {
        disconnected = 1;
        return 0;
      }

#if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
    if (this->is_typed_ec () )
      {
        if (CORBA::is_nil (this->nopolicy_typed_consumer_.in ()))
          {
            return 0;
          }
        consumer = CORBA::Object::_duplicate
          (this->nopolicy_typed_consumer_.in ());
      }
    else
      {
#endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
    if (CORBA::is_nil (this->nopolicy_consumer_.in ()))
      {
        return 0;
      }
    consumer = CORBA::Object::_duplicate (this->nopolicy_consumer_.in ());
#if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
      } /* ! this->is_typed_ec */
#endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
  }

#if (TAO_HAS_MINIMUM_CORBA == 0)
  return consumer->_non_existent ();
#else
  return 0;
#endif /* TAO_HAS_MINIMUM_CORBA */
}
CosLifeCycle::GenericFactory_ptr getEventChannelFactory ()
{
    TRACE_ENTER(EventChannelSupport);

    // Attempt to locate the OmniEvents event channel factory to create the event channels.
    // First, check for an initial reference in the omniORB configuration; if it cannot be
    // resolved in this manner, look it up via the naming service.
    LOG_TRACE(EventChannelSupport, "Locating EventChannelFactory via initial reference");
    CORBA::Object_var factoryObj;
    try {
        factoryObj = ossie::corba::Orb()->resolve_initial_references("EventService");
    } catch (const CORBA::ORB::InvalidName&) {
        LOG_TRACE(EventChannelSupport, "No initial reference for 'EventService'");
    } catch (const CORBA::Exception& e) {
        LOG_WARN(EventChannelSupport, "CORBA " << e._name() << " exception locating EventChannelFactory via initial reference");
    }

    if (CORBA::is_nil(factoryObj)) {
        LOG_TRACE(EventChannelSupport, "Looking up EventChannelFactory in NameService");
        CosNaming::Name_var factoryName = ossie::corba::stringToName("EventChannelFactory");

        try {
            factoryObj = ossie::corba::InitialNamingContext()->resolve(factoryName);
        } catch (const CosNaming::NamingContext::NotFound&) {
            LOG_TRACE(EventChannelSupport, "No naming service entry for 'EventChannelFactory'");
        } catch (const CORBA::Exception& e) {
            LOG_WARN(EventChannelSupport, "CORBA " << e._name() << " exception looking up EventChannelFactory in name service");
        }
    }

    CosLifeCycle::GenericFactory_var factory;
    if (!CORBA::is_nil(factoryObj)) {
        try {
            if (!factoryObj->_non_existent()) {
                factory = CosLifeCycle::GenericFactory::_narrow(factoryObj);
            }
        } catch (const CORBA::TRANSIENT&) {
            LOG_WARN(EventChannelSupport, "Could not contact EventChannelFactory");
        } 
    }
    TRACE_EXIT(EventChannelSupport);
    return factory._retn();
}
Example #6
0
void COSBindingNode::walkBranches(CosNaming::NamingContext_var& nodeContext)
{
	CosNaming::NamingContext_var newNodeContext;
	CosNaming::Binding_var binding( new CosNaming::Binding );

	CosNaming::BindingIterator_var biIterVar( new CosNaming::_objref_BindingIterator );
	CosNaming::BindingIterator_out biIter( biIterVar );

	CosNaming::BindingList_var biListVar( new CosNaming::BindingList );
	CosNaming::BindingList_out biList( biListVar );
	
	CORBA::Object_var obj;

	unsigned i = 0;
	
	if(CORBA::is_nil(nodeContext))
	{
		_isLeaf = true;
		
		//No need to iterate through the tree; this is a leaf.
		return;
	}
	
	try {
		nodeContext->list(0, biList, biIter);
	}
	catch(CORBA::TRANSIENT&) {
		_isDead = true;
	}
	catch(CORBA::INV_OBJREF&) {
		_isLeaf = true;
	}
	catch(CORBA::Exception&) {
	}
	catch(...)  {
		std::cerr << "Other list exception." << std::endl;
	}

	if( isLeaf() )
	{
		//No need to iterate through the tree; this is a leaf.
		return;
	}

	bool deadServantFound = false;

	while(biIter->next_one(binding))
	{
		i++;
		//get the context for this branch and add a new node
		obj = nodeContext->resolve( binding->binding_name );

		try {
			obj->_non_existent();
		}
		catch(CORBA::TRANSIENT&)
		{
			//This is a dead servant. 
			deadServantFound = true;

			addBranch(std::string(omni::omniURI::nameToString(binding->binding_name)));

			//_branches.push_back( 
			//	new COSBindingNode(
			//	omni::omniURI::nameToString( binding->binding_name ), true) );
		}
		catch(CORBA::COMM_FAILURE)
		{
			//This is a dead servant. 
			deadServantFound = true;

			addBranch(std::string(omni::omniURI::nameToString(binding->binding_name)));
			//_branches.push_back(
			//	new COSBindingNode(
			//	omni::omniURI::nameToString( binding->binding_name ), true) );
		}

		if( !deadServantFound )
		{
			try {
				newNodeContext = CosNaming::NamingContext::
					_narrow( obj );
			}
			catch(...)
			{
				std::cerr << "Branch list exception: _narrow" << std::endl;
			}

			try {
				addBranch(std::string(omni::omniURI::nameToString(binding->binding_name)), newNodeContext);
				
				//_branches.push_back( 
				//	new COSBindingNode(
				//	omni::omniURI::nameToString( binding->binding_name ), newNodeContext)
				//	);
			}
			catch(CORBA::INV_OBJREF&)
			{
				std::cerr << "Branch list exception: push_back" << std::endl;
			}
		}
	}

}