void
GeneratorBusinessH::doHome(IR__::HomeDef_ptr home)
{
	//
	// base home
	//
	IR__::HomeDef_var base = home->base_home();
	if(! CORBA::is_nil(base))
	{
		doHome(base);
	}
	//
	// supported interfaces
	//
	IR__::InterfaceDefSeq_var supp_intfs = home -> supported_interfaces();
	for(CORBA::ULong i = 0; i < supp_intfs->length(); i++) {
		handleAttribute((*supp_intfs)[i]);
		handleOperation((*supp_intfs)[i]);
	};

	handleAttribute(home);
	handleOperation(home);
	handleFactory(home);
	handleFinder(home);
}
void
GeneratorServantH::genHomeServant(IR__::HomeDef_ptr home, CIDL::LifecycleCategory lc)
{
	// handle base home
	IR__::HomeDef_var base = home->base_home();
	if(base)
	{ 
		genHomeServant(base, lc);
	}

	handleAttribute(home);
	handleOperation(home);
	handleFactory(home);
	handleFinder(home);

	//
	// supported interfaces
	//
	IR__::InterfaceDefSeq_var supp_intfs = home -> supported_interfaces();
	for(CORBA::ULong i = 0; i < supp_intfs->length(); i++) {
		handleAttribute((*supp_intfs)[i]);
		handleOperation((*supp_intfs)[i]);
	};
	
}
void
GeneratorPersistenceH::genAbstractObjsForConcreteType(IR__::AbstractStorageTypeDef_ptr abs_storagetype)
{
	IR__::InterfaceDefSeq_var abs_storagetype_seq = abs_storagetype->base_abstract_storagetypes();
	for(CORBA::ULong i=0; i<abs_storagetype_seq->length(); i++) 
	{
		bAbstract_ = false;
		handleAttribute((*abs_storagetype_seq)[i]);
		handleOperation((*abs_storagetype_seq)[i]);
	}

	bAbstract_ = false;
	handleAttribute(abs_storagetype);
	handleOperation(abs_storagetype);
}
void
GeneratorServantH::genComponentServantBody(IR__::ComponentDef_ptr component, CIDL::LifecycleCategory lc)
{
	//handle base component
	IR__::ComponentDef_var base = component->base_component();
	if(!CORBA::is_nil(base))
	{ 
		genComponentServantBody(base, lc);
	}

	handleAttribute(component);
	handleSupportedInterface(component);
	handleProvides(component);
	handleUses(component);
	handleEmits(component);
	handlePublishes(component);
	if(component->contents(CORBA__::dk_Consumes, false)->length())
	{
		out << "\n//\n// IDL:Components/EventConsumerBase/push_event:1.0\n//\n";
		out << "virtual void push_event (Components::EventBase* ev) throw (CORBA::SystemException);\n";
		handleConsumes(component);
	}
	handleSink(component);
	handleSource(component);
}
Ejemplo n.º 5
0
//
// component
//
void
GeneratorBase::doComponent(IR__::ComponentDef_ptr component)
{
	beginComponent(component);

	// contained attributes
	handleAttribute(component);

	// contained provides
	handleProvides(component);

	// contained uses
	handleUses(component);

	// contained emits
	handleEmits(component);

	// contained publishes
	handlePublishes(component);

	// contained consumes
	handleConsumes(component);

	// contained sink
	handleSink(component);

	// contained source
	handleSource(component);

	// contained siso
	handleSiSo(component);

	endComponent(component);
}
void
GeneratorValuetypesC::doInterface(IR__::InterfaceDef_ptr intf)
{
	//
	// check whether this interface was already handled
	//
	if (handled_interfaces_.find(intf->id()) != handled_interfaces_.end())
	{
		return;
	} 
	handled_interfaces_.insert(intf->id());

	//
	// base interfaces
	//
	IR__::InterfaceDefSeq_var base_seq = intf->base_interfaces();
	CORBA::ULong len = base_seq->length();
	for(CORBA::ULong i = 0; i < len; i++)
	{
		doInterface((*base_seq)[i]);
	}

	handleAttribute(intf);
	handleOperation(intf);
}
void
GeneratorServantC::genComponentServant(IR__::ComponentDef_ptr component)
{
	// handle base component
	IR__::ComponentDef_var base = component->base_component();
	if(!CORBA::is_nil(base))
	{ 
		genComponentServant(base);
	}

	handleAttribute(component);
	handleSupportedInterface(component);
	handleProvides(component);
	handleUses(component);
	handleEmits(component);
	handlePublishes(component);
	if(component->contents(CORBA__::dk_Consumes, false)->length())
	{
		// push_event
		out << "void\n";
		out << class_name_ << "::push_event (Components::EventBase* ev) throw (CORBA::SystemException)\n{\n";
		out.indent();
		out << "// not implemented yet, please report : 274772\n";
		out << "throw CORBA::NO_IMPLEMENT();\n";
		out.unindent();
		out << "}\n\n\n";

		handleConsumes(component);
	}
}
Ejemplo n.º 8
0
void
GeneratorLIDL::doHome(IR__::HomeDef_ptr home)
{	
	//
	// implicit home
	//
	out << "//\n// implicit home for " << home->id() << "\n//\n";
	out << "local interface CCM_" << home->name() << "Implicit\n";
	out << "{\n";
	out.indent();
	out << "::Components::EnterpriseComponent create() raises (Components::CreateFailure);\n";
	out.unindent();
	out << "};\n\n";


	//
	// explicit home
	//
	out << "//\n// explicit home for " << home->id() << "\n//\n";
	out << "local interface CCM_" << home->name() << "Explicit : ";
	IR__::HomeDef_var base = home->base_home();
	if(base)
	{
		out << getLocalName(base);
		out << "Explicit";

	}
	else
	{
		out << "::Components::HomeExecutorBase";
	}

	// supported interfaces
	IR__::InterfaceDefSeq_var supp_intfs = home -> supported_interfaces();
	for(CORBA::ULong i = 0; i < supp_intfs->length(); i++) {
		out << ", " << map_absolute_name((*supp_intfs)[i]);
	};
	
	out << "\n{\n";
	out.indent();

	managed_component_ = map_absolute_name(home->managed_component());

	handleAttribute(home);
	handleOperation(home);
	handleFactory(home);
	handleFinder(home);

	out.unindent();
	out << "};\n\n";
	

	//
	// home
	//
	out << "//\n// " << home->id() << "\n//\n";
	out << "local interface CCM_" << home->name() << " : CCM_" << home->name() << "Implicit, CCM_";
	out << home->name() << "Explicit\n{\n};\n\n";
}
Ejemplo n.º 9
0
//
// home
//
void
GeneratorEIDL::doHome(IR__::HomeDef_ptr home)
{	
	//
	// implicit home
	//
	out << "//\n// implicit home for " << home->id() << "\n//\n";
	out << "interface " << home->name() << "Implicit : ::Components::KeylessCCMHome\n";
	out << "{\n";
	out.indent();
	out << map_absolute_name(home->managed_component()) << " create() raises (Components::CreateFailure);\n";
	out.unindent();
	out << "};\n\n";

	//
	// explicit home
	//
	out << "//\n// explicit home for " << home->id() << "\n//\n";
	out << "interface " << home->name() << "Explicit : ";
	IR__::HomeDef_var base = home->base_home();
	if(base) {
		out << map_absolute_name(base);
		out << "Explicit";
	}
	else {
		out << "::Components::CCMHome";
	}
	// supported interfaces
	IR__::InterfaceDefSeq_var supp_intfs = home -> supported_interfaces();
	for(CORBA::ULong i = 0; i < supp_intfs->length(); i++) {
		out << ", " << map_absolute_name((*supp_intfs)[i]);
	};

	out << "\n{\n";
	out.indent();

	managed_component_ = map_absolute_name(home->managed_component());

	// content with potential order problems
	doInterfaceContent(home);

	// content without order problems
	handleException(home);
	handleAttribute(home);
	handleOperation(home);
	handleFactory(home);
	handleFinder(home);

	out.unindent();
	out << "};\n\n";
	
	//
	// home
	//
	out << "//\n// " << home->id() << "\n//\n";
	out << "interface " << home->name() << " : " << home->name() << "Implicit, ";
	out << home->name() << "Explicit\n{\n};\n\n";
};
Ejemplo n.º 10
0
void 
GeneratorPersistenceH::doAbstractStorageHome(IR__::AbstractStorageHomeDef_ptr abs_storagehome)
{
	IR__::AbstractStorageTypeDef_var abs_storagetype = abs_storagehome->managed_abstract_storagetype();

	// achtung: wenn kein modul, sollte vielleicht PSS_ der prefix für alle pss sein?
	out << "\n\n";
	open_module(out, abs_storagetype, "");
	out << "\n\n";

	out << "class " << std::string(abs_storagetype->name()) << ";\n";
	out << "class " << std::string(abs_storagetype->name()) << "Ref;\n\n";

	std::string strClassName = std::string(abs_storagehome->name());
	strActBasename_ = strClassName;

	out << "class " << strClassName << "\n";
	out.indent();
	
	IR__::InterfaceDefSeq_var abs_storagehome_seq = abs_storagehome->base_abstract_storagehomes();
	if(abs_storagehome_seq->length()==0)
		out << ": public virtual CosPersistentState::StorageHomeBase\n";
	else
		for(CORBA::ULong i=0; i<abs_storagehome_seq->length(); i++)
		{
			i==0 ? out << ": " : out << ", ";
			out << "public virtual " << ((*abs_storagehome_seq)[i])->name() << "\n";
		};

	out.unindent();
	out << "{\n\npublic:\n\n";
	out.indent();
    //out << strClassName << "();\n";
	//out << "~" << strClassName << "();\n";

	bAbstract_ = true;
	handleAttribute(abs_storagehome);
	handleOperation(abs_storagehome);
	handleFactory(abs_storagehome);
	handleKey(abs_storagehome);
	
	//generate _duplicate and _downcast operation
	//genDuplAndDown(strClassName);

	out.unindent();
	out << "};\n\n";
	out << "#ifdef ORBACUS_ORB\n";
	out << "typedef OB::ObjVar< " << strClassName << " > " << strClassName << "_var;\n";
	out << "typedef OB::ObjVar< " << strClassName << " > " << strClassName << "_out;\n";
	out << "#endif\n";
    out << "#ifdef MICO_ORB\n";
	out << "typedef ObjVar< " << strClassName << " > " << strClassName << "_var;\n";
	out << "typedef ObjVar< " << strClassName << " > " << strClassName << "_out;\n";
	out << "#endif\n";
	out << "\n\n";

	close_module(out, abs_storagetype);
}
void
GeneratorBusinessC::doComponent(IR__::ComponentDef_ptr component)
{
	// handle base component
	IR__::ComponentDef_var base = component->base_component();
	if(!CORBA::is_nil(base))
	{ 
		doComponent(base);
	}

	handleAttribute(component);
	handleSupportedInterface(component);

	// contained provides
	IR__::ContainedSeq_var contained_seq = component->contents(CORBA__::dk_Provides, false);
	handled_interfaces_.clear();
	CORBA::ULong len = contained_seq->length();
	for(CORBA::ULong i = 0; i < len; i++)
	{
		IR__::ProvidesDef_var act_provides = IR__::ProvidesDef::_narrow(((*contained_seq)[i]));
		bool realized_by_segment = false;

		// exclude facets realized by a segment
		CIDL::SegmentDefSeq_var segment_seq = composition_->executor_def()->segments();
		for (CORBA::ULong ii = 0; ii < segment_seq->length(); ii++)
		{
			// for each implemented facet
			IR__::ProvidesDefSeq_var provided_seq = segment_seq[ii]->provided_facets();
			for (CORBA::ULong iii = 0; iii < provided_seq->length(); iii++)
			{
				if(!strcmp(act_provides->name(), provided_seq[iii]->name()))
				{
					realized_by_segment = true;
					break;
				}
			}
		}

		if(!realized_by_segment)
		{
			doInterface(act_provides->interface_type());
		}
	}

	// consumes
	if(component->contents(CORBA__::dk_Consumes, false)->length() && need_push_)
	{
		out << "void\n";
		out << class_name_ << "::push_event (Components::EventBase* ev)\n";
		out << "    throw (CORBA::SystemException)\n{\n";
		out.insertUserSection(class_name_ + "::push_event", 0);
		out << "}\n\n\n";
		need_push_ = false;
	}
	handleConsumes(component);
}
void 
GeneratorPersistenceC::doStorageHome(IR__::StorageHomeDef_ptr storage_home)
{
	// base storage home
	IR__::StorageHomeDef_var base = storage_home->base_storage_home();
	if(! CORBA::is_nil(base))
	{
		doStorageHome(base);
	}

	// supported interfaces
	IR__::InterfaceDefSeq_var supp_intfs = storage_home -> supported_interfaces();
	for(CORBA::ULong i = 0; i < supp_intfs->length(); i++) {
		handleAttribute((*supp_intfs)[i]);
		handleOperation((*supp_intfs)[i]);
	};

	handleAttribute(storage_home);
	handleOperation(storage_home);
	handleFactory(storage_home);
	handlePSSKey(storage_home);
}
Ejemplo n.º 13
0
void
GeneratorPersistenceH::genAbstractObjsForConcreteHome(IR__::AbstractStorageHomeDef_ptr abs_storagehome)
{
	IR__::InterfaceDefSeq_var abs_storagehome_seq = abs_storagehome->base_abstract_storagehomes();
	for(CORBA::ULong i=0; i<abs_storagehome_seq->length(); i++) 
	{
		IR__::AbstractStorageHomeDef_var abs_storagehome_inh;
		abs_storagehome_inh = IR__::AbstractStorageHomeDef::_narrow((*abs_storagehome_seq)[i]);
		bAbstract_ = false;
		bASHKey_ = true;
		handleAttribute(abs_storagehome_inh);
		handleOperation(abs_storagehome_inh);
		handleFactory(abs_storagehome_inh);
		handleKey(abs_storagehome_inh);
	}

	bAbstract_ = false;
	bASHKey_ = true;
	handleAttribute(abs_storagehome);
	handleOperation(abs_storagehome);
	handleFactory(abs_storagehome);
	handleKey(abs_storagehome);
}
Ejemplo n.º 14
0
void
GeneratorServantH::doInterface(IR__::InterfaceDef_ptr intf)
{
	// base interfaces
	IR__::InterfaceDefSeq_var base_seq = intf->base_interfaces();
	CORBA::ULong i;
	for( i= 0; i < base_seq->length(); i++)
	{
		doInterface((*base_seq)[i]);
	}

	handleAttribute(intf);
	handleOperation(intf);
}
Ejemplo n.º 15
0
//
// component
//
void
GeneratorEIDL::doComponent(IR__::ComponentDef_ptr component)
{
	out << "//\n// " << component->id() << "\n//\n";
	out << "interface " << component->name() << " : ";
	
	// base component
	IR__::ComponentDef_var base = component->base_component();
	IR__::SourceDefSeq_var sources_seq = component->sources();
	IR__::SinkDefSeq_var sinks_seq = component->sinks();
	bool has_streams = sources_seq->length() || sinks_seq->length();

	if(!CORBA::is_nil(base)) {
		out << map_absolute_name(base);

		if (has_streams && !check_stream_CCM_object (base))
			out << ", ::StreamComponents::StreamCCMObject";
	}
	else {
		// Test whether the component has stream features
		if (has_streams)
			out << "::StreamComponents::StreamCCMObject";
		else
			out << "::Components::CCMObject";
	}

	// supported interfaces
	IR__::InterfaceDefSeq_var supported_seq = component->supported_interfaces();
	CORBA::ULong len = supported_seq->length();
	for(CORBA::ULong i = 0; i < len; i++)
	{
		out << ", " << map_absolute_name((*supported_seq)[i]);
	}
	out << "\n{\n";
	out.indent();

	// content
	handleAttribute(component);
	handleProvides(component);
	handleUses(component);
	handleEmits(component);
	handlePublishes(component);
	handleConsumes(component);

	out.unindent();
	out << "};\n\n";

	handleSink(component);
}
void 
GeneratorPersistenceC::doStorageType(IR__::StorageTypeDef_ptr storage_type)
{
	//
	// base storage type
	//
	IR__::StorageTypeDef_ptr base = storage_type->base_storage_type();
	if(! CORBA::is_nil(base))
	{
		doStorageType(base);
	}

	handleAttribute(storage_type);
	handleSupportedInterface(storage_type);
}
void 
GeneratorPersistenceC::doAbstractStorageType(IR__::AbstractStorageTypeDef_ptr abs_storage_type)
{
	//
	// base storage types
	//
	IR__::InterfaceDefSeq_var inh_intfs = abs_storage_type -> base_abstract_storage_types();
	for(CORBA::ULong i = 0; i < inh_intfs->length(); i++) {
		if(! CORBA::is_nil((*inh_intfs)[i]))
		{
			IR__::InterfaceDef_ptr temp_if = (*inh_intfs)[i];
			IR__::AbstractStorageTypeDef_ptr abs_temp_if = dynamic_cast <IR__::AbstractStorageTypeDef_ptr> (temp_if);
			doAbstractStorageType(abs_temp_if);
			handleAttribute(abs_storage_type);
		}	
	};
}
Ejemplo n.º 18
0
void
GeneratorBase::doInterface(IR__::InterfaceDef_ptr intface)
{
	beginInterface(intface);

	IR__::ContainedSeq_var contained_seq;
	CORBA::ULong len;
	CORBA::ULong i;

	// contained constants
	contained_seq = intface->contents(CORBA__::dk_Constant, false);
	len = contained_seq->length();
	for(i = 0; i < len; i++)
	{
		IR__::ConstantDef_var act_constant = IR__::ConstantDef::_narrow(((*contained_seq)[i]));
		doConstant(act_constant);
	}

	// contained typedefs
	contained_seq = intface->contents(CORBA__::dk_Typedef, false);
	len = contained_seq->length();
	for(i = 0; i < len; i++)
	{
		IR__::TypedefDef_var act_typedef = IR__::TypedefDef::_narrow(((*contained_seq)[i]));
		doTypedef(act_typedef);
	}

	// contained exceptions
	contained_seq = intface->contents(CORBA__::dk_Exception, false);
	len = contained_seq->length();
	for(i = 0; i < len; i++)
	{
		IR__::ExceptionDef_var act_exception = IR__::ExceptionDef::_narrow(((*contained_seq)[i]));
		doException(act_exception);
	}

	// contained attributes
	handleAttribute(intface);

	// contained operations
	handleOperation(intface);

	endInterface(intface);
}
Ejemplo n.º 19
0
void
GeneratorPersistenceH::genComponentPersistence(IR__::ComponentDef_ptr component, CIDL::LifecycleCategory lc)
{
	if( lc!=CIDL::lc_Entity && lc!=CIDL::lc_Process )
		return;

	// handle base component
	IR__::ComponentDef_var base_component = component->base_component();
	if(base_component)
		genComponentPersistence(base_component, lc);

	out << "//\n// component persistence\n//\n";
	out << "class " << component->name() << "Persistence\n";
	out.indent();
	if(base_component)
		out << ": public virtual " << base_component->name() << "Persistence\n";
	else
		out << ": public virtual StorageObjectImpl\n";
	out.unindent();
	out << "{\n\npublic:\n\n";
	out.indent();
    out << component->name() << "Persistence();\n";
	out << "~" << component->name() << "Persistence();\n";
	
	bAbstract_ = false;
	handleAttribute(component);
	
	out << "\nvoid write_state();\n";
	out << "void read_state();\n";
	out << "void setValue(std::map<std::string, CORBA::Any>& valueMap);\n\n";
	
	//generate _duplicate and _downcast operation
	//genDuplAndDown(strClassName);
	out.unindent();

	genMemberVariable(component);

	out << "};\n\n";

	out << "typedef ObjectFactoryTemplate<" << component->name() << "Persistence> " << component->name() << "PersistenceFactory;\n\n";
}
Ejemplo n.º 20
0
void
GeneratorServantH::genHomeServant(IR__::HomeDef_ptr home, CIDL::LifecycleCategory lc)
{
	// handle base home
	IR__::HomeDef_var base = home->base_home();
	if(base)
	{ 
		genHomeServant(base, lc);
	}

	handleAttribute(home);
	handleOperation(home);
	handleFactory(home);
	handleFinder(home);

	//
	// supported interfaces
	//
	IR__::InterfaceDefSeq_var supp_intfs = home -> supported_interfaces();
	for(CORBA::ULong i = 0; i < supp_intfs->length(); i++) {
		doInterface((*supp_intfs)[i]);

		//handleAttribute((*supp_intfs)[i]);
		//handleOperation((*supp_intfs)[i]);
	};

	if(lc==CIDL::lc_Entity || lc==CIDL::lc_Process)
	{
		out << "\nvoid get_table_info(std::map<std::string, std::string>& mTables);\n\n";
		out << "void init_datastore(const Connector_ptr pConn, const Sessio_ptr pSession);\n";
		out.unindent();
		out << "\nprivate:\n\n";
		out.indent();
		out << "bool compare_primarykey(" << mapFullNamePK(home->primary_key()) << "* pk_a, " << mapFullNamePK(home->primary_key()) << "* pk_b);\n\n";
		out << strNamespace_ << "::" << home->name() << "Persistence* pCcmStorageHome_;\n";
		if( !CORBA::is_nil(storagehome_) ) // there is binds_to
			out << strNamespace_ << "::" << storagehome_->name() << "* pPssStorageHome_;\n";
		out << "\n";
	}
}
Ejemplo n.º 21
0
//
// component
//
void
GeneratorEIDL::doComponent(IR__::ComponentDef_ptr component)
{
	out << "//\n// " << component->id() << "\n//\n";
	out << "interface " << component->name() << " : ";
	
	// base component
	IR__::ComponentDef_var base = component->base_component();
	if(!CORBA::is_nil(base)) {
		out << map_absolute_name(base);
	}
	else {
		out << "::Components::CCMObject";
	}

	// supported interfaces
	IR__::InterfaceDefSeq_var supported_seq = component->supported_interfaces();
	CORBA::ULong len = supported_seq->length();
	for(CORBA::ULong i = 0; i < len; i++)
	{
		out << ", " << map_absolute_name((*supported_seq)[i]);
	}
	out << "\n{\n";
	out.indent();

	// content
	handleAttribute(component);
	handleProvides(component);
	handleUses(component);
	handleEmits(component);
	handlePublishes(component);
	handleConsumes(component);
	handleSink(component);
	handleSource(component);
	handleSiSo(component);

	out.unindent();
	out << "};\n\n";
}
Ejemplo n.º 22
0
//
// interface
//
void
GeneratorEIDL::doInterface(IR__::InterfaceDef_ptr intface)
{
	out << "//\n// " << intface->id() << "\n//\n";
	out << "interface " << intface->name();
	
	//
	// base interfaces
	//
	IR__::InterfaceDefSeq_var base_seq = intface->base_interfaces();
	CORBA::ULong len = base_seq->length();
	for(CORBA::ULong i = 0; i < len; i++)
	{
		if(i)
		{
			out << ", ";
		}
		else
		{
			out << " : ";
		}
		out << map_absolute_name((*base_seq)[i]);
	}
	out << "\n{\n";
	out.indent();

	// content with potential order problems
	doInterfaceContent(intface);

	// content without order problems
	handleException(intface);
	handleAttribute(intface);
	handleOperation(intface);

	out.unindent();
	out << "};\n\n";
}
Ejemplo n.º 23
0
void JSSPageReader::parseAttributes()
{
	static const int eof = std::char_traits<char>::eof();

	std::string basename;
	std::istringstream istr(_attrs);
	int ch = istr.get();
	while (ch != eof && Poco::Ascii::isSpace(ch)) ch = istr.get();
	while (ch != eof && Poco::Ascii::isAlphaNumeric(ch)) { basename += (char) ch; ch = istr.get(); }
	while (ch != eof && Poco::Ascii::isSpace(ch)) ch = istr.get();
	while (ch != eof)
	{
		std::string name(basename + ".");
		std::string value;
		while (ch != eof && Poco::Ascii::isAlphaNumeric(ch)) { name += (char) ch; ch = istr.get(); }
		while (ch != eof && Poco::Ascii::isSpace(ch)) ch = istr.get();
		if (ch != '=') throw Poco::SyntaxException("Bad attribute syntax: '=' expected", where());
		ch = istr.get();
		while (ch != eof && Poco::Ascii::isSpace(ch)) ch = istr.get();
		if (ch == '"')
		{
			ch = istr.get();
			while (ch != eof && ch != '"') { value += (char) ch; ch = istr.get(); }
			if (ch != '"') throw Poco::SyntaxException("Bad attribute syntax: '\"' expected", where());
		}
		else if (ch == '\'')
		{
			ch = istr.get();
			while (ch != eof && ch != '\'') { value += (char) ch; ch = istr.get(); }
			if (ch != '\'') throw Poco::SyntaxException("Bad attribute syntax: ''' expected", where());
		}
		else throw Poco::SyntaxException("Bad attribute syntax: '\"' or ''' expected", where());
		ch = istr.get();
		handleAttribute(name, value);
		while (ch != eof && Poco::Ascii::isSpace(ch)) ch = istr.get();
	}
}
Ejemplo n.º 24
0
//
// home
//
void
GeneratorEIDL::doHome(IR__::HomeDef_ptr home)
{	
	//
	// implicit home
	//
	IR__::PrimaryKeyDef_ptr pk = home->primary_key();

	if(!CORBA::is_nil(pk))
	{
		//"copying" declaration of valuetype defined for primary key into EIDL. 
		//At the moment this is the better way to handle with it, however, 
		//it should be improved, for it is possible, that one primary key is
		//used by several different homes.
		/*
		out << "//\n// valuetype for primary key\n//\n";
		IR__::ValueDef_var act_value = pk->primary_key();
		out << "valuetype " << act_value->name() << "\n";
		out.indent();
		out << ": Components::PrimaryKeyBase\n";
		IR__::ValueDefSeq_var support_seq = act_value->abstract_base_values();
		CORBA::ULong len = support_seq->length();
		for(CORBA::ULong i = 0; i < len; i++)
		{
			char* szTemp = ((*support_seq)[i])->name();
			if(strcmp(szTemp, "PrimaryKeyBase")==0)
				continue;

			if(i==0)
				out << ": " << szTemp << "\n";
			else
				out << ", " << szTemp << "\n";
		}
		out.unindent();
		out << "{\n";

		//only attributes can be defined in a valuetype which is specially for a primary key
		IR__::ContainedSeq_var contained_seq = act_value->contents(CORBA__::dk_ValueMember, true);
		len = contained_seq->length();
		out.indent();
		for(i = 0; i < len; i++)
		{
			IR__::ValueMemberDef_var vMember = IR__::ValueMemberDef::_narrow((*contained_seq)[i]);
			(vMember->access()==CORBA__::PUBLIC_MEMBER) ? out << "public " : out << "private ";
			out << map_idl_type(vMember->type_def()) << " " << vMember->name() << ";\n";
		}
		out.unindent();
		out << "};\n\n";
		*/
		out << "//\n// implicit home for " << home->id() << "\n//\n";
		out << "interface " << home->name() << "Implicit\n";
		out << "{\n";
		out.indent();
		
		char* szt = pk->name();

		out << map_absolute_name(home->managed_component()) << " create(in " << pk->name() << " key)\n";
		out.indent();
		out << "raises (Components::CreateFailure, Components::DuplicateKeyValue, Components::InvalidKey);\n\n";
		out.unindent();

		out << map_absolute_name(home->managed_component()) << " find_by_primary_key(in " << pk->name() << " key)\n";
		out.indent();
		out << "raises (Components::FinderFailure, Components::UnknownKeyValue, Components::InvalidKey);\n\n";
		out.unindent();

		out << "void remove(in " << pk->name() << " key)\n";
		out.indent();
		out << "raises (Components::RemoveFailure, Components::UnknownKeyValue, Components::InvalidKey);\n\n";
		out.unindent();

		out << pk->name() << " get_primary_key(in " << map_absolute_name(home->managed_component()) << " comp);\n";
		
		out.unindent();
		out << "};\n\n";
	}
	else
	{
		out << "//\n// implicit home for " << home->id() << "\n//\n";
		out << "interface " << home->name() << "Implicit : ::Components::KeylessCCMHome\n";
		out << "{\n";
		out.indent();
		out << map_absolute_name(home->managed_component()) << " create() raises (Components::CreateFailure);\n";
		out.unindent();
		out << "};\n\n";
	}

	//
	// explicit home
	//
	out << "//\n// explicit home for " << home->id() << "\n//\n";
	out << "interface " << home->name() << "Explicit : ";
	IR__::HomeDef_var base = home->base_home();
	if(base) {
		out << map_absolute_name(base);
		out << "Explicit";
	}
	else {
		out << "::Components::CCMHome";
	}

	// supported interfaces
	IR__::InterfaceDefSeq_var supp_intfs = home -> supported_interfaces();
	for(CORBA::ULong i = 0; i < supp_intfs->length(); i++) {
		out << ", " << map_absolute_name((*supp_intfs)[i]);
	};

	out << "\n{\n";
	out.indent();

	managed_component_ = map_absolute_name(home->managed_component());

	// content with potential order problems
	doInterfaceContent(home);

	// content without order problems
	handleException(home);
	handleAttribute(home);
	handleOperation(home);
	handleFactory(home);
	handleFinder(home);

	out.unindent();
	out << "};\n\n";
	
	//
	// home
	//
	out << "//\n// " << home->id() << "\n//\n";
	out << "interface " << home->name() << " : " << home->name() << "Implicit, ";
	out << home->name() << "Explicit\n{\n};\n\n";
};
Ejemplo n.º 25
0
void 
GeneratorPersistenceH::doStorageHome(IR__::StorageHomeDef_ptr storagehome)
{
	IR__::StorageTypeDef_var storagetype = storagehome->managed_storagetype();

	// achtung: wenn kein modul, sollte vielleicht PSS_ der prefix für alle pss sein?
	out << "\n\n";
	open_module(out, storagetype, "");
	out << "\n\n";
	
	out << "class " << std::string(storagetype->name()) << ";\n";
	out << "class " << std::string(storagetype->name()) << "Ref;\n\n";

	std::string strClassName = std::string(storagehome->name());
	strActBasename_ = strClassName;

	out << "class " << strClassName << "\n";
	out.indent();
	
	IR__::StorageHomeDef_var base_storagehome = storagehome->base_storagehome();
	if(base_storagehome)
		out << ": public virtual " << base_storagehome->name() << "\n";
	else
		out << ": public virtual StorageHomeBaseImpl\n";

	IR__::InterfaceDefSeq_var supported_infs = storagehome->supported_interfaces();
	for(CORBA::ULong i=0; i<supported_infs->length(); i++) 
		out << ", public virtual " << ((*supported_infs)[i])->name() << "\n";

	out.unindent();
	out << "{\n\npublic:\n\n";
	out.indent();
    out << strClassName << "();\n";
	out << "~" << strClassName << "();\n\n";

	genCreateOperation(storagehome, false);
	genCreateOperation(storagehome, true);

	//
	//generate find_(ref)_by_primary_key, which is appropriate to find_by_primary_key from home
	//
	if( composition_->lifecycle()==CIDL::lc_Entity )
	{
		IR__::HomeDef_var home = composition_->ccm_home();
		IR__::PrimaryKeyDef_var pkey = IR__::PrimaryKeyDef::_duplicate(home->primary_key());
		if( !CORBA::is_nil(pkey) )
		{
			out << map_psdl_return_type(storagetype, false) << " find_by_primary_key(" << mapFullNamePK(pkey) << "* pkey)\n"; 
			out.indent();
			out << "throw(CosPersistentState::NotFound);\n";
			out.unindent();
		}
	}

	for(CORBA::ULong i=0; i<supported_infs->length(); i++) 
	{
		IR__::AbstractStorageHomeDef_var abs_storagehome_inh;
		abs_storagehome_inh = IR__::AbstractStorageHomeDef::_narrow((*supported_infs)[i]);
		genAbstractObjsForConcreteHome(abs_storagehome_inh);
	};

	bAbstract_ = false;
	bASHKey_ = false;
	handleAttribute(storagehome);
	handleOperation(storagehome);
	handleFactory(storagehome);
	handleKey(storagehome);

	//generate _duplicate and _downcast operation
	//genDuplAndDown(strClassName);

	out.unindent();

	out << "};\n\n\n";

	out << "typedef HomeFactoryTemplate<" << storagehome->name() << "> " << storagehome->name() << "Factory;\n\n";
	
	close_module(out, storagetype);
}
Ejemplo n.º 26
0
void 
GeneratorPersistenceH::genAbstractStorageTypeBody(IR__::AbstractStorageTypeDef_ptr abs_storagetype/*, bool bRef*/)
{
	std::string strClassName = std::string(abs_storagetype->name());

	out << "class " << strClassName << "\n";
	//bRef ? out << "Ref\n" : out << "\n";
	out.indent();
	
	IR__::InterfaceDefSeq_var abs_storagetype_seq = abs_storagetype->base_abstract_storagetypes();
	if(abs_storagetype_seq->length()==0)
	{
		out << ": public virtual CosPersistentState::StorageObject\n";
		//bRef ? out << "Ref\n" : out << "\n";
	}
	else
	{
		for(CORBA::ULong i=0; i<abs_storagetype_seq->length(); i++) 
		{
			i==0 ? out << ": " : out << ", ";
			out << "public virtual " << ((*abs_storagetype_seq)[i])->name() << "\n";
			//bRef ? out << "Ref\n" : out << "\n";
		}
	}

	out.unindent();
	out << "{\n\npublic:\n\n";
	out.indent();
    //out << strClassName;
	//bRef ? out << "Ref();\n" : out << "();\n";
	//out << "~" << strClassName;
	//bRef ? out << "Ref();\n" : out << "();\n";

	bAbstract_ = true;
	handleAttribute(abs_storagetype);
	handleOperation(abs_storagetype);
	
	//generate _duplicate and _downcast operation
	//genDuplAndDown(strClassName);

	out.unindent();
	out << "};\n\n";

	out << "#ifdef ORBACUS_ORB\n";
	out << "typedef OB::ObjVar< " << strClassName;
	//if(bRef) out << "Ref";
	out	<< " > " << strClassName;
	//if(bRef) out << "Ref"; 
	out << "_var;\n";
	out << "typedef OB::ObjVar< " << strClassName;
	//if(bRef) out << "Ref";
	out << " > " << strClassName;
	//if(bRef) out << "Ref";
	out << "_out;\n";
	out << "#endif\n";
	out << "#ifdef MICO_ORB\n";
	out << "typedef ObjVar< " << strClassName;
	//if(bRef) out << "Ref";
	out	<< " > " << strClassName;
	//if(bRef) out << "Ref"; 
	out << "_var;\n";
	out << "typedef ObjVar< " << strClassName;
	//if(bRef) out << "Ref";
	out << " > " << strClassName;
	//if(bRef) out << "Ref";
	out << "_out;\n";
	out << "#endif\n\n\n";
}
Ejemplo n.º 27
0
void
GeneratorPersistenceH::genStorageTypeBody(IR__::StorageTypeDef_ptr storagetype/*, bool bRef*/)
{
	std::string strClassName = std::string(storagetype->name());

	out << "class " << strClassName << "\n";
	//bRef ? out << "Ref\n" : out << "\n";
	out.indent();
	
	IR__::StorageTypeDef_var base_storagetype = storagetype->base_storagetype();
	if(base_storagetype)
	{
		out << ": public virtual " << base_storagetype->name() << "\n";
		//bRef ? out << "Ref\n" : out << "\n";
	}
	else
	{
		out << ": public virtual StorageObjectImpl\n";
		//if(bRef) out << "Ref";
		//out << "Impl\n";
	}

	IR__::InterfaceDefSeq_var supported_infs = storagetype->supported_interfaces();
	for(CORBA::ULong i=0; i<supported_infs->length(); i++)
	{
		out << ", public virtual " << ((*supported_infs)[i])->name() << "\n";
		//bRef ? out << "Ref\n" : out << "\n";
	};

	out.unindent();
	out << "{\n\npublic:\n\n";
	out.indent();
    out << strClassName << "();\n";
	//bRef ? out << "Ref();\n" : out << "();\n";
	out << "~" << strClassName << "();\n";
	//bRef ? out << "Ref();\n" : out << "();\n";

	for(CORBA::ULong i=0; i<supported_infs->length(); i++) 
	{
		IR__::AbstractStorageTypeDef_var abs_storagetype_inh;
		abs_storagetype_inh = IR__::AbstractStorageTypeDef::_narrow((*supported_infs)[i]);
		genAbstractObjsForConcreteType(abs_storagetype_inh);
	};

	bAbstract_ = false;
	handleAttribute(storagetype);
	handleOperation(storagetype);

	out << "\nvoid write_state();\n";
	out << "void read_state();\n";
	out << "void setValue(std::map<std::string, CORBA::Any>& valueMap);\n\n";
	
	//generate _duplicate and _downcast operation
	//genDuplAndDown(strClassName);
	out.unindent();

	genMemberVariable(storagetype);
	
	out << "};\n\n";

	out << "\ntypedef ObjectFactoryTemplate<" << storagetype->name() << "> " << storagetype->name() << "Factory;\n\n\n";
}
void
GeneratorValuetypesC::doValue(IR__::ValueDef_ptr value)
{
	open_module(out, value);
	class_name_ = mapName(value) + "Impl";
	
	out << "void\n";
	out << class_name_ << "::operator= (const " << class_name_ << "& v)\n{\n";
	out.indent();
	handleValueMember(value);
	out.insertUserSection(class_name_ + "::operator=", 0);
	out.unindent();
	out << "}\n\n\n";

	out << class_name_ << "::" << class_name_ << "(const " << class_name_ << "& v)\n{\n";
	out.indent();
	handleValueMember(value);
	out.insertUserSection(class_name_ + "::" + class_name_ + "1", 0);
	out.unindent();
	out << "}\n\n\n";

	// check whether this value(eventtype) has members.
	IR__::ContainedSeq_var contained_seq = value->contents(CORBA__::dk_ValueMember, false);
	if( contained_seq->length() > 0 ) // if has some, generate the constructor with parameters
	{
		out << class_name_ << "::" << class_name_ << "(";
		generateMemberParam( value, false );
		out << ")\n: " << mapFullNameWithPrefix(value, "OBV_") << "(";
		generateMemberInit( value, false );
		out << ")\n{\n";
		out.indent();
		out.insertUserSection(class_name_ + "::" + class_name_ + "2", 0);
		out.unindent();
		out << "}\n\n\n";
	}

	out << class_name_ << "::" << class_name_ << "()\n{\n";
	out.indent();
	out.insertUserSection(class_name_ + "::" + class_name_ + "3", 0);
	out.unindent();
	out << "}\n\n\n";

	out << class_name_ << "::~" << class_name_ << "()\n{\n";
	out.indent();
	out.insertUserSection(class_name_ + "::~" + class_name_, 0);
	out.unindent();
	out << "}\n\n\n";

	out << "CORBA::ValueBase*\n";
	out << class_name_ << "::_copy_value()\n{\n";
	out.indent();
	out << class_name_ << " *val = new " << class_name_ << "(* this);\n";
	out.insertUserSection(class_name_ + "::_copy_value", 0);
	out << "return val;\n";
	out.unindent();
	out << "}\n\n\n";

	//
	// supported interfaces
	//
	CORBA::ULong i;
	handled_interfaces_.clear();
	IR__::InterfaceDefSeq_var supp_intfs = value->supported_interfaces();
	for(i = 0; i < supp_intfs->length(); i++)
	{
		handleAttribute((*supp_intfs)[i]);
		handleOperation((*supp_intfs)[i]);
	};
	//
	// base value
	//
	IR__::ValueDef_var base = value->base_value();
	if(! CORBA::is_nil(base))
	{
		// todo
	}
	//
	// abstract base values
	//
	IR__::ValueDefSeq_var abstr = value->abstract_base_values();
	for(i = 0; i < abstr->length(); i++)
	{
		// todo
	};

	//
	// value type factory
	//
	out << "CORBA::ValueBase *\n";
	out << value->name() << "FactoryImpl::create_for_unmarshal ()\n{\n";
	out.indent();
	out << "return new " << mapFullName( value ) << "Impl();\n";
	out.unindent();
	out << "}\n\n\n";

	//
	// initializers
	//
	IR__::InitializerSeq_var ini = value->initializers();
	for(i = 0; i < ini->length(); i++)
	{
		// todo
	};

	//
	// static factory cleaner
	//
	out << "static Qedo::ValueFactoryCleaner " << value->name() << "Factory_cleaner( new ";
	out << value->name() << "FactoryImpl(), \"" << value->id() << "\" );\n";

	close_module(out, value);
}
void
GeneratorBusinessH::doComponent(IR__::ComponentDef_ptr component)
{
	//
	// base component
	//
	IR__::ComponentDef_ptr base = component->base_component();
	if(! CORBA::is_nil(base))
	{
		doComponent(base);
	}

	handleAttribute(component);
	handleSupportedInterface(component);

	//
	// provides
	//
	IR__::ContainedSeq_var contained_seq = component->contents(CORBA__::dk_Provides, false);
	handled_interfaces_.clear();
	for(CORBA::ULong i = 0; i < contained_seq->length(); i++)
	{
		IR__::ProvidesDef_var act_provides = IR__::ProvidesDef::_narrow(((*contained_seq)[i]));
		bool realized_by_segment = false;

		// exclude facets realized by a segment
		CIDL::SegmentDefSeq_var segment_seq = composition_->executor_def()->segments();
		for (CORBA::ULong i = 0; i < segment_seq->length(); i++)
		{
			// for each implemented facet
			IR__::ProvidesDefSeq_var provided_seq = segment_seq[i]->provided_facets();
			for (CORBA::ULong ii = 0; ii < provided_seq->length(); ii++)
			{
				if(!strcmp(act_provides->name(), provided_seq[ii]->name()))
				{
					realized_by_segment = true;
					break;
				}
			}
		}

		if(!realized_by_segment)
		{
			IR__::InterfaceDef_var intf = IR__::InterfaceDef::_narrow(act_provides->interface_type());
			if( !CORBA::is_nil(intf) )
			{
				doInterface(intf);
			}
		}
	}


	// consumes
	if(component->contents(CORBA__::dk_Consumes, false)->length() && need_push_)
	{
		out << "\n//\n// IDL:Components/EventConsumerBase/push_event:1.0\n//\n";
		out << "virtual void push_event (Components::EventBase* ev)\n";
		out << "    throw (CORBA::SystemException);\n\n";
		need_push_ = false;
	}

	handleConsumes(component);
	handleSink(component);
}
Ejemplo n.º 30
0
void
GeneratorLIDL::doComponent(IR__::ComponentDef_ptr component)
{
	
	component_ = IR__::ComponentDef::_duplicate(component);

	handleSink(component);

	//
	// executor
	//
	out << "//\n// executor for " << component->id() << "\n//\n";
	out << "local interface CCM_" << component->name() << "_Executor : ";
	
	// base component
	IR__::ComponentDef_var base = component->base_component();
	if(!CORBA::is_nil(base))
	{
		out << getLocalName(base) << "_Executor";
	}
	else
	{
		out << "::Components::EnterpriseComponent";
	}

	// supported interfaces
	IR__::InterfaceDefSeq_var supported_seq = component->supported_interfaces();
	CORBA::ULong len = supported_seq->length();
	if(len)
	{
		CORBA::ULong i;
		for( i= 0; i < len; i++)
		{
			out << ", " << map_absolute_name((*supported_seq)[i]);
		}
	}

	// sinks
	IR__::SinkDefSeq_var sink_seq = component->sinks();
	len = sink_seq->length();
	if(len)
	{
		CORBA::ULong i;
		for( i= 0; i < len; i++)
		{
			out << ", CCM_" << component->name() << "_" << (*sink_seq)[i]->name() << "_Sink";
		}
	}


	out << "\n{\n";
	out.indent();

	handleAttribute(component);

	out.unindent();
	out << "};\n\n";

	//
	// context
	//
	out << "//\n// context for " << component->id() << "\n//\n";
	out << "local interface CCM_" << component->name() << "_Context : ";
	
	// base component
	if(!CORBA::is_nil(base))
	{
		out << getLocalName(base) << "_Context";
	}
	else
	{
		out << "::Components::CCMContext";
	}
	out << "\n{\n";
	out.indent();

	handleUses(component);
	handleEmits(component);
	handlePublishes(component);
	handleSource(component);

	out.unindent();
	out << "};\n\n";
}